Commit Graph

85 Commits

Author SHA1 Message Date
Jude Melton-Houghton
60240ba268
Fix mvps receptor_off issue (#627) 2022-12-07 13:15:23 +01:00
Jude Melton-Houghton
f4070d3e64
Use FIFO queue for mvps (#599) 2022-04-01 23:33:41 +02:00
Jude Melton-Houghton
fb255d292e
Add .luacheckrc and fix issues it pointed out (#589) 2022-02-12 20:12:12 +01:00
Jude Melton-Houghton
4c5b13a347
Fix conductor lighting when aliases are used (#582) 2022-01-30 01:23:53 +01:00
Jude Melton-Houghton
ecea0a2896
Optimize light updates when turning conductors on and off (#578) 2021-11-27 16:28:13 +01:00
Jude Melton-Houghton
9323445182 Only skip conductors with flat rules in turnon/off 2021-08-21 13:30:28 +02:00
Desour
69d4a9584d Fix on-state effector-receptor combos (eg. gates) recepting to everywhere 2021-03-25 23:21:37 +01:00
DS
3f75c06a3b
Improve performance of mesecon.turnon and mesecon.turnoff (#556) 2021-03-25 16:53:51 +01:00
Vitaliy
583d2c1441
Replace mesecon.mergetable (#533) 2020-12-19 23:12:00 +03:00
DS
37eb7f00e8 Improve rules and rule handling (#370) 2017-10-08 02:39:02 +03:00
Jeija
6dacdaee1f Small cleanups in internal.lua, move forceloading reversal to legacy 2016-08-30 19:37:43 +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
Jeija
89153f6909 Further simplification of turnon/turnoff 2016-08-30 18:24:08 +02:00
Christopher Head
8e6536ca2e
Simplify turnon/turnoff.
It is no longer possible for get_node_force to return nil if the target
location does, in fact, exist, because a VM will always be able to load
it (whereas a forceload might not, due to exhaustion of forceload
resources). So it is no longer necessary to handle get_node_force
returning nil by deferring processing.
2016-08-24 00:42:40 -07: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
Jeija
778ee427f4 Fix bug introduced in previous commit that broke all logic blocks
turnon / turnoff were calling activate / deactivate on nodes even though
their rules didn't link

Fixes #278, thanks to @darkfeels
2016-07-31 22:26:33 +02:00
Jeija
7c7595fd7d Fix #276: Fix bugs in block forceloading in turnon / turnoff
Thanks to @Hawk777 for reporting this problem
2016-07-25 10:01:43 +02:00
Samuel Sieb
4b9039266e Fix crash due to force loading changes. 2016-02-22 15:47:18 -08:00
Jeija
c7428d8135 Remove unused VERSION file
and remove debug output
2016-02-19 12:20:52 +01:00
Jeija
cfd4f7c287 Force-load areas with mesecon usage
This is a major speedup for large mesecon machines / structures.
Force-loaded areas are stored in a file to be persistent over server
reboots. By default, areas are unloaded after 10 minutes (600s) without
usage, this can be customized with the mesecon.forceload_timeout
setting. Please turn max_forceloaded_blocks up for better performance.
2016-02-19 12:11:38 +01: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
c326dc221a Rewrite Logic Gates: Makes it super-easy to add new gates and cleans up code
Fix bugs in the Luacontroller (when placing, false input pin values were given) and fix variables
leaking into the global environment in pistons.
2014-11-29 15:08:37 +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
fb695e9c1c Fix #189, clean code and update documentation 2014-11-23 09:43:24 +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
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
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
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
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
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
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
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
a632a8abc8 Fix delayers and disable resuming if not using MESECONS_GLOBALSTEP 2014-01-19 13:57:11 +01:00
Jeija
1a492feb7a Turnon/turnoff overwritable 2014-01-11 18:31:30 +01: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
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
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
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
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
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
khonkhortisan
4f2604e01b mesecon:rules_link nil return rule
Fixes https://github.com/Jeija/minetest-mod-mesecons/issues/108
2013-06-10 18:29:40 -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