diff --git a/code/modules/projectiles/pins.dm b/code/modules/projectiles/pins.dm index e754a9c070..9fbe742d39 100644 --- a/code/modules/projectiles/pins.dm +++ b/code/modules/projectiles/pins.dm @@ -241,3 +241,87 @@ to_chat(user, "The pin beeps, refusing to fire.") return FALSE return TRUE + +/obj/item/firing_pin/security_level + name = "security level firing pin" + desc = "A sophisticated firing pin that authorizes operation based on its settings and current security level." + icon_state = "firing_pin_sec_level" + var/min_sec_level = SEC_LEVEL_GREEN + var/max_sec_level = SEC_LEVEL_DELTA + var/only_lethals = FALSE + var/can_toggle = TRUE + +/obj/item/firing_pin/security_level/Initialize() + . = ..() + fail_message = "INVALID SECURITY LEVEL. CURRENT: [uppertext(num2seclevel(GLOB.security_level))]. \ + MIN: [uppertext(num2seclevel(min_sec_level))]. MAX: [uppertext(num2seclevel(max_sec_level))]. \ + ONLY LETHALS: [only_lethals ? "YES" : "NO"]." + update_icon() + +/obj/item/firing_pin/security_level/examine(mob/user) + . = ..() + var/lethal = only_lethals ? "only lethal " : "" + if(min_sec_level != max_sec_level) + . += "It's currently set to disallow [lethal]operation when the security level isn't between [num2seclevel(min_sec_level)] and [num2seclevel(max_sec_level)]." + else + . += "It's currently set to disallow [lethal]operation when the security level isn't [num2seclevel(min_sec_level)]." + if(can_toggle) + . += "You can use a multitool to modify its settings." + +/obj/item/firing_pin/security_level/multitool_act(mob/living/user, obj/item/I) + . = TRUE + if(!can_toggle || !user.canUseTopic(src, BE_CLOSE)) + return + var/selection = alert(user, "Which setting would you want to modify?", "Firing Pin Settings", "Minimum Level Setting", "Maximum Level Setting", "Lethals Only Toggle") + if(QDELETED(src) || QDELETED(user) || !user.canUseTopic(src, BE_CLOSE)) + return + var/static/list/till_designs_pr_isnt_merged = list("green", "blue", "amber", "red", "delta") + switch(selection) + if("Minimum Level Setting") + var/input = input(user, "Input the new minimum level setting.", "Firing Pin Settings", num2seclevel(min_sec_level)) as null|anything in till_designs_pr_isnt_merged + if(!input) + return + min_sec_level = till_designs_pr_isnt_merged.Find(input) - 1 + if(min_sec_level > max_sec_level) + max_sec_level = SEC_LEVEL_DELTA + if("Maximum Level Setting") + var/input = input(user, "Input the new maximum level setting.", "Firing Pin Settings", num2seclevel(max_sec_level)) as null|anything in till_designs_pr_isnt_merged + if(!input) + return + max_sec_level = till_designs_pr_isnt_merged.Find(input) - 1 + if(max_sec_level < max_sec_level) + min_sec_level = SEC_LEVEL_GREEN + if("Lethals Only Toggle") + only_lethals = !only_lethals + + fail_message = "INVALID SECURITY LEVEL. CURRENT: [uppertext(num2seclevel(GLOB.security_level))]. \ + MIN: [uppertext(num2seclevel(min_sec_level))]. MAX: [uppertext(num2seclevel(max_sec_level))]. \ + ONLY LETHALS: [only_lethals ? "YES" : "NO"]." + update_icon() + +/obj/item/firing_pin/security_level/update_overlays() + . = ..() + var/offset = 0 + for(var/level in list(min_sec_level, max_sec_level)) + var/mutable_appearance/overlay = mutable_appearance(icon, "pin_sec_level_overlay") + overlay.pixel_x += offset + offset += 4 + switch(level) + if(SEC_LEVEL_GREEN) + overlay.color = "#b2ff59" //light green + if(SEC_LEVEL_BLUE) + overlay.color = "#99ccff" //light blue + if(SEC_LEVEL_AMBER) + overlay.color = "#ffae42" //light yellow/orange + if(SEC_LEVEL_RED) + overlay.color = "#ff3f34" //light red + else + overlay.color = "#fe59c2" //neon fuchsia + . += overlay + var/mutable_appearance/overlay = mutable_appearance(icon, "pin_sec_level_overlay") + overlay.pixel_x += offset + overlay.color = only_lethals ? "#b2ff59" : "#ff3f34" + . += overlay + +/obj/item/firing_pin/security_level/pin_auth(mob/living/user) + return (only_lethals && !(gun.chambered?.harmful)) || ISINRANGE(GLOB.security_level, min_sec_level, max_sec_level) diff --git a/icons/obj/device.dmi b/icons/obj/device.dmi index c58fb5d940..58c1cd921c 100644 Binary files a/icons/obj/device.dmi and b/icons/obj/device.dmi differ