diff options
author | stujones11 <stujones111@gmail.com> | 2016-01-13 19:51:50 +0000 |
---|---|---|
committer | stujones11 <stujones111@gmail.com> | 2016-01-13 21:06:38 +0000 |
commit | 4416e9b8ad399afa9016a9454e2f84926797cbb5 (patch) | |
tree | 26ebd2fc79da9181d26c2dd78cdd32ed7d013381 /railtrack/railtrack.lua | |
parent | 6dfdaf78522a9c92e4323fa5bb77eb3a7c11aa30 (diff) |
Remove placement privs until a better solution is found & misc fixes
Diffstat (limited to 'railtrack/railtrack.lua')
-rw-r--r-- | railtrack/railtrack.lua | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/railtrack/railtrack.lua b/railtrack/railtrack.lua index 3a1f714..9b4c2c9 100644 --- a/railtrack/railtrack.lua +++ b/railtrack/railtrack.lua @@ -22,18 +22,6 @@ railtrack.default_rail = { groups = {bendy = 2, dig_immediate = 2, attached_node = 1, connect_to_raillike = minetest.raillike_group("rail")}, railtype = "rail", - on_place = function(itemstack, placer, pointed_thing) - local name = placer:get_player_name() - if not name or pointed_thing.type ~= "node" then - return - end - if not minetest.is_singleplayer() then - if not minetest.check_player_privs(name, {rails=true}) then - minetest.chat_send_player(name, "Requires rails privilege") - return - end - end - end, after_place_node = function(pos, placer, itemstack) local meta = minetest.get_meta(pos) local def = itemstack:get_definition() or {} @@ -57,7 +45,13 @@ railtrack.default_rail = { on_construct = function(pos) railtrack:update_rails(pos) end, - after_destruct = function(pos) + after_destruct = function(pos, oldnode) + if not minetest.is_singleplayer() then + if not minetest.check_player_privs(name, {rails=true}) then + minetest.chat_send_player(name, "Requires rails privilege") + minetest.set_node(pos, oldnode) + end + end local cons = railtrack:get_connections(pos) for _, p in pairs(cons) do railtrack:update_rails(p) |