mirror of
https://github.com/ElCeejo/creatura.git
synced 2025-03-21 15:21:24 +00:00
Minor improvements to basic punch
This commit is contained in:
parent
7fa1c522eb
commit
35fb5b680e
1 changed files with 8 additions and 8 deletions
16
api.lua
16
api.lua
|
@ -436,7 +436,7 @@ function creatura.drop_items(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction)
|
function creatura.basic_punch_func(self, puncher, tflp, tool_caps, dir)
|
||||||
if not puncher then return end
|
if not puncher then return end
|
||||||
local tool = ""
|
local tool = ""
|
||||||
if puncher:is_player() then
|
if puncher:is_player() then
|
||||||
|
@ -446,21 +446,21 @@ function creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_cap
|
||||||
and is_value_in_table(self.immune_to, tool)) then
|
and is_value_in_table(self.immune_to, tool)) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self:apply_knockback(direction)
|
self:apply_knockback(dir, 12)
|
||||||
if not tool_capabilities
|
if not tool_caps
|
||||||
or not tool_capabilities.damage_groups
|
or not tool_caps.damage_groups
|
||||||
or not tool_capabilities.damage_groups.fleshy then
|
or not tool_caps.damage_groups.fleshy then
|
||||||
tool_capabilities = {
|
tool_caps = {
|
||||||
damage_groups = {
|
damage_groups = {
|
||||||
fleshy = 2
|
fleshy = 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
self:hurt(tool_capabilities.damage_groups.fleshy)
|
self:hurt(tool_caps.damage_groups.fleshy)
|
||||||
if random(4) < 2 then
|
if random(4) < 2 then
|
||||||
self:play_sound("hurt")
|
self:play_sound("hurt")
|
||||||
end
|
end
|
||||||
if time_from_last_punch > 0.5 then
|
if tflp > 0.5 then
|
||||||
self:play_sound("hit")
|
self:play_sound("hit")
|
||||||
end
|
end
|
||||||
self:indicate_damage()
|
self:indicate_damage()
|
||||||
|
|
Loading…
Add table
Reference in a new issue