Commit Graph

60 Commits

Author SHA1 Message Date
Jeija
011543a782 Fix #196, removes soft-depend on commonlib 2014-12-20 10:11:12 +01:00
Jeija
d2373eb605 Don't trigger an "off" event to itself when luacontroller turns a port off
I hope this doesn't break anyone's setup.
2014-11-29 10:56:09 +01:00
Jeija
2a51e40af9 Fix luacontroller: attempt to perform arithmetic on global 'print_count' (a nil value) 2014-11-25 19:53:29 +01:00
Jeija
4bd9d2a9ec Merge branch 'improve-luacontroller'
However, without the print_count limiting functionality

Conflicts:
	mesecons_luacontroller/init.lua
2014-11-25 17:36:52 +01:00
Jeija
f388dc475a Fix luacontroller interrupts not working if no iid is supplied 2014-11-23 10:59:51 +01:00
Jeija
085b4d8bb7 Fix burnt luacontroller, nodebox + crash 2014-11-22 23:14:45 +01:00
Jeija
0e3aa57ed3 Merge branch 'improve-luacontroller' of https://github.com/ShadowNinja/minetest-mod-mesecons into ShadowNinja-improve-luacontroller
Conflicts:
	mesecons/legacy.lua
	mesecons_luacontroller/init.lua
	mesecons_microcontroller/init.lua
2014-11-22 23:04:34 +01:00
Jeija
f977ac821a Re-implement settings system:
Settings can now be retrieved by mesecon.setting(<name>, <default>) and can be modified without
editing the source code by adding the setting to minetest.conf
For instance, you can add mesecon.blinky_plant_interval = 0.5 to minetest.conf in order to
increase the blinking speed.
Rewrite the blinky plant with nodetimers.
Fixes #161
2014-11-22 22:09:26 +01:00
Jeija
5be179bf11 Replace mesecon:<some_function> with mesecon.<some_function> for greater
flexibility and because it was never inteded to be OOP in the first
place.

mesecon.receptor_on and mesecon.receptor_off are provided by wrappers
(mesecon:receptor_on/off) for compatibility, but will be removed. Mod
programmers that use mesecons: Please update!

