1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2024-12-24 09:40:21 +01:00

mob alias now transfers staticdata (thanks MoNTE48)

This commit is contained in:
TenPlus1 2020-01-23 09:27:27 +00:00
parent c5b74230e5
commit 92ab4eeb2e
2 changed files with 8 additions and 4 deletions

10
api.lua
View File

@ -6,7 +6,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = { mobs = {
mod = "redo", mod = "redo",
version = "20200112", version = "20200123",
intllib = S, intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {} invis = minetest.global_exists("invisibility") and invisibility or {}
} }
@ -4267,13 +4267,17 @@ function mobs:alias_mob(old_name, new_name)
physical = false, physical = false,
on_activate = function(self) on_activate = function(self, staticdata)
if minetest.registered_entities[new_name] then if minetest.registered_entities[new_name] then
minetest.add_entity(self.object:get_pos(), new_name) minetest.add_entity(self.object:get_pos(), new_name, staticdata)
end end
self.object:remove() self.object:remove()
end,
get_staticdata = function(self)
return self
end end
}) })
end end

View File

@ -750,7 +750,7 @@ mobs:register_mob("mob_horse:horse", {
if inv:room_for_item("main", "mobs:saddle") then if inv:room_for_item("main", "mobs:saddle") then
inv:add_item("main", "mobs:saddle") inv:add_item("main", "mobs:saddle")
else else
minetest.add_item(clicker.getpos(), "mobs:saddle") minetest.add_item(clicker.get_pos(), "mobs:saddle")
end end
-- attach player to horse -- attach player to horse