Commit Graph

850 Commits

Author SHA1 Message Date
Jeija
fb695e9c1c Fix #189, clean code and update documentation 2014-11-23 09:43:24 +01:00
Jeija
fc4d675b84 Fix crafting with the default mesecon wire 2014-11-22 23:20:29 +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
a814abd1e0 Merge branch 'doorsounds' 2014-11-22 22:43:12 +01:00
Florian Euchner
fb5c9edaf4 Merge pull request #156 from HybridDog/ov_it
Use minetest.override_item to redefine mese
2014-11-22 22:30:31 +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
80d136125e Fix bug in mesecon.find_receptor that caused false turnoffs and rewrite lever +
switch
2014-11-22 20:49:54 +01:00
Jeija
a550323fea Fix compatibility with not yet updated mods that use mesecon:receptor_* 2014-11-22 20:05:36 +01:00
Jeija
d19e975955 Use iterative algorithm for mesecon.find_receptor_on, major performance improvement for large
circuits.
This also fixes a crash introduced with the previous commit that occured when placing a wire
crossing.
2014-11-22 17:12:48 +01:00
Jeija
29dc50057c Fix bug in mesecon.mergetable that caused false rules 2014-11-22 16:00:49 +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
b5cc933287 Pressure plates and the object detector will send power to vertical
wires 2 nodes below them, allows to hide circuitry powered by them.
Fixes #179
Rewrite pressure plates + vertical wires using mesecon.register_node.
2014-11-22 12:30:39 +01:00
Jeija
194155fff8 Rewrite mesecon wires. This should increase the efficiency and speed of
large machines.

It also makes the wires.lua code easier to understand and more
maintainable. In case any other mod depends on
mesecon:update_autoconnect, please update it to use
mesecon.update_autoconnect. This should also fix some other minor bugs.
Please report bugs if this commit creates new ones.

This commit changes wire looks and removes some unneccesary textures.
2014-11-22 11:40:58 +01:00
Jeija
87bfbb4de9 Fix #183, noteblock now uses default drawtype 2014-11-21 22:07:21 +01:00
Jeija
1b9f1b8c13 Fix #182, bug when placing wire crossings next to a powered source
In case this fix creates new bugs, please report them.
2014-11-21 22:05:35 +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
Vanessa Ezekowitz
d325292291 use the right mesecon:receptor_* call for on/off blinkyplant 2014-09-01 21:12:11 -04:00
Vanessa Ezekowitz
1ebd50ac75 use one ABM for blinkyplant instead of two.
using two ABMs allows the engine to desynchronize them, which makes the
duty cycle unpredictable.
2014-09-01 21:01:35 -04:00
Martin Doege
1908a225f9 add door sounds from minetest_game 2014-07-14 20:43:06 +02:00
Anthony Zhang
0c62545a3a Merge pull request #168 from ShadowNinja/fix-commandblock-quit
Fix the commandblock's check for quiting the formspec
2014-07-12 16:39:06 -04:00
Vanessa Ezekowitz
e88e213183 Merge branch 'master' of github.com:Novatux/minetest-mod-mesecons 2014-06-08 13:06:45 -04:00
Novatux
63998fd7e7 Localize a few variables, add "GET" command to node detector. 2014-06-08 19:02:15 +02:00
Vanessa Ezekowitz
13432ac87c Merge branch 'master' of github.com:Novatux/minetest-mod-mesecons 2014-06-08 10:28:57 -04:00
Novatux
b8714f7d93 Fix #164 2014-06-08 16:12:49 +02:00
Novatux
99cb021f15 Add node detector, which works like the player detector but detects a specific nodename (or any node except air) in front of it. 2014-06-08 08:29:17 +02:00
ShadowNinja
041429c985 Fix the commandblock's check for quiting the formspec
The submit button also sends a quit field.
2014-06-06 11:24:24 -04:00
Jeija
e5896076fe Make sure #160 cannot be exploited to make servers crash.
This is not exactly a fix for the issue, because extremely
large circuits (3000+ conductors) still won't work with this applied.
This simply aborts any execution if there is the danger of a stack overflow.
2014-06-01 11:00:39 +02:00
Zefram
b64fea4f70 Don't allow non-inventory items as ingredients
Some mesecon wires (the turned-on nodes) that were
not_in_creative_inventory and should never appear in an actual inventory
were also mesecon_conductor_craftable.  This is liable to make a craft
guide show them as potential ingredients, due to the use of the group
in recipes.
2014-05-02 09:07:52 +02:00
Jeija
a6916191aa Fix #140 once again 2014-04-30 14:44:47 +02:00
Zefram
f1eaee2281 fix programming microcontroller through form
The handling of the "quit" pseudo-field meant that the microcontroller
couldn't be programmed with explicit code, only with the examples.
The "quit" can actually be ignored: what matters for programming the
controller is whether the "code" field was supplied.
2014-04-25 18:30:59 +02:00
HybridDog
b9178dfcaa use minetest.override_item to redefine mese 2014-04-21 13:27:12 +02: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
1f66687580 Fix bug that made delayers oscillate their input port
when powering off the delayer faster than the delay time.
Actually, delayers should have never worked since the ActionQueue update as
they always used the default rules for their output, which is obviously nonsense.
2014-03-23 09:28:22 +01:00
Jeija
1852e967a9 Send changesignals for placed receptors when not powered, make on_placenode code more readable
with comments. Also fixes a bug of lua- / microcontrollers not being updated when pushed by a
piston.
This could cause some bugs, even though I haven't found any while testing as it is a very core part of mesecons.
2014-03-21 21:31:34 +01:00
Jeija
a9427d267b Merge pull request #141 from ShadowNinja/commandblock_textarea
Use a textarea for the commandblock to accept multiple commands
2014-03-20 21:02:43 +01:00
Jeija
2cab6aa5ef Merge pull request #134 from Novatux/master
Fix a few bugs that caused effectors not to turn off sometimes
2014-03-20 09:28:03 +01:00
Jeija
37405e5a06 Fix #146 2014-03-19 15:13:23 +01: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
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