mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2025-01-10 17:19:35 +01:00
Add function to replace mobs
This commit is contained in:
parent
8e3f9d2169
commit
e4af02ea52
1 changed files with 9 additions and 0 deletions
|
@ -538,3 +538,12 @@ function mcl_util.get_object_name(object)
|
|||
return luaentity.nametag and luaentity.nametag ~= "" and luaentity.nametag or luaentity.description or luaentity.name
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_util.replace_mob(obj, mob)
|
||||
local rot = obj:get_yaw()
|
||||
local pos = obj:get_pos()
|
||||
obj:remove()
|
||||
obj = minetest.add_entity(pos, mob)
|
||||
obj:set_yaw(rot)
|
||||
return obj
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue