Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
AndroBetel committed Aug 16, 2024
1 parent e1e6502 commit aa723b5
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 20 deletions.
4 changes: 2 additions & 2 deletions code/game/jobs/role_authority.dm
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,12 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou
new_human.job = new_job.title //TODO Why is this a mob variable at all?

if(new_job.gear_preset_whitelist[job_whitelist])
arm_equipment(new_human, new_job.gear_preset_whitelist[job_whitelist], FALSE, TRUE)
arm_equipment(new_human, new_job.gear_preset_whitelist[job_whitelist], FALSE, TRUE, late_join)
var/generated_account = new_job.generate_money_account(new_human)
new_job.announce_entry_message(new_human, generated_account, whitelist_status) //Tell them their spawn info.
new_job.generate_entry_conditions(new_human, whitelist_status) //Do any other thing that relates to their spawn.
else
arm_equipment(new_human, new_job.gear_preset, FALSE, TRUE) //After we move them, we want to equip anything else they should have.
arm_equipment(new_human, new_job.gear_preset, FALSE, TRUE, late_join) //After we move them, we want to equip anything else they should have.
var/generated_account = new_job.generate_money_account(new_human)
new_job.announce_entry_message(new_human, generated_account) //Tell them their spawn info.
new_job.generate_entry_conditions(new_human) //Do any other thing that relates to their spawn.
Expand Down
17 changes: 10 additions & 7 deletions code/modules/admin/game_master/extra_buttons/rename_platoon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ GLOBAL_VAR_INIT(main_platoon_initial_name, GLOB.main_platoon_name)
to_chat(src, SPAN_NOTICE("The platoon name should be 16 characters or less."))
return

do_rename_platoon(new_name, mob)

/proc/do_rename_platoon(name, mob/renamer)
var/old_name = GLOB.main_platoon_name

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

radiochannels[new_name] = channel
radiochannels[name] = channel

var/list/keys_to_readd = list()

Expand All @@ -47,17 +50,17 @@ GLOBAL_VAR_INIT(main_platoon_initial_name, GLOB.main_platoon_name)
department_radio_keys -= key

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

ROLES_SQUAD_ALL -= old_name
ROLES_SQUAD_ALL += new_name
ROLES_SQUAD_ALL += 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
GLOB.frozen_items[name] = copy_frozen_platoon_items

SEND_GLOBAL_SIGNAL(COMSIG_GLOB_PLATOON_NAME_CHANGE, new_name, old_name)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_PLATOON_NAME_CHANGE, name, old_name)

log_admin("[key_name(src)] has renamed the platoon from [GLOB.main_platoon_name] to [new_name].")
log_admin("[key_name(renamer)] has renamed the platoon from [GLOB.main_platoon_name] to [name].")

GLOB.main_platoon_name = new_name
GLOB.main_platoon_name = name
6 changes: 3 additions & 3 deletions code/modules/admin/verbs/select_equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,19 @@

//note: when adding new dresscodes, on top of adding a proper skills_list, make sure the ID given has
//a rank that matches a job title unless you want the human to bypass the skill system.
/proc/arm_equipment(mob/living/carbon/human/M, dresscode, randomise = FALSE, count_participant = FALSE, client/mob_client, show_job_gear = TRUE)
/proc/arm_equipment(mob/living/carbon/human/M, dresscode, randomise = FALSE, count_participant = FALSE, client/mob_client, show_job_gear = TRUE, late_join)
if(ispath(dresscode))
if(!GLOB.gear_path_presets_list)
CRASH("arm_equipment !gear_path_presets_list")
if(!GLOB.gear_path_presets_list[dresscode])
CRASH("arm_equipment !gear_path_presets_list[dresscode]")
GLOB.gear_path_presets_list[dresscode].load_preset(M, randomise, count_participant, mob_client, show_job_gear)
GLOB.gear_path_presets_list[dresscode].load_preset(M, randomise, count_participant, mob_client, show_job_gear, late_join)
else
if(!GLOB.gear_name_presets_list)
CRASH("arm_equipment !gear_path_presets_list")
if(!GLOB.gear_name_presets_list[dresscode])
CRASH("arm_equipment !gear_path_presets_list[dresscode]")
GLOB.gear_name_presets_list[dresscode].load_preset(M, randomise, count_participant, mob_client, show_job_gear)
GLOB.gear_name_presets_list[dresscode].load_preset(M, randomise, count_participant, mob_client, show_job_gear, late_join)

