Skip to content
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
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion beestation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@
#include "code\datums\hud.dm"
#include "code\datums\map_config.dm"
#include "code\datums\mind.dm"
#include "code\datums\minigames_menu.dm"
#include "code\datums\movement_detector.dm"
#include "code\datums\mutable_appearance.dm"
#include "code\datums\mutations.dm"
Expand Down Expand Up @@ -2156,7 +2157,6 @@
#include "code\modules\atmospherics\machinery\portable\scrubber.dm"
#include "code\modules\awaymissions\away_props.dm"
#include "code\modules\awaymissions\bluespaceartillery.dm"
#include "code\modules\awaymissions\capture_the_flag.dm"
#include "code\modules\awaymissions\corpse.dm"
#include "code\modules\awaymissions\exile.dm"
#include "code\modules\awaymissions\gateway.dm"
Expand Down Expand Up @@ -2198,6 +2198,9 @@
#include "code\modules\buildmode\submodes\smite.dm"
#include "code\modules\buildmode\submodes\throwing.dm"
#include "code\modules\buildmode\submodes\variable_edit.dm"
#include "code\modules\capture_the_flag\_defines.dm"
#include "code\modules\capture_the_flag\ctf_game.dm"
#include "code\modules\capture_the_flag\ctf_panel.dm"
#include "code\modules\cargo\bounty.dm"
#include "code\modules\cargo\bounty_console.dm"
#include "code\modules\cargo\centcom_podlauncher.dm"
Expand Down
6 changes: 3 additions & 3 deletions code/__DEFINES/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ GLOBAL_VAR_INIT(ghost_role_flags, (~0))
//ie fugitives, space dragon, etc. also includes dynamic midrounds as it's the same deal
#define GHOSTROLE_MIDROUND_EVENT (1<<0)
//ie ashwalkers, free golems, beach bums
#define GHOSTROLE_SPAWNER (1<<1)
#define GHOSTROLE_SPAWNER (1<<1)
//ie mind monkeys, sentience potion
#define GHOSTROLE_STATION_SENTIENCE (1<<2)
//ie pais, posibrains
#define GHOSTROLE_SILICONS (1<<3)
#define GHOSTROLE_SILICONS (1<<3)
//ie mafia, ctf
#define GHOSTROLE_MINIGAME (1<<4)
#define GHOSTROLE_MINIGAME (1<<4)

// Job deadmin flags
#define DEADMIN_POSITION_HEAD (1<<0)
Expand Down
12 changes: 6 additions & 6 deletions code/_onclick/hud/_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@
#define ui_head "WEST+1:8,SOUTH+3:11"

//Ghosts

#define ui_ghost_jumptomob "SOUTH:6,CENTER-2:24"
#define ui_ghost_orbit "SOUTH:6,CENTER-1:24"
#define ui_ghost_reenter_corpse "SOUTH:6,CENTER:24"
#define ui_ghost_teleport "SOUTH:6,CENTER+1:24"
#define ui_ghost_pai "SOUTH: 6, CENTER+2:24"
#define ui_ghost_spawners_menu "SOUTH:6,CENTER-3:24"
#define ui_ghost_orbit "SOUTH:6,CENTER-2:24"
#define ui_ghost_reenter_corpse "SOUTH:6,CENTER-1:24"
#define ui_ghost_teleport "SOUTH:6,CENTER:24"
#define ui_ghost_pai "SOUTH: 6, CENTER+1:24"
#define ui_ghost_minigames "SOUTH: 6, CENTER+2:24"

//Team finder

Expand Down
30 changes: 22 additions & 8 deletions code/_onclick/hud/ghost.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
icon = 'icons/mob/screen_ghost.dmi'

/atom/movable/screen/ghost/MouseEntered()
. = ..()
flick(icon_state + "_anim", src)

/atom/movable/screen/ghost/jumptomob
name = "Jump to mob"
icon_state = "jumptomob"
/atom/movable/screen/ghost/spawners_menu
name = "Spawners menu"
icon_state = "spawners"

/atom/movable/screen/ghost/jumptomob/Click()
var/mob/dead/observer/G = usr
G.jumptomob()
/atom/movable/screen/ghost/spawners_menu/Click()
var/mob/dead/observer/observer = usr
observer.open_spawners_menu()

/atom/movable/screen/ghost/orbit
name = "Orbit"
Expand Down Expand Up @@ -44,12 +45,20 @@
var/mob/dead/observer/G = usr
G.register_pai()

