summaryrefslogtreecommitdiff
path: root/mesecons_microcontroller
diff options
context:
space:
mode:
authorJeija <jeija@mesecons.net>2014-04-20 21:44:58 +0200
committerJeija <jeija@mesecons.net>2014-04-20 21:51:17 +0200
commit300abcb5877d948e6a68be454ed46b65a0f90f01 (patch)
tree8f8ba5271d7a11b66cd087506713a14047972518 /mesecons_microcontroller
parent1f666875807c3c8e6c1771e4fb46c374d2e40ccb (diff)
downloadmesecons-300abcb5877d948e6a68be454ed46b65a0f90f01.tar
mesecons-300abcb5877d948e6a68be454ed46b65a0f90f01.tar.gz
mesecons-300abcb5877d948e6a68be454ed46b65a0f90f01.tar.bz2
mesecons-300abcb5877d948e6a68be454ed46b65a0f90f01.tar.xz
mesecons-300abcb5877d948e6a68be454ed46b65a0f90f01.zip
Fix #155 (option 2 used). Remove non-ActionQueue system. Enable overheat for more than 20 actions per second on lua- / microcontrollers and gates.
Fix a bug where a burnt luacontroller didn't have the correct pin-states as the burnt controller does not register any changes from outside.
Diffstat (limited to 'mesecons_microcontroller')
-rw-r--r--mesecons_microcontroller/init.lua42
1 files changed, 5 insertions, 37 deletions
diff --git a/mesecons_microcontroller/init.lua b/mesecons_microcontroller/init.lua
index b6134da..ec7afbd 100644
--- a/mesecons_microcontroller/init.lua
+++ b/mesecons_microcontroller/init.lua
@@ -93,7 +93,6 @@ minetest.register_node(nodename, {
"button[7.5,0.2;1.5,3;brsflop;RS-Flop]"..
"button_exit[3.5,1;2,3;program;Program]")
meta:set_string("infotext", "Unprogrammed Microcontroller")
- meta:set_int("heat", 0)
local r = ""
for i=1, EEPROM_SIZE+1 do r=r.."0" end --Generate a string with EEPROM_SIZE*"0"
meta:set_string("eeprom", r)
@@ -156,7 +155,6 @@ minetest.register_craft({
function yc_reset(pos)
yc_action(pos, {a=false, b=false, c=false, d=false})
local meta = minetest.get_meta(pos)
- meta:set_int("heat", 0)
meta:set_int("afterid", 0)
local r = ""
for i=1, EEPROM_SIZE+1 do r=r.."0" end --Generate a string with EEPROM_SIZE*"0"
@@ -165,11 +163,12 @@ end
function update_yc(pos)
local meta = minetest.get_meta(pos)
- yc_heat(meta)
- --minetest.after(0.5, yc_cool, meta)
- if (yc_overheat(meta)) then
+
+ if (mesecon.do_overheat(pos)) then
minetest.remove_node(pos)
- minetest.after(0.2, yc_overheat_off, pos) --wait for pending parsings
+ minetest.after(0.2, function (pos)
+ mesecon:receptor_off(pos, mesecon.rules.flat)
+ end , pos) -- wait for pending parsings
minetest.add_item(pos, "mesecons_microcontroller:microcontroller0000")
end
@@ -698,34 +697,3 @@ function yc_merge_portstates(Lreal, Lvirtual)
if Lvirtual.d or Lreal.d then L.d = true end
return L
end
-
---"Overheat" protection
-function yc_heat(meta)
- h = meta:get_int("heat")
- if h ~= nil then
- meta:set_int("heat", h + 1)
- end
-end
-
---function yc_cool(meta)
--- h = meta:get_int("heat")
--- if h ~= nil then
--- meta:set_int("heat", h - 1)
--- end
---end
-
-function yc_overheat(meta)
- if MESECONS_GLOBALSTEP then return false end
- h = meta:get_int("heat")
- if h == nil then return true end -- if nil the overheat
- if h>60 then
- return true
- else
- return false
- end
-end
-
-function yc_overheat_off(pos)
- rules = mesecon:get_rules("mesecons_microcontroller:microcontroller1111")
- mesecon:receptor_off(pos, rules)
-end