if(M.faction)
M.check_event_info(M.faction)
Expand Down
19 changes: 18 additions & 1 deletion code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define MENU_MENTOR "mentor"
#define MENU_SETTINGS "settings"
#define MENU_SPECIAL "special"
#define MENU_PLTCO "pltco"

var/list/preferences_datums = list()

Expand Down Expand Up @@ -243,6 +244,8 @@ var/const/MAX_SAVE_SLOTS = 10

/// If this client has auto observe enabled, used by /datum/orbit_menu
var/auto_observe = TRUE
/// Name for platoon used when spawning as LT
var/platoon_name = "Sun Riders"

/datum/preferences/New(client/C)
key_bindings = deep_copy_list(GLOB.hotkey_keybinding_list_by_key) // give them default keybinds and update their movement keys
Expand Down Expand Up @@ -307,6 +310,7 @@ var/const/MAX_SAVE_SLOTS = 10

dat += "<center>"
dat += "<a[current_menu == MENU_MARINE ? " class='linkOff'" : ""] href=\"byond://?src=\ref[user];preference=change_menu;menu=[MENU_MARINE]\"><b>Human</b></a> - "
dat += "<a[current_menu == MENU_PLTCO ? " class='linkOff'" : ""] href=\"byond://?src=\ref[user];preference=change_menu;menu=[MENU_PLTCO]\"><b>Platoon Commander</b></a> - "
dat += "<a[current_menu == MENU_XENOMORPH ? " class='linkOff'" : ""] href=\"byond://?src=\ref[user];preference=change_menu;menu=[MENU_XENOMORPH]\"><b>Xenomorph</b></a> - "
if(RoleAuthority.roles_whitelist[user.ckey] & WHITELIST_COMMANDER)
dat += "<a[current_menu == MENU_CO ? " class='linkOff'" : ""] href=\"byond://?src=\ref[user];preference=change_menu;menu=[MENU_CO]\"><b>Commanding Officer</b></a> - "
Expand Down Expand Up @@ -434,6 +438,12 @@ var/const/MAX_SAVE_SLOTS = 10
dat += "<b>Flavor Text:</b> <a href='byond://?src=\ref[user];preference=flavor_text;task=open'><b>[TextPreview(flavor_texts["general"], 15)]</b></a><br>"
dat += "</div>"

if(MENU_PLTCO)
dat += "<div id='column1'>"
dat += "<h2><b><u>Platoon Settings:</u></b></h2>"
dat += "<b>Platoon Name:</b> <a href='?_src_=prefs;preference=plat_name;task=input'><b>[platoon_name]</b></a><br>"
dat += "</div>"

if(MENU_XENOMORPH)
dat += "<div id='column1'>"
dat += "<h2><b><u>Xenomorph Information:</u></b></h2>"
Expand Down Expand Up @@ -1251,6 +1261,13 @@ var/const/MAX_SAVE_SLOTS = 10
return
ghost_vision_pref = choice

if("plat_name")
var/raw_name = input(user, "Choose your Platoon's name:", "Character Preference") as text|null
if(length(raw_name) > 16 || !length(raw_name)) // Check to ensure that the user entered text (rather than cancel.)
to_chat(user, "<font color='red'>Invalid name. Your name should be at least 2 and at most [MAX_NAME_LEN] characters long. It may only contain the characters A-Z, a-z, -, ' and .</font>")
else
platoon_name = raw_name

if("synth_name")
var/raw_name = input(user, "Choose your Synthetic's name:", "Character Preference") as text|null
if(raw_name) // Check to ensure that the user entered text (rather than cancel.)
Expand Down Expand Up @@ -1994,7 +2011,6 @@ var/const/MAX_SAVE_SLOTS = 10

if("change_menu")
current_menu = href_list["menu"]

ShowChoices(user)
return 1

Expand Down Expand Up @@ -2333,3 +2349,4 @@ var/const/MAX_SAVE_SLOTS = 10
#undef MENU_MENTOR
#undef MENU_SETTINGS
#undef MENU_SPECIAL
#undef MENU_PLTCO
6 changes: 6 additions & 0 deletions code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@
S["adaptive_zoom"] >> adaptive_zoom
S["tooltips"] >> tooltips

