forked from mtcontrib/boost_cart
Fix nil error on tool_capabilities
This commit is contained in:
parent
afb52ba3b4
commit
145ca1c61d
8
init.lua
8
init.lua
|
@ -116,8 +116,12 @@ function boost_cart.cart:on_punch(puncher, time_from_last_punch, tool_capabiliti
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
time_from_last_punch = math.min(time_from_last_punch, tool_capabilities.full_punch_interval)
|
local punch_interval = 1
|
||||||
local f = 3 * (time_from_last_punch / tool_capabilities.full_punch_interval)
|
if tool_capabilities and tool_capabilities.full_punch_interval then
|
||||||
|
punch_interval = tool_capabilities.full_punch_interval
|
||||||
|
end
|
||||||
|
time_from_last_punch = math.min(time_from_last_punch or punch_interval, punch_interval)
|
||||||
|
local f = 3 * (time_from_last_punch / punch_interval)
|
||||||
|
|
||||||
self.velocity = vector.multiply(cart_dir, f)
|
self.velocity = vector.multiply(cart_dir, f)
|
||||||
self.old_pos = nil
|
self.old_pos = nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user