forked from MineClone5/MineClone5
Adjust spawner doll size
This commit is contained in:
parent
6b92d6691d
commit
5720b1c041
|
@ -22,6 +22,20 @@ local function find_doll(pos)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function set_doll_properties(doll, mob)
|
||||||
|
local mobinfo = minetest.registered_entities[mob]
|
||||||
|
local prop = {
|
||||||
|
_mob = mob,
|
||||||
|
mesh = mobinfo.mesh,
|
||||||
|
textures = get_mob_textures(mob),
|
||||||
|
visual_size = {
|
||||||
|
x = mobinfo.visual_size.x * 0.5,
|
||||||
|
y = mobinfo.visual_size.y * 0.5,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
doll:set_properties(prop)
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node("mobs:spawner", {
|
minetest.register_node("mobs:spawner", {
|
||||||
tiles = {"mob_spawner.png"},
|
tiles = {"mob_spawner.png"},
|
||||||
drawtype = "glasslike",
|
drawtype = "glasslike",
|
||||||
|
@ -44,7 +58,6 @@ minetest.register_node("mobs:spawner", {
|
||||||
meta:set_string("infotext", S("Spawner Not Active (enter settings)"))
|
meta:set_string("infotext", S("Spawner Not Active (enter settings)"))
|
||||||
meta:set_string("command", spawner_default)
|
meta:set_string("command", spawner_default)
|
||||||
|
|
||||||
pos.y = pos.y - 0.28
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_destruct = function(pos)
|
on_destruct = function(pos)
|
||||||
|
@ -94,15 +107,9 @@ minetest.register_node("mobs:spawner", {
|
||||||
-- Create or update doll
|
-- Create or update doll
|
||||||
local doll = find_doll(pos)
|
local doll = find_doll(pos)
|
||||||
if not doll then
|
if not doll then
|
||||||
doll = minetest.add_entity(pos, "mobs:spawner_mob_doll")
|
doll = minetest.add_entity({x=pos.x, y=pos.y-0.3, z=pos.z}, "mobs:spawner_mob_doll")
|
||||||
end
|
end
|
||||||
local prop = {
|
set_doll_properties(doll, mob)
|
||||||
_mob = mob,
|
|
||||||
mesh = minetest.registered_entities[mob].mesh,
|
|
||||||
textures = get_mob_textures(mob),
|
|
||||||
}
|
|
||||||
doll:set_properties(prop)
|
|
||||||
|
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, S("Mob Spawner settings failed!"))
|
minetest.chat_send_player(name, S("Mob Spawner settings failed!"))
|
||||||
minetest.chat_send_player(name,
|
minetest.chat_send_player(name,
|
||||||
|
@ -121,7 +128,6 @@ local spawner_mob_doll_def = {
|
||||||
physical = true,
|
physical = true,
|
||||||
collisionbox = {0,0,0,0,0,0},
|
collisionbox = {0,0,0,0,0,0},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
visual_size = {x=0.6,y=0.6},
|
|
||||||
makes_footstep_sound = false,
|
makes_footstep_sound = false,
|
||||||
timer = 0,
|
timer = 0,
|
||||||
automatic_rotate = math.pi * 2.9,
|
automatic_rotate = math.pi * 2.9,
|
||||||
|
@ -135,21 +141,10 @@ end
|
||||||
|
|
||||||
spawner_mob_doll_def.on_activate = function(self, staticdata, dtime_s)
|
spawner_mob_doll_def.on_activate = function(self, staticdata, dtime_s)
|
||||||
local mob = staticdata
|
local mob = staticdata
|
||||||
local prop
|
if mob == "" or mob == nil then
|
||||||
if mob ~= nil and mob ~= "" then
|
mob = default_mob
|
||||||
prop = {
|
|
||||||
_mob = mob,
|
|
||||||
mesh = minetest.registered_entities[mob].mesh,
|
|
||||||
textures = get_mob_textures(mob),
|
|
||||||
}
|
|
||||||
else
|
|
||||||
prop = {
|
|
||||||
_mob = default_mob,
|
|
||||||
mesh = minetest.registered_entities[default_mob].mesh,
|
|
||||||
textures = get_mob_textures(default_mob),
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
self.object:set_properties(prop)
|
set_doll_properties(self.object, mob)
|
||||||
self.object:setvelocity({x=0, y=0, z=0})
|
self.object:setvelocity({x=0, y=0, z=0})
|
||||||
self.object:setacceleration({x=0, y=0, z=0})
|
self.object:setacceleration({x=0, y=0, z=0})
|
||||||
self.object:set_armor_groups({immortal=1})
|
self.object:set_armor_groups({immortal=1})
|
||||||
|
|
Loading…
Reference in New Issue