48 lines
1.8 KiB
Lua
48 lines
1.8 KiB
Lua
lobby = {}
|
|
lobby.map = {} --Holds number of players in a level.
|
|
lobby.voted = {} --Holds player names, and if they have voted.
|
|
lobby.votes = {}
|
|
lobby.suspect = {} --Holds number of votes a player has marking them as suspect
|
|
lobby.game = {} --Holds player names and what map they are on.
|
|
lobby.xp = {} --The current XP amount for each level.
|
|
lobby.traitors = {} --
|
|
lobby.corpses = {}
|
|
lobby.vote_timer = {}
|
|
lobby.spawn_pos = {x=29996, y=-4.5, z=30041.5}
|
|
lobby.spawn_pos = minetest.setting_get_pos('traitor_lobby_spawn') or lobby.spawn_pos
|
|
lobby.sabotage = {}
|
|
lobby.sabotage_level = {}
|
|
lobby.stat = {} --stores what map_id a player is looking at for viewing stats.
|
|
lobby.button_pos = {} --stores the pos of a button a player is viewing formspecs of.
|
|
--Yes I know these table names are not very clear.
|
|
|
|
--[[
|
|
Saving data:
|
|
local data = {}
|
|
data.level_pos = {x = pos_x, y = pos_y, z = pos_z}
|
|
data.xp = tonumber(fields.xp)
|
|
lobby.savedata.IDs[map_id] = true
|
|
lobby.savedata.data[map_id] = data
|
|
lobby.savedata.stats[map_id] = stats
|
|
|
|
----
|
|
Retriving data:
|
|
local game_data = lobby.savedata.data[map_id]
|
|
local game_pos = game_data['level_pos']
|
|
|
|
player_attributes:set_string('mode', 'builder')
|
|
This is set anytime a player goes to a level they have build access on.
|
|
|
|
player_attributes:set_string('mode', 'player')
|
|
This is set when a player is playing a level with other people, as it's meant to be played.
|
|
|
|
player_attributes:set_string('mode', 'traitor')
|
|
This is set when a player is playing a level with other people, and is the traitor.
|
|
|
|
player_attributes:set_string('mode', 'solo')
|
|
This is set when a player plays a level solo, usually to earn XP, but could also be to explore levels.
|
|
|
|
player_attributes:set_string('mode', 'ghost')
|
|
This is set when a player, playing with others, dies on a level.
|
|
]]
|