@@ -149,8 +149,17 @@ local getinterrupt = function(pos)
149
149
local iid = iid or math.random ()
150
150
local meta = minetest .env :get_meta (pos )
151
151
local interrupts = minetest .deserialize (meta :get_string (" lc_interrupts" )) or {}
152
- table.insert (interrupts , iid )
153
- meta :set_string (" lc_interrupts" , minetest .serialize (interrupts ))
152
+ local found = false
153
+ for _ , i in ipairs (interrupts ) do
154
+ if minetest .serialize (i ) == minetest .serialize (event .iid ) then
155
+ found = true
156
+ break
157
+ end
158
+ end
159
+ if not found then
160
+ table.insert (interrupts , iid )
161
+ meta :set_string (" lc_interrupts" , minetest .serialize (interrupts ))
162
+ end
154
163
minetest .after (time , interrupt , {pos = pos , iid = iid })
155
164
end
156
165
return interrupt
@@ -251,9 +260,9 @@ local do_overheat = function (pos, meta)
251
260
heat (meta )
252
261
minetest .after (0.5 , cool , meta )
253
262
if overheat (meta ) then
254
- minetest .env :remove_node (pos )
263
+ mesecon :swap_node (pos , BASENAME .. " _burnt" )
264
+ minetest .env :get_meta (pos ):set_string (" lc_interrupts" , " " )
255
265
minetest .after (0.2 , overheat_off , pos ) -- wait for pending operations
256
- minetest .env :add_item (pos , BASENAME .. " 0000" )
257
266
return true
258
267
end
259
268
end
479
488
end
480
489
end
481
490
491
+ -- overheated luacontroller
492
+ minetest .register_node (BASENAME .. " _burnt" , {
493
+ drawtype = " nodebox" ,
494
+ tiles = {
495
+ " jeija_luacontroller_burnt_top.png" ,
496
+ " jeija_microcontroller_bottom.png" ,
497
+ " jeija_microcontroller_sides.png" ,
498
+ " jeija_microcontroller_sides.png" ,
499
+ " jeija_microcontroller_sides.png" ,
500
+ " jeija_microcontroller_sides.png"
501
+ },
502
+ inventory_image = " jeija_luacontroller_burnt_top.png" ,
503
+ paramtype = " light" ,
504
+ groups = {dig_immediate = 2 , not_in_creative_inventory = 1 },
505
+ drop = BASENAME .. " 0000" ,
506
+ sunlight_propagates = true ,
507
+ selection_box = selectionbox ,
508
+ node_box = nodebox ,
509
+ on_construct = reset_meta ,
510
+ on_receive_fields = function (pos , formname , fields )
511
+ reset (pos )
512
+ reset_meta (pos , fields .code )
513
+ local err = lc_update (pos , {type = " program" })
514
+ if err then print (err ) end
515
+ reset_meta (pos , fields .code , err )
516
+ end ,
517
+ sounds = default .node_sound_stone_defaults (),
518
+ is_luacontroller = true ,
519
+ virtual_portstates = {a = false , b = false , c = false , d = false },
520
+ })
521
+
482
522
---- --------------------
483
523
-- Craft Registration --
484
524
---- --------------------
0 commit comments