Commit Graph

44 Commits

Author SHA1 Message Date
Jude Melton-Houghton 0a4a88b1b9
Consolidate horizontal rules getters (#602) 2022-06-05 11:19:18 +02:00
Jude Melton-Houghton 960b7c4915
Make some fixes to movement and rotation (#584) 2022-05-07 22:24:58 +02:00
Jude Melton-Houghton 399ee9f5b5
Avoid duplicating VManip data in Lua memory (#600) 2022-03-08 18:15:30 +01:00
Jude Melton-Houghton 3c27bb9350
Fix VM light update issue (#590) 2022-02-13 00:19:33 +01: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 e15c55c066
Handle getting out-of-bounds bits in get_bit (#574)
The binary state is not padded with zeroes, so they must be inferred.
2021-08-02 21:33:45 +02:00
Vitaliy 583d2c1441
Replace mesecon.mergetable (#533) 2020-12-19 23:12:00 +03:00
Vitaliy 6921909100
Restrict Lua controller interrupt IDs (#534)
* Deprecate non-string IIDs
* Restrict tabular IIDs to proper trees
Fixes crash on recursive interrupt ID (#473)
2020-09-21 22:32:25 +03:00
Vitaliy 1b54011b68 Use table.copy in mesecons.tablecopy
mesecons.tablecopy didn’t support recursive tables, while Minetest table.copy works well for them.
2019-09-23 19:50:04 +02:00
DS 37eb7f00e8 Improve rules and rule handling (#370) 2017-10-08 02:39:02 +03:00
DS 905260c8db Handle blasts (#356) 2017-10-07 01:44:49 +03:00
Jeija 54daee236e Luacontroller: Revert function stripping from digiline messages 2017-01-15 20:11:12 +01:00
Jeija 8743699298 Luacontroller: Fix bugs in 703e6fda, no more functions as keys
Thanks to @ShadowNinja for reporting this
Make sure functions that are keys in tables and functions inside nested tables also get removed when using digiline_send.
2016-12-31 10:43:45 +01:00
Jeija 703e6fdadb Luacontroller: Restrict digiline messages
Restrict maximum length of messages to 50.000 characters and disable sending functions or table references over the wire. Restrict types of channel variable to string, number or boolean.

The missing length restriction made DoS-like attacks possible by overflowing memory using string concatenation. Thanks to gamemanj for disclosing this issue.
2016-12-28 10:07:59 +01:00
Christopher Head 203aaf3c90 Remove an unused function. 2016-11-17 14:55:02 +01:00
Jeija 6dacdaee1f Small cleanups in `internal.lua`, move forceloading reversal to legacy 2016-08-30 19:37:43 +02:00
Christopher Head 6d79272ed4
Implement VoxelManipulator-based transactions.
Rather than calling out through the Lua-to-C API for each node that
needs to be read or written, a group of map reads (and optionally
writes) can be grouped into a transaction. Access to map data within the
transaction is provided at high speed by means of VoxelManipulators.
Once the reads and writes are finished, the transaction can be committed
or aborted.
2016-08-24 00:42:38 -07:00
Christopher Head 564cee346a
Use VoxelManipulators for get_node_force.
A VoxelManipulator, when asked to read a mapblock, in addition to making
that mapblock available to the caller, also pulls it into the server’s
map cache, thus making get_node calls in the immediate future succeed.

This has the dual advantages that not every mapblock containing a
Mesecons circuit need remain loaded at all times (rather mapblocks can
be loaded on demand as signals are sent), and that the server need not
bother running ABMs and ticking entities within those mapblocks that are
loaded due to Mesecons signalling.
2016-08-24 00:41:47 -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 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 7865d42834 Always use minetest.set_node instead of minetest.add_node for consistency 2016-02-14 21:00:37 +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 dca4706c7f Fix #197, doesn't remove the legacy code that triggered it though 2015-01-03 10:12:12 +01:00
Jeija 011543a782 Fix #196, removes soft-depend on commonlib 2014-12-20 10:11:12 +01: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 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 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 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 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 b3f3692622 Fix crash if metarule not found 2014-01-04 16:51:52 +01:00
Novatux ae557d1cd4 Fixes with multi-conductors that have special connects 2014-01-04 15:52:52 +01:00
Uberi 16b4b79c51 Update code to standards of Minetest 0.4.8. 2013-11-30 22:13:00 -05:00
Vanessa Ezekowitz f46bc329de Use minetest.swap_node() instead of mesecons' version, Minor code changes
here and there to facilitate this.
2013-11-30 20:34:55 -05:00
khonkhortisan 885899cbaf Crossover 2013-06-20 09:30:26 -07:00
Jeija 57e1547515 Make pistons and movestones move objects (push only yet) 2013-04-02 11:57:28 +02:00
Jeija a1852204fb Cleanup and improve piston code 2012-12-16 11:58:43 +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