From aa723b5b12694ebb22ada592e4e22906a9a85dbe Mon Sep 17 00:00:00 2001 From: AndroBetel <44546836+AndroBetel@users.noreply.github.com> Date: Fri, 16 Aug 2024 15:14:34 +0300 Subject: [PATCH] 1 --- code/game/jobs/role_authority.dm | 4 ++-- .../extra_buttons/rename_platoon.dm | 17 ++++++++++------- code/modules/admin/verbs/select_equipment.dm | 6 +++--- code/modules/client/preferences.dm | 19 ++++++++++++++++++- code/modules/client/preferences_savefile.dm | 6 ++++++ .../modules/gear_presets/_select_equipment.dm | 7 ++++++- code/modules/gear_presets/uscm_ship.dm | 11 +++++------ 7 files changed, 50 insertions(+), 20 deletions(-) diff --git a/code/game/jobs/role_authority.dm b/code/game/jobs/role_authority.dm index 42ffc22570..af57c4323a 100644 --- a/code/game/jobs/role_authority.dm +++ b/code/game/jobs/role_authority.dm @@ -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. diff --git a/code/modules/admin/game_master/extra_buttons/rename_platoon.dm b/code/modules/admin/game_master/extra_buttons/rename_platoon.dm index 575319ad73..e596aee195 100644 --- a/code/modules/admin/game_master/extra_buttons/rename_platoon.dm +++ b/code/modules/admin/game_master/extra_buttons/rename_platoon.dm @@ -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() @@ -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 diff --git a/code/modules/admin/verbs/select_equipment.dm b/code/modules/admin/verbs/select_equipment.dm index 83a9cb1a06..560afc1a65 100644 --- a/code/modules/admin/verbs/select_equipment.dm +++ b/code/modules/admin/verbs/select_equipment.dm @@ -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) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index e54d86c7b7..710505eac7 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -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() @@ -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 @@ -307,6 +310,7 @@ var/const/MAX_SAVE_SLOTS = 10 dat += "
" dat += "Human - " + dat += "Platoon Commander - " dat += "Xenomorph - " if(RoleAuthority.roles_whitelist[user.ckey] & WHITELIST_COMMANDER) dat += "Commanding Officer - " @@ -434,6 +438,12 @@ var/const/MAX_SAVE_SLOTS = 10 dat += "Flavor Text: [TextPreview(flavor_texts["general"], 15)]
" dat += "" + if(MENU_PLTCO) + dat += "
" + dat += "

Platoon Settings:

" + dat += "Platoon Name: [platoon_name]
" + dat += "
" + if(MENU_XENOMORPH) dat += "
" dat += "

Xenomorph Information:

" @@ -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, "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 .") + 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.) @@ -1994,7 +2011,6 @@ var/const/MAX_SAVE_SLOTS = 10 if("change_menu") current_menu = href_list["menu"] - ShowChoices(user) return 1 @@ -2333,3 +2349,4 @@ var/const/MAX_SAVE_SLOTS = 10 #undef MENU_MENTOR #undef MENU_SETTINGS #undef MENU_SPECIAL +#undef MENU_PLTCO diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 4e6e166b2b..f4941945cb 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -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)) @@ -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) @@ -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() @@ -583,6 +587,7 @@ S["uplinklocation"] >> uplinklocation S["exploit_record"] >> exploit_record + S["plat_name"] >> platoon_name S.Unlock() @@ -740,6 +745,7 @@ S["uplinklocation"] << uplinklocation S["exploit_record"] << exploit_record + S["plat_name"] << platoon_name S.Unlock() diff --git a/code/modules/gear_presets/_select_equipment.dm b/code/modules/gear_presets/_select_equipment.dm index 6aefa9a673..9e2f860228 100644 --- a/code/modules/gear_presets/_select_equipment.dm +++ b/code/modules/gear_presets/_select_equipment.dm @@ -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) @@ -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 @@ -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 diff --git a/code/modules/gear_presets/uscm_ship.dm b/code/modules/gear_presets/uscm_ship.dm index 905fa8265b..00e1e5ddcf 100644 --- a/code/modules/gear_presets/uscm_ship.dm +++ b/code/modules/gear_presets/uscm_ship.dm @@ -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"