Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add E2 function entity:propKeepFrozen(number) #3240

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/entities/gmod_wire_expression2/core/custom/cl_prop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ E2Helper.Descriptions["propSpawnEffect(n)"] = "Set to 1 to enable prop spawn eff
E2Helper.Descriptions["propDelete(e:)"] = "Deletes the specified prop."
E2Helper.Descriptions["propDelete(t:)"] = "Deletes all the props in the given table, returns the amount of props deleted."
E2Helper.Descriptions["propDelete(r:)"] = "Deletes all the props in the given array, returns the amount of props deleted."
E2Helper.Descriptions["propKeepFrozen(e:n)"] = "if set to non-zero, prevents the entity from being unfrozen by physgun reload, can be unfrozen otherwise."
E2Helper.Descriptions["propFreeze(e:n)"] = "Passing 0 unfreezes the entity, everything else freezes it."
E2Helper.Descriptions["propNotSolid(e:n)"] = "Passing 0 makes the entity solid, everything else makes it non-solid."
E2Helper.Descriptions["propGravity(e:n)"] = "Passing 0 makes the entity weightless, everything else makes it weighty."
Expand Down
11 changes: 10 additions & 1 deletion lua/entities/gmod_wire_expression2/core/custom/prop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ local ValidSpawn = PropCore.ValidSpawn
local canHaveInvalidPhysics = {
delete=true, parent=true, deparent=true, solid=true,
shadow=true, draw=true, use=true, pos=true, ang=true,
manipulate=true, noDupe=true
manipulate=true, noDupe=true, keepFrozen=true
}

function PropCore.ValidAction(self, entity, cmd, bone)
Expand Down Expand Up @@ -815,6 +815,15 @@ e2function void entity:propFreeze(number freeze)
PhysManipulate(this, nil, nil, freeze, nil, nil)
end

e2function void entity:propKeepFrozen(number keepFrozen)
if not ValidAction(self, this, "keepFrozen") then return end
this.PropcoreKeepFrozen = keepFrozen ~= 0 or nil
end

hook.Add("CanPlayerUnfreeze", "E2_PropcoreKeepFrozen", function(_, Ent)
if Ent.PropcoreKeepFrozen then return false end
end)

e2function void entity:propNotSolid(number notsolid)
if not ValidAction(self, this, "solid") then return end
PhysManipulate(this, nil, nil, nil, nil, notsolid)
Expand Down
Loading