mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 01:34:01 +00:00
* 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>
53 lines
1.5 KiB
Plaintext
53 lines
1.5 KiB
Plaintext
GLOBAL_DATUM_INIT(ctf_panel, /datum/ctf_panel, new())
|
|
|
|
/datum/ctf_panel
|
|
|
|
/datum/ctf_panel/ui_state(mob/user)
|
|
return GLOB.observer_state
|
|
|
|
/datum/ctf_panel/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "CTFPanel")
|
|
ui.open()
|
|
|
|
/datum/ctf_panel/ui_data(mob/user)
|
|
var/list/data = list()
|
|
data["teams"] = list()
|
|
data["enabled"] = ""
|
|
for(var/obj/machinery/capture_the_flag/team in GLOB.machines)
|
|
var/list/this = list()
|
|
this["name"] = team
|
|
this["color"] = team.team
|
|
this["score"] = team.points + team.control_points
|
|
this["team_size"] = team.team_members.len
|
|
this["refs"] += "[REF(team)]"
|
|
data["teams"] += list(this)
|
|
if(!data["enabled"])
|
|
if(team.ctf_enabled)
|
|
data["enabled"] = "CTF is currently running!"
|
|
else
|
|
data["enabled"] = "CTF needs [CTF_REQUIRED_PLAYERS] players to start, currently [team.people_who_want_to_play.len]/[CTF_REQUIRED_PLAYERS] have signed up!"
|
|
return data
|
|
|
|
|
|
/datum/ctf_panel/ui_act(action, params, datum/tgui/ui)
|
|
.= ..()
|
|
if(.)
|
|
return
|
|
var/mob/user = ui.user
|
|
|
|
switch(action)
|
|
if("jump")
|
|
var/obj/machinery/capture_the_flag/ctf_spawner = locate(params["refs"])
|
|
if(istype(ctf_spawner))
|
|
user.forceMove(get_turf(ctf_spawner))
|
|
return TRUE
|
|
if("join")
|
|
var/obj/machinery/capture_the_flag/ctf_spawner = locate(params["refs"])
|
|
if(istype(ctf_spawner))
|
|
if(ctf_spawner.ctf_enabled)
|
|
user.forceMove(get_turf(ctf_spawner))
|
|
ctf_spawner.attack_ghost(user)
|
|
return TRUE
|