From 63b386636a94cbc853f0a8959fd8f15fbf9750b4 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 6 Sep 2016 09:30:11 +0200 Subject: [PATCH] Add message for activating config mode --- easyvend.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/easyvend.lua b/easyvend.lua index 15ddc16..86018e3 100644 --- a/easyvend.lua +++ b/easyvend.lua @@ -96,6 +96,16 @@ easyvend.buysell = function(nodename) return buysell end +easyvend.is_active = function(nodename) + if ( nodename == "easyvend:depositor_on" or nodename == "easyvend:vendor_on" ) then + return true + elseif ( nodename == "easyvend:depositor" or nodename == "easyvend:vendor" ) then + return false + else + return nil + end +end + easyvend.set_formspec = function(pos, player) local meta = minetest.get_meta(pos) local node = minetest.get_node(pos) @@ -367,6 +377,12 @@ easyvend.on_receive_fields_config = function(pos, formname, fields, sender) if fields.config then meta:set_int("configmode", 1) + local was_active = easyvend.is_active(node.name) + if was_active then + meta:set_string("message", "Configuration mode activated; machine disabled.") + else + meta:set_string("message", "Configuration mode activated.") + end easyvend.machine_check(pos, node) return end -- 2.11.4.GIT