From fce8f946e1c87b865d167b25dc0659d3765fc595 Mon Sep 17 00:00:00 2001 From: AndroBetel <44546836+AndroBetel@users.noreply.github.com> Date: Tue, 10 Sep 2024 22:38:33 +0300 Subject: [PATCH] LT prefs menu (#383) --- code/__DEFINES/__game.dm | 6 ++ code/_globalvars/global_lists.dm | 3 + code/game/jobs/job/job.dm | 4 +- code/game/jobs/role_authority.dm | 6 +- .../structures/stool_bed_chair_nest/chairs.dm | 1 + .../extra_buttons/rename_platoon.dm | 63 ++++++++++++++++--- code/modules/admin/verbs/select_equipment.dm | 6 +- code/modules/client/preferences.dm | 29 ++++++++- code/modules/client/preferences_savefile.dm | 10 +++ .../modules/gear_presets/_select_equipment.dm | 7 ++- code/modules/gear_presets/uscm_ship.dm | 19 ++++++ 11 files changed, 134 insertions(+), 20 deletions(-) diff --git a/code/__DEFINES/__game.dm b/code/__DEFINES/__game.dm index 532caa08b0..67b97d7815 100644 --- a/code/__DEFINES/__game.dm +++ b/code/__DEFINES/__game.dm @@ -553,3 +553,9 @@ #define PERF_TOGGLE_SHUTTLES (1<<3) /// Disables loading Techwebs and additional Z-Levels #define PERF_TOGGLE_TECHWEBS (1<<4) + +/// Dropship Camos +#define DROPSHIP_CAMO_TAN "Tan" +#define DROPSHIP_CAMO_NAVY "Navy" +#define DROPSHIP_CAMO_URBAN "Urban" +#define DROPSHIP_CAMO_JUNGLE "Jungle" diff --git a/code/_globalvars/global_lists.dm b/code/_globalvars/global_lists.dm index ee444cf63f..8d9d683318 100644 --- a/code/_globalvars/global_lists.dm +++ b/code/_globalvars/global_lists.dm @@ -211,6 +211,9 @@ GLOBAL_REFERENCE_LIST_INDEXED(hair_styles_list, /datum/sprite_accessory/hair, na GLOBAL_REFERENCE_LIST_INDEXED(facial_hair_styles_list, /datum/sprite_accessory/facial_hair, name) //stores /datum/sprite_accessory/facial_hair indexed by name GLOBAL_REFERENCE_LIST_INDEXED(hair_gradient_list, /datum/sprite_accessory/hair_gradient, name) GLOBAL_REFERENCE_LIST_INDEXED(yautja_hair_styles_list, /datum/sprite_accessory/yautja_hair, name) + //Dropship camos + +GLOBAL_LIST_INIT(dropship_camos, list(DROPSHIP_CAMO_TAN, DROPSHIP_CAMO_NAVY, DROPSHIP_CAMO_URBAN, DROPSHIP_CAMO_JUNGLE)) //Backpacks var/global/list/backbaglist = list("Backpack", "Satchel") diff --git a/code/game/jobs/job/job.dm b/code/game/jobs/job/job.dm index 103c826ce5..97317916af 100644 --- a/code/game/jobs/job/job.dm +++ b/code/game/jobs/job/job.dm @@ -286,12 +286,12 @@ human.job = title //TODO Why is this a mob variable at all? if(gear_preset_whitelist[job_whitelist]) - arm_equipment(human, gear_preset_whitelist[job_whitelist], FALSE, TRUE) + arm_equipment(human, gear_preset_whitelist[job_whitelist], FALSE, TRUE, late_join = FALSE) var/generated_account = generate_money_account(human) announce_entry_message(human, generated_account, whitelist_status) //Tell them their spawn info. generate_entry_conditions(human, whitelist_status) //Do any other thing that relates to their spawn. else - arm_equipment(human, gear_preset, FALSE, TRUE) //After we move them, we want to equip anything else they should have. + arm_equipment(human, gear_preset, FALSE, TRUE, FALSE) //After we move them, we want to equip anything else they should have. var/generated_account = generate_money_account(human) announce_entry_message(human, generated_account) //Tell them their spawn info. generate_entry_conditions(human) //Do any other thing that relates to their spawn. diff --git a/code/game/jobs/role_authority.dm b/code/game/jobs/role_authority.dm index ea6ec48d60..f26bef936c 100644 --- a/code/game/jobs/role_authority.dm +++ b/code/game/jobs/role_authority.dm @@ -477,7 +477,7 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou M.job = null -/datum/authority/branch/role/proc/equip_role(mob/living/new_mob, datum/job/new_job, turf/late_join) +/datum/authority/branch/role/proc/equip_role(mob/living/new_mob, datum/job/new_job, late_join) if(!istype(new_mob) || !istype(new_job)) return @@ -500,12 +500,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 = 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 = 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/game/objects/structures/stool_bed_chair_nest/chairs.dm b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm index ace85b2f23..956c902e96 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm @@ -397,6 +397,7 @@ /obj/structure/bed/chair/dropship/passenger/afterbuckle() + . = ..() if(buckled_mob) icon_state = initial(icon_state) + "_buckled" overlays += chairbar 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..067a437070 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,57 @@ 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 - - SEND_GLOBAL_SIGNAL(COMSIG_GLOB_PLATOON_NAME_CHANGE, new_name, old_name) - - log_admin("[key_name(src)] has renamed the platoon from [GLOB.main_platoon_name] to [new_name].") - - GLOB.main_platoon_name = new_name + GLOB.frozen_items[name] = copy_frozen_platoon_items + + SEND_GLOBAL_SIGNAL(COMSIG_GLOB_PLATOON_NAME_CHANGE, name, old_name) + + log_admin("[key_name(renamer)] has renamed the platoon from [GLOB.main_platoon_name] to [name].") + + GLOB.main_platoon_name = name + + +/proc/change_dropship_camo(camo, mob/renamer) + var/turf_icon + var/cargo_icon + var/cockpit_icon + + switch(camo) + if(DROPSHIP_CAMO_TAN) + turf_icon = 'icons/turf/dropship.dmi' + cargo_icon = 'icons/obj/structures/doors/dropship1_cargo.dmi' + cockpit_icon = 'icons/obj/structures/doors/dropship1_pilot.dmi' + if(DROPSHIP_CAMO_NAVY) + turf_icon = 'icons/turf/dropship2.dmi' + cargo_icon = 'icons/obj/structures/doors/dropship2_cargo.dmi' + cockpit_icon = 'icons/obj/structures/doors/dropship2_pilot.dmi' + if(DROPSHIP_CAMO_URBAN) + turf_icon = 'icons/turf/dropship3.dmi' + cargo_icon = 'icons/obj/structures/doors/dropship2_cargo.dmi' + cockpit_icon = 'icons/obj/structures/doors/dropship2_pilot.dmi' + if(DROPSHIP_CAMO_JUNGLE) + turf_icon = 'icons/turf/dropship4.dmi' + cargo_icon = 'icons/obj/structures/doors/dropship4_cargo.dmi' + cockpit_icon = 'icons/obj/structures/doors/dropship4_pilot.dmi' + + for(var/turf/closed/shuttle/midway/midway_turfs in world) + if(istype(midway_turfs.loc, /area/shuttle/midway)) + midway_turfs.icon = turf_icon + for(var/obj/structure/shuttle/part/midway/midway_parts in world) + var/turf/turf_to_check = get_turf(midway_parts) + if(istype(turf_to_check.loc, /area/shuttle/midway)) + midway_parts.icon = turf_icon + for(var/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/cargo in world) + var/turf/turf_to_check = get_turf(cargo) + if(istype(turf_to_check.loc, /area/shuttle/midway)) + cargo.icon = cargo_icon + for(var/obj/structure/machinery/door/airlock/hatch/cockpit/cockpit in world) + var/turf/turf_to_check = get_turf(cockpit) + if(istype(turf_to_check.loc, /area/shuttle/midway)) + cockpit.icon = cockpit_icon 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 dc67dcd57d..a0428133fd 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() @@ -244,6 +245,11 @@ var/const/MAX_SAVE_SLOTS = 20 /// 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" + /// Dropship camo used when spawning as LT + var/dropship_camo = DROPSHIP_CAMO_JUNGLE + /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 macros = new(C, src) @@ -307,6 +313,7 @@ var/const/MAX_SAVE_SLOTS = 20 dat += "
" dat += "Human - " + dat += "Platoon Commander - " dat += "Xenomorph - " if(RoleAuthority.roles_whitelist[user.ckey] & WHITELIST_COMMANDER) dat += "Commanding Officer - " @@ -433,6 +440,13 @@ var/const/MAX_SAVE_SLOTS = 20 dat += "Flavor Text: [TextPreview(flavor_texts["general"], 15)]
" dat += "" + if(MENU_PLTCO) + dat += "
" + dat += "

Platoon Settings:

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

Xenomorph Information:

" @@ -1259,6 +1273,19 @@ var/const/MAX_SAVE_SLOTS = 20 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 ("dropship_camo") + var/new_camo = tgui_input_list(user, "Choose your platoon's dropship camo:", "Character Preferences", GLOB.dropship_camos) + + if (new_camo) + dropship_camo = new_camo + 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.) @@ -2002,7 +2029,6 @@ var/const/MAX_SAVE_SLOTS = 20 if("change_menu") current_menu = href_list["menu"] - ShowChoices(user) return 1 @@ -2341,3 +2367,4 @@ var/const/MAX_SAVE_SLOTS = 20 #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..28a53d866d 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -467,6 +467,7 @@ S["yautja_status"] << yautja_status S["synth_status"] << synth_status + S["lang_chat_disabled"] << lang_chat_disabled S["show_permission_errors"] << show_permission_errors S["key_bindings"] << key_bindings @@ -584,6 +585,9 @@ S["uplinklocation"] >> uplinklocation S["exploit_record"] >> exploit_record + S["ds_camo"] >> dropship_camo + S["plat_name"] >> platoon_name + S.Unlock() //Sanitize @@ -633,6 +637,9 @@ preferred_armor = sanitize_inlist(preferred_armor, GLOB.armor_style_list, "Random") //b_type = sanitize_text(b_type, initial(b_type)) + platoon_name = platoon_name ? sanitize_text(platoon_name, initial(platoon_name)) : "Sun Riders" + dropship_camo = sanitize_inlist(dropship_camo, GLOB.dropship_camos, initial(dropship_camo)) + alternate_option = sanitize_integer(alternate_option, 0, 2, initial(alternate_option)) if(!job_preference_list) ResetJobs() @@ -741,6 +748,9 @@ S["uplinklocation"] << uplinklocation S["exploit_record"] << exploit_record + S["ds_camo"] << dropship_camo + S["plat_name"] << platoon_name + S.Unlock() return TRUE diff --git a/code/modules/gear_presets/_select_equipment.dm b/code/modules/gear_presets/_select_equipment.dm index 8dafd13b36..68cd563f6e 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 630669ad32..e6c37a7bbd 100644 --- a/code/modules/gear_presets/uscm_ship.dm +++ b/code/modules/gear_presets/uscm_ship.dm @@ -612,6 +612,18 @@ 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/handle_late_join(mob/living/carbon/human/new_human, late_join) + if(late_join) + return + + add_verb(new_human.client, /client/proc/commander_rename_platoon) + + do_rename_platoon(new_human.client.prefs.platoon_name) + change_dropship_camo(new_human.client.prefs.dropship_camo) + +/datum/equipment_preset/uscm_ship/so/lesser_rank + paygrade = "MO1" + /datum/equipment_preset/uscm_ship/so/upp name = "UPP Platoon Commander (PltCo)" languages = list(LANGUAGE_RUSSIAN, LANGUAGE_ENGLISH) @@ -641,6 +653,13 @@ new_human.equip_to_slot_or_del(new /obj/item/storage/pouch/general/large(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/upp/handle_late_join(mob/living/carbon/human/new_human, late_join) + if(!late_join) + add_verb(new_human.client, /client/proc/commander_rename_platoon) + +/datum/equipment_preset/uscm_ship/so/upp/lesser_rank + paygrade = "UO1" + //*****************************************************************************************************/ /datum/equipment_preset/uscm_ship/sea