Add spectating.

This commit is contained in:
Splizard 2013-01-27 16:26:42 +13:00
parent d31128b45f
commit ddd94b3bb6
3 changed files with 25 additions and 1 deletions

View File

@ -1,8 +1,8 @@
--Drop the item the player was holding
minetest.register_on_dieplayer(function(player)
local pos = player:getpos()
inv = player:get_inventory()
inventorylist = inv:get_list("main")
--Drop all players items
for i,v in pairs(inventorylist) do
obj = minetest.env:add_item({x=math.floor(pos.x)+math.random(), y=pos.y, z=math.floor(pos.z)+math.random()}, v)
if obj ~= nil then

View File

@ -12,6 +12,13 @@ glass_arena.set_size(200)
--Set texture of the arena. [SAFE]
glass_arena.set_texture("default_glass.png")
-----------------------------------
--------Spawn configuration--------
--Set what happens to players on death.
--Defaults to nothing.
spawning.on_death("spectate")
-----------------------------------
--------Chest configuration--------
local chest_item = random_chests.register_item

17
mods/spawning/init.lua Normal file
View File

@ -0,0 +1,17 @@
spawning = {}
function spawning.on_death(mode)
if mode == "spectate" then
minetest.register_on_dieplayer(function(player)
local name = player:get_player_name()
local privs = minetest.get_player_privs(name)
privs.fast = true
privs.fly = true
privs.interact = false
minetest.set_player_privs(name, privs)
minetest.auth_reload()
minetest.chat_send_player(name, "You are now spectating")
end
end
end