Commit Graph

76 Commits

Author SHA1 Message Date
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
Jeija
ef087f2bb6 Fix Bug: Wrong usage of action_on/action_off instead of action_change 2013-01-19 23:37:03 +01:00
Jeija
7e231b99a6 Make nr in rules rotation local in order not to pullute the holy global namespace 2012-12-28 07:33:16 +01:00
Jeija
ac0fb91139 Minor cleanup of mesecno torch and add another rule to it (behind above) 2012-12-27 10:50:20 +01:00
Jeija
7fe4947056 Bugfix foes for pistons, delayyrs, gates and microcontrollers. Rework delayers. 2012-12-27 09:28:04 +01:00
Jeija
d91e0b66cb Re-write pistons from scratch, propably fixes a lot of bugs and doesn't cause too many new ones. 2012-12-26 22:54:28 +01:00
Jeija
23bebfc054 Merge branch 'master' into nextgen
Conflicts:
	mesecons/internal.lua
	mesecons/wires.lua
	mesecons_pistons/init.lua
2012-12-21 16:22:25 +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
313b9adcd5 Should fix this bug: bit.ly/XEy94j 2012-12-18 15:59:23 +01:00
Jeija
c76c274cc0 Remove mesecons:updatenode 2012-12-16 12:00:11 +01:00