Go to file
Robert Zenz 30441c5cb9 Added support for new auto-pickup fields. 2016-01-10 13:28:28 +01:00
deps Updated dependencies. 2016-01-09 16:02:02 +01:00
doc Added support for new auto-pickup fields. 2016-01-10 13:28:28 +01:00
mods Added support for new auto-pickup fields. 2016-01-10 13:28:28 +01:00
.gitmodules Initial commit. 2015-12-13 13:25:36 +01:00
LICENSE Initial commit. 2015-12-13 13:25:36 +01:00
Makefile Initial commit. 2015-12-13 13:25:36 +01:00
README Added support for new auto-pickup fields. 2016-01-10 13:28:28 +01:00
README.md Fixed link. 2015-12-17 23:59:58 +01:00

README.md

minetest-australopithecus-death-inventory-drop

A system which makes the player drop their inventory on death.

Features

  • Items "explode" away from the player, spreading them over a fair distance in all directions.
  • Certain percentage of items can be retained or be destroyed.
  • Completely configurable from the configuration.

Usage

The system activates itself, you just need to add the mod to the subgame.

Configuration

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

# The percentage of how many items are destroyed upon death, a random amount
# is picked based on the given range, defaults to "0.15, 0.35".
deathinventorydrop_percentage_destroyed_items = 0.15, 0.35

# The percentage of how many items are retained, meaning the player is
# allowed to keep after death, defaults to "0, 0.15".
deathinventorydrop_percentage_retained_items = 0, 0.15

# If the stacks that are split in some way, defaults to random.
# Possible values are:
#  random: The dropped stacks are split randomly.
#  single: The dropped stacks are split into every single item.
#  stack: The dropped stacks are dropped as they are.
deathinventorydrop_split = random

# The maximum velocity of newly dropped items, a list with x, y and z
# values, defaults to "7, 10, 7".
deathinventorydrop_velocity = 7, 10, 7

Drop additional items

If you want to drop additional items, that is easily possible by invoking deathinventorydrop.drop_inventory, which accepts the Player, the InvRef and the name of the list to drop.

minetest.register_on_dieplayer(function(player)
    -- Checking of the object exists allows us to define the dependency as
    -- optional.
    -- Checking if the system is active at all.
    if deathinventorydrop ~= nil and deathinventorydrop.active then
        -- Drops all items in the list and also clears the list.
        deathinventorydrop.drop_inventory(player, your_inventory, "your_list")
    else
        -- Do something different here.
    end
end)

Force activation

You can force the activation of the system, even it has been disabled in the configuration, by invoking deathinventorydrop.activate_internal.