-
-
Notifications
You must be signed in to change notification settings - Fork 682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhauls Observer UI #10050
Closed
Closed
Overhauls Observer UI #10050
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0a76920
https://github.com/tgstation/tgstation/pull/57471
Tsar-Salat bc20ad5
https://github.com/tgstation/tgstation/pull/61638
Tsar-Salat f1722f0
feeexes
Tsar-Salat de77f96
ran prettier
Tsar-Salat ea5caa7
Merge branch 'master' into spawners_menu
Tsar-Salat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#define CTF_REQUIRED_PLAYERS 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { useBackend } from '../backend'; | ||
import { Box, Button, Section, Flex, Stack, Divider } from '../components'; | ||
import { Window } from '../layouts'; | ||
|
||
export const CTFPanel = (props, context) => { | ||
const { act, data } = useBackend(context); | ||
const teams = data.teams || []; | ||
const enabled = data.enabled || []; | ||
return ( | ||
<Window title="CTF Panel" width={700} height={600}> | ||
<Window.Content scrollable> | ||
<Box textAlign="center" fontSize="18px"> | ||
{enabled} | ||
</Box> | ||
|
||
<Divider /> | ||
|
||
<Flex align="center" wrap="wrap" textAlign="center" m={-0.5}> | ||
{teams.map((team) => ( | ||
<Flex.Item key={team.name} width="49%" m={0.5} mb={8}> | ||
<Section key={team.name} title={`${team.color} Team`}> | ||
<Stack fill mb={1}> | ||
<Stack.Item grow> | ||
<Box> | ||
<b>{team.team_size}</b> member | ||
{team.team_size === 1 ? '' : 's'} | ||
</Box> | ||
</Stack.Item> | ||
|
||
<Stack.Item grow> | ||
<Box> | ||
<b>{team.score}</b> point | ||
{team.score === 1 ? '' : 's'} | ||
</Box> | ||
</Stack.Item> | ||
</Stack> | ||
|
||
<Button | ||
content="Jump" | ||
fontSize="18px" | ||
fluid={1} | ||
color={team.color.toLowerCase()} | ||
onClick={() => | ||
act('jump', { | ||
refs: team.refs, | ||
}) | ||
} | ||
/> | ||
|
||
<Button | ||
content="Join" | ||
fontSize="18px" | ||
fluid={1} | ||
color={team.color.toLowerCase()} | ||
onClick={() => | ||
act('join', { | ||
refs: team.refs, | ||
}) | ||
} | ||
/> | ||
</Section> | ||
</Flex.Item> | ||
))} | ||
</Flex> | ||
</Window.Content> | ||
</Window> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { useBackend } from '../backend'; | ||
import { Button, Section, Stack } from '../components'; | ||
import { Window } from '../layouts'; | ||
|
||
export const MinigamesMenu = (props, context) => { | ||
const { act } = useBackend(context); | ||
return ( | ||
<Window title="Minigames Menu" width={450} height={200}> | ||
<Window.Content> | ||
<Section title="Select Minigame" textAlign="center"> | ||
<Stack> | ||
<Stack.Item grow> | ||
<Button content="CTF" fluid={1} fontSize={3} textAlign="center" lineHeight="3" onClick={() => act('ctf')} /> | ||
</Stack.Item> | ||
</Stack> | ||
</Section> | ||
</Window.Content> | ||
</Window> | ||
); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.