1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-16 07:20:31 +01:00

Creeper damages by 21hp units (10.5 hearts) on armor and player

This commit is contained in:
LeMagnesium 2015-03-25 16:14:51 +01:00
parent f4b9d0a10a
commit e2a49d6552
2 changed files with 8 additions and 4 deletions

View File

@ -593,7 +593,7 @@ function mobs:register_mob(name, def)
pos.x = math.floor(pos.x+0.5) pos.x = math.floor(pos.x+0.5)
pos.y = math.floor(pos.y+0.5) pos.y = math.floor(pos.y+0.5)
pos.z = math.floor(pos.z+0.5) pos.z = math.floor(pos.z+0.5)
do_tnt_physics(pos, 3) -- on applique le principe le la tnt do_tnt_physics(pos, 3, self) -- on applique le principe le la tnt
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
minetest.sound_play("tnt_explode", {pos = pos,gain = 1.0,max_hear_distance = 16,}) minetest.sound_play("tnt_explode", {pos = pos,gain = 1.0,max_hear_distance = 16,})
if minetest.get_node(pos).name == "default:water_source" or minetest.get_node(pos).name == "default:water_flowing" or minetest.is_protected(pos, "tnt") then if minetest.get_node(pos).name == "default:water_source" or minetest.get_node(pos).name == "default:water_flowing" or minetest.is_protected(pos, "tnt") then
@ -1021,7 +1021,7 @@ function check_for_death(self)
end end
end end
function do_tnt_physics(tnt_np,tntr) function do_tnt_physics(tnt_np,tntr,entity)
local objs = minetest.get_objects_inside_radius(tnt_np, tntr) local objs = minetest.get_objects_inside_radius(tnt_np, tntr)
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
local oname = obj:get_entity_name() local oname = obj:get_entity_name()
@ -1031,7 +1031,11 @@ function do_tnt_physics(tnt_np,tntr)
obj:setvelocity({x=(p.x - tnt_np.x) + (tntr / 4) + v.x, y=(p.y - tnt_np.y) + (tntr / 2) + v.y, z=(p.z - tnt_np.z) + (tntr / 4) + v.z}) obj:setvelocity({x=(p.x - tnt_np.x) + (tntr / 4) + v.x, y=(p.y - tnt_np.y) + (tntr / 2) + v.y, z=(p.z - tnt_np.z) + (tntr / 4) + v.z})
else else
if obj:get_player_name() ~= nil then if obj:get_player_name() ~= nil then
obj:set_hp(obj:get_hp() - 16) -- loose 16 life points when detonate if entity.object ~= nil then
obj:punch(entity.object, 1.0, {full_punch_interval=1.0,damage_groups = {fleshy=entity.damage}})
else
obj:set_hp(obj:get_hp() - 21)
end
end end
end end
end end

View File

@ -7,7 +7,7 @@ mobs:register_mob("mobs:creeper", {
-- agressive, does 4 damage to player when hit -- agressive, does 4 damage to player when hit
passive = false, passive = false,
attack_type = "kamicaze", attack_type = "kamicaze",
damage = 0, damage = 21,
-- health & armor -- health & armor
hp_min = 40, hp_max = 50, armor = 90, hp_min = 40, hp_max = 50, armor = 90,
-- textures and model -- textures and model