Added support for the new fields for auto-pickup.

master
Robert Zenz 2016-01-10 13:18:38 +01:00
parent 8f9eb4f2da
commit 92eab53207
3 changed files with 39 additions and 16 deletions

11
README
View File

@ -26,10 +26,13 @@ The system can be configured by adding settings to the `minetest.conf`:
# If the system should be activated, defaults to true.
autodrops_activate = true
# If the droppedby field should be set on the new items, whih if
# auto-pickup is used, prevents the items from being picked up instantious,
# defaults to true.
autodrops_set_dropped_by = true
# If the field should be set to disable automatically pickup provided
# by the auto-pickup mod, defaults to false.
autodrops_autopickup_disable = false
# The value for the timeout before the auto-pickup mod is allowed to pick
# it up, defaults to 1.
autodrops_autopickup_timeout = 1
# If the stacks that are split in some way, defaults to single.
# Possible values are:

View File

@ -81,8 +81,12 @@
<td class="summary">If the system is currently active/has been activated.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_dropped_by">set_dropped_by</a></td>
<td class="summary">If the dropped_by field should be set to the player name.</td>
<td class="name" nowrap><a href="#autopickup_disable">autopickup_disable</a></td>
<td class="summary">If the field should be set to disable auto-pickup.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#autopickup_timeout">autopickup_timeout</a></td>
<td class="summary">The timeout value to set for auto-pickup.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#split">split</a></td>
@ -222,11 +226,25 @@
</dd>
<dt>
<a name = "set_dropped_by"></a>
<strong>set_dropped_by</strong>
<a name = "autopickup_disable"></a>
<strong>autopickup_disable</strong>
</dt>
<dd>
If the dropped_by field should be set to the player name.
If the field should be set to disable auto-pickup.
</dd>
<dt>
<a name = "autopickup_timeout"></a>
<strong>autopickup_timeout</strong>
</dt>
<dd>
The timeout value to set for auto-pickup.

View File

@ -35,8 +35,11 @@ autodrops = {
--- If the system is currently active/has been activated.
active = false,
--- If the dropped_by field should be set to the player name.
set_dropped_by = settings.get_bool("autodrops_set_dropped_by", true),
--- If the field should be set to disable auto-pickup.
autopickup_disable = settings.get_bool("autodrops_autopickup_disable", false),
--- The timeout value to set for auto-pickup.
autopickup_timeout = settings.get_number("autodrops_autopickup_timeout", 1),
--- The split method that is used. Possible values are "stack", "random"
-- and "single", defaults to "single". "stack" means that the full stack
@ -81,11 +84,10 @@ function autodrops.drop(position, player, stacks)
autodrops.velocity.z,
autodrops.split)
if autodrops.set_dropped_by then
items:foreach(function(item, index)
item:get_luaentity().dropped_by = player:get_player_name()
end)
end
items:foreach(function(item, index)
item:get_luaentity().autopickup_disable = autodrops.autopickup_disable
item:get_luaentity().autopickup_timeout = autodrops.autopickup_timeout
end)
end
--- The handler which is registered for handling the node drops.