Add mcl_burning damage interval
parent
aeb7078c05
commit
c9e589b931
|
@ -36,6 +36,7 @@ local paddling_speed = 22
|
|||
local boat_y_offset = 0.35
|
||||
local boat_y_offset_ground = boat_y_offset + 0.6
|
||||
local boat_side_offset = 1.001
|
||||
local boat_max_hp = 4
|
||||
|
||||
--
|
||||
-- Boat entity
|
||||
|
@ -50,7 +51,7 @@ local boat = {
|
|||
mesh = "mcl_boats_boat.b3d",
|
||||
textures = {"mcl_boats_texture_oak_boat.png"},
|
||||
visual_size = boat_visual_size,
|
||||
hp_max = 4,
|
||||
hp_max = boat_max_hp,
|
||||
|
||||
_driver = nil, -- Attached driver (player) or nil if none
|
||||
_passenger = nil,
|
||||
|
@ -186,6 +187,12 @@ function boat.on_step(self, dtime, moveresult)
|
|||
v_slowdown = 0.05
|
||||
end
|
||||
|
||||
--local yaw = self.object:get_yaw()
|
||||
--local hp = math.min(self.object:get_hp() + 2 * dtime, boat_max_hp)
|
||||
--self.object:set_rotation(vector.new((boat_max_hp - hp) / boat_max_hp, 0, 0))
|
||||
self.object:set_hp(self.object:get_hp() + 2 * dtime)
|
||||
--self.object:set_yaw(yaw)
|
||||
|
||||
if moveresult and moveresult.collides then
|
||||
for _, collision in ipairs(moveresult.collisions) do
|
||||
local pos = collision.node_pos
|
||||
|
|
|
@ -120,7 +120,7 @@ function mcl_burning.damage(obj)
|
|||
end
|
||||
end
|
||||
|
||||
function mcl_burning.set_on_fire(obj, burn_time, damage, reason)
|
||||
function mcl_burning.set_on_fire(obj, burn_time, damage, interval, reason)
|
||||
local luaentity = obj:get_luaentity()
|
||||
if luaentity and luaentity.fire_resistant then
|
||||
return
|
||||
|
@ -174,6 +174,7 @@ function mcl_burning.set_on_fire(obj, burn_time, damage, reason)
|
|||
end
|
||||
mcl_burning.set(obj, "float", "burn_time", burn_time)
|
||||
mcl_burning.set(obj, "float", "damage", damage)
|
||||
mcl_burning.set(obj, "float", "interval", interval)
|
||||
mcl_burning.set(obj, "string", "reason", reason)
|
||||
mcl_burning.set(obj, "int", "hud_id", hud_id)
|
||||
mcl_burning.set(obj, "int", "sound_id", sound_id)
|
||||
|
@ -208,6 +209,7 @@ function mcl_burning.extinguish(obj)
|
|||
end
|
||||
|
||||
mcl_burning.set(obj, "float", "damage")
|
||||
mcl_burning.set(obj, "float", "interval")
|
||||
mcl_burning.set(obj, "string", "reason")
|
||||
mcl_burning.set(obj, "float", "burn_time")
|
||||
mcl_burning.set(obj, "float", "damage_timer")
|
||||
|
@ -238,7 +240,12 @@ function mcl_burning.tick(obj, dtime)
|
|||
|
||||
local damage_timer = mcl_burning.get(obj, "float", "damage_timer") + dtime
|
||||
|
||||
if damage_timer >= 1 then
|
||||
local interval = mcl_burning.get(obj, "float", "interval")
|
||||
if interval == 0 then
|
||||
interval = 1
|
||||
end
|
||||
|
||||
if damage_timer >= interval then
|
||||
damage_timer = 0
|
||||
mcl_burning.damage(obj)
|
||||
end
|
||||
|
|
|
@ -2975,7 +2975,8 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
|||
if weapon then
|
||||
local fire_aspect_level = mcl_enchanting.get_enchantment(weapon, "fire_aspect")
|
||||
if fire_aspect_level > 0 then
|
||||
mcl_burning.set_on_fire(self.object, 4, fire_aspect_level * 2)
|
||||
local damage = fire_aspect_level * 4 - 1
|
||||
mcl_burning.set_on_fire(self.object, 4, 1, 4 / damage)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ mobs:register_arrow("mobs_mc:blaze_fireball", {
|
|||
if rawget(_G, "armor") and armor.last_damage_types then
|
||||
armor.last_damage_types[player:get_player_name()] = "fireball"
|
||||
end
|
||||
mcl_burning.set_on_fire(player, 5, 1, "blaze")
|
||||
mcl_burning.set_on_fire(player, 5, 1, 5 / 4, "blaze")
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 5},
|
||||
|
@ -99,7 +99,7 @@ mobs:register_arrow("mobs_mc:blaze_fireball", {
|
|||
end,
|
||||
|
||||
hit_mob = function(self, mob)
|
||||
mcl_burning.set_on_fire(mob, 5)
|
||||
mcl_burning.set_on_fire(mob, 5, 1, 5 / 4)
|
||||
mob:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 5},
|
||||
|
|
|
@ -253,7 +253,7 @@ ARROW_ENTITY.on_step = function(self, dtime)
|
|||
end
|
||||
damage_particles(self.object:get_pos(), self._is_critical)
|
||||
if mcl_burning.is_burning(self.object) then
|
||||
mcl_burning.set_on_fire(obj, 4)
|
||||
mcl_burning.set_on_fire(obj, 5, 1, 5 / 4)
|
||||
end
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
|
|
|
@ -215,7 +215,8 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch,
|
|||
if wielditem then
|
||||
local fire_aspect_level = mcl_enchanting.get_enchantment(wielditem, "fire_aspect")
|
||||
if fire_aspect_level > 0 then
|
||||
mcl_burning.set_on_fire(player, fire_aspect_level * 4 - 1, 1, hitter:get_player_name())
|
||||
local damage = fire_aspect_level * 4 - 1
|
||||
mcl_burning.set_on_fire(player, 4, 1, 4 / damage, hitter:get_player_name())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue