From c4a97641d87dc0de8cbf4c6d8dab03e5ead4f7b1 Mon Sep 17 00:00:00 2001 From: Geeves Date: Sat, 21 Jan 2023 14:21:29 +0200 Subject: [PATCH] Security Goon Equipment (#15548) * --- code/controllers/subsystems/job.dm | 24 +++---- .../preference_setup/loadout/gear_tweaks.dm | 11 +++ .../preference_setup/loadout/loadout.dm | 29 +++++++- .../preference_setup/loadout/loadout_eyes.dm | 15 ++++ .../preference_setup/loadout/loadout_mask.dm | 2 +- code/modules/clothing/glasses/glasses.dm | 67 ++++++++++++++---- .../clothing/under/accessories/accessory.dm | 16 +++++ html/changelogs/geeves-goon_coifs.yml | 7 ++ icons/clothing/accessories/goon_coif.dmi | Bin 0 -> 751 bytes icons/clothing/eyes/goon_goggles.dmi | Bin 0 -> 1156 bytes maps/sccv_horizon/sccv_horizon-2_deck_2.dmm | 60 ++++++++++------ 11 files changed, 179 insertions(+), 52 deletions(-) create mode 100644 html/changelogs/geeves-goon_coifs.yml create mode 100644 icons/clothing/accessories/goon_coif.dmi create mode 100644 icons/clothing/eyes/goon_goggles.dmi diff --git a/code/controllers/subsystems/job.dm b/code/controllers/subsystems/job.dm index 58655abb234..f295e73d101 100644 --- a/code/controllers/subsystems/job.dm +++ b/code/controllers/subsystems/job.dm @@ -688,27 +688,21 @@ if(G.augment) //augments are handled somewhere else continue - var/permitted = !G.allowed_roles || (job.title in G.allowed_roles) - permitted = permitted && G.check_species_whitelist(H) - permitted = permitted && (!G.faction || (G.faction == H.employer_faction || H.employer_faction == "Stellar Corporate Conglomerate")) - var/our_culture = text2path(prefs.culture) - permitted = permitted && (!G.culture_restriction || (our_culture in G.culture_restriction)) - var/our_origin = text2path(prefs.origin) - permitted = permitted && (!G.origin_restriction || (our_origin in G.origin_restriction)) + var/metadata + var/list/gear_test = prefs.gear[G.display_name] + if(gear_test?.len) + metadata = gear_test + else + metadata = list() - if(!permitted) - to_chat(H, "Your current job, culture, origin or whitelist status does not permit you to spawn with [thing]!") + var/cant_spawn_reason = G.cant_spawn_item_reason(null, metadata, H, job, prefs) + if(cant_spawn_reason) + to_chat(H, SPAN_WARNING(cant_spawn_reason)) continue if(G.slot && !(G.slot in custom_equip_slots)) // This is a miserable way to fix the loadout overwrite bug, but the alternative requires // adding an arg to a bunch of different procs. Will look into it after this merge. ~ Z - var/metadata - var/list/gear_test = prefs.gear[G.display_name] - if(gear_test?.len) - metadata = gear_test - else - metadata = list() var/obj/item/CI = G.spawn_item(null,metadata, H) if (H.equip_to_slot_or_del(CI, G.slot)) to_chat(H, "Equipping you with [thing]!") diff --git a/code/modules/client/preference_setup/loadout/gear_tweaks.dm b/code/modules/client/preference_setup/loadout/gear_tweaks.dm index ace54e037c3..99aedeff199 100644 --- a/code/modules/client/preference_setup/loadout/gear_tweaks.dm +++ b/code/modules/client/preference_setup/loadout/gear_tweaks.dm @@ -107,6 +107,17 @@ Path adjustment return gear_data.path = valid_paths[metadata] +/* +Faction-based Path adjustment +Same as the adjustment above, but the associated value is a list with the first value containing the path and the second the faction requirement +*/ + +/datum/gear_tweak/path/faction/tweak_gear_data(var/metadata, var/datum/gear_data/gear_data) + if(!(metadata in valid_paths)) + return + gear_data.path = valid_paths[metadata][1] + gear_data.faction_requirement = valid_paths[metadata][2] + /* Content adjustment */ diff --git a/code/modules/client/preference_setup/loadout/loadout.dm b/code/modules/client/preference_setup/loadout/loadout.dm index 3802ad1edb4..f660ff74e82 100644 --- a/code/modules/client/preference_setup/loadout/loadout.dm +++ b/code/modules/client/preference_setup/loadout/loadout.dm @@ -400,13 +400,38 @@ var/list/gear_datums = list() /datum/gear_data var/path var/location + var/faction_requirement -/datum/gear_data/New(var/path, var/location) +/datum/gear_data/New(var/path, var/location, var/faction) src.path = path src.location = location + src.faction_requirement = faction + +/datum/gear/proc/cant_spawn_item_reason(var/location, var/metadata, var/mob/living/carbon/human/human, var/datum/job/job, var/datum/preferences/prefs) + var/datum/gear_data/gd = new(path, location, faction) + for(var/datum/gear_tweak/gt in gear_tweaks) + if(metadata["[gt]"]) + gt.tweak_gear_data(metadata["[gt]"], gd, human) + else + gt.tweak_gear_data(gt.get_default(), gd, human) + + var/obj/spawning_item = gd.path + if(length(allowed_roles) && !(job.title in allowed_roles)) + return "You cannot spawn with the [initial(spawning_item.name)] with your current job!" + if(!check_species_whitelist(human)) + return "You cannot spawn with the [initial(spawning_item.name)] with your current species!" + if(gd.faction_requirement && (human.employer_faction != "Stellar Corporate Conglomerate" && gd.faction_requirement != human.employer_faction)) + return "You cannot spawn with the [initial(spawning_item.name)] with your current faction!" + var/our_culture = text2path(prefs.culture) + if(culture_restriction && !(our_culture in culture_restriction)) + return "You cannot spawn with the [initial(spawning_item.name)] with your current culture!" + var/our_origin = text2path(prefs.origin) + if(origin_restriction && !(our_origin in origin_restriction)) + return "You cannot spawn with the [initial(spawning_item.name)] with your current origin!" + return null /datum/gear/proc/spawn_item(var/location, var/metadata, var/mob/living/carbon/human/H) - var/datum/gear_data/gd = new(path, location) + var/datum/gear_data/gd = new(path, location, faction) for(var/datum/gear_tweak/gt in gear_tweaks) if(metadata["[gt]"]) gt.tweak_gear_data(metadata["[gt]"], gd, H) diff --git a/code/modules/client/preference_setup/loadout/loadout_eyes.dm b/code/modules/client/preference_setup/loadout/loadout_eyes.dm index f975dac4d87..5e1d7488303 100644 --- a/code/modules/client/preference_setup/loadout/loadout_eyes.dm +++ b/code/modules/client/preference_setup/loadout/loadout_eyes.dm @@ -132,3 +132,18 @@ blindfold["blindfold"] = /obj/item/clothing/glasses/sunglasses/blindfold/white blindfold["blindfold, transparent"] = /obj/item/clothing/glasses/sunglasses/blindfold/white/seethrough gear_tweaks += new /datum/gear_tweak/path(blindfold) + +/datum/gear/eyes/goon_goggles + display_name = "tactical goggles selection" + description = "A selection of tactical eyewear. Note that factional ones can only be taken by members of that faction." + path = /obj/item/clothing/glasses/safety/goggles/goon + +/datum/gear/eyes/goon_goggles/New() + allowed_roles = security_positions + ..() + var/list/goggles = list() + goggles["goggles, tactical"] = list(/obj/item/clothing/glasses/safety/goggles/goon, null) + goggles["goggles, tactical (PMCG)"] = list(/obj/item/clothing/glasses/safety/goggles/goon/pmc, "Private Military Contracting Group") + goggles["goggles, tactical (Zavodskoi)"] = list(/obj/item/clothing/glasses/safety/goggles/goon/zavod, "Zavodskoi Interstellar") + goggles["goggles, tactical (Idris)"] = list(/obj/item/clothing/glasses/safety/goggles/goon/idris, "Idris Incorporated") + gear_tweaks += new /datum/gear_tweak/path/faction(goggles) diff --git a/code/modules/client/preference_setup/loadout/loadout_mask.dm b/code/modules/client/preference_setup/loadout/loadout_mask.dm index e03d4c186b1..9d46993528d 100644 --- a/code/modules/client/preference_setup/loadout/loadout_mask.dm +++ b/code/modules/client/preference_setup/loadout/loadout_mask.dm @@ -19,4 +19,4 @@ /datum/gear/mask/cloth display_name = "cloth mask" path = /obj/item/clothing/mask/cloth - flags = GEAR_HAS_NAME_SELECTION | GEAR_HAS_DESC_SELECTION | GEAR_HAS_COLOR_SELECTION \ No newline at end of file + flags = GEAR_HAS_NAME_SELECTION | GEAR_HAS_DESC_SELECTION | GEAR_HAS_COLOR_SELECTION diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm index 49914ad63f5..0071676382a 100644 --- a/code/modules/clothing/glasses/glasses.dm +++ b/code/modules/clothing/glasses/glasses.dm @@ -234,11 +234,17 @@ BLIND // can't see anything icon_state = "goggles_standard" item_state = "goggles_standard" off_state = "goggles_standard" + var/base_icon_state action_button_name = "Flip Goggles" + var/change_item_state_on_flip = FALSE var/flip_down = "down to protect your eyes." var/flip_up = "up out of your face." var/up = 0 +/obj/item/clothing/glasses/safety/goggles/Initialize(mapload, material_key) + . = ..() + base_icon_state = icon_state + /obj/item/clothing/glasses/safety/goggles/attack_self() toggle() @@ -253,18 +259,24 @@ BLIND // can't see anything src.up = !src.up flags_inv |= HIDEEYES body_parts_covered |= EYES - icon_state = initial(item_state) + icon_state = base_icon_state + if(change_item_state_on_flip) item_state = icon_state to_chat(usr, SPAN_NOTICE("You flip \the [src] [flip_down]")) else src.up = !src.up flags_inv &= ~HIDEEYES body_parts_covered &= ~EYES - icon_state = "[initial(icon_state)]_up" + icon_state = "[base_icon_state]_up" + if(change_item_state_on_flip) item_state = icon_state to_chat(usr, SPAN_NOTICE("You push \the [src] [flip_up]")) - update_clothing_icon() + handle_additional_changes() + update_worn_icon() update_icon() usr.update_action_buttons() +/obj/item/clothing/glasses/safety/goggles/proc/handle_additional_changes() + return + /obj/item/clothing/glasses/safety/goggles/prescription name = "prescription safety goggles" desc = "A simple pair of safety goggles. It's general chemistry all over again. Comes with a prescription overlay." @@ -279,19 +291,48 @@ BLIND // can't see anything item_state = "wasteland_goggles" off_state = "wasteland_goggles" contained_sprite = TRUE + change_item_state_on_flip = TRUE flip_down = "up to protect your eyes." flip_up = "and let it hang around your neck." -/obj/item/clothing/glasses/safety/goggles/wasteland/toggle() - ..() - icon_state = initial(icon_state) - if(up) - item_state = "[initial(item_state)]_up" - else - item_state = initial(icon_state) - update_worn_icon() - update_clothing_icon() - update_icon() +/obj/item/clothing/glasses/safety/goggles/goon + name = "tactical goggles" + desc = "A stylish pair of tactical goggles that protect the eyes from aerosolized chemicals." + var/brand_name + icon = 'icons/clothing/eyes/goon_goggles.dmi' + var/sprite_state = "security_goggles" + contained_sprite = TRUE + change_item_state_on_flip = TRUE + +/obj/item/clothing/glasses/safety/goggles/goon/Initialize(mapload, material_key) + icon_state = sprite_state + item_state = sprite_state + off_state = sprite_state + . = ..() + if(brand_name) + desc += " This pair has been made in [brand_name] colors." + +/obj/item/clothing/glasses/safety/goggles/goon/security/process_hud(var/mob/M) + if(!up) + process_sec_hud(M, TRUE) + +/obj/item/clothing/glasses/safety/goggles/goon/is_sec_hud() + return !up + +/obj/item/clothing/glasses/safety/goggles/goon/handle_additional_changes() + flash_protection = up ? FLASH_PROTECTION_NONE : FLASH_PROTECTION_MODERATE + +/obj/item/clothing/glasses/safety/goggles/goon/pmc + sprite_state = "pmc_goggles" + brand_name = "PMCG" + +/obj/item/clothing/glasses/safety/goggles/goon/zavod + sprite_state = "zavod_goggles" + brand_name = "Zavodskoi" + +/obj/item/clothing/glasses/safety/goggles/goon/idris + sprite_state = "idris_goggles" + brand_name = "Idris" /obj/item/clothing/glasses/eyepatch name = "eyepatch" diff --git a/code/modules/clothing/under/accessories/accessory.dm b/code/modules/clothing/under/accessories/accessory.dm index c288801791c..d4d8ab924da 100644 --- a/code/modules/clothing/under/accessories/accessory.dm +++ b/code/modules/clothing/under/accessories/accessory.dm @@ -1034,3 +1034,19 @@ contained_sprite = TRUE icon_override = null body_parts_covered = UPPER_TORSO + +/obj/item/clothing/accessory/goon_coif + name = "tactical coif" + desc = "A comfortable tactical coif that goes around the head." + icon = 'icons/clothing/accessories/goon_coif.dmi' + body_parts_covered = HEAD + icon_state = "goon_coif" + item_state = "goon_coif" + contained_sprite = TRUE + slot_flags = SLOT_MASK | SLOT_EARS | SLOT_TIE + +/obj/item/clothing/accessory/goon_coif/get_ear_examine_text(var/mob/user, var/ear_text = "left") + return "on [user.get_pronoun("his")] head" + +/obj/item/clothing/accessory/goon_coif/get_mask_examine_text(var/mob/user) + return "on [user.get_pronoun("his")] head" diff --git a/html/changelogs/geeves-goon_coifs.yml b/html/changelogs/geeves-goon_coifs.yml new file mode 100644 index 00000000000..bc9437b233b --- /dev/null +++ b/html/changelogs/geeves-goon_coifs.yml @@ -0,0 +1,7 @@ +author: HappyFox, Geeves + +delete-after: True + +changes: + - rscadd: "Added tactical goggles to the loadout for Security roles, they have integrated security HUDs and flash protection." + - rscadd: "Added tactical coifs to the Security armory, they can go in the mask, ear, or clothing accessory slots." \ No newline at end of file diff --git a/icons/clothing/accessories/goon_coif.dmi b/icons/clothing/accessories/goon_coif.dmi new file mode 100644 index 0000000000000000000000000000000000000000..820b30523e33090d40a3b704917eccb6b41192cb GIT binary patch literal 751 zcmeAS@N?(olHy`uVBq!ia0vp^3xK$RgBeKf-aAPXNZADVgt#6!a6n2<+1$oe&&Wzm z%ScR8PF_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