mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-26 00:50:21 +01:00
ability to override initial_properties when using minetest.add_entity()
This commit is contained in:
parent
be7b6bc5fe
commit
a6a3b44c96
23
api.lua
23
api.lua
@ -14,7 +14,7 @@ local use_vh1 = minetest.get_modpath("visual_harm_1ndicators")
|
|||||||
-- Global
|
-- Global
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20231205",
|
version = "20231229",
|
||||||
translate = S,
|
translate = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {},
|
invis = minetest.global_exists("invisibility") and invisibility or {},
|
||||||
node_snow = minetest.registered_aliases["mapgen_snow"]
|
node_snow = minetest.registered_aliases["mapgen_snow"]
|
||||||
@ -3124,6 +3124,21 @@ function mob_class:mob_staticdata()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local is_property_name = {
|
||||||
|
hp_max = true,
|
||||||
|
physical = true,
|
||||||
|
collide_with_objects = true,
|
||||||
|
collisionbox = true,
|
||||||
|
selectionbox = true,
|
||||||
|
pointable = true,
|
||||||
|
visual_size = true,
|
||||||
|
textures = true,
|
||||||
|
is_visible = true,
|
||||||
|
stepheight = true,
|
||||||
|
glow = true,
|
||||||
|
show_on_minimap = true,
|
||||||
|
}
|
||||||
|
|
||||||
-- activate mob and reload settings
|
-- activate mob and reload settings
|
||||||
function mob_class:mob_activate(staticdata, def, dtime)
|
function mob_class:mob_activate(staticdata, def, dtime)
|
||||||
|
|
||||||
@ -3161,10 +3176,16 @@ function mob_class:mob_activate(staticdata, def, dtime)
|
|||||||
t = type(stat)
|
t = type(stat)
|
||||||
|
|
||||||
if t ~= "function" and t ~= "nil" and t ~= "userdata" then
|
if t ~= "function" and t ~= "nil" and t ~= "userdata" then
|
||||||
|
|
||||||
|
if is_property_name[_] then
|
||||||
|
|
||||||
|
self.object:set_properties({[_] = stat})
|
||||||
|
else
|
||||||
self[_] = stat
|
self[_] = stat
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local prop = self.object:get_properties()
|
local prop = self.object:get_properties()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user