Skip to content

Commit

Permalink
LT prefs menu (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndroBetel committed Sep 10, 2024
1 parent 3543c18 commit fce8f94
Show file tree
Hide file tree
Showing 11 changed files with 134 additions and 20 deletions.
6 changes: 6 additions & 0 deletions code/__DEFINES/__game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 3 additions & 0 deletions code/_globalvars/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions code/game/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions code/game/jobs/role_authority.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@


/obj/structure/bed/chair/dropship/passenger/afterbuckle()
. = ..()
if(buckled_mob)
icon_state = initial(icon_state) + "_buckled"
overlays += chairbar
Expand Down
63 changes: 53 additions & 10 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,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
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
29 changes: 28 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 @@ -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)
Expand Down Expand Up @@ -307,6 +313,7 @@ var/const/MAX_SAVE_SLOTS = 20

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 @@ -433,6 +440,13 @@ var/const/MAX_SAVE_SLOTS = 20
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 += "<b>Dropship Camo:</b> <a href='?_src_=prefs;preference=dropship_camo;task=input'><b>[dropship_camo]</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 @@ -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, "<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 ("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.)
Expand Down Expand Up @@ -2002,7 +2029,6 @@ var/const/MAX_SAVE_SLOTS = 20

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

ShowChoices(user)
return 1

Expand Down Expand Up @@ -2341,3 +2367,4 @@ var/const/MAX_SAVE_SLOTS = 20
#undef MENU_MENTOR
#undef MENU_SETTINGS
#undef MENU_SPECIAL
#undef MENU_PLTCO
10 changes: 10 additions & 0 deletions code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
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
19 changes: 19 additions & 0 deletions code/modules/gear_presets/uscm_ship.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fce8f94

Please sign in to comment.