Skip to content

Commit

Permalink
Add e:propSleep(n) to propcore (#3187)
Browse files Browse the repository at this point in the history
* e:propSleep(n)

* Add description

* Use :IsValid instead of IsValid

Co-authored-by: Denneisk <[email protected]>

---------

Co-authored-by: Denneisk <[email protected]>
  • Loading branch information
Astralcircle and Denneisk authored Nov 28, 2024
1 parent 95311d6 commit 8f8368c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/entities/gmod_wire_expression2/core/custom/cl_prop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ E2Helper.Descriptions["propInertia(e:n)"] = "Sets the directional inertia"
E2Helper.Descriptions["propInertia(e:v)"] = E2Helper.Descriptions["propInertia(e:n)"]
E2Helper.Descriptions["propDraw(e:n)"] = "Passing 0 disables rendering for the entity (makes it really invisible)"
E2Helper.Descriptions["propShadow(e:n)"] = "Passing 0 disables rendering for the entity's shadow"
E2Helper.Descriptions["propSleep(e:n)"] = "Puts an entity to 'sleep', causing it to stop moving until any physical interaction occurs."
E2Helper.Descriptions["propSetBuoyancy(e:n)"] = "Sets the prop's buoyancy ratio from 0 to 1"
E2Helper.Descriptions["propSetFriction(e:n)"] = "Sets prop's friction coefficient (default is 1)"
E2Helper.Descriptions["propGetFriction(e:)"] = "Gets prop's friction coefficient"
Expand Down Expand Up @@ -128,4 +129,4 @@ E2Helper.Descriptions["entitySurfaceProps(xcd:)"] = E2Helper.Descriptions["ourSu
E2Helper.Descriptions["theirSurfaceProps(xcd:)"] = "Returns a number representing the surface properties of the hit entity"
E2Helper.Descriptions["hitEntitySurfaceProps(xcd:)"] = E2Helper.Descriptions["theirSurfaceProps(xcd:)"] .. "\nAlias of theirSurfaceProps(xcd:)"
E2Helper.Descriptions["deltaTime(xcd:)"] = "Returns a number representing how long ago the last collision between the tracked entity and the hit entity was, in seconds.\nCapped at 1 second."
E2Helper.Descriptions["hitEntity(xcd:)"] = "Returns the entity that was hit for this collision."
E2Helper.Descriptions["hitEntity(xcd:)"] = "Returns the entity that was hit for this collision."
12 changes: 12 additions & 0 deletions lua/entities/gmod_wire_expression2/core/custom/prop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,18 @@ e2function void entity:propShadow(number shadowEnable)
this:DrawShadow( shadowEnable ~= 0 )
end

e2function void entity:propSleep(number sleep)
if not ValidAction(self, this, "sleep") then return end
local phys = this:GetPhysicsObject()
if phys:IsValid() then
if sleep ~= 0 then
phys:Sleep()
else
phys:Wake()
end
end
end

e2function void entity:propGravity(number gravity)
if not ValidAction(self, this, "gravity") then return end
local physCount = this:GetPhysicsObjectCount()
Expand Down

0 comments on commit 8f8368c

Please sign in to comment.