1
0
mirror of https://github.com/SmallJoker/boost_cart.git synced 2024-12-25 10:20:19 +01:00

Fix 0/0 condition on faulty tool capabilities

This commit is contained in:
SmallJoker 2021-05-02 15:01:58 +02:00
parent 5b53183381
commit b05a49afb5

View File

@ -156,7 +156,8 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
end end
local punch_interval = 1 local punch_interval = 1
if tool_capabilities and tool_capabilities.full_punch_interval then -- Faulty tool registrations may cause the interval to be set to 0 !
if tool_capabilities and (tool_capabilities.full_punch_interval or 0) > 0 then
punch_interval = tool_capabilities.full_punch_interval punch_interval = tool_capabilities.full_punch_interval
end end
time_from_last_punch = math.min(time_from_last_punch or punch_interval, punch_interval) time_from_last_punch = math.min(time_from_last_punch or punch_interval, punch_interval)