From eb9451ce596bd3b21dd5748dc5888ad8fe025a1b Mon Sep 17 00:00:00 2001 From: Redox Date: Sat, 14 Dec 2024 09:44:03 +0100 Subject: [PATCH] Add e2 func entity:isAsleep (#3219) --- lua/entities/gmod_wire_expression2/core/entity.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/entities/gmod_wire_expression2/core/entity.lua b/lua/entities/gmod_wire_expression2/core/entity.lua index a04d5556..ad01bf0e 100644 --- a/lua/entities/gmod_wire_expression2/core/entity.lua +++ b/lua/entities/gmod_wire_expression2/core/entity.lua @@ -581,6 +581,12 @@ e2function number entity:isFrozen() if phys:IsMoveable() then return 0 else return 1 end end +e2function number entity:isAsleep() + if not validPhysics(this) then return self:throw("Invalid entity!", 0) end + local phys = this:GetPhysicsObject() + if phys:IsAsleep() then return 1 else return 0 end +end + --[[******************************************************************************]] __e2setcost(30) -- temporary