Skip to content

Commit

Permalink
Objective info and jump
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Oct 27, 2023
1 parent b7f97cd commit d2a5b0f
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 5 deletions.
34 changes: 29 additions & 5 deletions code/modules/admin/game_master/game_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)

// Objective stuff
data["objective_click_intercept"] = objective_click_intercept
data["game_master_objectives"] = length(GLOB.game_master_objectives) ? GLOB.game_master_objectives : ""

// Communication stuff
data["communication_clarity"] = GLOB.radio_communication_clarity
Expand Down Expand Up @@ -184,6 +185,23 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)
current_click_intercept_action = OBJECTIVE_CLICK_INTERCEPT_ACTION
return

if("jump_to")
if(!params["val"])
return

var/list/objective = params["val"]

var/atom/objective_atom = locate(objective["object_ref"])

var/turf/objective_turf = get_turf(objective_atom)

if(!objective_turf)
return TRUE

var/client/jumping_client = ui.user.client
jumping_client.jump_to_turf(objective_turf)
return TRUE

//Communication Section
if("use_game_master_phone")
game_master_phone.attack_hand(ui.user)
Expand Down Expand Up @@ -252,7 +270,10 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)
return TRUE

SSminimaps.remove_marker(object)
GLOB.game_master_objectives -= object
for(var/list/cycled_objective in GLOB.game_master_objectives)
var/atom/objective_object = locate(cycled_objective["object_ref"])
if(objective_object == object)
GLOB.game_master_objectives.Remove(list(cycled_objective))
return TRUE

if(tgui_alert(user, "Do you want to make [object] an objective?", "Confirmation", list("Yes", "No")) != "Yes")
Expand Down Expand Up @@ -283,12 +304,15 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)

SSminimaps.add_marker(object, z_level, MINIMAP_FLAG_USCM, given_image = background)

/// objective_info needs to be implemented both in the game master menu and overwatch TGUI
/// GLOB.game_master_objectives should also probably hold a datum with more info including the icon here for TGUI usage
/// - Morrow
var/objective_info = tgui_input_text(user, "Objective info?", "Objective Info")

GLOB.game_master_objectives[object] = objective_info || ""
var/object_ref = REF(object)

GLOB.game_master_objectives += list(list(
"object_name" = object.name,
"objective_info" = (objective_info || ""),
"object_ref" = object_ref,
))
return TRUE

else
Expand Down
37 changes: 37 additions & 0 deletions tgui/packages/tgui/interfaces/GameMaster.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export const GameMaster = (props, context) => {
<Flex.Item>
<Section title="Objectives">
<Flex grow>
<Section title="Objective">
<Flex direction="column">
<Flex.Item>
<Button
selected={data.objective_click_intercept}
Expand All @@ -81,6 +83,41 @@ export const GameMaster = (props, context) => {
}}
/>
</Flex.Item>
{data.game_master_objectives && (
<Flex.Item>
<Collapsible title="Objectives">
<Stack vertical>
{data.game_master_objectives.map((val) => {
if (val) {
return (
<Stack.Item>
<Divider />
<Flex>
<Flex.Item align="center">
<Button
content={val.object_name}
onClick={() => {
act('jump_to', { val });
}}
/>
</Flex.Item>
<Flex.Item
grow
pl={1}
py={0.25}
fontSize="12px">
{val.objective_info}
</Flex.Item>
</Flex>
</Stack.Item>
);
}
})}
<Divider />
</Stack>
</Collapsible>
</Flex.Item>
)}
</Flex>
</Section>
</Flex.Item>
Expand Down

0 comments on commit d2a5b0f

Please sign in to comment.