mirror of
https://github.com/APercy/airutils.git
synced 2025-03-15 08:01:22 +00:00
adjust damage system
This commit is contained in:
parent
f5d727a38f
commit
a91f2e9cb2
1 changed files with 12 additions and 17 deletions
|
@ -597,19 +597,16 @@ function airutils.logic(self)
|
|||
end
|
||||
|
||||
local function damage_vehicle(self, toolcaps, ttime, damage)
|
||||
for group,_ in pairs( (toolcaps.damage_groups or {}) ) do
|
||||
local tmp = ttime / (toolcaps.full_punch_interval or 1.4)
|
||||
|
||||
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)
|
||||
if (not toolcaps) then
|
||||
return
|
||||
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
|
||||
|
||||
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
|
||||
airutils.setText(self, self._vehicle_name)
|
||||
|
||||
-- lets permit destroying on the air
|
||||
local is_flying = not self.colinfo.touching_ground
|
||||
--if is_flying and not puncher:is_player() then
|
||||
if not puncher:is_player() then
|
||||
if (puncher and puncher:is_player() and
|
||||
(string.find(puncher:get_wielded_item():get_name(), "rayweapon") or
|
||||
toolcaps.damage_groups.vehicle)) then
|
||||
damage_vehicle(self, toolcaps, ttime, damage)
|
||||
end
|
||||
--end
|
||||
|
||||
if not puncher or not puncher:is_player() then
|
||||
return
|
||||
|
|
Loading…
Add table
Reference in a new issue