S["plat_name"] >> platoon_name

//Sanitize
ooccolor = sanitize_hexcolor(ooccolor, CONFIG_GET(string/ooc_color_normal))
lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
Expand Down Expand Up @@ -357,6 +359,7 @@
custom_cursors = sanitize_integer(custom_cursors, FALSE, TRUE, TRUE)
pref_special_job_options = sanitize_islist(pref_special_job_options, list())
pref_job_slots = sanitize_islist(pref_job_slots, list())
platoon_name = platoon_name ? sanitize_text(platoon_name, initial(platoon_name)) : initial(platoon_name)
vars["fps"] = fps

if(remembered_key_bindings)
Expand Down Expand Up @@ -481,6 +484,7 @@
S["no_radials_preference"] << no_radials_preference
S["no_radial_labels_preference"] << no_radial_labels_preference
S["custom_cursors"] << custom_cursors
S["plat_name"] << platoon_name

S.Unlock()

Expand Down Expand Up @@ -583,6 +587,7 @@

S["uplinklocation"] >> uplinklocation
S["exploit_record"] >> exploit_record
S["plat_name"] >> platoon_name

S.Unlock()

Expand Down Expand Up @@ -740,6 +745,7 @@

S["uplinklocation"] << uplinklocation
S["exploit_record"] << exploit_record
S["plat_name"] << platoon_name

S.Unlock()

Expand Down
7 changes: 6 additions & 1 deletion code/modules/gear_presets/_select_equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
/datum/equipment_preset/proc/load_languages(mob/living/carbon/human/new_human, client/mob_client)
new_human.set_languages(languages)

/datum/equipment_preset/proc/load_preset(mob/living/carbon/human/new_human, randomise = FALSE, count_participant = FALSE, client/mob_client, show_job_gear = TRUE)
/datum/equipment_preset/proc/load_preset(mob/living/carbon/human/new_human, randomise = FALSE, count_participant = FALSE, client/mob_client, show_job_gear = TRUE, late_join)
load_race(new_human, mob_client)
if(randomise || uses_special_name)
load_name(new_human, randomise, mob_client)
Expand All @@ -163,6 +163,8 @@

new_human.regenerate_icons()

handle_late_join(new_human, late_join)

new_human.marine_points = MARINE_TOTAL_BUY_POINTS //resetting buy points
new_human.marine_snowflake_points = MARINE_TOTAL_SNOWFLAKE_POINTS
new_human.marine_buyable_categories = MARINE_CAN_BUY_ALL
Expand Down Expand Up @@ -381,6 +383,9 @@ GLOBAL_LIST_EMPTY(personal_closets)

return background

/datum/equipment_preset/proc/handle_late_join(mob/living/carbon/human/new_human, late_join)
return

/datum/equipment_preset/strip //For removing all equipment
name = "*strip*"
flags = EQUIPMENT_PRESET_EXTRA
Expand Down
11 changes: 5 additions & 6 deletions code/modules/gear_presets/uscm_ship.dm
Original file line number Diff line number Diff line change
Expand Up @@ -594,13 +594,12 @@
new_human.equip_to_slot_or_del(new /obj/item/storage/pouch/general/medium(new_human), WEAR_R_STORE)
new_human.equip_to_slot_or_del(new /obj/item/device/binoculars/range(new_human), WEAR_L_HAND)

/datum/equipment_preset/uscm_ship/so/load_status(mob/living/carbon/human/new_human, client/mob_client)
. = ..()

if(!new_human.client)
return
/datum/equipment_preset/uscm_ship/so/handle_late_join(mob/living/carbon/human/new_human, late_join)
to_chat(world, "[new_human.name], [late_join ? "YES" : "NO"]")
if(!late_join)
add_verb(new_human.client, /client/proc/commander_rename_platoon)

add_verb(new_human.client, /client/proc/commander_rename_platoon)
do_rename_platoon(new_human.client.prefs.platoon_name)

/datum/equipment_preset/uscm_ship/so/lesser_rank
paygrade = "MO1"
Expand Down

0 comments on commit aa723b5

Please sign in to comment.