Skip to content

Commit

Permalink
Comms clarity (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf authored Oct 22, 2023
1 parent 7a37db5 commit 29c6e3b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
13 changes: 12 additions & 1 deletion code/modules/admin/game_master/game_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
/// Assoc list that holds our custom game master objectives, formatted as atom = objective_string
GLOBAL_LIST_EMPTY(game_master_objectives)

/// Percentage of characters end up clear when sent via radio message
GLOBAL_VAR_INIT(radio_communication_clarity, 100)

/proc/open_game_master_panel(client/using_client)
set name = "Game Master Panel"
set category = "Game Master"
Expand Down Expand Up @@ -72,7 +75,6 @@ GLOBAL_LIST_EMPTY(game_master_objectives)

/// End Objective Stuff


/// Holds what type of click intercept we are using
var/current_click_intercept_action

Expand Down Expand Up @@ -105,6 +107,8 @@ GLOBAL_LIST_EMPTY(game_master_objectives)
// Objective stuff
data["objective_click_intercept"] = objective_click_intercept

// Communication stuff
data["communication_clarity"] = GLOB.radio_communication_clarity

return data

Expand Down Expand Up @@ -161,6 +165,13 @@ GLOBAL_LIST_EMPTY(game_master_objectives)
current_click_intercept_action = OBJECTIVE_CLICK_INTERCEPT_ACTION
return

//Communication Section
if("set_communication_clarity")
var/new_clarity = text2num(params["clarity"])
if(!isnum(new_clarity))
return

GLOB.radio_communication_clarity = clamp(new_clarity, 0, 100)

/datum/game_master/ui_close(mob/user)
. = ..()
Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/hear_say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
else
message = stars(message)

if(GLOB.radio_communication_clarity < 100)
message = stars(message, GLOB.radio_communication_clarity)

if(language)
style = language.color

Expand Down
30 changes: 28 additions & 2 deletions tgui/packages/tgui/interfaces/GameMaster.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useBackend } from '../backend';
import { Flex, Dropdown, Button, Section } from '../components';
import { Flex, Dropdown, Button, Section, Slider } from '../components';
import { Window } from '../layouts';

export const GameMaster = (props, context) => {
Expand All @@ -25,7 +25,7 @@ export const GameMaster = (props, context) => {
}}
/>
</Flex.Item>
<Flex.Item grow>
<Flex.Item>
<Dropdown
options={data.spawnable_xenos}
selected={data.selected_xeno}
Expand Down Expand Up @@ -76,6 +76,32 @@ export const GameMaster = (props, context) => {
</Flex>
</Section>
</Flex.Item>
<Flex.Item>
<Section title="Communication">
<Flex grow direction="column">
<Flex.Item>
<Button
content="Game Master Phone (SoonTM)"
onClick={() => {
act('use_game_master_phone');
}}
/>
</Flex.Item>
<Flex.Item>Communication Clarity</Flex.Item>
<Flex.Item>
<Slider
maxValue={100}
minValue={0}
value={data.communication_clarity}
suppressFlicker={2500}
onChange={(e, clarity) => {
act('set_communication_clarity', { clarity });
}}
/>
</Flex.Item>
</Flex>
</Section>
</Flex.Item>
</Flex>
</Window.Content>
</Window>
Expand Down

0 comments on commit 29c6e3b

Please sign in to comment.