mirror of
https://github.com/ElCeejo/creatura.git
synced 2025-03-21 15:21:24 +00:00
Only add wear in survival
This commit is contained in:
parent
6a0a9b30d4
commit
00c8b7fa1f
1 changed files with 3 additions and 1 deletions
4
api.lua
4
api.lua
|
@ -441,9 +441,11 @@ 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
|
||||||
local tool_name = ""
|
local tool_name = ""
|
||||||
|
local add_wear = false
|
||||||
if puncher:is_player() then
|
if puncher:is_player() then
|
||||||
tool = puncher:get_wielded_item()
|
tool = puncher:get_wielded_item()
|
||||||
tool_name = tool:get_name()
|
tool_name = tool:get_name()
|
||||||
|
add_wear = not minetest.is_creative_enabled(target)
|
||||||
end
|
end
|
||||||
if (self.immune_to
|
if (self.immune_to
|
||||||
and is_value_in_table(self.immune_to, tool_name)) then
|
and is_value_in_table(self.immune_to, tool_name)) then
|
||||||
|
@ -461,7 +463,7 @@ function creatura.basic_punch_func(self, puncher, tflp, tool_caps, dir)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
self:hurt(tool_caps.damage_groups.fleshy)
|
self:hurt(tool_caps.damage_groups.fleshy)
|
||||||
if tool then
|
if add_wear then
|
||||||
local wear = floor((tool_caps.damage_groups.full_punch_interval / 75) * 9000)
|
local wear = floor((tool_caps.damage_groups.full_punch_interval / 75) * 9000)
|
||||||
tool:add_wear(wear)
|
tool:add_wear(wear)
|
||||||
puncher:set_wielded_item(tool)
|
puncher:set_wielded_item(tool)
|
||||||
|
|
Loading…
Add table
Reference in a new issue