Skip to content

Commit

Permalink
The most cursed squad renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Nov 6, 2023
1 parent af4fb30 commit 0c0f4aa
Show file tree
Hide file tree
Showing 14 changed files with 172 additions and 11 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals/signals_global.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@
/// From /proc/biohazard_lockdown()
#define COMSIG_GLOB_RESEARCH_LOCKDOWN "research_lockdown_closed"
#define COMSIG_GLOB_RESEARCH_LIFT "research_lockdown_opened"

/// From /client/proc/rename_platoon()
#define COMSIG_GLOB_PLATOON_NAME_CHANGE "platoon_name_change"
26 changes: 26 additions & 0 deletions code/game/jobs/job/marine/squads.dm
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,32 @@

RegisterSignal(SSdcs, COMSIG_GLOB_MODE_POSTSETUP, PROC_REF(setup_supply_drop_list))

/datum/squad/marine/alpha/New()
. = ..()

RegisterSignal(SSdcs, COMSIG_GLOB_PLATOON_NAME_CHANGE, PROC_REF(rename_platoon))

/datum/squad/marine/alpha/proc/rename_platoon(datum/source, new_name, old_name)
SIGNAL_HANDLER

name = new_name

for(var/mob/living/carbon/human/marine in marines_list)
if(!istype(marine.wear_id, /obj/item/card/id))
continue

var/obj/item/card/id/marine_card = marine.wear_id
var/datum/weakref/marine_card_registered = marine.wear_id.registered_ref

if(!istype(marine_card_registered))
continue

if(marine != marine_card_registered.resolve())
continue

marine_card.assignment = "[new_name] [marine.job]"
marine_card.name = "[marine_card.registered_name]'s ID Card ([marine_card.assignment])"

/datum/squad/proc/setup_supply_drop_list()
SIGNAL_HANDLER

