forked from VoxeLibre/VoxeLibre
Merge branch 'master' into sponge-API
This commit is contained in:
commit
4f0a3b625b
|
@ -149,13 +149,18 @@ minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
||||||
end, true)
|
end, true)
|
||||||
|
|
||||||
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
||||||
|
if player:get_hp() > 0 then
|
||||||
|
mt_reason.approved = true
|
||||||
if hp_change < 0 then
|
if hp_change < 0 then
|
||||||
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason))
|
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason))
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end, false)
|
end, false)
|
||||||
|
|
||||||
minetest.register_on_dieplayer(function(player, mt_reason)
|
minetest.register_on_dieplayer(function(player, mt_reason)
|
||||||
|
if mt_reason.approved then
|
||||||
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason))
|
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason))
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_on_mods_loaded(function()
|
minetest.register_on_mods_loaded(function()
|
||||||
|
|
|
@ -539,7 +539,7 @@ function mcl_util.get_object_name(object)
|
||||||
local luaentity = object:get_luaentity()
|
local luaentity = object:get_luaentity()
|
||||||
|
|
||||||
if not luaentity then
|
if not luaentity then
|
||||||
return ""
|
return tostring(object)
|
||||||
end
|
end
|
||||||
|
|
||||||
return luaentity.nametag and luaentity.nametag ~= "" and luaentity.nametag or luaentity.description or luaentity.name
|
return luaentity.nametag and luaentity.nametag ~= "" and luaentity.nametag or luaentity.description or luaentity.name
|
||||||
|
|
|
@ -87,6 +87,12 @@ end
|
||||||
|
|
||||||
|
|
||||||
mobs.death_logic = function(self, dtime)
|
mobs.death_logic = function(self, dtime)
|
||||||
|
|
||||||
|
--stop crashing game when object is nil
|
||||||
|
if not self or not self.object or not self.object:get_luaentity() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
self.death_animation_timer = self.death_animation_timer + dtime
|
self.death_animation_timer = self.death_animation_timer + dtime
|
||||||
|
|
||||||
--get all attached entities and sort through them
|
--get all attached entities and sort through them
|
||||||
|
|
|
@ -204,8 +204,9 @@ mcl_damage.register_on_death(function(obj, reason)
|
||||||
|
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
send_to = true
|
send_to = true
|
||||||
end -- ToDo: add mob death messages for owned mobs, only send to owner (sent_to = "player name")
|
end
|
||||||
|
|
||||||
|
-- ToDo: add mob death messages for owned mobs, only send to owner (sent_to = "player name")
|
||||||
|
|
||||||
if send_to then
|
if send_to then
|
||||||
local messages = mcl_death_messages.messages[reason.type] or {}
|
local messages = mcl_death_messages.messages[reason.type] or {}
|
||||||
|
|
|
@ -27,8 +27,16 @@ end
|
||||||
local function crystal_explode(self, puncher)
|
local function crystal_explode(self, puncher)
|
||||||
if self._exploded then return end
|
if self._exploded then return end
|
||||||
self._exploded = true
|
self._exploded = true
|
||||||
local strength = puncher and explosion_strength or 1
|
local strength = 1
|
||||||
mcl_explosions.explode(vector.add(self.object:get_pos(), {x = 0, y = 1.5, z = 0}), strength, {drop_chance = 1}, puncher)
|
local source
|
||||||
|
if puncher then
|
||||||
|
strength = explosion_strength
|
||||||
|
local reason = {}
|
||||||
|
mcl_damage.from_punch(reason, puncher)
|
||||||
|
mcl_damage.finish_reason(reason)
|
||||||
|
source = reason.source
|
||||||
|
end
|
||||||
|
mcl_explosions.explode(vector.add(self.object:get_pos(), {x = 0, y = 1.5, z = 0}), strength, {drop_chance = 1}, self.object, source)
|
||||||
minetest.after(0, self.object.remove, self.object)
|
minetest.after(0, self.object.remove, self.object)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue