50 lines
2.1 KiB
Lua
50 lines
2.1 KiB
Lua
for i = 1,7 do
|
|
|
|
minetest.register_node('lobby:corpse_'..i, {
|
|
description = 'Corpse',
|
|
drawtype = 'mesh',
|
|
mesh = 'corpse.obj',
|
|
tiles = {'gamer_skin_'..i..'.png^lobby_corpse.png', 'lobby_blood.png'},
|
|
use_texture_alpha = true,
|
|
walkable = false,
|
|
groups = {breakable=1, not_in_creative_inventory=1},
|
|
paramtype = 'light',
|
|
paramtype2 = 'facedir',
|
|
selection_box = {
|
|
type = 'fixed',
|
|
fixed = {-.6, -.5, -.6, .6, -.2, .6}, -- Right, Bottom, Back, Left, Top, Front
|
|
},
|
|
collision_box = {
|
|
type = 'fixed',
|
|
fixed = {-.6, -.5, -.6, .6, -.2, .6}, -- Right, Bottom, Back, Left, Top, Front
|
|
},
|
|
on_rightclick = function(pos, node, clicker, itemstack)
|
|
local name = clicker:get_player_name()
|
|
local player_attributes = clicker:get_meta()
|
|
local mode = player_attributes:get_string('mode')
|
|
local voting = player_attributes:get_string('voting')
|
|
local map_id = lobby.game[name]
|
|
if voting == 'false' then
|
|
if map_id ~= 'lobby' and mode == 'player' then
|
|
minetest.remove_node(pos)
|
|
local game_data = lobby.savedata.data[map_id]
|
|
local game_pos = game_data['level_pos']
|
|
local survivors = lobby.players_on_level(map_id)
|
|
lobby.votes[map_id] = 0
|
|
for _, player in pairs(minetest.get_connected_players()) do
|
|
local rname = player:get_player_name()
|
|
if lobby.game[rname] == map_id then
|
|
lobby.voted[rname] = false
|
|
player:set_physics_override({speed=0})
|
|
player_attributes:set_string('voting', 'true')
|
|
minetest.chat_send_player(rname, minetest.colorize('#FF0000', 'Somebody discovered a corpse!'))
|
|
minetest.show_formspec(rname, 'lobby:voting', lobby.voting_formspec(survivors))
|
|
player:set_pos({x=game_pos.x+(math.random(-3,3)),y=game_pos.y,z=game_pos.z+(math.random(-3,3))})
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end,
|
|
})
|
|
end
|