Commit Graph

860 Commits

Author SHA1 Message Date
Jeija
54efc64558 Duplicate unhash_blockpos code to legacy.lua
Duplicating that small piece of code seems like a better idea than
putting the undo-forceloading code back into util.lua. This way, it is
easier to remember to remove that unneccesary code after a couple of
months / years, when people have transitioned. This also means we can
make changes to the code in util.lua without breaking old code.
2016-08-31 08:46:11 +02:00
Jeija
dfeb070a20 Remove some long unused legacy code
The change that required this compatibility layer happened in
2014, so other mods have had a lot of time to update.
2016-08-30 20:54:20 +02: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
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
Carter Kolwey
4816dee396 Move shared textures into base mod (fixes a few LuaC issues) 2016-08-23 11:02:12 +02:00
Florian Euchner
a3042b44fc Merge pull request #282 from Hawk777/luacontroller-comment
Remove an obsolete comment.
2016-08-16 12:14:33 +02:00
Christopher Head
53eaf2af11
Remove an obsolete comment. 2016-08-16 00:16:24 -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
Carter Kolwey
acd41b5773 Don't bother checking if a node can overheat before cooling it 2016-07-09 11:17:08 +02:00
number Zero
f9f7600017 Command block server crash fixed
Before that, command block would crash the server if activated when no
players are online
2016-07-09 11:01:27 +02:00
Carter Kolwey
40487a65f4 Add protection support to Luacontrollers,
protection is ignored with protection_bypass_priv
2016-05-17 07:58:50 +02:00
Florian Euchner
75308f73e4 Merge pull request #270 from Emon-Omen/patch-1
Fixed missing capital letter in "ghoststone"
2016-05-17 07:53:35 +02:00
Emon
478680292c fixed missing capital letter @ line 29 2016-05-16 22:24:56 +02:00
Jeija
85bc62a65d Add COPYING.txt file to clarify coprights and licenses 2016-05-16 08:04:57 +02:00
Jeija
ed3964da80 Remove microcontroller documentation files from the source tree
The files are still available for download in a GitHub release
2016-05-15 19:04:18 +02:00
electrodude
6cae381c27 Luacontroller: Fix remove_functions stack overflow bug 2016-04-26 20:40:12 +02:00
Jeija
4249ed4986 Mese as conductor: Fix light source, make code more flexible
Closes #265
2016-04-26 19:44:05 +02:00
Florian Euchner
c4f0c5c169 Merge pull request #264 from cheapie/master
Escape command block commands for formspec
2016-04-21 19:26:28 +02:00
Carter Kolwey
2dea21f9ef Escape command block commands for formspec 2016-04-21 02:15:54 -05:00
Pedro Gimeno
b487783c23 Disable JIT optimization for user code and allow string.find in plain mode
Disabling LuaJIT for user code enables normal working of debug.sethook() even for loops. The drawback is that that code will run more slowly.

The fourth parameter of string.find indicates whether the second parameter should be interpreted literally (true) or as a pattern (false). Allowing patterns enables DoS attacks, but it's possible to
allow literal matching with little effort, by disallowing the function only if the fourth parameter (plain mode) is not `true`.
2016-04-02 17:31:40 +02:00
Jeija
72e513ecbd Luacontroller: Put clearing debug hook before throwing error back in 2016-03-14 12:51:57 +01:00
Jeija
1e77b193dd Luacontroller: Add safe version of string.rep and remove string.gsub,
fixes #255
2016-03-13 22:01:46 +01:00
Jeija
08b14e3af0 Luacontroller: Fix function usage in LuaJIT, make 'do' no longer
prohibited, remove pcall and xpcall, fix global lookup of "jit"
variable, correct error locations

Thanks to @ShadowNinja and @gamemanj for fixing this in #241
2016-03-13 21:16:16 +01:00
Jeija
e5dba66c21 Revert "Toggle trapdoors on signal, workaround for #252"
Please use the screwdriver if you want to rotate trapdoors.
This reverts commit 417a136c5e.
2016-02-28 07:16:45 +01:00
Jeija
417a136c5e Toggle trapdoors on signal, workaround for #252 2016-02-27 20:40:16 +01:00
Jeija
2dc8101fa1 Merge branch 'ssieb-master' 2016-02-23 10:20:09 +01: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
f099b43e11 Update documentation: Fix mesecons.net links 2016-02-16 19:55:46 +01:00
Jeija
7b84105512 Consistently use UNIX line endings (LF instead of CR LF) 2016-02-15 23:05:21 +01:00
Jeija
80f72b2621 Fix vertical wires not updating power when adding to / removing from a vertical line
Call mesecon.on_dignode / mesecon.on_placenode to take care of that.
2016-02-15 22:52:56 +01:00
Jeija
fe9c6871de Fix pistons not connecting to wire and not activating when placing
up/down pistons from certain directions
2016-02-15 16:36:27 +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
6b54f025c1 Merge branch 'playerdetector_update' of https://github.com/HybridDog/minetest-mod-mesecons into HybridDog-playerdetector_update 2016-02-14 13:41:48 +01:00
Jeija
c98805a5b5 Merge branch 'fix_pistons' of https://github.com/HybridDog/minetest-mod-mesecons into HybridDog-fix_pistons 2016-02-14 12:55:18 +01:00
Auke Kok
fb4c440265 Doors: Use new mesh door API if available
I've implemented a new door API in minetest_game that
performs all the needed things to assure doors are
properly openend and closed, without mods needing to
know the inner details of what needs to be done.

Mesecons can just fetch a reference to the door object
and call the appropriate open or close method, which
simplifies this code a lot.

For compatibility, this code retains the old code path
and tests whether the new API is available, so this
code remains functional if the new API is not available.

Since the metal trapdoor was only recently added, I added
it to the new API codepath only, it's unlikely to be
present on older versions of minetest_game anyway.

As a benefit from the new door API, there is now
absolutely no more accidental switching closed trapdoors
to open on power off, which could happen with the
old method - since that was just a simple toggle.
2016-02-14 11:30:52 +01:00
HybridDog
cf45e24c57 this way it works better because unknown nodes may not stay unknown 2016-02-09 16:58:49 +01:00
HybridDog
3f00c1d1cb fix pistons not working in every buildable_to node 2016-02-09 11:32:09 +01:00
HybridDog
c1d0481f8f playerdetector: short code and don't get scanname for every object 2016-01-03 14:56:32 +01:00
Jeija
f56c4ce35c Merge branch 'HybridDog-noteblock_update' 2016-01-02 23:01:08 +01:00
HybridDog
0ec503f32c Noteblock: Code cleanup 2016-01-02 22:58:08 +01:00