mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-25 16:40:23 +01:00
tweak staticdata checks
This commit is contained in:
parent
83e9180853
commit
4962d44be9
21
api.lua
21
api.lua
@ -6,7 +6,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20200616",
|
version = "20200619",
|
||||||
intllib = S,
|
intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
invis = minetest.global_exists("invisibility") and invisibility or {}
|
||||||
}
|
}
|
||||||
@ -3022,7 +3022,9 @@ function mob_class:mob_staticdata()
|
|||||||
|
|
||||||
local t = type(stat)
|
local t = type(stat)
|
||||||
|
|
||||||
if t ~= "function" and t ~= "nil" and t ~= "userdata"
|
if t ~= "function"
|
||||||
|
and t ~= "nil"
|
||||||
|
and t ~= "userdata"
|
||||||
and _ ~= "_cmi_components" then
|
and _ ~= "_cmi_components" then
|
||||||
tmp[_] = self[_]
|
tmp[_] = self[_]
|
||||||
end
|
end
|
||||||
@ -3063,10 +3065,18 @@ function mob_class:mob_activate(staticdata, def, dtime)
|
|||||||
local tmp = minetest.deserialize(staticdata)
|
local tmp = minetest.deserialize(staticdata)
|
||||||
|
|
||||||
if tmp then
|
if tmp then
|
||||||
|
|
||||||
for _,stat in pairs(tmp) do
|
for _,stat in pairs(tmp) do
|
||||||
|
|
||||||
|
local t = type(stat)
|
||||||
|
|
||||||
|
if t ~= "function"
|
||||||
|
and t ~= "nil"
|
||||||
|
and t ~= "userdata" then
|
||||||
self[_] = stat
|
self[_] = stat
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- force current model into mob
|
-- force current model into mob
|
||||||
self.mesh = def.mesh
|
self.mesh = def.mesh
|
||||||
@ -3958,7 +3968,7 @@ function mobs:register_arrow(name, def)
|
|||||||
|
|
||||||
self:hit_object(player)
|
self:hit_object(player)
|
||||||
|
|
||||||
self.object:remove(); -- print("hit object")
|
self.object:remove() ; -- print("hit object")
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -4144,7 +4154,6 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
|
|||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -4160,7 +4169,9 @@ function mobs:force_capture(self, clicker)
|
|||||||
|
|
||||||
local t = type(stat)
|
local t = type(stat)
|
||||||
|
|
||||||
if t ~= "function" and t ~= "nil" and t ~= "userdata" then
|
if t ~= "function"
|
||||||
|
and t ~= "nil"
|
||||||
|
and t ~= "userdata" then
|
||||||
tmp[_] = self[_]
|
tmp[_] = self[_]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user