mirror of
https://github.com/wiremod/wire.git
synced 2025-03-04 03:03:04 -05:00
New is* E2 functions (#3220)
* New is* functions * entity:weapons() optimization * Missing description
This commit is contained in:
parent
eb9451ce59
commit
80c4eb069e
@ -450,6 +450,16 @@ e2function number entity:isNPC()
|
||||
if this:IsNPC() then return 1 else return 0 end
|
||||
end
|
||||
|
||||
e2function number entity:isNextBot()
|
||||
if not IsValid(this) then return self:throw("Invalid entity!", 0) end
|
||||
if this:IsNextBot() then return 1 else return 0 end
|
||||
end
|
||||
|
||||
e2function number entity:isRagdoll()
|
||||
if not IsValid(this) then return self:throw("Invalid entity!", 0) end
|
||||
if this:IsRagdoll() then return 1 else return 0 end
|
||||
end
|
||||
|
||||
e2function number entity:isVehicle()
|
||||
if not IsValid(this) then return self:throw("Invalid entity!", 0) end
|
||||
if this:IsVehicle() then return 1 else return 0 end
|
||||
@ -587,6 +597,18 @@ e2function number entity:isAsleep()
|
||||
if phys:IsAsleep() then return 1 else return 0 end
|
||||
end
|
||||
|
||||
e2function number entity:isGravityEnabled()
|
||||
if not validPhysics(this) then return self:throw("Invalid entity!", 0) end
|
||||
local phys = this:GetPhysicsObject()
|
||||
if phys:IsGravityEnabled() then return 1 else return 0 end
|
||||
end
|
||||
|
||||
e2function number entity:isPenetrating()
|
||||
if not validPhysics(this) then return self:throw("Invalid entity!", 0) end
|
||||
local phys = this:GetPhysicsObject()
|
||||
if phys:IsPenetrating() then return 1 else return 0 end
|
||||
end
|
||||
|
||||
--[[******************************************************************************]]
|
||||
|
||||
__e2setcost(30) -- temporary
|
||||
|
@ -151,6 +151,18 @@ e2function number entity:isFlashlightOn()
|
||||
return this:FlashlightIsOn() and 1 or 0
|
||||
end
|
||||
|
||||
e2function number entity:isSpeaking()
|
||||
if not IsValid(this) then return self:throw("Invalid entity!", 0) end
|
||||
if not this:IsPlayer() then return self:throw("Expected a Player but got Entity", 0) end
|
||||
return this:IsSpeaking() and 1 or 0
|
||||
end
|
||||
|
||||
e2function number entity:isBot()
|
||||
if not IsValid(this) then return self:throw("Invalid entity!", 0) end
|
||||
if not this:IsPlayer() then return self:throw("Expected a Player but got Entity", 0) end
|
||||
return this:IsBot() and 1 or 0
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
e2function number entity:frags()
|
||||
|
@ -40,11 +40,7 @@ end
|
||||
e2function array entity:weapons()
|
||||
if not IsValid(this) then return {} end
|
||||
if not this:IsPlayer() then return {} end
|
||||
local ret = {}
|
||||
for k,v in pairs(this:GetWeapons()) do
|
||||
ret[#ret + 1] = v
|
||||
end
|
||||
return ret
|
||||
return this:GetWeapons()
|
||||
end
|
||||
|
||||
[nodiscard]
|
||||
|
@ -283,7 +283,12 @@ E2Helper.Descriptions["isPlayer(e:)"] = "Is the entity a player?"
|
||||
E2Helper.Descriptions["isOnFire(e:)"] = "Is the entity on fire?"
|
||||
E2Helper.Descriptions["isWeapon(e:)"] = "Is the entity a weapon?"
|
||||
E2Helper.Descriptions["isNPC(e:)"] = "Is the entity a NPC?"
|
||||
E2Helper.Descriptions["isNextBot(e:)"] = "Is the entity a NextBot?"
|
||||
E2Helper.Descriptions["isRagdoll(e:)"] = "Is the entity a ragdoll?"
|
||||
E2Helper.Descriptions["isFrozen(e:)"] = "Is the entity frozen?"
|
||||
E2Helper.Descriptions["isAsleep(e:)"] = "Is the entity asleep?"
|
||||
E2Helper.Descriptions["isPenetrating(e:)"] = "Is the entity penetrating another entity?"
|
||||
E2Helper.Descriptions["isGravityEnabled(e:)"] = "Is gravity enabled for the entity?"
|
||||
E2Helper.Descriptions["isVehicle(e:)"] = "Is the entity a vehicle?"
|
||||
E2Helper.Descriptions["inVehicle(e:)"] = "Is the player in a vehicle?"
|
||||
E2Helper.Descriptions["isWorld(e:)"] = "Is the entity the world?"
|
||||
@ -296,6 +301,8 @@ E2Helper.Descriptions["isSuperAdmin(e:)"] = "Is the player a super admin?"
|
||||
E2Helper.Descriptions["isAlive(e:)"] = "Is the player or NPC alive?"
|
||||
E2Helper.Descriptions["isCrouch(e:)"] = "Is the player crouching?"
|
||||
E2Helper.Descriptions["isFlashlightOn(e:)"] = "Returns 1 if the player has flashlight on, 0 otherwise"
|
||||
E2Helper.Descriptions["isSpeaking(e:)"] = "Returns 1 if the player speaks, 0 otherwise"
|
||||
E2Helper.Descriptions["isBot(e:)"] = "Returns 1 if the player is a bot, 0 otherwise"
|
||||
E2Helper.Descriptions["isTyping(e:)"] = "Is the player typing a message in chat?"
|
||||
E2Helper.Descriptions["isValid(e:)"] = "Returns 1 if the entity is valid, 0 otherwise"
|
||||
E2Helper.Descriptions["isValidPhysics(e:)"] = "Returns 1 if the entity has valid physics (players don't)"
|
||||
|
Loading…
Reference in New Issue
Block a user