mirror of
https://github.com/wiremod/wire.git
synced 2025-03-04 03:03:04 -05:00
Fix invalid return of of e:weapon() (#3238)
This commit is contained in:
parent
45c2987bbc
commit
886ef66aa9
@ -14,16 +14,16 @@ __e2setcost(2) -- temporary
|
||||
|
||||
[nodiscard]
|
||||
e2function entity entity:weapon()
|
||||
if not IsValid(this) then return nil end
|
||||
if not this:IsPlayer() and not this:IsNPC() then return nil end
|
||||
if not IsValid(this) then return self:throw("Invalid entity!", NULL) end
|
||||
if not this:IsPlayer() and not this:IsNPC() then return self:throw("Expected a Player or NPC but got Entity", NULL) end
|
||||
|
||||
return this:GetActiveWeapon()
|
||||
end
|
||||
|
||||
[nodiscard]
|
||||
e2function entity entity:weapon(string weaponclassname)
|
||||
if not IsValid(this) then return nil end
|
||||
if not this:IsPlayer() and not this:IsNPC() then return nil end
|
||||
if not IsValid(this) then return self:throw("Invalid entity!", NULL) end
|
||||
if not this:IsPlayer() and not this:IsNPC() then return self:throw("Expected a Player or NPC but got Entity", NULL) end
|
||||
|
||||
return this:GetWeapon(weaponclassname)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user