Files
Bubberstation/code/datums/minigames_menu.dm
SkyratBot 3c20b53bd3 [MIRROR] Replaces the Mafia button with the Minigames button. Adds tgui panels for selecting minigames and for CTF [MDB IGNORE] (#8659)
* Replaces the Mafia button with the Minigames button. Adds tgui panels for selecting minigames and for CTF (#61638)

This PR replaces the Mafia button on the observer HUD with a minigames button that allows you to access both CTF and Mafia.

It also adds a CTF menu that allows you to view current scores, players needed to start a game, and joining a ctf game without needing to move to the spawner.

Co-authored-by: Jared-Fogle <35135081+Mothblocks@ users.noreply.github.com>

* Replaces the Mafia button with the Minigames button. Adds tgui panels for selecting minigames and for CTF

Co-authored-by: NamelessFairy <40036527+NamelessFairy@users.noreply.github.com>
Co-authored-by: Jared-Fogle <35135081+Mothblocks@ users.noreply.github.com>
2021-10-07 12:55:09 -04:00

48 lines
1019 B
Plaintext

/datum/minigames_menu
var/mob/dead/observer/owner
/datum/minigames_menu/New(mob/dead/observer/new_owner)
if(!istype(new_owner))
qdel(src)
owner = new_owner
/datum/minigames_menu/Destroy()
owner = null
return ..()
/datum/minigames_menu/ui_state(mob/user)
return GLOB.observer_state
/datum/minigames_menu/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "MinigamesMenu")
ui.open()
/datum/minigames_menu/ui_act(action, params, datum/tgui/ui)
. = ..()
if(.)
return
switch(action)
if("mafia")
ui.close()
mafia()
return TRUE
if("ctf")
ui.close()
ctf()
return TRUE
/datum/minigames_menu/proc/mafia()
var/datum/mafia_controller/game = GLOB.mafia_game //this needs to change if you want multiple mafia games up at once.
if(!game)
game = create_mafia_game("mafia")
game.ui_interact(usr)
/datum/minigames_menu/proc/ctf()
var/datum/ctf_panel/ctf_panel
if(!ctf_panel)
ctf_panel = new(src)
ctf_panel.ui_interact(usr)