better checks for nil on find method and player object
* really closes https://notabug.org/TenPlus1/mobs_redo/issues/114 again * really closes #107 * nil checks * improve the previous commit f78202cf8e1d4ba59bbe57cf774d2ba26b69ffc3
This commit is contained in:
parent
f8db9f0f39
commit
3b03af0ba1
30
api.lua
30
api.lua
@ -272,17 +272,17 @@ local check_for = function(look_for, look_inside)
|
||||
|
||||
if not str then goto continue end
|
||||
|
||||
if str == look_for then
|
||||
return true
|
||||
if str then
|
||||
if str:find("group:") then
|
||||
local group = str:split(":")[2] or ""
|
||||
if minetest.get_item_group(look_for, group) ~= 0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if str and str:find("group:") then
|
||||
|
||||
local group = str:split(":")[2] or ""
|
||||
|
||||
if minetest.get_item_group(look_for, group) ~= 0 then
|
||||
return true
|
||||
end
|
||||
if str == look_for then
|
||||
return true
|
||||
end
|
||||
|
||||
::continue::
|
||||
@ -2120,12 +2120,12 @@ function mob_class:follow_flop()
|
||||
|
||||
for n = 1, #players do
|
||||
|
||||
if players[n] and get_distance(players[n]:get_pos(), s) < self.view_range
|
||||
and not is_invisible(self, players[n]:get_player_name()) then
|
||||
|
||||
self.following = players[n]
|
||||
|
||||
break
|
||||
if players[n] then
|
||||
if get_distance(players[n]:get_pos(), s) < self.view_range
|
||||
and not is_invisible(self, players[n]:get_player_name()) then
|
||||
self.following = players[n]
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user