adjust damage system

This commit is contained in:
Gundul 2023-10-01 17:21:48 +02:00
parent f5d727a38f
commit a91f2e9cb2

View file

@ -597,19 +597,16 @@ function airutils.logic(self)
end end
local function damage_vehicle(self, toolcaps, ttime, damage) local function damage_vehicle(self, toolcaps, ttime, damage)
for group,_ in pairs( (toolcaps.damage_groups or {}) ) do if (not toolcaps) then
local tmp = ttime / (toolcaps.full_punch_interval or 1.4) return
if tmp < 0 then
tmp = 0.0
elseif tmp > 1 then
tmp = 1.0
end
damage = damage + (toolcaps.damage_groups[group] or 0) * tmp
self.hp_max = self.hp_max - damage
airutils.setText(self, self._vehicle_name)
end end
value = toolcaps.damage_groups.fleshy or 0
if (toolcaps.damage_groups.vehicle) then
value = toolcaps.damage_groups.vehicle
end
damage = damage + value / 10
self.hp_max = self.hp_max - damage
airutils.setText(self, self._vehicle_name)
end end
function airutils.on_punch(self, puncher, ttime, toolcaps, dir, damage) function airutils.on_punch(self, puncher, ttime, toolcaps, dir, damage)
@ -619,13 +616,11 @@ function airutils.on_punch(self, puncher, ttime, toolcaps, dir, damage)
end end
airutils.setText(self, self._vehicle_name) airutils.setText(self, self._vehicle_name)
-- lets permit destroying on the air if (puncher and puncher:is_player() and
local is_flying = not self.colinfo.touching_ground (string.find(puncher:get_wielded_item():get_name(), "rayweapon") or
--if is_flying and not puncher:is_player() then toolcaps.damage_groups.vehicle)) then
if not puncher:is_player() then
damage_vehicle(self, toolcaps, ttime, damage) damage_vehicle(self, toolcaps, ttime, damage)
end end
--end
if not puncher or not puncher:is_player() then if not puncher or not puncher:is_player() then
return return