Merge remote-tracking branch 'upstream/master' into forkhausen

This commit is contained in:
Alexander Minges 2020-05-05 14:15:20 +02:00
commit d32c427c39
70 changed files with 631 additions and 351 deletions

View file

@ -1,3 +1,4 @@
mcl_explosions
mcl_core
mcl_sounds
mcl_player

View file

@ -206,7 +206,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
-- Explode if already ignited
if self._boomtimer then
self.object:remove()
tnt.boom(pos)
mcl_explosions.explode(pos, 4, { drop_chance = 1.0 })
return
end
@ -249,7 +249,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
local pos = self.object:get_pos()
if self._boomtimer <= 0 then
self.object:remove()
tnt.boom(pos)
mcl_explosions.explode(pos, 4, { drop_chance = 1.0 })
return
else
tnt.smoke_step(pos)

View file

@ -93,7 +93,7 @@ local node_snow = "mcl_core:snow"
mobs.fallback_node = minetest.registered_aliases["mapgen_dirt"] or "mcl_core:dirt"
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_hunger = minetest.get_modpath("mcl_hunger") ~= nil
local mod_worlds = minetest.get_modpath("mcl_worlds") ~= nil
@ -2234,26 +2234,10 @@ local do_states = function(self, dtime)
local pos = self.object:get_pos()
-- dont damage anything if area protected or next to water
if minetest.find_node_near(pos, 1, {"group:water"})
or minetest.is_protected(pos, "") then
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,
})
if mod_explosions then
if mobs_griefing and not minetest.is_protected(pos, "") then
mcl_explosions.explode(self.object:get_pos(), self.explosion_strength, { drop_chance = 1.0 }, self.object)
else
minetest.sound_play(self.sounds.explode, {
pos = pos,
gain = 1.0,
@ -2263,6 +2247,8 @@ local do_states = function(self, dtime)
entity_physics(pos, entity_damage_radius)
effect(pos, 32, "tnt_smoke.png", nil, nil, node_break_radius, 1, 0)
end
end
self.object:remove()
return true
end
@ -2758,7 +2744,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
self.object:set_velocity({
x = dir.x * kb,
y = up,
y = dir.y * kb + up,
z = dir.z * kb
})
@ -3381,8 +3367,8 @@ minetest.register_entity(name, {
runaway_timer = 0,
pathfinding = def.pathfinding,
immune_to = def.immune_to or {},
explosion_radius = def.explosion_radius,
explosion_damage_radius = def.explosion_damage_radius,
explosion_radius = def.explosion_radius, -- LEGACY
explosion_damage_radius = def.explosion_damage_radius, -- LEGACY
explosion_timer = def.explosion_timer or 3,
allow_fuse_reset = def.allow_fuse_reset ~= false,
stop_to_explode = def.stop_to_explode ~= false,
@ -3409,6 +3395,7 @@ minetest.register_entity(name, {
texture_mods = {},
shoot_arrow = def.shoot_arrow,
sounds_child = def.sounds_child,
explosion_strength = def.explosion_strength,
-- End of MCL2 extensions
on_spawn = def.on_spawn,
@ -3853,8 +3840,7 @@ end
-- no damage to nodes explosion
function mobs:safe_boom(self, pos, radius)
function mobs:safe_boom(self, pos, strength)
minetest.sound_play(self.sounds and self.sounds.explode or "tnt_explode", {
pos = pos,
gain = 1.0,
@ -3867,19 +3853,14 @@ end
-- make explosion with protection and tnt mod check
function mobs:boom(self, pos, radius)
function mobs:boom(self, pos, strength, fire)
if mobs_griefing
and mod_tnt and tnt and tnt.boom
and not minetest.is_protected(pos, "") then
tnt.boom(pos, {
radius = radius,
damage_radius = radius,
sound = self.sounds and self.sounds.explode,
explode_center = true,
is_tnt = false,
})
if mod_explosions then
if mobs_griefing and not minetest.is_protected(pos, "") then
mcl_explosions.explode(pos, strength, { drop_chance = 1.0, fire = fire }, self.object)
else
mobs:safe_boom(self, pos, strength)
end
else
mobs:safe_boom(self, pos, radius)
end

View file

@ -1,2 +1,2 @@
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

View file

@ -36,9 +36,8 @@ mobs:register_mob("mobs_mc:creeper", {
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
attack_type = "explode",
explosion_radius = 3,
explosion_strength = 3,
reach = 4,
explosion_damage_radius = 7,
explosion_timer = 1.5,
allow_fuse_reset = true,
stop_to_explode = true,

View file

@ -79,13 +79,12 @@ mobs:register_arrow("mobs_mc:fireball", {
textures = {"mcl_fire_fire_charge.png"},
velocity = 15,
-- direct hit, no fire... just plenty of pain
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 6},
}, nil)
mobs:boom(self, self.object:get_pos(), 3)
mobs:boom(self, self.object:get_pos(), 1, true)
end,
hit_mob = function(self, mob)
@ -93,12 +92,11 @@ mobs:register_arrow("mobs_mc:fireball", {
full_punch_interval = 1.0,
damage_groups = {fleshy = 6},
}, nil)
mobs:boom(self, self.object:get_pos(), 3)
mobs:boom(self, self.object:get_pos(), 1, true)
end,
-- node hit, explode
hit_node = function(self, pos, node)
mobs:boom(self, pos, 3)
mobs:boom(self, pos, 1, true)
end
})

View file

@ -49,8 +49,7 @@ mobs:register_mob("mobs_mc:wither", {
lava_damage = 0,
fire_damage = 0,
attack_type = "dogshoot",
explosion_radius = 3,
explosion_fire = false,
explosion_strength = 8,
dogshoot_stop = true,
arrow = "mobs_mc:wither_skull",
reach = 5,