From 4416e9b8ad399afa9016a9454e2f84926797cbb5 Mon Sep 17 00:00:00 2001
From: stujones11 <stujones111@gmail.com>
Date: Wed, 13 Jan 2016 19:51:50 +0000
Subject: Remove placement privs until a better solution is found & misc fixes

---
 railcart/init.lua | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'railcart')

diff --git a/railcart/init.lua b/railcart/init.lua
index df9d4f1..417b429 100644
--- a/railcart/init.lua
+++ b/railcart/init.lua
@@ -32,6 +32,10 @@ minetest.register_globalstep(function(dtime)
 	end
 end)
 
+minetest.register_on_shutdown(function()
+	railcart:save()
+end)
+
 minetest.register_privilege("carts", "Player can pick-up and place carts.")
 
 minetest.register_entity("railcart:cart_entity", {
@@ -58,6 +62,7 @@ minetest.register_entity("railcart:cart_entity", {
 			if self.cart then
 				if self.cart.id then
 					railcart.allcarts[self.cart.id] = nil
+					railcart:save()
 				end
 			end
 			self.object:remove()
@@ -136,6 +141,7 @@ minetest.register_craftitem("railcart:cart", {
 		cart.prev = vector.new(pos)
 		cart.accel = railtrack:get_acceleration(pos)
 		table.insert(railcart.allcarts, cart)
+		railcart:save()
 		if not minetest.setting_getbool("creative_mode") then
 			itemstack:take_item()
 		end
-- 
cgit v1.2.3