forked from VoxeLibre/VoxeLibre
mcl_mobs: Use player refs for indexing
This commit is contained in:
parent
d13631005b
commit
2156ec2793
|
@ -1405,7 +1405,7 @@ end
|
|||
local follow_holding = function(self, clicker)
|
||||
if self.nofollow then return false end
|
||||
|
||||
if mcl_mobs.invis[clicker:get_player_name()] then
|
||||
if mcl_mobs.invis[clicker] then
|
||||
return false
|
||||
end
|
||||
|
||||
|
@ -1924,7 +1924,7 @@ local monster_attack = function(self)
|
|||
|
||||
if objs[n]:is_player() then
|
||||
|
||||
if mcl_mobs.invis[ objs[n]:get_player_name() ] or (not object_in_range(self, objs[n])) then
|
||||
if mcl_mobs.invis[ objs[n] ] or (not object_in_range(self, objs[n])) then
|
||||
type = ""
|
||||
else
|
||||
player = objs[n]
|
||||
|
@ -2053,7 +2053,7 @@ local runaway_from = function(self)
|
|||
|
||||
if objs[n]:is_player() then
|
||||
|
||||
if mcl_mobs.invis[ objs[n]:get_player_name() ]
|
||||
if mcl_mobs.invis[ objs[n] ]
|
||||
or self.owner == objs[n]:get_player_name()
|
||||
or (not object_in_range(self, objs[n])) then
|
||||
type = ""
|
||||
|
@ -2135,7 +2135,7 @@ local follow_flop = function(self)
|
|||
for n = 1, #players do
|
||||
|
||||
if (object_in_range(self, players[n]))
|
||||
and not mcl_mobs.invis[ players[n]:get_player_name() ] then
|
||||
and not mcl_mobs.invis[ players[n] ] then
|
||||
|
||||
self.following = players[n]
|
||||
|
||||
|
@ -2538,7 +2538,7 @@ local do_states = function(self, dtime)
|
|||
or not self.attack:get_pos()
|
||||
or not object_in_range(self, self.attack)
|
||||
or self.attack:get_hp() <= 0
|
||||
or (self.attack:is_player() and mcl_mobs.invis[ self.attack:get_player_name() ]) then
|
||||
or (self.attack:is_player() and mcl_mobs.invis[ self.attack ]) then
|
||||
|
||||
self.state = "stand"
|
||||
set_velocity(self, 0)
|
||||
|
@ -3317,7 +3317,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
|||
and self.state ~= "flop"
|
||||
and (self.child == false or self.type == "monster")
|
||||
and hitter:get_player_name() ~= self.owner
|
||||
and not mcl_mobs.invis[ name ] then
|
||||
and not mcl_mobs.invis[ hitter ] then
|
||||
|
||||
if not die then
|
||||
-- attack whoever punched mob
|
||||
|
|
Loading…
Reference in New Issue