Skip to content

Commit

Permalink
Added support for new auto-pickup fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertZenz committed Jan 10, 2016
1 parent 601ff18 commit 30441c5
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ The system can be configured by adding settings to the `minetest.conf`:
# If the system should be activated, defaults to true.
deathinventorydrop_activate = 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 2.
autodrops_autopickup_timeout = 2

# The name of the lists to drop, a comma separated list, defaults to "main".
deathinventorydrop_inventories = main

Expand Down
36 changes: 36 additions & 0 deletions doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ <h2><a href="#Fields">Fields</a></h2>
<td class="summary">If the system is active/has been activated.</td>
</tr>
<tr>
<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="#inventories">inventories</a></td>
<td class="summary">The list of inventories/list names to drop, they need to be in players
inventory, defaults to "main".</td>
Expand Down Expand Up @@ -251,6 +259,34 @@ <h2><a name="Fields"></a>Fields</h2>



</dd>
<dt>
<a name = "autopickup_disable"></a>
<strong>autopickup_disable</strong>
</dt>
<dd>
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.







</dd>
<dt>
<a name = "inventories"></a>
Expand Down
13 changes: 12 additions & 1 deletion mods/death_inventory_drop/deathinventorydrop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ deathinventorydrop = {
--- If the system is active/has been activated.
active = false,

--- If the field should be set to disable auto-pickup.
autopickup_disable = settings.get_bool("deathinventorydrop_autopickup_disable", false),

--- The timeout value to set for auto-pickup.
autopickup_timeout = settings.get_number("deathinventorydrop_autopickup_timeout", 2),

--- The list of inventories/list names to drop, they need to be in players
-- inventory, defaults to "main".
inventories = settings.get_list("deathinventorydrop_inventories", "main"),
Expand Down Expand Up @@ -116,13 +122,18 @@ function deathinventorydrop.drop_inventory(player, inventory, list_name)
total_item_count,
deathinventorydrop.percentage_destroyed_items)

itemutil.blop(
local spawned_items = itemutil.blop(
player,
items,
deathinventorydrop.velocity.x,
deathinventorydrop.velocity.y,
deathinventorydrop.velocity.z,
deathinventorydrop.split)

spawned_items:foreach(function(spawned_item, index)
spawned_item:get_luaentity().autopickup_disable = deathinventorydrop.autopickup_disable
spawned_item:get_luaentity().autopickup_timeout = deathinventorydrop.autopickup_timeout
end)

inventory:set_list(list_name, retained_items)
end
Expand Down

0 comments on commit 30441c5

Please sign in to comment.