2015-12-13 04:25:36 -08:00
|
|
|
minetest-australopithecus-death-inventory-drop
|
|
|
|
==============================================
|
|
|
|
|
|
|
|
A system which makes the player drop their inventory on death.
|
|
|
|
|
|
|
|
|
2015-12-17 14:08:33 -08:00
|
|
|
Features
|
|
|
|
--------
|
|
|
|
|
|
|
|
* Items "explode" away from the player, spreading them over a fair distance in
|
|
|
|
all directions.
|
2016-01-09 04:15:21 -08:00
|
|
|
* Certain percentage of items can be retained or be destroyed.
|
2015-12-17 14:08:33 -08:00
|
|
|
* Completely configurable from the configuration.
|
|
|
|
|
|
|
|
|
2015-12-13 04:25:36 -08:00
|
|
|
Usage
|
2015-12-17 14:07:00 -08:00
|
|
|
-----
|
2015-12-13 04:25:36 -08:00
|
|
|
|
|
|
|
The system activates itself, you just need to add the mod to the subgame.
|
|
|
|
|
|
|
|
|
|
|
|
Configuration
|
2015-12-17 14:07:00 -08:00
|
|
|
-------------
|
2015-12-13 04:25:36 -08:00
|
|
|
|
|
|
|
The system can be configured by adding settings to the `minetest.conf`:
|
|
|
|
|
|
|
|
# If the system should be activated, defaults to true.
|
2015-12-13 04:31:58 -08:00
|
|
|
deathinventorydrop_activate = true
|
2015-12-13 04:25:36 -08:00
|
|
|
|
2016-01-10 04:28:28 -08:00
|
|
|
# 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
|
|
|
|
|
2015-12-13 04:25:36 -08:00
|
|
|
# The name of the lists to drop, a comma separated list, defaults to "main".
|
|
|
|
deathinventorydrop_inventories = main
|
|
|
|
|
2016-01-09 04:15:21 -08:00
|
|
|
# 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
|
|
|
|
|
2015-12-13 04:25:36 -08:00
|
|
|
# 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
|
|
|
|
|
2015-12-19 02:16:33 -08:00
|
|
|
# The maximum velocity of newly dropped items, a list with x, y and z
|
|
|
|
# values, defaults to "7, 10, 7".
|
2015-12-13 04:25:36 -08:00
|
|
|
deathinventorydrop_velocity = 7, 10, 7
|
|
|
|
|
2015-12-19 02:16:33 -08:00
|
|
|
|
|
|
|
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`.
|
|
|
|
|