2017-07-05 01:15:46 +00:00
|
|
|
--License for code WTFPL and otherwise stated in readmes
|
|
|
|
|
2022-02-13 20:40:12 +00:00
|
|
|
local S = minetest.get_translator("mobs_mc")
|
2017-07-05 01:15:46 +00:00
|
|
|
|
|
|
|
--###################
|
|
|
|
--################### CREEPER
|
|
|
|
--###################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 12:44:49 +00:00
|
|
|
mcl_mobs:register_mob("mobs_mc:creeper", {
|
2017-07-05 01:15:46 +00:00
|
|
|
type = "monster",
|
2020-04-11 00:46:03 +00:00
|
|
|
spawn_class = "hostile",
|
2017-07-05 01:15:46 +00:00
|
|
|
hp_min = 20,
|
|
|
|
hp_max = 20,
|
2020-12-06 14:46:42 +00:00
|
|
|
xp_min = 5,
|
|
|
|
xp_max = 5,
|
2017-07-05 01:15:46 +00:00
|
|
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.69, 0.3},
|
|
|
|
pathfinding = 1,
|
|
|
|
visual = "mesh",
|
|
|
|
mesh = "mobs_mc_creeper.b3d",
|
|
|
|
textures = {
|
2021-02-13 00:48:46 +00:00
|
|
|
{"mobs_mc_creeper.png",
|
|
|
|
"mobs_mc_empty.png"},
|
2017-07-05 01:15:46 +00:00
|
|
|
},
|
|
|
|
visual_size = {x=3, y=3},
|
|
|
|
sounds = {
|
|
|
|
attack = "tnt_ignite",
|
2018-09-18 14:14:55 +00:00
|
|
|
death = "mobs_mc_creeper_death",
|
|
|
|
damage = "mobs_mc_creeper_hurt",
|
2018-03-31 01:51:49 +00:00
|
|
|
fuse = "tnt_ignite",
|
2017-07-05 01:15:46 +00:00
|
|
|
explode = "tnt_explode",
|
|
|
|
distance = 16,
|
|
|
|
},
|
2022-02-13 20:40:12 +00:00
|
|
|
makes_footstep_sound = true,
|
2018-03-31 01:51:49 +00:00
|
|
|
walk_velocity = 1.05,
|
2021-11-11 15:03:04 +00:00
|
|
|
run_velocity = 2.1,
|
2018-01-26 17:50:28 +00:00
|
|
|
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
|
2017-07-05 01:15:46 +00:00
|
|
|
attack_type = "explode",
|
2022-02-13 20:40:12 +00:00
|
|
|
|
2021-04-07 16:47:40 +00:00
|
|
|
--hssssssssssss
|
|
|
|
|
2021-05-04 07:53:28 +00:00
|
|
|
explosion_strength = 3,
|
2022-02-13 20:40:12 +00:00
|
|
|
explosion_radius = 3.5,
|
|
|
|
explosion_damage_radius = 3.5,
|
|
|
|
explosiontimer_reset_radius = 6,
|
2021-11-11 15:47:32 +00:00
|
|
|
reach = 3,
|
2022-02-13 20:40:12 +00:00
|
|
|
explosion_timer = 1.5,
|
2018-03-31 01:51:49 +00:00
|
|
|
allow_fuse_reset = true,
|
|
|
|
stop_to_explode = true,
|
2017-07-05 01:15:46 +00:00
|
|
|
|
|
|
|
-- Force-ignite creeper with flint and steel and explode after 1.5 seconds.
|
|
|
|
-- TODO: Make creeper flash after doing this as well.
|
|
|
|
-- TODO: Test and debug this code.
|
|
|
|
on_rightclick = function(self, clicker)
|
2022-02-13 20:40:12 +00:00
|
|
|
if self._forced_explosion_countdown_timer ~= nil then
|
2017-07-05 01:15:46 +00:00
|
|
|
return
|
|
|
|
end
|
|
|
|
local item = clicker:get_wielded_item()
|
2022-05-25 21:25:15 +00:00
|
|
|
if item:get_name() == "mcl_fire:flint_and_steel" then
|
2020-07-10 14:08:40 +00:00
|
|
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
2017-07-05 01:15:46 +00:00
|
|
|
-- Wear tool
|
|
|
|
local wdef = item:get_definition()
|
|
|
|
item:add_wear(1000)
|
|
|
|
-- Tool break sound
|
2017-08-06 12:09:25 +00:00
|
|
|
if item:get_count() == 0 and wdef.sound and wdef.sound.breaks then
|
2020-04-06 22:55:45 +00:00
|
|
|
minetest.sound_play(wdef.sound.breaks, {pos = clicker:get_pos(), gain = 0.5}, true)
|
2017-07-05 01:15:46 +00:00
|
|
|
end
|
|
|
|
clicker:set_wielded_item(item)
|
|
|
|
end
|
2018-03-31 01:51:49 +00:00
|
|
|
self._forced_explosion_countdown_timer = self.explosion_timer
|
2020-04-06 22:55:45 +00:00
|
|
|
minetest.sound_play(self.sounds.attack, {pos = self.object:get_pos(), gain = 1, max_hear_distance = 16}, true)
|
2017-07-05 01:15:46 +00:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
do_custom = function(self, dtime)
|
2022-02-13 20:40:12 +00:00
|
|
|
if self._forced_explosion_countdown_timer ~= nil then
|
2017-07-05 01:15:46 +00:00
|
|
|
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
|
|
|
|
if self._forced_explosion_countdown_timer <= 0 then
|
2022-05-25 12:44:49 +00:00
|
|
|
mcl_mobs:boom(self, mcl_util.get_object_center(self.object), self.explosion_strength)
|
2017-07-05 01:15:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
2021-01-05 16:52:27 +00:00
|
|
|
on_die = function(self, pos, cmi_cause)
|
|
|
|
-- Drop a random music disc when killed by skeleton or stray
|
|
|
|
if cmi_cause and cmi_cause.type == "punch" then
|
|
|
|
local luaentity = cmi_cause.puncher and cmi_cause.puncher:get_luaentity()
|
|
|
|
if luaentity and luaentity.name:find("arrow") then
|
|
|
|
local shooter_luaentity = luaentity._shooter and luaentity._shooter:get_luaentity()
|
|
|
|
if shooter_luaentity and (shooter_luaentity.name == "mobs_mc:skeleton" or shooter_luaentity.name == "mobs_mc:stray") then
|
2022-05-25 21:25:15 +00:00
|
|
|
minetest.add_item({x=pos.x, y=pos.y+1, z=pos.z}, "mcl_jukebox:record_" .. math.random(9))
|
2021-01-05 16:52:27 +00:00
|
|
|
end
|
|
|
|
end
|
2017-07-05 01:15:46 +00:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
maxdrops = 2,
|
|
|
|
drops = {
|
2022-05-25 21:25:15 +00:00
|
|
|
{name = "mcl_mobitems:gunpowder",
|
2017-07-05 01:15:46 +00:00
|
|
|
chance = 1,
|
|
|
|
min = 0,
|
2020-12-23 16:41:42 +00:00
|
|
|
max = 2,
|
|
|
|
looting = "common",},
|
2017-07-05 01:15:46 +00:00
|
|
|
|
2017-07-05 22:43:34 +00:00
|
|
|
-- Head
|
|
|
|
-- TODO: Only drop if killed by charged creeper
|
2022-05-25 21:25:15 +00:00
|
|
|
{name = "mcl_heads:creeper",
|
2017-07-05 22:43:34 +00:00
|
|
|
chance = 200, -- 0.5%
|
2017-07-05 01:15:46 +00:00
|
|
|
min = 1,
|
|
|
|
max = 1,},
|
|
|
|
},
|
|
|
|
animation = {
|
|
|
|
speed_normal = 24,
|
|
|
|
speed_run = 48,
|
|
|
|
stand_start = 0,
|
|
|
|
stand_end = 23,
|
|
|
|
walk_start = 24,
|
|
|
|
walk_end = 49,
|
|
|
|
run_start = 24,
|
|
|
|
run_end = 49,
|
|
|
|
hurt_start = 110,
|
|
|
|
hurt_end = 139,
|
|
|
|
death_start = 140,
|
|
|
|
death_end = 189,
|
|
|
|
look_start = 50,
|
|
|
|
look_end = 108,
|
|
|
|
},
|
|
|
|
floats = 1,
|
|
|
|
fear_height = 4,
|
|
|
|
view_range = 16,
|
|
|
|
})
|
|
|
|
|
2022-05-25 12:44:49 +00:00
|
|
|
mcl_mobs:register_mob("mobs_mc:creeper_charged", {
|
2022-02-13 20:40:12 +00:00
|
|
|
description = S("Creeper"),
|
2021-02-13 00:48:46 +00:00
|
|
|
type = "monster",
|
|
|
|
spawn_class = "hostile",
|
|
|
|
hp_min = 20,
|
|
|
|
hp_max = 20,
|
|
|
|
xp_min = 5,
|
|
|
|
xp_max = 5,
|
|
|
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.69, 0.3},
|
|
|
|
pathfinding = 1,
|
|
|
|
visual = "mesh",
|
|
|
|
mesh = "mobs_mc_creeper.b3d",
|
2021-04-07 16:47:40 +00:00
|
|
|
|
|
|
|
--BOOM
|
2021-04-25 15:30:15 +00:00
|
|
|
|
2021-02-13 00:48:46 +00:00
|
|
|
textures = {
|
|
|
|
{"mobs_mc_creeper.png",
|
|
|
|
"mobs_mc_creeper_charge.png"},
|
|
|
|
},
|
|
|
|
visual_size = {x=3, y=3},
|
|
|
|
sounds = {
|
|
|
|
attack = "tnt_ignite",
|
|
|
|
death = "mobs_mc_creeper_death",
|
|
|
|
damage = "mobs_mc_creeper_hurt",
|
|
|
|
fuse = "tnt_ignite",
|
|
|
|
explode = "tnt_explode",
|
|
|
|
distance = 16,
|
|
|
|
},
|
2022-02-13 20:40:12 +00:00
|
|
|
makes_footstep_sound = true,
|
2021-02-13 00:48:46 +00:00
|
|
|
walk_velocity = 1.05,
|
|
|
|
run_velocity = 2.1,
|
|
|
|
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
|
|
|
|
attack_type = "explode",
|
|
|
|
|
2021-05-04 07:53:28 +00:00
|
|
|
explosion_strength = 6,
|
2022-02-13 20:40:12 +00:00
|
|
|
explosion_radius = 8,
|
|
|
|
explosion_damage_radius = 8,
|
|
|
|
explosiontimer_reset_radius = 6,
|
2021-11-11 15:47:32 +00:00
|
|
|
reach = 3,
|
2022-02-13 20:40:12 +00:00
|
|
|
explosion_timer = 1.5,
|
2021-02-13 00:48:46 +00:00
|
|
|
allow_fuse_reset = true,
|
|
|
|
stop_to_explode = true,
|
|
|
|
|
|
|
|
-- Force-ignite creeper with flint and steel and explode after 1.5 seconds.
|
|
|
|
-- TODO: Make creeper flash after doing this as well.
|
|
|
|
-- TODO: Test and debug this code.
|
|
|
|
on_rightclick = function(self, clicker)
|
2022-02-13 20:40:12 +00:00
|
|
|
if self._forced_explosion_countdown_timer ~= nil then
|
2021-02-13 00:48:46 +00:00
|
|
|
return
|
|
|
|
end
|
|
|
|
local item = clicker:get_wielded_item()
|
2022-05-25 21:25:15 +00:00
|
|
|
if item:get_name() == "mcl_fire:flint_and_steel" then
|
2021-02-13 00:48:46 +00:00
|
|
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
|
|
|
-- Wear tool
|
|
|
|
local wdef = item:get_definition()
|
|
|
|
item:add_wear(1000)
|
|
|
|
-- Tool break sound
|
|
|
|
if item:get_count() == 0 and wdef.sound and wdef.sound.breaks then
|
|
|
|
minetest.sound_play(wdef.sound.breaks, {pos = clicker:get_pos(), gain = 0.5}, true)
|
|
|
|
end
|
|
|
|
clicker:set_wielded_item(item)
|
|
|
|
end
|
|
|
|
self._forced_explosion_countdown_timer = self.explosion_timer
|
|
|
|
minetest.sound_play(self.sounds.attack, {pos = self.object:get_pos(), gain = 1, max_hear_distance = 16}, true)
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
do_custom = function(self, dtime)
|
2022-02-13 20:40:12 +00:00
|
|
|
if self._forced_explosion_countdown_timer ~= nil then
|
2021-02-13 00:48:46 +00:00
|
|
|
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
|
|
|
|
if self._forced_explosion_countdown_timer <= 0 then
|
2022-05-25 12:44:49 +00:00
|
|
|
mcl_mobs:boom(self, mcl_util.get_object_center(self.object), self.explosion_strength)
|
2021-02-13 00:48:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
on_die = function(self, pos, cmi_cause)
|
|
|
|
-- Drop a random music disc when killed by skeleton or stray
|
|
|
|
if cmi_cause and cmi_cause.type == "punch" then
|
|
|
|
local luaentity = cmi_cause.puncher and cmi_cause.puncher:get_luaentity()
|
|
|
|
if luaentity and luaentity.name:find("arrow") then
|
|
|
|
local shooter_luaentity = luaentity._shooter and luaentity._shooter:get_luaentity()
|
|
|
|
if shooter_luaentity and (shooter_luaentity.name == "mobs_mc:skeleton" or shooter_luaentity.name == "mobs_mc:stray") then
|
2022-05-25 21:25:15 +00:00
|
|
|
minetest.add_item({x=pos.x, y=pos.y+1, z=pos.z}, "mcl_jukebox:record_" .. math.random(9))
|
2021-02-13 00:48:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
maxdrops = 2,
|
|
|
|
drops = {
|
2022-05-25 21:25:15 +00:00
|
|
|
{name = "mcl_mobitems:gunpowder",
|
2021-02-13 00:48:46 +00:00
|
|
|
chance = 1,
|
|
|
|
min = 0,
|
|
|
|
max = 2,
|
|
|
|
looting = "common",},
|
|
|
|
|
|
|
|
-- Head
|
|
|
|
-- TODO: Only drop if killed by charged creeper
|
2022-05-25 21:25:15 +00:00
|
|
|
{name = "mcl_heads:creeper",
|
2021-02-13 00:48:46 +00:00
|
|
|
chance = 200, -- 0.5%
|
|
|
|
min = 1,
|
|
|
|
max = 1,},
|
|
|
|
},
|
|
|
|
animation = {
|
|
|
|
speed_normal = 24,
|
|
|
|
speed_run = 48,
|
|
|
|
stand_start = 0,
|
|
|
|
stand_end = 23,
|
|
|
|
walk_start = 24,
|
|
|
|
walk_end = 49,
|
|
|
|
run_start = 24,
|
|
|
|
run_end = 49,
|
|
|
|
hurt_start = 110,
|
|
|
|
hurt_end = 139,
|
|
|
|
death_start = 140,
|
|
|
|
death_end = 189,
|
|
|
|
look_start = 50,
|
|
|
|
look_end = 108,
|
|
|
|
},
|
|
|
|
floats = 1,
|
|
|
|
fear_height = 4,
|
|
|
|
view_range = 16,
|
|
|
|
--Having trouble when fire is placed with lightning
|
|
|
|
fire_resistant = true,
|
|
|
|
glow = 3,
|
|
|
|
})
|
2017-07-05 01:15:46 +00:00
|
|
|
|
2022-05-25 12:44:49 +00:00
|
|
|
mcl_mobs:spawn_specific(
|
2021-04-25 15:30:15 +00:00
|
|
|
"mobs_mc:creeper",
|
|
|
|
"overworld",
|
2021-04-08 11:39:18 +00:00
|
|
|
"ground",
|
|
|
|
{
|
|
|
|
"Mesa",
|
|
|
|
"FlowerForest",
|
|
|
|
"Swampland",
|
|
|
|
"Taiga",
|
|
|
|
"ExtremeHills",
|
|
|
|
"Jungle",
|
|
|
|
"Savanna",
|
|
|
|
"BirchForest",
|
|
|
|
"MegaSpruceTaiga",
|
|
|
|
"MegaTaiga",
|
|
|
|
"ExtremeHills+",
|
|
|
|
"Forest",
|
|
|
|
"Plains",
|
|
|
|
"Desert",
|
|
|
|
"ColdTaiga",
|
|
|
|
"IcePlainsSpikes",
|
|
|
|
"SunflowerPlains",
|
|
|
|
"IcePlains",
|
|
|
|
"RoofedForest",
|
|
|
|
"ExtremeHills+_snowtop",
|
|
|
|
"MesaPlateauFM_grasstop",
|
|
|
|
"JungleEdgeM",
|
|
|
|
"ExtremeHillsM",
|
|
|
|
"JungleM",
|
|
|
|
"BirchForestM",
|
|
|
|
"MesaPlateauF",
|
|
|
|
"MesaPlateauFM",
|
|
|
|
"MesaPlateauF_grasstop",
|
|
|
|
"MesaBryce",
|
|
|
|
"JungleEdge",
|
|
|
|
"SavannaM",
|
|
|
|
"FlowerForest_beach",
|
|
|
|
"Forest_beach",
|
|
|
|
"StoneBeach",
|
|
|
|
"ColdTaiga_beach_water",
|
|
|
|
"Taiga_beach",
|
|
|
|
"Savanna_beach",
|
|
|
|
"Plains_beach",
|
|
|
|
"ExtremeHills_beach",
|
|
|
|
"ColdTaiga_beach",
|
|
|
|
"Swampland_shore",
|
|
|
|
"JungleM_shore",
|
|
|
|
"Jungle_shore",
|
|
|
|
"MesaPlateauFM_sandlevel",
|
|
|
|
"MesaPlateauF_sandlevel",
|
|
|
|
"MesaBryce_sandlevel",
|
|
|
|
"Mesa_sandlevel",
|
|
|
|
"RoofedForest_ocean",
|
|
|
|
"JungleEdgeM_ocean",
|
|
|
|
"BirchForestM_ocean",
|
|
|
|
"BirchForest_ocean",
|
|
|
|
"IcePlains_deep_ocean",
|
|
|
|
"Jungle_deep_ocean",
|
|
|
|
"Savanna_ocean",
|
|
|
|
"MesaPlateauF_ocean",
|
|
|
|
"ExtremeHillsM_deep_ocean",
|
|
|
|
"Savanna_deep_ocean",
|
|
|
|
"SunflowerPlains_ocean",
|
|
|
|
"Swampland_deep_ocean",
|
|
|
|
"Swampland_ocean",
|
|
|
|
"MegaSpruceTaiga_deep_ocean",
|
|
|
|
"ExtremeHillsM_ocean",
|
|
|
|
"JungleEdgeM_deep_ocean",
|
|
|
|
"SunflowerPlains_deep_ocean",
|
|
|
|
"BirchForest_deep_ocean",
|
|
|
|
"IcePlainsSpikes_ocean",
|
|
|
|
"Mesa_ocean",
|
|
|
|
"StoneBeach_ocean",
|
|
|
|
"Plains_deep_ocean",
|
|
|
|
"JungleEdge_deep_ocean",
|
|
|
|
"SavannaM_deep_ocean",
|
|
|
|
"Desert_deep_ocean",
|
|
|
|
"Mesa_deep_ocean",
|
|
|
|
"ColdTaiga_deep_ocean",
|
|
|
|
"Plains_ocean",
|
|
|
|
"MesaPlateauFM_ocean",
|
|
|
|
"Forest_deep_ocean",
|
|
|
|
"JungleM_deep_ocean",
|
|
|
|
"FlowerForest_deep_ocean",
|
|
|
|
"MegaTaiga_ocean",
|
|
|
|
"StoneBeach_deep_ocean",
|
|
|
|
"IcePlainsSpikes_deep_ocean",
|
|
|
|
"ColdTaiga_ocean",
|
|
|
|
"SavannaM_ocean",
|
|
|
|
"MesaPlateauF_deep_ocean",
|
|
|
|
"MesaBryce_deep_ocean",
|
|
|
|
"ExtremeHills+_deep_ocean",
|
|
|
|
"ExtremeHills_ocean",
|
|
|
|
"Forest_ocean",
|
|
|
|
"MegaTaiga_deep_ocean",
|
|
|
|
"JungleEdge_ocean",
|
|
|
|
"MesaBryce_ocean",
|
|
|
|
"MegaSpruceTaiga_ocean",
|
|
|
|
"ExtremeHills+_ocean",
|
|
|
|
"Jungle_ocean",
|
|
|
|
"RoofedForest_deep_ocean",
|
|
|
|
"IcePlains_ocean",
|
|
|
|
"FlowerForest_ocean",
|
|
|
|
"ExtremeHills_deep_ocean",
|
|
|
|
"MesaPlateauFM_deep_ocean",
|
|
|
|
"Desert_ocean",
|
|
|
|
"Taiga_ocean",
|
|
|
|
"BirchForestM_deep_ocean",
|
|
|
|
"Taiga_deep_ocean",
|
|
|
|
"JungleM_ocean",
|
|
|
|
"FlowerForest_underground",
|
|
|
|
"JungleEdge_underground",
|
|
|
|
"StoneBeach_underground",
|
|
|
|
"MesaBryce_underground",
|
|
|
|
"Mesa_underground",
|
|
|
|
"RoofedForest_underground",
|
|
|
|
"Jungle_underground",
|
|
|
|
"Swampland_underground",
|
|
|
|
"BirchForest_underground",
|
|
|
|
"Plains_underground",
|
|
|
|
"MesaPlateauF_underground",
|
|
|
|
"ExtremeHills_underground",
|
|
|
|
"MegaSpruceTaiga_underground",
|
|
|
|
"BirchForestM_underground",
|
|
|
|
"SavannaM_underground",
|
|
|
|
"MesaPlateauFM_underground",
|
|
|
|
"Desert_underground",
|
|
|
|
"Savanna_underground",
|
|
|
|
"Forest_underground",
|
|
|
|
"SunflowerPlains_underground",
|
|
|
|
"ColdTaiga_underground",
|
|
|
|
"IcePlains_underground",
|
|
|
|
"IcePlainsSpikes_underground",
|
|
|
|
"MegaTaiga_underground",
|
|
|
|
"Taiga_underground",
|
|
|
|
"ExtremeHills+_underground",
|
|
|
|
"JungleM_underground",
|
|
|
|
"ExtremeHillsM_underground",
|
|
|
|
"JungleEdgeM_underground",
|
|
|
|
},
|
2021-04-25 15:30:15 +00:00
|
|
|
0,
|
|
|
|
7,
|
|
|
|
20,
|
|
|
|
16500,
|
|
|
|
2,
|
2022-05-25 21:25:15 +00:00
|
|
|
mcl_vars.mg_overworld_min,
|
|
|
|
mcl_vars.mg_overworld_max)
|
2017-07-05 01:15:46 +00:00
|
|
|
|
|
|
|
-- spawn eggs
|
2022-05-25 12:44:49 +00:00
|
|
|
mcl_mobs:register_egg("mobs_mc:creeper", S("Creeper"), "mobs_mc_spawn_icon_creeper.png", 0)
|