Skip to content

minetest-australopithecus/minetest-australopithecus-death-inventory-drop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A mod for Minetest which makes the player drop their whole inventory on death. This is a mirror of the GitLab repository.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published