Skip to content

Commit

Permalink
Medals (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Apr 10, 2024
1 parent 4020295 commit 4475857
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"**/.pnp.*": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"files.eol": "\n",
"files.insertFinalNewline": true,
Expand Down
21 changes: 19 additions & 2 deletions code/datums/medal_awards.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#define MARINE_VALOR_MEDAL "medal of valor"
#define MARINE_HEROISM_MEDAL "medal of exceptional heroism"

#define ALL_MARINE_MEDALS list(MARINE_CONDUCT_MEDAL, MARINE_BRONZE_HEART_MEDAL, MARINE_VALOR_MEDAL, MARINE_HEROISM_MEDAL)

#define XENO_SLAUGHTER_MEDAL "royal jelly of slaughter"
#define XENO_RESILIENCE_MEDAL "royal jelly of resilience"
#define XENO_SABOTAGE_MEDAL "royal jelly of sabotage"
Expand Down Expand Up @@ -35,7 +37,6 @@ GLOBAL_LIST_EMPTY(jelly_awards)
giver_mob = list()
giver_ckey = list()


/proc/give_medal_award(medal_location, as_admin = FALSE)
if(as_admin && !check_rights(R_ADMIN))
as_admin = FALSE
Expand All @@ -45,14 +46,22 @@ GLOBAL_LIST_EMPTY(jelly_awards)
var/list/recipient_ranks = list()
for(var/datum/data/record/record in GLOB.data_core.general)
var/recipient_name = record.fields["name"]
if(usr.real_name == recipient_name && !as_admin)
continue
recipient_ranks[recipient_name] = record.fields["rank"]
possible_recipients += recipient_name

var/chosen_recipient = tgui_input_list(usr, "Who do you want to award a medal to?", "Medal Recipient", possible_recipients)
if(!chosen_recipient)
return FALSE

var/list/choosable_medals = list(MARINE_CONDUCT_MEDAL)

if(as_admin)
choosable_medals = ALL_MARINE_MEDALS

// Pick a medal
var/medal_type = tgui_input_list(usr, "What type of medal do you want to award?", "Medal Type", list(MARINE_CONDUCT_MEDAL, MARINE_BRONZE_HEART_MEDAL, MARINE_VALOR_MEDAL, MARINE_HEROISM_MEDAL))
var/medal_type = tgui_input_list(usr, "What type of medal do you want to award?", "Medal Type", choosable_medals)
if(!medal_type)
return FALSE

Expand Down Expand Up @@ -179,6 +188,14 @@ GLOBAL_LIST_EMPTY(jelly_awards)
user.visible_message("ERROR: ID card not registered for [user.real_name] in USCM registry. Potential medal fraud detected.")
return

if(!(FACTION_USCM in user.faction_group))
to_chat(user, SPAN_WARNING("Medals only available for USCM personnel."))
return

if(length(GLOB.medal_awards))
to_chat(user, SPAN_WARNING("Only one medal may be awarded per operation."))
return

if(give_medal_award(get_turf(printer)))
user.visible_message(SPAN_NOTICE("[printer] prints a medal."))

Expand Down
5 changes: 4 additions & 1 deletion code/datums/paygrades/paygrade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ GLOBAL_LIST_INIT(co_paygrades, list(
"MO6E",
"MO6C",
"MO5",
"MO4"
"MO4",
"MO3",
"MO2",
"MO1",
))

GLOBAL_LIST_INIT(wy_paygrades, list(
Expand Down
7 changes: 7 additions & 0 deletions code/modules/cm_marines/overwatch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,17 @@
return
change_lead(user, params["ref"])

if("award_medal")
print_medal(user, src)
return

if("insubordination")
mark_insubordination()
return

if("transfer_marine")
transfer_squad()
return

if("change_locations_ignored")
switch(z_hidden)
Expand Down
7 changes: 2 additions & 5 deletions tgui/packages/tgui/interfaces/OverwatchConsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,8 @@ const SquadMonitor = (props, context) => {
onClick={() => act('transfer_marine')}>
Transfer Marine
</Button>
<Button
color="red"
icon="running"
onClick={() => act('insubordination')}>
Insubordination
<Button color="blue" icon="medal" onClick={() => act('award_medal')}>
Award Medal
</Button>
</>
}>
Expand Down

0 comments on commit 4475857

Please sign in to comment.