Skip to content
Permalink
Browse files
Carts: Fix 0/0 condition on faulty tool capabilities
  • Loading branch information
SmallJoker committed May 2, 2021
1 parent 79e63a8 commit 4945f4bf9a472388aa419179be4ba8fb1eaccabe
Showing with 2 additions and 1 deletion.
  1. +2 −1 mods/carts/cart_entity.lua
@@ -134,7 +134,8 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
end

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
end
time_from_last_punch = math.min(time_from_last_punch or punch_interval, punch_interval)

0 comments on commit 4945f4b

Please sign in to comment.