1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 18:20:36 +01:00

Merge pull request #502 from Coethium/mff.carts

[Carts] Requests improvments
This commit is contained in:
Coethium 2016-08-11 23:31:52 +02:00 committed by GitHub
commit aaf5ca5a87

View File

@ -63,6 +63,8 @@ function carts.cart:on_rightclick(clicker)
if self.driver and player_name == self.driver then if self.driver and player_name == self.driver then
self.driver = nil self.driver = nil
carts:manage_attachment(clicker, false) carts:manage_attachment(clicker, false)
self.object:setacceleration({x=0, y=0, z=0}) -- Stops the cart when we leave it
self.object:setvelocity({x=0, y=0, z=0})
elseif not self.driver then elseif not self.driver then
self.driver = player_name self.driver = player_name
carts:manage_attachment(clicker, true, self.object) carts:manage_attachment(clicker, true, self.object)
@ -138,7 +140,7 @@ function carts.cart:on_punch(puncher, time_from_last_punch, tool_capabilities, d
if math.abs(vel.x + vel.z) > carts.punch_speed_min then if math.abs(vel.x + vel.z) > carts.punch_speed_min then
return return
end end
end --end --Only the driver can punch
local punch_dir = carts:velocity_to_dir(puncher:get_look_dir()) local punch_dir = carts:velocity_to_dir(puncher:get_look_dir())
punch_dir.y = 0 punch_dir.y = 0
@ -158,6 +160,7 @@ function carts.cart:on_punch(puncher, time_from_last_punch, tool_capabilities, d
self.old_dir = cart_dir self.old_dir = cart_dir
self.old_pos = nil self.old_pos = nil
self.punched = true self.punched = true
end
end end
function carts.cart:on_step(dtime) function carts.cart:on_step(dtime)