Stalker model and mechanics implemented

This commit is contained in:
the-real-herowl 2024-05-12 06:02:15 +02:00
parent d826a587da
commit 970f6cf377
7 changed files with 54 additions and 17 deletions

View File

@ -957,6 +957,7 @@ function mob_class:do_states_attack (dtime)
if self.v_start then if self.v_start then
self.timer = self.timer + dtime self.timer = self.timer + dtime
self.blinktimer = (self.blinktimer or 0) + dtime self.blinktimer = (self.blinktimer or 0) + dtime
self:set_animation("fuse")
if self.blinktimer > 0.2 then if self.blinktimer > 0.2 then
self.blinktimer = 0 self.blinktimer = 0

View File

@ -3,10 +3,47 @@
local S = minetest.get_translator("mobs_mc") local S = minetest.get_translator("mobs_mc")
--################### --###################
--################### CREEPER --################### STALKER
--################### --###################
local function get_texture(self)
local on_name = self.standing_on
local texture
local texture_suff = ""
if on_name ~= "air" then
local tiles = minetest.registered_nodes[on_name].tiles
if tiles then
local tile = tiles[1]
local color
if type(tile) == "table" then
texture = tile.name or tile.image
if tile.color then
color = minetest.colorspec_to_colorstring(tile.color)
end
elseif type(tile) == "string" then
texture = tile
end
if not color then
color = minetest.colorspec_to_colorstring(minetest.registered_nodes[on_name].color)
end
if color then
texture_suff = "^[multiply:" .. color .. "^[hsl:0:0:20"
end
end
end
if not texture then
texture = "vl_stalker_default.png"
end
texture = "([combine:16x24:0,0=" .. texture .. ":0,16=" .. texture .. texture_suff
if self.attack then
texture = texture .. ")^vl_mobs_stalker_overlay_angry.png"
else
texture = texture .. ")^vl_mobs_stalker_overlay.png"
end
return texture
end
mcl_mobs.register_mob("mobs_mc:creeper", { mcl_mobs.register_mob("mobs_mc:creeper", {
@ -21,16 +58,16 @@ mcl_mobs.register_mob("mobs_mc:creeper", {
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.69, 0.3}, collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.69, 0.3},
pathfinding = 1, pathfinding = 1,
visual = "mesh", visual = "mesh",
mesh = "mobs_mc_creeper.b3d", mesh = "vl_stalker.b3d",
head_swivel = "Head_Control", -- head_swivel = "Head_Control",
bone_eye_height = 2.35, bone_eye_height = 2.35,
head_eye_height = 1.8; head_eye_height = 1.8;
curiosity = 2, curiosity = 2,
textures = { textures = {
{"mobs_mc_creeper.png", {"([combine:16x24:0,0=vl_stalker_default.png:0,16=vl_stalker_default.png)^vl_mobs_stalker_overlay.png",
"mobs_mc_empty.png"}, "mobs_mc_empty.png"},
}, },
visual_size = {x=3, y=3}, visual_size = {x=2, y=2},
sounds = { sounds = {
attack = "tnt_ignite", attack = "tnt_ignite",
death = "mobs_mc_creeper_death", death = "mobs_mc_creeper_death",
@ -86,6 +123,7 @@ mcl_mobs.register_mob("mobs_mc:creeper", {
self:boom(mcl_util.get_object_center(self.object), self.explosion_strength) self:boom(mcl_util.get_object_center(self.object), self.explosion_strength)
end end
end end
self.object:set_properties({textures={get_texture(self)}})
end, end,
on_die = function(self, pos, cmi_cause) on_die = function(self, pos, cmi_cause)
-- Drop a random music disc when killed by skeleton or stray -- Drop a random music disc when killed by skeleton or stray
@ -115,20 +153,16 @@ mcl_mobs.register_mob("mobs_mc:creeper", {
max = 1,}, max = 1,},
}, },
animation = { animation = {
speed_normal = 24, speed_normal = 30,
speed_run = 48, speed_run = 60,
stand_start = 0, stand_start = 0,
stand_end = 23, stand_end = 23,
walk_start = 24, walk_start = 24,
walk_end = 49, walk_end = 49,
run_start = 24, run_start = 24,
run_end = 49, run_end = 49,
hurt_start = 110, fuse_start = 49,
hurt_end = 139, fuse_end = 80,
death_start = 140,
death_end = 189,
look_start = 50,
look_end = 108,
}, },
floats = 1, floats = 1,
fear_height = 4, fear_height = 4,
@ -146,15 +180,16 @@ mcl_mobs.register_mob("mobs_mc:creeper_charged", {
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.69, 0.3}, collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.69, 0.3},
pathfinding = 1, pathfinding = 1,
visual = "mesh", visual = "mesh",
mesh = "mobs_mc_creeper.b3d", mesh = "vl_stalker.b3d",
--BOOM --BOOM
textures = { textures = {
{"mobs_mc_creeper.png", {"([combine:16x24:0,0=vl_stalker_default.png:0,16=vl_stalker_default.png)^vl_mobs_stalker_overlay.png",
"mobs_mc_creeper_charge.png"}, "vl_stalker_charge.png"},
}, },
visual_size = {x=3, y=3}, use_texture_alpha = true,
visual_size = {x=2, y=2},
sounds = { sounds = {
attack = "tnt_ignite", attack = "tnt_ignite",
death = "mobs_mc_creeper_death", death = "mobs_mc_creeper_death",
@ -208,6 +243,7 @@ mcl_mobs.register_mob("mobs_mc:creeper_charged", {
self:boom(mcl_util.get_object_center(self.object), self.explosion_strength) self:boom(mcl_util.get_object_center(self.object), self.explosion_strength)
end end
end end
self.object:set_properties({textures={get_texture(self), "vl_stalker_charge.png"}})
end, end,
on_die = function(self, pos, cmi_cause) on_die = function(self, pos, cmi_cause)
-- Drop a random music disc when killed by skeleton or stray -- Drop a random music disc when killed by skeleton or stray

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B