Skip to content

Commit 5a709a9

Browse files
authored
Fix E2Lib.isOwner invalid arguments in damage core (#3396)
Fixes: ```lua @name bugreport/attacker_no_owner @strict #Shouldn't throw an error owner():takeDamage(1,owner()) ```
1 parent ae980ba commit 5a709a9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lua/entities/gmod_wire_expression2/core/damage.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ e2function void entity:takeDamage(number amount, entity attacker)
117117
if not Enabled:GetBool() then return self:throw("Dealing damage is disabled via wire_expression2_damage_enabled") end
118118
if not IsValid(this) then return self:throw("Invalid entity!", nil) end
119119
if not IsValid(attacker) then return self:throw("Invalid attacker entity!", nil) end
120-
if not E2Lib.isOwner(attacker) then return self:throw("You do not own the attacker entity!", nil) end
120+
if not E2Lib.isOwner(self, attacker) then return self:throw("You do not own the attacker entity!", nil) end
121121
if not WireLib.CanDamage(self.player, this) then return self:throw("You cannot damage this entity!", nil) end
122122

123123
this:TakeDamage(amount, attacker, self.entity)
@@ -127,9 +127,9 @@ e2function void entity:takeDamage(number amount, entity attacker, entity inflict
127127
if not Enabled:GetBool() then return self:throw("Dealing damage is disabled via wire_expression2_damage_enabled") end
128128
if not IsValid(this) then return self:throw("Invalid entity!", nil) end
129129
if not IsValid(attacker) then return self:throw("Invalid attacker entity!", nil) end
130-
if not E2Lib.isOwner(attacker) then return self:throw("You do not own the attacker entity!", nil) end
130+
if not E2Lib.isOwner(self, attacker) then return self:throw("You do not own the attacker entity!", nil) end
131131
if not IsValid(inflictor) then return self:throw("Invalid inflictor entity!", nil) end
132-
if not E2Lib.isOwner(inflictor) then return self:throw("You do not own the inflictor entity!", nil) end
132+
if not E2Lib.isOwner(self, inflictor) then return self:throw("You do not own the inflictor entity!", nil) end
133133
if not WireLib.CanDamage(self.player, this) then self:throw("You cannot damage this entity!", nil) end
134134

135135
this:TakeDamage(amount, attacker, inflictor)

0 commit comments

Comments
 (0)