Revised activation system.
Also fixed that the wrong value was read from the configuration.master
parent
e370352a0a
commit
b45bf292b5
|
@ -52,6 +52,15 @@
|
|||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#activate">activate ()</a></td>
|
||||
<td class="summary">Activates the autodrops system, if it has not been disabled in
|
||||
configuration by setting "autodrops_activate" to false.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#activate_internal">activate_internal ()</a></td>
|
||||
<td class="summary">Activates the autodrops system without checking the configuration.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#drop">drop (position, stacks)</a></td>
|
||||
<td class="summary">Drops the given ItemStacks at the given position, based on the settings.</td>
|
||||
|
@ -63,6 +72,14 @@
|
|||
</table>
|
||||
<h2><a href="#Fields">Fields</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#activate">activate</a></td>
|
||||
<td class="summary">If the system should be automatically activated.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#active">active</a></td>
|
||||
<td class="summary">If the system is currently active/has been activated.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#split">split</a></td>
|
||||
<td class="summary">The split method that is used.</td>
|
||||
|
@ -79,6 +96,36 @@
|
|||
|
||||
<h2><a name="Functions"></a>Functions</h2>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "activate"></a>
|
||||
<strong>activate ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Activates the autodrops system, if it has not been disabled in
|
||||
configuration by setting "autodrops_activate" to false.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "activate_internal"></a>
|
||||
<strong>activate_internal ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Activates the autodrops system without checking the configuration. Does
|
||||
nothing on multiple calls.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "drop"></a>
|
||||
<strong>drop (position, stacks)</strong>
|
||||
|
@ -139,6 +186,34 @@
|
|||
</dl>
|
||||
<h2><a name="Fields"></a>Fields</h2>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "activate"></a>
|
||||
<strong>activate</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
If the system should be automatically activated.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "active"></a>
|
||||
<strong>active</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
If the system is currently active/has been activated.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "split"></a>
|
||||
<strong>split</strong>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue