Commit Graph

705 Commits

Author SHA1 Message Date
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
Anthony
8440d05e8c Merge pull request #151 from CiaranG/lua-formspec
Handle luacontroller formspec events correctly
2014-03-11 18:11:35 -04: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
Jeija
a59f53d71a Merge pull request #148 from CiaranG/upper
Add missing string.upper to luacontroller
2014-02-16 14:33:35 +01:00
Ciaran Gultnieks
c240d399fb Add missing string.upper to luacontroller 2014-02-16 13:28:07 +00:00
Jeija
ee3797746f Fix #140 by adding a save button to the Player Detector 2014-01-19 14:12:34 +01: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
Jeija
a632a8abc8 Fix delayers and disable resuming if not using MESECONS_GLOBALSTEP 2014-01-19 13:57:11 +01:00
Jeija
a6bd955449 Merge pull request #144 from Novatux/gates-fix
Fix gates with serverstep code.
Let's give that a try.
2014-01-11 23:17:14 -08:00
Jeija
6c979a6ebb Merge pull request #142 from Novatux/actionqueue
Action Queue bugfixes by Novatux
2014-01-11 11:19:52 -08:00
Novatux
fe50e87da1 Make receptor_on/off overwritable, fix a serious bug. 2014-01-11 20:12:22 +01:00
Jeija
c8ef37f522 Actionqueue tweaks 2014-01-11 20:11:54 +01:00
Jeija
1a492feb7a Turnon/turnoff overwritable 2014-01-11 18:31:30 +01:00
ShadowNinja
eea4dbbea8 Use a textarea for the commandblock to accept multiple commands 2014-01-11 12:15:01 -05:00
ShadowNinja
cd30aed807 Fix #136 by always running commands as the placer 2014-01-11 11:42:23 -05:00
ShadowNinja
76b9198717 Revert "Remove command block until #136 is fixed"
This reverts commit 3f76b77001.
2014-01-11 11:42:23 -05:00
Jeija
d066b91632 Fix infinite priority bug in mesecon:turnoff, thanks to Novatux 2014-01-11 16:48:25 +01:00
Jeija
1083539e9b Resume turnon/off calls as soon as area is loaded in case turnon/off calls end in unloaded territory 2014-01-11 16:46:27 +01:00
Jeija
6afded8284 Fix unloaded area in receptor_off, yet it was only fixed in receptor_on 2014-01-11 16:18:35 +01:00
Jeija
ff5e315325 Fix ActionQueue delays 2014-01-11 15:36:30 +01:00
Jeija
f1211f7dae Add ActionQueue priority system
This makes effectors nearer to the source of the action (the receptor) update first.

This defines behaviour for this piston circuit: http://i.imgur.com/9Pp2Mzb.png
And defines, that this memory circuit does not work from this direction: http://i.imgur.com/jJn0aFh.png
But it will work when using the switch from the other side: http://i.imgur.com/nvw0oZB.png

Only if two effectors have the same distance, there is nothing we can do about it, behaviour is not defined.
"Distance" is determined by the stack size of recursions in turnon / turnoff.
Priorities are between 0 (lowest) and 1 (highest).
2014-01-11 14:57:56 +01:00
Jeija
93fb489bdb Fix the bugs spotted by Novatux - thanks for spotting them 2014-01-11 08:57:21 +01:00
Novatux
f1ae54ed12 Try to fix gateswith serverstep code. 2014-01-11 07:24:42 +01:00
Jeija
7517cc4af1 Add dummy mesecons_commandblock/init.lua as we keep the textures in that folder 2014-01-10 23:13:07 +01:00
Jeija
c067e52714 Merge pull request #138 from ShadowNinja/split_textures
Move textures into their mods
2014-01-10 14:10:20 -08:00
Jeija
2d004b19ea First draft of some kind of Action Queue (just like the globalstep queue in to_update), but more flexible and also including delay functionality (mesecon_delayer).
The queue is also saved to a file, so that when restarting mesecons, delayers resume to the state they had when the game shut down. Needs testing.
2014-01-10 22:33:40 +01:00
ShadowNinja
de6dd30745 Move textures into their mods 2014-01-10 13:13:02 -05:00
Jeija
3f76b77001 Remove command block until #136 is fixed 2014-01-09 17:39:59 +01:00
Novatux
5e02b3beef Fix a few bugs that caused effectors not to turn off sometimes (rules_link is evil!) 2014-01-05 13:51:09 +01:00
Jeija
39361fb719 Merge pull request #133 from Novatux/master
Use swap_node instead of add_node when replacing conductors.
2014-01-05 01:01:53 -08:00
Novatux
9c2a5c313c Use swap_node instead of add_node when replacing conductors. 2014-01-05 09:52:06 +01:00
Novatux
fb417d45a7 Fix when there are several rules with different specials 2014-01-04 17:22:04 +01:00
Novatux
b3f3692622 Fix crash if metarule not found 2014-01-04 16:51:52 +01:00
Novatux
ae557d1cd4 Fixes with multi-conductors that have special connects 2014-01-04 15:52:52 +01:00
Novatux
d5b39951a4 Fix bugs with multi-rules conductors (like crossing) that have param2 2014-01-04 14:15:41 +01:00
Novatux
b0f81a8c62 Add mesecon:register_on_mvps_move, fix mesecon:mvps_pull_all 2014-01-03 11:04:19 +01:00
Uberi
d9cc1d5aa1 Vertical wire update. 2013-12-18 15:14:03 -05:00
Uberi
e8d31c3e5a Change field receipt handling to work properly with Minetest 0.4.8. 2013-12-18 14:54:46 -05:00
Anthony
85f2f3f742 Merge pull request #126 from qwrwed/master
change on_punch to on_rightclick, make disabled blinky plants drop norma...
2013-12-02 10:43:10 -08:00
qwrwed
711c73a197 change on_punch to on_rightclick, make disabled blinky plants drop normal ones 2013-12-02 17:50:00 +00:00
Uberi
16b4b79c51 Update code to standards of Minetest 0.4.8. 2013-11-30 22:13:00 -05:00
Uberi
b4654cedb7 Compat shim for minetest.swap_node, lightstone conducts from the bottom. 2013-11-30 21:23:58 -05:00
Vanessa Ezekowitz
3105ae7084 Merge branch 'master' of github.com:Jeija/minetest-mod-mesecons 2013-11-30 20:45:38 -05:00
Vanessa Ezekowitz
f12206acc6 Remove "disabled" blinkyplant from inventory 2013-11-30 20:45:10 -05:00
Uberi
f479dd27d5 Fix vertical wire drops. 2013-11-30 20:44:33 -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
Vanessa Ezekowitz
669e3d0880 use 'wood' group for crafting pistons, pressure plates, and noteblocks 2013-11-30 19:07:12 -05:00
VanessaE
2d0ff5e2ac Merge pull request #124 from qwrwed/master
Make blinkyplants toggleable
2013-11-29 14:44:51 -08:00
qwrwed
33de6fad55 Make blinkyplants toggleable 2013-11-29 22:06:50 +00:00