Signed by: Gabriel Pérez-Cerezo <gabriel@gpcf.eu> Don't sell now actually doesn't sell the node master
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>
Tue, 28 Jun 2016 13:31:08 +0000 (15:31 +0200)
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>
Tue, 28 Jun 2016 13:31:08 +0000 (15:31 +0200)
init.lua

index 7fa5eb5..339f92c 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -603,10 +603,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
         if fields.sell then
            minetest.show_formspec(player:get_player_name(), "sell"..formname, protector.generate_sale_formspec(meta,pos))
         end
-        if fields.sell then
-           swap_node(pos, "protector:protect_sell")
-           meta:set_string("infotext", S("Protection for sale (owned by @1)", meta:get_string("owner")))
-        end
+
 
       end
       if string.sub(formname, 0, string.len("sellprotector:node_")) == "sellprotector:node_" then
@@ -624,6 +621,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
            end
         end
         meta:set_string("price", minetest.serialize(price))
+        if fields.ok then
+           swap_node(pos, "protector:protect_sell")
+           meta:set_string("infotext", S("Protection for sale (owned by @1)", meta:get_string("owner")))
+        end
         if not fields.ok and not fields.dont_sell then
            minetest.show_formspec(player:get_player_name(), formname, protector.generate_sale_formspec(meta,pos))
         end