summaryrefslogtreecommitdiff
path: root/railcart/init.lua
diff options
context:
space:
mode:
authorstujones11 <stujones111@gmail.com>2016-01-22 18:54:56 +0000
committerstujones11 <stujones111@gmail.com>2016-01-22 18:54:56 +0000
commit0e9a29ddfc38ce8c198be21bd9597a7d5f03a9d4 (patch)
tree14072eb3afb5c17824530cd879c4fe0f78908d66 /railcart/init.lua
parentdc2ca22a8b876eac69947b244d4f6ae274927e59 (diff)
Set cart pitch and yaw on placement
Diffstat (limited to 'railcart/init.lua')
-rw-r--r--railcart/init.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/railcart/init.lua b/railcart/init.lua
index 7ca7fe2..8d60051 100644
--- a/railcart/init.lua
+++ b/railcart/init.lua
@@ -165,12 +165,16 @@ minetest.register_craftitem("railcart:cart", {
return
end
end
+ local cons = railtrack:get_connections(pos)
local cart = railcart.cart:new()
cart.id = #railcart.allcarts + 1
cart.inv = railcart:create_detached_inventory(cart.id)
cart.pos = pos
cart.prev = vector.new(pos)
cart.accel = railtrack:get_acceleration(pos)
+ if cons[1] then
+ cart.target = cons[1]
+ end
table.insert(railcart.allcarts, cart)
railcart:save()
if not minetest.setting_getbool("creative_mode") then