Also, fix microcontroller polluting the global namespace and remove some
deprecated stuff.
2014-11-22 15:42:22 +01:00
Jeija
ffacbfde5a Use an iterative algorithm for turnon() and turnoff(), fixes #160
This may also bring some performance benefit.
2014-11-22 14:47:18 +01:00
Jeija
dcf1f799c5 Fix #184, Fix #186, Fix #187
Just some minor issues like dead code.
2014-11-21 21:43:28 +01:00
ShadowNinja
bd1766e448 Improve the LuaController
Changes:
  * Stops code after a certain number of instructions.
  * Allows functions, due to instruction counting.
  * Allows loops and goto with non-JIT Lua (LuaJIT doesn't count looping as an instruction, allowing infinite loops), due to instruction counting.
  * Removes string matching functions as they can be slow.
  * Adds some safe functions.
  * Limits the amount of printing that can be done (to prevent console flooding).
  * Code cleanup.
  * More...
2014-10-07 17:09:25 -04:00
Jeija
300abcb587 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.
2014-04-20 21:51:17 +02:00
Jeija
3d2cfeace8 Fix #83 (experimental)
Why did we actually put the update action in a queue again? Whatever issue it that was for, I couldn't reproduce it.
Propably the ActionQueue fixed that...?
2014-03-19 14:47:22 +01:00
Jeija
df6829e553 Remove timer() from LuaController and make interrupt() use the ActionQueue so that it will keep working when restarting the server 2014-03-19 10:20:43 +01:00
Jeija
39a0e56c18 Improve and clean up luacontroller digiline_send on globalstep feature 2014-03-19 09:11:07 +01:00
Jeija
b50721c701 Merge branch 'digiline-non-reentrant' of https://github.com/CiaranG/minetest-mod-mesecons into CiaranG-digiline-non-reentrant
Conflicts:
	mesecons_luacontroller/init.lua
2014-03-16 21:12:50 +01:00
Jeija
38ff900274 Merge pull request #152 from CiaranG/timer
Add timer() function/event (node timer based) to luacontroller
2014-03-16 21:05:49 +01:00
Ciaran Gultnieks
9eda62df7b Add timer() function/event (node timer based) to luacontroller
This adds a timer(<seconds>) function, which causes an event of type
"timer" to be fired after that many seconds has elapsed.

Because it's node timer based, it works properly across server restarts
and block unloading. Thus, simplest example, a blinky plant replacement
with a 10 second period:

if event.type == "program" then
  timer(10)
elseif event.type == "timer" then
  port.a = not port.a
  timer(10)
end
2014-03-11 22:50:48 +00:00
Ciaran Gultnieks
5d3cba0bd4 Handle luacontroller formspec events correctly
Example of problem fixed by this: Edit lua code, press Execute. Now
(execute button has focus), hold down a key. Zillions of "program"
events are generated.
2014-03-11 17:54:56 +00:00
Ciaran Gultnieks
5002315ec9 Send digiline messages after luacontroller execution
In the same way as for port settings, this queues up digiline messages
sent during the luacontroller's execution, and sends them afterwards.
This solves many problems, but one example:

1. Send a message, and receive a reply from another device.
2. While handling the reply event (effectively a nested invocation
   on the same luacontroller) make a change to memory
3. Notice that the memory change has no effect, because after
   completion of the reply handling, it stores the memory, but then
   the original invocation completes and overwrites it with it's
   own earlier copy of the same memory.
2014-03-11 17:34:30 +00:00
Ciaran Gultnieks
c240d399fb Add missing string.upper to luacontroller 2014-02-16 13:28:07 +00:00
Jeija
8a71f51b26 Merge branch 'actionqueue'
This introduces the ActionQueue, a new kind of MESECONS_GLOBALSTEP.
Circuits using delayers will now resume when restarting the server.
Also, large circuits should automatically resume if parts of them are
in unloaded chunks.
Old circuits e.g. using gates will not resume when mesecons is updated,
which means you have to restart them once. But after that, it should work
just like it used to.
This will fix a lot of stuff but may also introduce some new bugs.
So please report them!
2014-01-19 13:59:22 +01:00
Novatux
f1ae54ed12 Try to fix gateswith serverstep code. 2014-01-11 07:24:42 +01:00
ShadowNinja
de6dd30745 Move textures into their mods 2014-01-10 13:13:02 -05:00
Uberi
e8d31c3e5a Change field receipt handling to work properly with Minetest 0.4.8. 2013-12-18 14:54:46 -05:00
Uberi
16b4b79c51 Update code to standards of Minetest 0.4.8. 2013-11-30 22:13:00 -05:00
Vanessa Ezekowitz
f46bc329de Use minetest.swap_node() instead of mesecons' version, Minor code changes
here and there to facilitate this.
2013-11-30 20:34:55 -05:00
khonkhortisan
913e355a71 Merge pull request #112 from khonkhortisan/multi_rules
Multi rules
Merged for near-future textures to be merged cleanly.
2013-08-27 22:22:30 -07:00
Anthony Zhang
ec63bd3abf Merge remote-tracking branch 'refs/remotes/origin/master' 2013-06-22 15:39:01 -04:00
khonkhortisan
d15e3eedb0 Descend µ in comment 2013-06-22 09:11:06 -07:00
khonkhortisan
885899cbaf Crossover 2013-06-20 09:30:26 -07:00
Anthony Zhang
c87bc60635 Support cyclic references in luacontroller memory tables, prohibit usage of goto statement (bugs reported by Nore). 2013-06-10 16:40:34 -04:00
Anthony Zhang
8ea71a9036 Fix bug where functions in Luacontroller EEPROM crashes the server (fixes #107). 2013-06-06 16:38:40 -04:00
Novatux
edc10dac47 Add an ABM function which resets heat to 0, since gates/controllers won't be cooled normally if they are moved (piston, etc...) during the cooling delay. 2013-06-05 06:45:19 +02:00
Anthony Zhang
24160d45ff Silly mistake, interrupts should work better now. 2013-05-21 17:57:25 -04:00
Anthony Zhang
682cf34792 Add burnt luacontroller (so you don't lose your program after an overheat) and prevent interrupts from piling up (fixes #101, metadata trashing). Idea for burnt luacontroller comes from ShadowNinja. 2013-05-15 21:36:16 -04:00
Jeija
e789794c75 Experimental fix for issue #85 by removing ignored ports from the luacontroller 2013-04-01 22:24:01 +02:00
Jeija
36bcce57b0 Add table.* to luacontroller sandbox 2013-03-26 15:12:56 +01:00
Anthony Zhang
21550b3727 Explicit tables of luacontroller environment. 2013-03-23 18:41:44 -04:00
Anthony Zhang
6983db6d82 Add math library to luacontroller, and make sure to copy stuff so code can't get out of the sandbox. 2013-03-23 17:49:25 -04:00
Anthony Zhang
3c3e45c7ea Avoid corrupting metadata. 2013-03-15 17:46:59 -04:00
Anthony Zhang
5fd1cf5c80 Use formspec_escape when available. 2013-03-15 17:21:16 -04:00
Anthony Zhang
e1211729cc Avoid borking the luacontroller if the code uses square brackets. When the next stable MT is released, uncomment the formspec_escape call to take advantave of formspec escaping. 2013-03-15 17:07:15 -04:00
Anthony Zhang
3792b692aa Digging and footstep sounds for everything that needs them! Plus, pushing buttons, punching switches, and flipping levers all make sounds. 2013-03-06 20:51:57 -05:00
Jeija
cc41f136cc More distinguishable inventory image for the luacontroller (not wield
item, just top)
2013-02-19 16:58:17 +01:00
Jeija
1c4ab938ad Fix a dumb bug that conflicted with different things in the luacontroller 2013-02-12 10:58:29 +01:00
Jeija
eeed4f148d Fix odd behaviour when using interrupts in the luacontroller 2013-02-12 10:25:24 +01:00
Jeija
591e2d7cde LuaController: Queue setting the ports (wait for pending operations) 2013-02-10 23:10:22 +01:00
Jeija
59cd72191b Add tostring, tonumber, string to luacontroller, prohibit 'function' 2013-01-22 21:15:49 +01:00