Expand Down
10 changes: 10 additions & 0 deletions code/game/machinery/cryopod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ GLOBAL_LIST_INIT(frozen_items, list(SQUAD_MARINE_1 = list(), SQUAD_MARINE_2 = li
/obj/structure/machinery/computer/cryopod/alpha
cryotype = SQUAD_MARINE_1

/obj/structure/machinery/computer/cryopod/alpha/Initialize()
. = ..()

RegisterSignal(SSdcs, COMSIG_GLOB_PLATOON_NAME_CHANGE, PROC_REF(rename_platoon))

/obj/structure/machinery/computer/cryopod/alpha/proc/rename_platoon(datum/source, new_name, old_name)
SIGNAL_HANDLER

cryotype = new_name

/obj/structure/machinery/computer/cryopod/bravo
cryotype = SQUAD_MARINE_2

Expand Down
23 changes: 23 additions & 0 deletions code/game/objects/effects/landmarks/landmarks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@
else
LAZYADD(GLOB.spawns_by_job[job], src)

RegisterSignal(SSdcs, COMSIG_GLOB_PLATOON_NAME_CHANGE, PROC_REF(rename_platoon))

/obj/effect/landmark/start/Destroy()
if(job)
if(squad)
Expand All @@ -263,6 +265,17 @@
LAZYREMOVE(GLOB.spawns_by_job[job], src)
return ..()

/obj/effect/landmark/start/proc/rename_platoon(datum/source, new_name, old_name)
SIGNAL_HANDLER
if(squad != old_name)
return

LAZYREMOVE(GLOB.spawns_by_squad_and_job, squad)
squad = new_name
LAZYINITLIST(GLOB.spawns_by_squad_and_job)
LAZYINITLIST(GLOB.spawns_by_squad_and_job[squad])
LAZYADD(GLOB.spawns_by_squad_and_job[squad][job], src)

/obj/effect/landmark/start/AISloc
name = "AI"

Expand Down Expand Up @@ -385,6 +398,16 @@
name = "alpha late join"
squad = SQUAD_MARINE_1

/obj/effect/landmark/late_join/alpha/Initialize(mapload, ...)
. = ..()

RegisterSignal(SSdcs, COMSIG_GLOB_PLATOON_NAME_CHANGE, PROC_REF(rename_platoon))

/obj/effect/landmark/late_join/alpha/proc/rename_platoon(datum/source, new_name, old_name)
SIGNAL_HANDLER

squad = new_name

/obj/effect/landmark/late_join/bravo
name = "bravo late join"
squad = SQUAD_MARINE_2
Expand Down
32 changes: 32 additions & 0 deletions code/game/objects/items/devices/radio/encryptionkey.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,38 @@
var/list/tracking_options
var/abstract = FALSE

/obj/item/device/encryptionkey/Initialize(mapload, ...)
. = ..()

RegisterSignal(SSdcs, COMSIG_GLOB_PLATOON_NAME_CHANGE, PROC_REF(rename_platoon))

if(!isnull(channels[SQUAD_MARINE_1]) && SQUAD_MARINE_1 != GLOB.main_platoon_name)
rename_platoon(null, GLOB.main_platoon_name, SQUAD_MARINE_1)

/obj/item/device/encryptionkey/proc/rename_platoon(datum/source, new_name, old_name)
SIGNAL_HANDLER

var/toggled_channel = channels[old_name]

if(isnull(toggled_channel))
return

channels -= old_name

channels[new_name] = toggled_channel

if(!istype(loc, /obj/item/device/radio/headset))
return

var/obj/item/device/radio/headset/current_headset = loc

var/passed_freq = current_headset.secure_radio_connections[old_name].frequency
current_headset.secure_radio_connections -= old_name

SSradio.remove_object(current_headset, passed_freq)

current_headset.recalculateChannels()

/obj/item/device/encryptionkey/binary
icon_state = "binary_key"
translate_apollo = TRUE
Expand Down
21 changes: 16 additions & 5 deletions code/game/objects/items/devices/radio/headset.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@
if(radiochannels[cycled_channel] == frequency)
default_freq = cycled_channel

RegisterSignal(SSdcs, COMSIG_GLOB_PLATOON_NAME_CHANGE, PROC_REF(rename_platoon))

if(SQUAD_MARINE_1 == default_freq && SQUAD_MARINE_1 != GLOB.main_platoon_name)
rename_platoon(null, GLOB.main_platoon_name, SQUAD_MARINE_1)

/obj/item/device/radio/headset/proc/rename_platoon(datum/source, new_name, old_name)
SIGNAL_HANDLER

set_frequency(frequency)

/obj/item/device/radio/headset/Destroy()
wearer = null
QDEL_NULL_LIST(keys)
Expand Down Expand Up @@ -763,11 +773,6 @@
if(istype(H, /mob/living/carbon/human))
if(H.assigned_squad)
switch(H.assigned_squad.name)
if(SQUAD_MARINE_1)
name = "[SQUAD_MARINE_1] radio headset"
desc = "This is used by [SQUAD_MARINE_1] squad members."
icon_state = "alpha_headset"
frequency = ALPHA_FREQ
if(SQUAD_MARINE_2)
name = "[SQUAD_MARINE_2] radio headset"
desc = "This is used by [SQUAD_MARINE_2] squad members."
Expand All @@ -792,6 +797,12 @@
desc = "This is used by [SQUAD_MARINE_CRYO] squad members."
frequency = CRYO_FREQ

if(H.assigned_squad.name == GLOB.main_platoon_name)
name = "[GLOB.main_platoon_name] radio headset"
desc = "This is used by [GLOB.main_platoon_name] squad members."
icon_state = "alpha_headset"
frequency = ALPHA_FREQ

switch(GET_DEFAULT_ROLE(H.job))
if(JOB_SQUAD_LEADER)
name = "marine leader " + name
Expand Down
2 changes: 2 additions & 0 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ var/list/roundstart_mod_verbs = list(
add_verb(src, /client/proc/togglebuildmodeself)
add_verb(src, /client/proc/toggle_game_master)
add_verb(src, /client/proc/toggle_join_xeno)
add_verb(src, /client/proc/rename_platoon)
if(CLIENT_HAS_RIGHTS(src, R_SERVER))
add_verb(src, admin_verbs_server)
if(CLIENT_HAS_RIGHTS(src, R_DEBUG))
Expand Down Expand Up @@ -359,6 +360,7 @@ var/list/roundstart_mod_verbs = list(
/client/proc/togglebuildmodeself,
/client/proc/toggle_game_master,
/client/proc/toggle_join_xeno,
/client/proc/rename_platoon,
admin_verbs_admin,
admin_verbs_ban,
admin_verbs_minor_event,
Expand Down
42 changes: 42 additions & 0 deletions code/modules/admin/game_master/extra_buttons/rename_platoon.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

GLOBAL_VAR_INIT(main_platoon_name, SQUAD_MARINE_1)

/// Ability to rename the platoon
/client/proc/rename_platoon()
set name = "Rename Platoon"
set category = "Game Master.Extras"

if(!admin_holder || !check_rights(R_MOD, FALSE))
return

var/new_name = tgui_input_text(mob, "New platoon name?", "Platoon Name", GLOB.main_platoon_name)
if(!new_name || !istext(new_name))
return

var/old_name = GLOB.main_platoon_name

var/channel = radiochannels[old_name]
radiochannels -= old_name

radiochannels[new_name] = channel

var/list/keys_to_readd = list()

for(var/key in department_radio_keys)
if(department_radio_keys[key] == old_name)
keys_to_readd += key
department_radio_keys -= key

for(var/key in keys_to_readd)
department_radio_keys[key] = new_name

ROLES_SQUAD_ALL -= old_name
ROLES_SQUAD_ALL += new_name

var/list/copy_frozen_platoon_items = GLOB.frozen_items[old_name]
GLOB.frozen_items -= old_name
GLOB.frozen_items[new_name] = copy_frozen_platoon_items

SEND_GLOBAL_SIGNAL(COMSIG_GLOB_PLATOON_NAME_CHANGE, new_name, old_name)

GLOB.main_platoon_name = new_name
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/// For PvE CM we start without the ability for people to join as xenos. This can be toggled by game masters.
/client/proc/toggle_join_xeno()
set name = "Toggle Player Xeno Joins"
set category = "Game Master"
set category = "Game Master.Extras"

if(!admin_holder || !check_rights(R_MOD, FALSE))
return
Expand Down
7 changes: 4 additions & 3 deletions code/modules/clothing/head/head.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@
if(istype(H))
if(H.assigned_squad)
switch(H.assigned_squad.name)
if(SQUAD_MARINE_1)
icon_state = "beret_alpha"
desc = "Often found atop heads, slightly less found on those still attached."
if(SQUAD_MARINE_2)
icon_state = "beret_bravo"
desc = "It has quite a lot of debris on it, the person wearing this probably moves less than a wall."
Expand All @@ -114,6 +111,10 @@
if(SQUAD_MARINE_5)
icon_state = "beret_echo"
desc = "Tightly Woven, as it should be."

if(H.assigned_squad.name == GLOB.main_platoon_name)
icon_state = "beret_alpha"
desc = "Often found atop heads, slightly less found on those still attached."
else
icon_state = "beret"
desc = initial(desc)
Expand Down
10 changes: 10 additions & 0 deletions code/modules/cm_marines/overwatch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,16 @@
icon_state = "alphadrop"
squad = SQUAD_MARINE_1

/obj/structure/supply_drop/alpha/Initialize(mapload, ...)
. = ..()

RegisterSignal(SSdcs, COMSIG_GLOB_PLATOON_NAME_CHANGE, PROC_REF(rename_platoon))

/obj/structure/supply_drop/alpha/proc/rename_platoon(datum/source, new_name, old_name)
SIGNAL_HANDLER

squad = new_name

/obj/structure/supply_drop/bravo
icon_state = "bravodrop"
squad = SQUAD_MARINE_2
Expand Down
3 changes: 2 additions & 1 deletion colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,8 @@
#include "code\modules\admin\ToRban.dm"
#include "code\modules\admin\game_master\game_master.dm"
#include "code\modules\admin\game_master\game_master_submenu.dm"
#include "code\modules\admin\game_master\toggle_join_xeno.dm"
#include "code\modules\admin\game_master\extra_buttons\rename_platoon.dm"
#include "code\modules\admin\game_master\extra_buttons\toggle_join_xeno.dm"
#include "code\modules\admin\game_master\game_master_submenu\vents.dm"
#include "code\modules\admin\medal_panel\medals_panel.dm"
#include "code\modules\admin\medal_panel\medals_panel_tgui.dm"
Expand Down
Binary file modified icons/obj/items/clothing/cm_hats.dmi
Binary file not shown.
2 changes: 1 addition & 1 deletion maps/map_files/golden_arrow/golden_arrow.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -5636,7 +5636,7 @@
},
/area/golden_arrow/hangar)
"Jb" = (
/obj/structure/machinery/cm_vending/clothing/medic/alpha,
/obj/structure/machinery/cm_vending/clothing/medic,
/turf/open/floor/almayer{
icon_state = "sterile_green"
},
Expand Down

0 comments on commit 0c0f4aa

Please sign in to comment.