Make mobs and bed use mcl_explosions
parent
6a576c50a0
commit
56d484f69b
|
@ -93,7 +93,7 @@ local node_snow = "mcl_core:snow"
|
||||||
mobs.fallback_node = minetest.registered_aliases["mapgen_dirt"] or "mcl_core:dirt"
|
mobs.fallback_node = minetest.registered_aliases["mapgen_dirt"] or "mcl_core:dirt"
|
||||||
|
|
||||||
local mod_weather = minetest.get_modpath("mcl_weather") ~= nil
|
local mod_weather = minetest.get_modpath("mcl_weather") ~= nil
|
||||||
local mod_tnt = minetest.get_modpath("mcl_tnt") ~= nil
|
local mod_explosions = minetest.get_modpath("mcl_explosions") ~= nil
|
||||||
local mod_mobspawners = minetest.get_modpath("mcl_mobspawners") ~= nil
|
local mod_mobspawners = minetest.get_modpath("mcl_mobspawners") ~= nil
|
||||||
local mod_hunger = minetest.get_modpath("mcl_hunger") ~= nil
|
local mod_hunger = minetest.get_modpath("mcl_hunger") ~= nil
|
||||||
local mod_worlds = minetest.get_modpath("mcl_worlds") ~= nil
|
local mod_worlds = minetest.get_modpath("mcl_worlds") ~= nil
|
||||||
|
@ -2218,26 +2218,10 @@ local do_states = function(self, dtime)
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
-- dont damage anything if area protected or next to water
|
if mod_explosions then
|
||||||
if minetest.find_node_near(pos, 1, {"group:water"})
|
if mobs_griefing and not minetest.is_protected(pos, "") then
|
||||||
or minetest.is_protected(pos, "") then
|
mcl_explosions.explode(self.object:get_pos(), self.explosion_strength, { drop_chance = 1.0 }, self.object)
|
||||||
|
|
||||||
node_break_radius = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
self.object:remove()
|
|
||||||
|
|
||||||
if mobs_griefing and mod_tnt and tnt and tnt.boom
|
|
||||||
and not minetest.is_protected(pos, "") then
|
|
||||||
|
|
||||||
tnt.boom(pos, {
|
|
||||||
radius = node_break_radius,
|
|
||||||
damage_radius = entity_damage_radius,
|
|
||||||
sound = self.sounds.explode,
|
|
||||||
is_tnt = false,
|
|
||||||
})
|
|
||||||
else
|
else
|
||||||
|
|
||||||
minetest.sound_play(self.sounds.explode, {
|
minetest.sound_play(self.sounds.explode, {
|
||||||
pos = pos,
|
pos = pos,
|
||||||
gain = 1.0,
|
gain = 1.0,
|
||||||
|
@ -2247,6 +2231,8 @@ local do_states = function(self, dtime)
|
||||||
entity_physics(pos, entity_damage_radius)
|
entity_physics(pos, entity_damage_radius)
|
||||||
effect(pos, 32, "tnt_smoke.png", nil, nil, node_break_radius, 1, 0)
|
effect(pos, 32, "tnt_smoke.png", nil, nil, node_break_radius, 1, 0)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
self.object:remove()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -3365,8 +3351,8 @@ minetest.register_entity(name, {
|
||||||
runaway_timer = 0,
|
runaway_timer = 0,
|
||||||
pathfinding = def.pathfinding,
|
pathfinding = def.pathfinding,
|
||||||
immune_to = def.immune_to or {},
|
immune_to = def.immune_to or {},
|
||||||
explosion_radius = def.explosion_radius,
|
explosion_radius = def.explosion_radius, -- LEGACY
|
||||||
explosion_damage_radius = def.explosion_damage_radius,
|
explosion_damage_radius = def.explosion_damage_radius, -- LEGACY
|
||||||
explosion_timer = def.explosion_timer or 3,
|
explosion_timer = def.explosion_timer or 3,
|
||||||
allow_fuse_reset = def.allow_fuse_reset ~= false,
|
allow_fuse_reset = def.allow_fuse_reset ~= false,
|
||||||
stop_to_explode = def.stop_to_explode ~= false,
|
stop_to_explode = def.stop_to_explode ~= false,
|
||||||
|
@ -3393,6 +3379,7 @@ minetest.register_entity(name, {
|
||||||
texture_mods = {},
|
texture_mods = {},
|
||||||
shoot_arrow = def.shoot_arrow,
|
shoot_arrow = def.shoot_arrow,
|
||||||
sounds_child = def.sounds_child,
|
sounds_child = def.sounds_child,
|
||||||
|
explosion_strength = def.explosion_strength,
|
||||||
-- End of MCL2 extensions
|
-- End of MCL2 extensions
|
||||||
|
|
||||||
on_spawn = def.on_spawn,
|
on_spawn = def.on_spawn,
|
||||||
|
@ -3838,7 +3825,6 @@ end
|
||||||
|
|
||||||
-- no damage to nodes explosion
|
-- no damage to nodes explosion
|
||||||
function mobs:safe_boom(self, pos, radius)
|
function mobs:safe_boom(self, pos, radius)
|
||||||
|
|
||||||
minetest.sound_play(self.sounds and self.sounds.explode or "tnt_explode", {
|
minetest.sound_play(self.sounds and self.sounds.explode or "tnt_explode", {
|
||||||
pos = pos,
|
pos = pos,
|
||||||
gain = 1.0,
|
gain = 1.0,
|
||||||
|
@ -3853,17 +3839,12 @@ end
|
||||||
-- make explosion with protection and tnt mod check
|
-- make explosion with protection and tnt mod check
|
||||||
function mobs:boom(self, pos, radius)
|
function mobs:boom(self, pos, radius)
|
||||||
|
|
||||||
if mobs_griefing
|
if mod_explosions then
|
||||||
and mod_tnt and tnt and tnt.boom
|
if mobs_griefing and not minetest.is_protected(pos, "") then
|
||||||
and not minetest.is_protected(pos, "") then
|
mcl_explosions.explode(pos, self.explosion_strength, { drop_chance = 1.0 }, self.object)
|
||||||
|
else
|
||||||
tnt.boom(pos, {
|
mobs:safe_boom(self, pos, radius)
|
||||||
radius = radius,
|
end
|
||||||
damage_radius = radius,
|
|
||||||
sound = self.sounds and self.sounds.explode,
|
|
||||||
explode_center = true,
|
|
||||||
is_tnt = false,
|
|
||||||
})
|
|
||||||
else
|
else
|
||||||
mobs:safe_boom(self, pos, radius)
|
mobs:safe_boom(self, pos, radius)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
name = mcl_mobs
|
name = mcl_mobs
|
||||||
optional_depends = mcl_weather, mcl_tnt, mcl_hunger, mcl_worlds, invisibility, lucky_block, cmi, doc_identifier, mcl_armor
|
optional_depends = mcl_weather, mcl_explosions, mcl_hunger, mcl_worlds, invisibility, lucky_block, cmi, doc_identifier, mcl_armor
|
||||||
|
|
|
@ -36,9 +36,8 @@ mobs:register_mob("mobs_mc:creeper", {
|
||||||
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
|
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
|
||||||
attack_type = "explode",
|
attack_type = "explode",
|
||||||
|
|
||||||
explosion_radius = 3,
|
explosion_strength = 3,
|
||||||
reach = 4,
|
reach = 4,
|
||||||
explosion_damage_radius = 7,
|
|
||||||
explosion_timer = 1.5,
|
explosion_timer = 1.5,
|
||||||
allow_fuse_reset = true,
|
allow_fuse_reset = true,
|
||||||
stop_to_explode = true,
|
stop_to_explode = true,
|
||||||
|
|
|
@ -49,8 +49,7 @@ mobs:register_mob("mobs_mc:wither", {
|
||||||
lava_damage = 0,
|
lava_damage = 0,
|
||||||
fire_damage = 0,
|
fire_damage = 0,
|
||||||
attack_type = "dogshoot",
|
attack_type = "dogshoot",
|
||||||
explosion_radius = 3,
|
explosion_strength = 8,
|
||||||
explosion_fire = false,
|
|
||||||
dogshoot_stop = true,
|
dogshoot_stop = true,
|
||||||
arrow = "mobs_mc:wither_skull",
|
arrow = "mobs_mc:wither_skull",
|
||||||
reach = 5,
|
reach = 5,
|
||||||
|
|
|
@ -5,6 +5,7 @@ local pi = math.pi
|
||||||
local player_in_bed = 0
|
local player_in_bed = 0
|
||||||
local is_sp = minetest.is_singleplayer()
|
local is_sp = minetest.is_singleplayer()
|
||||||
local weather_mod = minetest.get_modpath("mcl_weather") ~= nil
|
local weather_mod = minetest.get_modpath("mcl_weather") ~= nil
|
||||||
|
local explosions_mod = minetest.get_modpath("mcl_explosions") ~= nil
|
||||||
|
|
||||||
-- Helper functions
|
-- Helper functions
|
||||||
|
|
||||||
|
@ -307,8 +308,8 @@ function mcl_beds.on_rightclick(pos, player, is_top)
|
||||||
if dim == "nether" or dim == "end" then
|
if dim == "nether" or dim == "end" then
|
||||||
-- Bed goes BOOM in the Nether or End.
|
-- Bed goes BOOM in the Nether or End.
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
if minetest.get_modpath("mcl_tnt") then
|
if explosions_mod then
|
||||||
tnt.boom(pos, {radius = 4, damage_radius = 4, is_tnt = false})
|
mcl_explosions.explode(pos, 5, {drop_chance = 1.0, fire = true})
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue