Commit Graph

61 Commits

Author SHA1 Message Date
Jeija
95fedc88bc Never postpone action_on or action_off
There is no more need for that since VoxelManip caching makes sure we
always get an answer to get_node_force.
2016-09-04 09:50:30 +02:00
Jeija
433778c2ec Add Hawk777 to contributor list, update developer documentation URL 2016-09-04 09:32:41 +02:00
Jeija
e561be7fa3 Greatly improve performance by making use of VoxelManips in turnoff
Instead of seperately looking for onstate receptors along equipotential
sections of the circuit before turning off, do that while already
modifying the VoxelManip. In case an onstate receptor is found, discard
the VoxelManip cache, otherwise commit it after turnoff is completed.
2016-08-30 19:12:09 +02:00
Christopher Head
bc9d4c2d5a
Use VM transactions for conductor state changes.
VoxelManipulator-based transactions are used to hopefully speed up
scanning and replacing of networks of conductors when receptors start or
stop driving signals into them.
2016-08-24 00:42:40 -07:00
Carter Kolwey
912f17f335 Split wires into their own mod, introduce autoconnect hooks
The update_autoconnect function had to be abstracted away from the
default wires, any kind of wire can now register autoconnect hooks,
which should make having multiple different wire types much easier.

mesecons_mvps, mesecons_receiver and mesecons_random made use of
update_autoconnect, their code was also adapted. This also fixes a
receiver bug: If a receiver was placed with a onstate receptor next
to it (but not the wall lever / button that caused the receiver to
appear) the receiver didn't turn on in the past.

Also move documentation for mesecon wire into mesecons_wire.
2016-08-23 11:08:53 +02:00
Jeija
809192f353 Use vector helper functions instead of old builtin cmpPos and addPosRule functions 2016-02-14 20:55:50 +01:00
Jeija
97f7b5745f Remove trailing whitespace 2015-10-04 13:30:34 +02:00
Jeija
a550323fea Fix compatibility with not yet updated mods that use mesecon:receptor_* 2014-11-22 20:05:36 +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
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
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
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
a632a8abc8 Fix delayers and disable resuming if not using MESECONS_GLOBALSTEP 2014-01-19 13:57:11 +01: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
6afded8284 Fix unloaded area in receptor_off, yet it was only fixed in receptor_on 2014-01-11 16:18:35 +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
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
Novatux
fb417d45a7 Fix when there are several rules with different specials 2014-01-04 17:22:04 +01:00
Novatux
d5b39951a4 Fix bugs with multi-rules conductors (like crossing) that have param2 2014-01-04 14:15:41 +01:00
Uberi
16b4b79c51 Update code to standards of Minetest 0.4.8. 2013-11-30 22:13:00 -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
khonkhortisan
885899cbaf Crossover 2013-06-20 09:30:26 -07:00
Novatux
afad592783 Change mesecons signals so that they update effectors only after a globalstep, configurable to be on/off 2013-06-05 15:37:55 -04: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
841bc70b97 Fix a bug that occured when using a receptor placed directly next to a
gate.
We need to call a changesignal even if the gate/other effector is still
connected to a power source in a way.
2013-01-09 16:56:25 +01:00
Jeija
7fe4947056 Bugfix foes for pistons, delayyrs, gates and microcontrollers. Rework delayers. 2012-12-27 09:28:04 +01:00
Jeija
9019a4aff7 Bugfix, wires sometimes turned off for no reason 2012-12-21 16:04:19 +01:00
Jeija
6b1bfe6391 Add rule-name system. Every input rule can now have a name, that could help e.g. the microcontroller to know where a signal comes from. 2012-12-19 17:34:05 +01:00
Jeija
2c4a46a557 Minor cleanup, use addPosRule 2012-12-16 16:29:03 +01:00
Jeija
44dc1a128c Upload cleaned up mesecons to nextgen branch 2012-12-15 18:45:51 +01:00
Jeija
00e071b695 Cleanup, make and use util.lua, port command block and delayer to nodedef 2012-12-08 21:56:09 +01:00
Jeija
e0aa5b1d3d New branch: Move mesecon to node definition instead of functions like register_conductor; first steps: move everything to legacy 2012-12-08 14:14:04 +01:00
Jeija
f959c16763 Fix Microcontroller bug (discovered by Fenris) and some others that propably noone found 2012-09-08 15:10:31 +02:00
Jeija
3928d54d0c Implement mesecon:register_receptor(onstate, offstate, rules, get_rules) and make add_receptor_node(_off) deprecated 2012-09-06 09:53:30 +02:00
Jeija
7e7e1de725 Code cleanup 2012-09-05 23:52:09 +02:00
Jeija
78fdedc880 Add conductor rules, add demo isolated mesecons to proof that it works 2012-08-16 21:24:06 +02:00
Jeija
00ce2540c2 New effector system, effectors have to be registered with mesecon:register_effector(onstate, offstate, rules, function get_rules) rules and function get_rules are optional. You don't have to specify both onstate and offstate (required for e.g. removestone) 2012-08-13 20:17:45 +02:00
Jeija
24c50571f7 Make mesecons only connect to input and output ports (e.g. of the delayer) 2012-08-13 16:49:14 +02:00
Jeija
b197d29bef Code cleanup, little bugfix (some conductors placed next to receptors didn't turn on) 2012-08-13 13:12:19 +02:00
Jeija
955b8254dd Code cleanup 2012-08-13 12:03:36 +02:00
Jeija
b8ba13a17a Code cleanup 2012-08-13 11:58:04 +02:00
Jeija
c20a4b3a89 Minimal speedup by not checking some nodes twice for receptors 2012-08-13 09:37:55 +02:00
Jeija
c8c2fd32da Code cleanup and ond more extremely small speedup 2012-08-13 08:50:10 +02:00
Jeija
fc74976f9c Further (small) speed improvement, shrink code & more comments on it 2012-08-12 23:02:38 +02:00
Jeija
9829abc74d HUGE speed improvement 2012-08-12 10:57:00 +02:00
Jeija
6b1941a380 Add new nodebox style wires. Can be activated by setting NEW_STYLE_WIRES to true (in mesecons/settings.lua) 2012-08-11 22:58:00 +02:00
Jeija
8fa6894953 Consistency improvement and remove dead code 2012-08-10 18:58:21 +02:00
Kotolegokot
70841d8c8e not_in_creative_inventory 2012-08-01 15:58:19 +06:00
Jeija
3ed865d94d Fix Bug: Mesecons cannot be digged due to a collisionbox failure 2012-06-20 19:26:07 +02:00