lobby.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. lobby = {}
  2. lobby.map = {} --Holds number of players in a level.
  3. lobby.voted = {} --Holds player names, and if they have voted.
  4. lobby.votes = {}
  5. lobby.suspect = {} --Holds number of votes a player has marking them as suspect
  6. lobby.game = {} --Holds player names and what map they are on.
  7. lobby.xp = {} --The current XP amount for each level.
  8. lobby.traitors = {} --
  9. lobby.corpses = {}
  10. lobby.vote_timer = {}
  11. lobby.play_time = {}
  12. lobby.spawn_pos = {x=29996, y=-4.5, z=30041.5}
  13. lobby.spawn_pos = minetest.setting_get_pos('traitor_lobby_spawn') or lobby.spawn_pos
  14. lobby.sabotage = {}
  15. lobby.sabotage_level = {}
  16. lobby.survivors = {}
  17. lobby.stat = {} --stores what map_id a player is looking at for viewing stats.
  18. lobby.button_pos = {} --stores the pos of a button a player is viewing formspecs of.
  19. --Yes I know these table names are not very clear.
  20. --[[
  21. Saving data:
  22. local data = {}
  23. data.level_pos = {x = pos_x, y = pos_y, z = pos_z}
  24. data.xp = tonumber(fields.xp)
  25. lobby.savedata.IDs[map_id] = true
  26. lobby.savedata.data[map_id] = data
  27. lobby.savedata.stats[map_id] = stats
  28. ----
  29. Retriving data:
  30. local game_data = lobby.savedata.data[map_id]
  31. local game_pos = game_data['level_pos']
  32. player_attributes:set_string('mode', 'builder')
  33. This is set anytime a player goes to a level they have build access on.
  34. player_attributes:set_string('mode', 'player')
  35. This is set when a player is playing a level with other people, as it's meant to be played.
  36. player_attributes:set_string('mode', 'traitor')
  37. This is set when a player is playing a level with other people, and is the traitor.
  38. player_attributes:set_string('mode', 'solo')
  39. This is set when a player plays a level solo, usually to earn XP, but could also be to explore levels.
  40. player_attributes:set_string('mode', 'ghost')
  41. This is set when a player, playing with others, dies on a level.
  42. ]]