Commit Graph

65 Commits

Author SHA1 Message Date
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
Jeija a1852204fb Cleanup and improve piston code 2012-12-16 11:58:43 +01:00
Jeija 5fb5df446c Bugfix, use param2 for conductors when turning them on/off 2012-12-15 21:23:38 +01:00
Jeija 18731cbc8a Bugfix, param2 for conductors 2012-12-15 21:21:54 +01:00
Jeija 44dc1a128c Upload cleaned up mesecons to nextgen branch 2012-12-15 18:45:51 +01:00
Jeija c0d3bd2abb Include experimental vertical wires (needs textures) 2012-12-13 18:42:45 +01:00
Jeija de46729b97 Merge branch 'mesecons_in_nodedef'
Conflicts:
	mesecons/internal.lua
2012-12-11 19:49:55 +01:00
Jeija 5904abbd79 Port gates (finally) 2012-12-10 19:46:24 +01:00
Jeija cf6080f723 Port more blocks to nodedef system: object detector, extrawires, water turbine, insulated wire 2012-12-08 22:28:46 +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 8578fd89c8 Port lightstones (as reference for effectors) + blinky plant to the new nodedef system 2012-12-08 19:02:34 +01:00
Jeija 472650f099 Finish new mesecon-in-nodedef for conductors and receptors. Make wires and switch use it for reference. 2012-12-08 17:50:25 +01:00