forked from VoxeLibre/VoxeLibre
Compare commits
15 Commits
fa2f4c11a6
...
3928e12634
Author | SHA1 | Date |
---|---|---|
teknomunk | 3928e12634 | |
teknomunk | 304550d90c | |
teknomunk | 0a2336ad82 | |
teknomunk | 75a767a0ab | |
teknomunk | 7e0afd7e21 | |
teknomunk | 15fa925aae | |
teknomunk | 4935f5fdda | |
teknomunk | 41032ec999 | |
teknomunk | d64ee18f75 | |
teknomunk | 1942384fe5 | |
teknomunk | 9b50dd6565 | |
teknomunk | a88951ac6a | |
teknomunk | bc343769ee | |
seventeenthShulker | 8aa65f85f2 | |
qoheniac | e27e70a91b |
|
@ -150,6 +150,11 @@ function mob_class:mob_activate(staticdata, def, dtime)
|
|||
local tmp = minetest.deserialize(staticdata)
|
||||
|
||||
if tmp then
|
||||
-- Patch incorrectly converted mobs
|
||||
if tmp.base_mesh ~= minetest.registered_entities[self.name].mesh then
|
||||
mcl_mobs.strip_staticdata(tmp)
|
||||
end
|
||||
|
||||
for _,stat in pairs(tmp) do
|
||||
self[_] = stat
|
||||
end
|
||||
|
|
|
@ -342,13 +342,33 @@ function mcl_mobs.register_mob(name, def)
|
|||
minetest.register_entity(name, setmetatable(final_def,mcl_mobs.mob_class_meta))
|
||||
end -- END mcl_mobs.register_mob function
|
||||
|
||||
|
||||
local STRIP_FIELDS = { "mesh", "base_size", "textures", "base_mesh", "base_texture" }
|
||||
function mcl_mobs.strip_staticdata(unpacked_staticdata)
|
||||
-- Strip select fields from the staticdata to prevent conversion issues
|
||||
for i = 1,#STRIP_FIELDS do
|
||||
unpacked_staticdata[STRIP_FIELDS[i]] = nil
|
||||
end
|
||||
end
|
||||
function mcl_mobs.register_conversion(old_name, new_name)
|
||||
minetest.register_entity(old_name, {
|
||||
on_activate = function(self, staticdata, dtime)
|
||||
local obj = minetest.add_entity(self.object:get_pos(), new_name, staticdata)
|
||||
local hook = (obj:get_luaentity() or {})._on_after_convert
|
||||
if hook then hook(obj) end
|
||||
self.object:remove()
|
||||
local unpacked_staticdata = minetest.deserialize(staticdata)
|
||||
mcl_mobs.strip_staticdata(unpacked_staticdata)
|
||||
staticdata = minetest.serialize(unpacked_staticdata)
|
||||
|
||||
local old_object = self.object
|
||||
if not old_object then return end
|
||||
|
||||
local pos = old_object:get_pos()
|
||||
if not pos then return end
|
||||
old_object:remove()
|
||||
|
||||
local new_object = minetest.add_entity(pos, new_name, staticdata)
|
||||
if not new_object then return end
|
||||
|
||||
local hook = (new_object:get_luaentity() or {})._on_after_convert
|
||||
if hook then hook(new_object) end
|
||||
end,
|
||||
_convert_to = new_name,
|
||||
})
|
||||
|
@ -572,7 +592,12 @@ function mcl_mobs.register_egg(mob, desc, background_color, overlay_color, addeg
|
|||
--minetest.log("min light: " .. mob_light_lvl[1])
|
||||
--minetest.log("max light: " .. mob_light_lvl[2])
|
||||
|
||||
mcl_mobspawners.setup_spawner(pointed_thing.under, itemstack:get_name(), mob_light_lvl[1], mob_light_lvl[2])
|
||||
-- Handle egg conversion
|
||||
local mob_name = itemstack:get_name()
|
||||
local convert_to = (minetest.registered_entities[mob_name] or {})._convert_to
|
||||
if convert_to then mob_name = convert_to end
|
||||
|
||||
mcl_mobspawners.setup_spawner(pointed_thing.under, mob_name, mob_light_lvl[1], mob_light_lvl[2])
|
||||
if not minetest.is_creative_enabled(name) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
|
|
@ -196,7 +196,7 @@ end
|
|||
mcl_stairs.register_stair_and_slab("blackstone", "mcl_blackstone:blackstone",
|
||||
{cracky=3, pickaxey=1, material_stone=1},
|
||||
{"mcl_blackstone_top.png", "mcl_blackstone_top.png", "mcl_blackstone_side.png"},
|
||||
S("Blackstone Stairs"),
|
||||
S("Blackstone Stair"),
|
||||
S("Blackstone Slab"),
|
||||
mcl_sounds.node_sound_stone_defaults(), 6, 2,
|
||||
S("Double Blackstone Slab"), nil)
|
||||
|
@ -204,7 +204,7 @@ mcl_stairs.register_stair_and_slab("blackstone", "mcl_blackstone:blackstone",
|
|||
mcl_stairs.register_stair_and_slab("blackstone_polished", "mcl_blackstone:blackstone_polished",
|
||||
{cracky=3, pickaxey=1, material_stone=1},
|
||||
{"mcl_blackstone_polished.png"},
|
||||
S("Polished Blackstone Stairs"),
|
||||
S("Polished Blackstone Stair"),
|
||||
S("Polished Blackstone Slab"),
|
||||
mcl_sounds.node_sound_stone_defaults(), 6, 2,
|
||||
S("Double Polished Blackstone Slab"), nil)
|
||||
|
@ -212,7 +212,7 @@ mcl_stairs.register_stair_and_slab("blackstone_polished", "mcl_blackstone:blacks
|
|||
mcl_stairs.register_stair_and_slab("blackstone_chiseled_polished", "mcl_blackstone:blackstone_chiseled_polished",
|
||||
{cracky=3, pickaxey=1, material_stone=1},
|
||||
{"mcl_blackstone_chiseled_polished.png"},
|
||||
S("Chiseled Polished Blackstone Stairs"),
|
||||
S("Chiseled Polished Blackstone Stair"),
|
||||
S("Chiseled Polished Blackstone Slab"),
|
||||
mcl_sounds.node_sound_stone_defaults(), 6, 2,
|
||||
S("Double Chiseled Polished Blackstone Slab"), nil)
|
||||
|
@ -220,10 +220,10 @@ mcl_stairs.register_stair_and_slab("blackstone_chiseled_polished", "mcl_blacksto
|
|||
mcl_stairs.register_stair_and_slab("blackstone_brick_polished", "mcl_blackstone:blackstone_brick_polished",
|
||||
{cracky=3, pickaxey=1, material_stone=1},
|
||||
{"mcl_blackstone_polished_bricks.png"},
|
||||
S("Polished Blackstone Brick Stair Stairs"),
|
||||
S("Polished Blackstone Brick Stair Slab"),
|
||||
S("Polished Blackstone Brick Stair"),
|
||||
S("Polished Blackstone Brick Slab"),
|
||||
mcl_sounds.node_sound_stone_defaults(), 6, 2,
|
||||
S("Double Polished Blackstone Brick Stair Slab"), nil)
|
||||
S("Double Polished Blackstone Brick Slab"), nil)
|
||||
|
||||
--Wall
|
||||
mcl_walls.register_wall(
|
||||
|
|
|
@ -9,10 +9,10 @@ Blackstone Slab=Schwarzstein Stufe
|
|||
Polished Blackstone Slab=Polierte Schwarzstein Stufe
|
||||
Chiseled Polished Blackstone Slab=Gemeißelte Polierte Schwarzstein Stufe
|
||||
Polished Blackstone Brick Slab=Polierte Schwarzsteinziegel Stufe
|
||||
Blackstone Stairs=Schwarzstein Treppe
|
||||
Polished Blackstone Stairs=Polierte Schwarzstein Treppe
|
||||
Chiseled Polished Blackstone Stairs=Gemeißelte Polierte Schwarzstein Treppe
|
||||
Polished Blackstone Brick Stairs=Polierte Schwarzsteinziegel Treppe
|
||||
Blackstone Stair=Schwarzstein Treppe
|
||||
Polished Blackstone Stair=Polierte Schwarzstein Treppe
|
||||
Chiseled Polished Blackstone Stair=Gemeißelte Polierte Schwarzstein Treppe
|
||||
Polished Blackstone Brick Stair=Polierte Schwarzsteinziegel Treppe
|
||||
Quartz Bricks=Quartz Ziegel
|
||||
Soul Torch=Seelenfakel
|
||||
Soul Lantern=Seelenlaterne
|
||||
|
|
|
@ -83,6 +83,13 @@ local function respawn_doll(pos)
|
|||
local mob = meta:get_string("Mob")
|
||||
local doll
|
||||
if mob and mob ~= "" then
|
||||
-- Handle conversion of mob spawners
|
||||
local convert_to = (minetest.registered_entities[mob] or {})._convert_to
|
||||
if convert_to then
|
||||
mob = convert_to
|
||||
meta:set_string("Mob", mob)
|
||||
end
|
||||
|
||||
doll = find_doll(pos)
|
||||
if not doll then
|
||||
doll = spawn_doll(pos)
|
||||
|
@ -128,7 +135,6 @@ function mcl_mobspawners.setup_spawner(pos, Mob, MinLight, MaxLight, MaxMobsInAr
|
|||
end
|
||||
set_doll_properties(doll, Mob)
|
||||
|
||||
|
||||
-- Start spawning very soon
|
||||
local t = minetest.get_node_timer(pos)
|
||||
t:start(2)
|
||||
|
@ -165,7 +171,6 @@ local function spawn_mobs(pos, elapsed)
|
|||
local count = 0
|
||||
local ent
|
||||
|
||||
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
|
||||
-- spawn mob if player detected and in range
|
||||
|
@ -367,7 +372,6 @@ doll_def.on_activate = function(self, staticdata, dtime_s)
|
|||
self.object:set_velocity({x=0, y=0, z=0})
|
||||
self.object:set_acceleration({x=0, y=0, z=0})
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
|
||||
end
|
||||
|
||||
doll_def.on_step = function(self, dtime)
|
||||
|
|
|
@ -77,7 +77,7 @@ mcl_stairs.register_slab("granite", "mcl_core:granite",
|
|||
mcl_stairs.register_stair("diorite", "mcl_core:diorite",
|
||||
{pickaxey=1, material_stone=1},
|
||||
{"mcl_core_diorite.png"},
|
||||
S("Granite Stairs"),
|
||||
S("Diorite Stairs"),
|
||||
mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8)
|
||||
mcl_stairs.register_slab("diorite", "mcl_core:diorite",
|
||||
{pickaxey=1, material_stone=1},
|
||||
|
|
Loading…
Reference in New Issue