Convert old mob to the new stalker

This commit is contained in:
the-real-herowl 2024-05-12 06:28:24 +02:00
parent 0dcf38094c
commit 22b6c25458
2 changed files with 39 additions and 3 deletions

View File

@ -11,7 +11,7 @@ local function get_texture(self)
local on_name = self.standing_on local on_name = self.standing_on
local texture local texture
local texture_suff = "" local texture_suff = ""
if on_name ~= "air" then if on_name and on_name ~= "air" then
local tiles = minetest.registered_nodes[on_name].tiles local tiles = minetest.registered_nodes[on_name].tiles
if tiles then if tiles then
local tile = tiles[1] local tile = tiles[1]
@ -64,7 +64,7 @@ mcl_mobs.register_mob("mobs_mc:stalker", {
head_eye_height = 1.8; head_eye_height = 1.8;
curiosity = 2, curiosity = 2,
textures = { textures = {
{"([combine:16x24:0,0=vl_stalker_default.png:0,16=vl_stalker_default.png)^vl_mobs_stalker_overlay.png", {get_texture({}),
"mobs_mc_empty.png"}, "mobs_mc_empty.png"},
}, },
visual_size = {x=2, y=2}, visual_size = {x=2, y=2},
@ -185,7 +185,7 @@ mcl_mobs.register_mob("mobs_mc:stalker_charged", {
--BOOM --BOOM
textures = { textures = {
{"([combine:16x24:0,0=vl_stalker_default.png:0,16=vl_stalker_default.png)^vl_mobs_stalker_overlay.png", {get_texture({}),
"vl_stalker_charge.png"}, "vl_stalker_charge.png"},
}, },
use_texture_alpha = true, use_texture_alpha = true,
@ -296,6 +296,36 @@ mcl_mobs.register_mob("mobs_mc:stalker_charged", {
glow = 3, glow = 3,
}) })
-- compat
minetest.register_entity("mobs_mc:creeper", {
on_activate = function(self, staticdata, dtime)
local obj = minetest.add_entity(self.object:get_pos(), "mobs_mc:stalker", staticdata)
obj:set_properties({
visual_size = {x=2, y=2},
mesh = "vl_stalker.b3d",
textures = {
{get_texture({}),
"mobs_mc_empty.png"},
},
})
self.object:remove()
end,
})
minetest.register_entity("mobs_mc:creeper_charged", {
on_activate = function(self, staticdata, dtime)
local obj = minetest.add_entity(self.object:get_pos(), "mobs_mc:stalker_charged", staticdata)
obj:set_properties({
visual_size = {x=2, y=2},
mesh = "vl_stalker.b3d",
textures = {
{get_texture({}),
"vl_stalker_charge.png"},
},
})
self.object:remove()
end,
})
mcl_mobs:spawn_specific( mcl_mobs:spawn_specific(
"mobs_mc:stalker", "mobs_mc:stalker",
"overworld", "overworld",
@ -446,3 +476,4 @@ mcl_vars.mg_overworld_max)
-- spawn eggs -- spawn eggs
mcl_mobs.register_egg("mobs_mc:stalker", S("Stalker"), "#0da70a", "#000000", 0) mcl_mobs.register_egg("mobs_mc:stalker", S("Stalker"), "#0da70a", "#000000", 0)
minetest.register_alias("mobs_mc:creeper", "mobs_mc:stalker")

View File

@ -497,6 +497,11 @@ mcl_mobs.register_mob("mobs_mc:rover", {
minetest.register_entity("mobs_mc:enderman", { minetest.register_entity("mobs_mc:enderman", {
on_activate = function(self, staticdata, dtime) on_activate = function(self, staticdata, dtime)
minetest.add_entity(self.object:get_pos(), "mobs_mc:rover", staticdata) minetest.add_entity(self.object:get_pos(), "mobs_mc:rover", staticdata)
obj:set_properties({
mesh = "vl_rover.b3d",
textures = { "vl_mobs_rover.png^vl_mobs_rover_face.png" },
visual_size = {x=10, y=10},
})
self.object:remove() self.object:remove()
end, end,
}) })