Commit Graph

51 Commits

Author SHA1 Message Date
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
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
Jeija
2b30360da2 Bugfix for the luacontroller that occured when two events occur at the
same time (output connected to input).
The behaviour of the controller can now be described this way:
The luacontroller sets port A, then B, then C, then D; if it is
interrupted by another event during that time it stops and let the
second event do the job.
2013-01-22 18:26:27 +01:00
Jeija
18da94006a Lots of bugfixes concerning the luacontroller
- Bug when using NOT-Gates
- Moved error label a little downwards
- On digiline event, msg and channel are now in event.*, not in
event.iid.*
2013-01-20 18:00:33 +01:00
Jeija
ef087f2bb6 Fix Bug: Wrong usage of action_on/action_off instead of action_change 2013-01-19 23:37:03 +01:00
Jeija
62ddebaecb Add support in luacontroller for a not yet released mod called 'digilines' 2013-01-19 21:45:39 +01:00
Jeija
fc384aedbb Remove unused variable 2013-01-19 12:04:10 +01:00
Jeija
ec517becab Texture the LuaController formspec 2013-01-19 12:03:27 +01:00
Jeija
0d44144421 Bugfixes and improved stability of the luacontroller 2013-01-14 17:58:14 +01:00
Jeija
240fb83e8b Implement interrupt(time, iid): The whole code is called again after a
certain amount of time.
Whenever it is called, an event is set.
Possible events are: program, interrupt, on and off
It also contains additional information (on/off -> event.in; interrupt ->
event.iid)
iid must be an integer or string value, otherwise the interrupt is not active
2013-01-13 17:33:16 +01:00
Jeija
e297a02ec2 Implement a memory for the controller (accesible via mem.) and cleanup code
Based on PilzAdam's code.
2013-01-13 11:08:13 +01:00