[mobs_mc] rename creeper to stalker and update to upstream version
This commit is contained in:
parent
94ee0cdbe0
commit
3de7d4f330
1 changed files with 117 additions and 42 deletions
|
@ -3,14 +3,60 @@
|
||||||
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 and 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 or texture == "" then
|
||||||
|
texture = "vl_stalker_default.png"
|
||||||
|
end
|
||||||
|
texture = texture:gsub("([\\^:\\[])","\\%1") -- escape texture modifiers
|
||||||
|
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
|
||||||
|
|
||||||
|
local AURA = "vl_stalker_overloaded_aura.png"
|
||||||
|
local function get_overloaded_aura(timer)
|
||||||
|
local frame = math.floor(timer*16)
|
||||||
|
local f = tostring(frame)
|
||||||
|
local nf = tostring(16-f)
|
||||||
|
return "[combine:16x24:-" .. nf ..",0=" .. AURA .. ":" .. f .. ",0=" .. AURA
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
mcl_mobs.register_mob("mobs_mc:creeper", {
|
|
||||||
description = S("Creeper"),
|
mcl_mobs.register_mob("mobs_mc:stalker", {
|
||||||
|
description = S("Stalker"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
spawn_in_group = 1,
|
spawn_in_group = 1,
|
||||||
|
@ -21,16 +67,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",
|
{get_texture({}),
|
||||||
"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",
|
||||||
|
@ -56,8 +102,8 @@ mcl_mobs.register_mob("mobs_mc:creeper", {
|
||||||
allow_fuse_reset = true,
|
allow_fuse_reset = true,
|
||||||
stop_to_explode = true,
|
stop_to_explode = true,
|
||||||
|
|
||||||
-- Force-ignite creeper with flint and steel and explode after 1.5 seconds.
|
-- Force-ignite stalker with flint and steel and explode after 1.5 seconds.
|
||||||
-- TODO: Make creeper flash after doing this as well.
|
-- TODO: Make stalker flash after doing this as well.
|
||||||
-- TODO: Test and debug this code.
|
-- TODO: Test and debug this code.
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
if self._forced_explosion_countdown_timer ~= nil then
|
if self._forced_explosion_countdown_timer ~= nil then
|
||||||
|
@ -86,6 +132,11 @@ 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
|
||||||
|
local new_texture = get_texture(self)
|
||||||
|
if self._stalker_texture ~= new_texture then
|
||||||
|
self.object:set_properties({textures={new_texture, "mobs_mc_empty.png"}})
|
||||||
|
self._stalker_texture = new_texture
|
||||||
|
end
|
||||||
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
|
||||||
|
@ -108,35 +159,42 @@ mcl_mobs.register_mob("mobs_mc:creeper", {
|
||||||
looting = "common",},
|
looting = "common",},
|
||||||
|
|
||||||
-- Head
|
-- Head
|
||||||
-- TODO: Only drop if killed by charged creeper
|
-- TODO: Only drop if killed by charged stalker
|
||||||
{name = "mcl_heads:creeper",
|
{name = "mcl_heads:stalker",
|
||||||
chance = 200, -- 0.5%
|
chance = 200, -- 0.5%
|
||||||
min = 1,
|
min = 1,
|
||||||
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,
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
})
|
|
||||||
|
|
||||||
mcl_mobs.register_mob("mobs_mc:creeper_charged", {
|
_on_after_convert = function(obj)
|
||||||
description = S("Creeper"),
|
obj:set_properties({
|
||||||
|
visual_size = {x=2, y=2},
|
||||||
|
mesh = "vl_stalker.b3d",
|
||||||
|
textures = {
|
||||||
|
{get_texture({}),
|
||||||
|
"mobs_mc_empty.png"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}) -- END mcl_mobs.register_mob("mobs_mc:stalker", {
|
||||||
|
|
||||||
|
mcl_mobs.register_mob("mobs_mc:stalker_overloaded", {
|
||||||
|
description = S("Overloaded Stalker"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
hp_min = 20,
|
hp_min = 20,
|
||||||
|
@ -146,15 +204,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",
|
{get_texture({}),
|
||||||
"mobs_mc_creeper_charge.png"},
|
AURA},
|
||||||
},
|
},
|
||||||
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",
|
||||||
|
@ -178,8 +237,8 @@ mcl_mobs.register_mob("mobs_mc:creeper_charged", {
|
||||||
allow_fuse_reset = true,
|
allow_fuse_reset = true,
|
||||||
stop_to_explode = true,
|
stop_to_explode = true,
|
||||||
|
|
||||||
-- Force-ignite creeper with flint and steel and explode after 1.5 seconds.
|
-- Force-ignite stalker with flint and steel and explode after 1.5 seconds.
|
||||||
-- TODO: Make creeper flash after doing this as well.
|
-- TODO: Make stalker flash after doing this as well.
|
||||||
-- TODO: Test and debug this code.
|
-- TODO: Test and debug this code.
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
if self._forced_explosion_countdown_timer ~= nil then
|
if self._forced_explosion_countdown_timer ~= nil then
|
||||||
|
@ -208,6 +267,9 @@ 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
|
||||||
|
if not self._aura_timer or self._aura_timer > 1 then self._aura_timer = 0 end
|
||||||
|
self._aura_timer = self._aura_timer + dtime
|
||||||
|
self.object:set_properties({textures={get_texture(self), get_overloaded_aura(self._aura_timer)}})
|
||||||
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
|
||||||
|
@ -222,7 +284,7 @@ mcl_mobs.register_mob("mobs_mc:creeper_charged", {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_lightning_strike = function(self, pos, pos2, objects)
|
on_lightning_strike = function(self, pos, pos2, objects)
|
||||||
mcl_util.replace_mob(self.object, "mobs_mc:creeper_charged")
|
mcl_util.replace_mob(self.object, "mobs_mc:stalker_overloaded")
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
maxdrops = 2,
|
maxdrops = 2,
|
||||||
|
@ -234,27 +296,23 @@ mcl_mobs.register_mob("mobs_mc:creeper_charged", {
|
||||||
looting = "common",},
|
looting = "common",},
|
||||||
|
|
||||||
-- Head
|
-- Head
|
||||||
-- TODO: Only drop if killed by charged creeper
|
-- TODO: Only drop if killed by overloaded stalker
|
||||||
{name = "mcl_heads:creeper",
|
{name = "mcl_heads:stalker",
|
||||||
chance = 200, -- 0.5%
|
chance = 200, -- 0.5%
|
||||||
min = 1,
|
min = 1,
|
||||||
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,
|
||||||
|
@ -262,10 +320,25 @@ mcl_mobs.register_mob("mobs_mc:creeper_charged", {
|
||||||
--Having trouble when fire is placed with lightning
|
--Having trouble when fire is placed with lightning
|
||||||
fire_resistant = true,
|
fire_resistant = true,
|
||||||
glow = 3,
|
glow = 3,
|
||||||
})
|
|
||||||
|
_on_after_convert = function(obj)
|
||||||
|
obj:set_properties({
|
||||||
|
visual_size = {x=2, y=2},
|
||||||
|
mesh = "vl_stalker.b3d",
|
||||||
|
textures = {
|
||||||
|
{get_texture({}),
|
||||||
|
AURA},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}) -- END mcl_mobs.register_mob("mobs_mc:stalker_overloaded", {
|
||||||
|
|
||||||
|
-- compat
|
||||||
|
mcl_mobs.register_conversion("mobs_mc:creeper", "mobs_mc:stalker")
|
||||||
|
mcl_mobs.register_conversion("mobs_mc:creeper_charged", "mobs_mc:stalker_overloaded")
|
||||||
|
|
||||||
mcl_mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:creeper",
|
"mobs_mc:stalker",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
{
|
{
|
||||||
|
@ -413,4 +486,6 @@ mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mcl_mobs.register_egg("mobs_mc:creeper", S("Creeper"), "#0da70a", "#000000", 0)
|
mcl_mobs.register_egg("mobs_mc:stalker", S("Stalker"), "#0da70a", "#000000", 0)
|
||||||
|
minetest.register_alias("mobs_mc:creeper", "mobs_mc:stalker")
|
||||||
|
mcl_mobs.register_egg("mobs_mc:stalker_overloaded", S("Overloaded Stalker"), "#00a77a", "#000000", 0)
|
Loading…
Reference in a new issue