diff --git a/doc/index.html b/doc/index.html index 4cd6187..63073df 100644 --- a/doc/index.html +++ b/doc/index.html @@ -52,6 +52,15 @@

Functions

+ + + + + + + + @@ -63,6 +72,14 @@
activate ()Activates the autodrops system, if it has not been disabled in + configuration by setting "autodrops_activate" to false.
activate_internal ()Activates the autodrops system without checking the configuration.
drop (position, stacks) Drops the given ItemStacks at the given position, based on the settings.

Fields

+ + + + + + + + @@ -79,6 +96,36 @@

Functions

+
+ + activate () +
+
+ Activates the autodrops system, if it has not been disabled in + configuration by setting "autodrops_activate" to false. + + + + + + + +
+
+ + activate_internal () +
+
+ Activates the autodrops system without checking the configuration. Does + nothing on multiple calls. + + + + + + + +
drop (position, stacks) @@ -139,6 +186,34 @@

Fields

+
+ + activate +
+
+ If the system should be automatically activated. + + + + + + + +
+
+ + active +
+
+ If the system is currently active/has been activated. + + + + + + + +
split diff --git a/mods/auto_drops/autodrops.lua b/mods/auto_drops/autodrops.lua index 4e3819f..8f599c0 100644 --- a/mods/auto_drops/autodrops.lua +++ b/mods/auto_drops/autodrops.lua @@ -29,6 +29,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- which are dropped on the ground, instead of being send directly to -- the player inventory. autodrops = { + --- If the system should be automatically activated. + activate = settings.get_bool("autodrops_activate"), + + --- If the system is currently active/has been activated. + active = false, + --- The split method that is used. Possible values are "stack", "random" -- and "single", defaults to "single". "stack" means that the full stack -- as provided is dropped, "random" splits the provided stack randomly and @@ -40,11 +46,21 @@ autodrops = { } --- Activates the autodrops system, if it has not been disabled in --- configuration by setting "autodrops_active" to false. +--- Activates the autodrops system, if it has not been disabled in +-- configuration by setting "autodrops_activate" to false. function autodrops.activate() - if settings.get_bool("autodrops_active", true) then + if autodrops.activate then + autodrops.activate_internal() + end +end + +--- Activates the autodrops system without checking the configuration. Does +-- nothing on multiple calls. +function autodrops.activate_internal() + if not autodrops.active then minetestex.register_on_nodedrops(autodrops.node_drops_handler) + + autodrops.active = true end end
activateIf the system should be automatically activated.
activeIf the system is currently active/has been activated.
split The split method that is used.