/atom/movable/screen/ghost/minigames_menu
name ="Minigames"
icon_state = "minigames"

/atom/movable/screen/ghost/minigames_menu/Click()
var/mob/dead/observer/observer = usr
observer.open_minigames_menu()

/datum/hud/ghost/New(mob/owner)
..()
var/atom/movable/screen/using

using = new /atom/movable/screen/ghost/jumptomob()
using.screen_loc = ui_ghost_jumptomob
using = new /atom/movable/screen/ghost/spawners_menu()
using.screen_loc = ui_ghost_spawners_menu
using.hud = src
static_inventory += using

Expand All @@ -73,6 +82,11 @@
using.hud = src
static_inventory += using

using = new /atom/movable/screen/ghost/minigames_menu()
using.screen_loc = ui_ghost_minigames
using.hud = src
static_inventory += using

using = new /atom/movable/screen/language_menu
using.icon = ui_style
using.hud = src
Expand Down
50 changes: 50 additions & 0 deletions code/datums/minigames_menu.dm
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)
1 change: 1 addition & 0 deletions code/modules/capture_the_flag/_defines.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define CTF_REQUIRED_PLAYERS 4
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
#define INSTAGIB_RESPAWN 50 //5 seconds
#define DEFAULT_RESPAWN 150 //15 seconds
#define AMMO_DROP_LIFETIME 300
#define CTF_REQUIRED_PLAYERS 4



/obj/item/ctf
name = "banner"
Expand Down Expand Up @@ -730,4 +727,3 @@
#undef INSTAGIB_RESPAWN
#undef DEFAULT_RESPAWN
#undef AMMO_DROP_LIFETIME
#undef CTF_REQUIRED_PLAYERS
52 changes: 52 additions & 0 deletions code/modules/capture_the_flag/ctf_panel.dm
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
23 changes: 21 additions & 2 deletions code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_SPIRIT)
// of the mob
var/deadchat_name
var/datum/orbit_menu/orbit_menu
var/datum/spawners_menu/spawners_menu
var/datum/minigames_menu/minigames_menu

/mob/dead/observer/Initialize(mapload)
set_invisibility(GLOB.observer_default_invisibility)
Expand All @@ -69,7 +71,8 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_SPIRIT)
add_verb(list(
/mob/dead/observer/proc/dead_tele,
/mob/dead/observer/proc/open_spawners_menu,
/mob/dead/observer/proc/tray_view))
/mob/dead/observer/proc/tray_view,
/mob/dead/observer/proc/open_minigames_menu))

if(icon_state in GLOB.ghost_forms_with_directions_list)
ghostimage_default = image(src.icon,src,src.icon_state + "_nodir")
Expand All @@ -87,7 +90,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_SPIRIT)
var/turf/T
var/mob/body = loc
if(ismob(body))
T = get_turf(body) //Where is the body located?
T = get_turf(body) //Where is the body located?

gender = body.gender
if(body.mind && body.mind.name)
Expand Down Expand Up @@ -182,6 +185,8 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_SPIRIT)
updateallghostimages()

QDEL_NULL(orbit_menu)
QDEL_NULL(spawners_menu)
QDEL_NULL(minigames_menu)

var/datum/component/tracking_beacon/beacon = GetComponent(/datum/component/tracking_beacon)
if(beacon)
Expand Down Expand Up @@ -930,6 +935,20 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp

SSmobs.spawner_menu.ui_interact(src)

/mob/dead/observer/proc/open_minigames_menu()
set name = "Minigames Menu"
set desc = "See all currently available minigames"
set category = "Ghost"
if(!client)
return
if(!isobserver(src))
to_chat(usr, "<span class='warning'>You must be a ghost to play minigames!</span>")
return
if(!minigames_menu)
minigames_menu = new(src)

minigames_menu.ui_interact(src)

/mob/dead/observer/proc/tray_view()
set category = "Ghost"
set name = "T-ray view"
Expand Down
Binary file modified icons/mob/screen_ghost.dmi
Binary file not shown.
68 changes: 68 additions & 0 deletions tgui/packages/tgui/interfaces/CTFPanel.js
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}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Window title="CTF Panel" width={700} height={600}>
<Window title="CTF Panel" width={700} height={600} theme="generic">

<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>
);
};
20 changes: 20 additions & 0 deletions tgui/packages/tgui/interfaces/MinigamesMenu.js
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>
);
};
Loading