From 2368968c666e6900ec070ffae1ee661cee0f34b9 Mon Sep 17 00:00:00 2001 From: necromanceranne <40847847+necromanceranne@users.noreply.github.com> Date: Fri, 26 Mar 2021 08:45:14 +1100 Subject: [PATCH] Ports #42721 which happened to resolve this already --- .../recipes/recipes_weapon_and_ammo.dm | 2 +- code/game/objects/items/shields.dm | 67 +++++++++++++++++++ code/modules/assembly/flash.dm | 64 ------------------ code/modules/cargo/bounties/security.dm | 2 +- code/modules/cargo/exports/weapons.dm | 4 +- 5 files changed, 71 insertions(+), 68 deletions(-) diff --git a/code/datums/components/crafting/recipes/recipes_weapon_and_ammo.dm b/code/datums/components/crafting/recipes/recipes_weapon_and_ammo.dm index 0135cab77f..95361c3da2 100644 --- a/code/datums/components/crafting/recipes/recipes_weapon_and_ammo.dm +++ b/code/datums/components/crafting/recipes/recipes_weapon_and_ammo.dm @@ -16,7 +16,7 @@ /datum/crafting_recipe/strobeshield name = "Strobe Shield" - result = /obj/item/assembly/flash/shield + result = /obj/item/shield/riot/flash reqs = list(/obj/item/wallframe/flasher = 1, /obj/item/assembly/flash/handheld = 1, /obj/item/shield/riot = 1) diff --git a/code/game/objects/items/shields.dm b/code/game/objects/items/shields.dm index 9ba994746a..84faf27242 100644 --- a/code/game/objects/items/shields.dm +++ b/code/game/objects/items/shields.dm @@ -351,6 +351,73 @@ playsound(owner, 'sound/effects/bang.ogg', 50) new /obj/item/stack/sheet/mineral/wood(get_turf(src)) +/obj/item/shield/riot/flash + name = "strobe shield" + desc = "A shield with a built in, high intensity light capable of blinding and disorienting suspects. Takes regular handheld flashes as bulbs." + icon_state = "flashshield" + item_state = "flashshield" + var/obj/item/assembly/flash/handheld/embedded_flash + +/obj/item/shield/riot/flash/Initialize() + . = ..() + embedded_flash = new(src) + +/obj/item/shield/riot/flash/ComponentInitialize() + . = .. () + AddElement(/datum/element/update_icon_updates_onmob) + +/obj/item/shield/riot/flash/attack(mob/living/M, mob/user) + . = embedded_flash.attack(M, user) + update_icon() + +/obj/item/shield/riot/flash/attack_self(mob/living/carbon/user) + . = embedded_flash.attack_self(user) + update_icon() + +/obj/item/shield/riot/flash/on_shield_block(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return) + . = ..() + if (. && !embedded_flash.crit_fail) + embedded_flash.activate() + update_icon() + + +/obj/item/shield/riot/flash/attackby(obj/item/W, mob/user) + if(istype(W, /obj/item/assembly/flash/handheld)) + var/obj/item/assembly/flash/handheld/flash = W + if(flash.crit_fail) + to_chat(user, "No sense replacing it with a broken bulb!") + return + else + to_chat(user, "You begin to replace the bulb...") + if(do_after(user, 20, target = user)) + if(flash.crit_fail || !flash || QDELETED(flash)) + return + playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE) + qdel(embedded_flash) + embedded_flash = flash + flash.forceMove(src) + update_icon() + return + ..() + +/obj/item/shield/riot/flash/emp_act(severity) + . = ..() + embedded_flash.emp_act(severity) + update_icon() + +/obj/item/shield/riot/flash/update_icon_state() + if(!embedded_flash || embedded_flash.crit_fail) + icon_state = "riot" + item_state = "riot" + else + icon_state = "flashshield" + item_state = "flashshield" + +/obj/item/shield/riot/flash/examine(mob/user) + . = ..() + if (embedded_flash?.crit_fail) + . += "The mounted bulb has burnt out. You can try replacing it with a new one." + /obj/item/shield/riot/tele name = "telescopic shield" desc = "An advanced riot shield made of lightweight materials that collapses for easy storage." diff --git a/code/modules/assembly/flash.dm b/code/modules/assembly/flash.dm index 07a9f499f8..5eb1f77fd7 100644 --- a/code/modules/assembly/flash.dm +++ b/code/modules/assembly/flash.dm @@ -262,70 +262,6 @@ /obj/item/assembly/flash/armimplant/proc/cooldown() overheat = FALSE -/obj/item/assembly/flash/shield - name = "strobe shield" - desc = "A shield with a built in, high intensity light capable of blinding and disorienting suspects. Takes regular handheld flashes as bulbs." - icon = 'icons/obj/items_and_weapons.dmi' - icon_state = "flashshield" - item_state = "flashshield" - lefthand_file = 'icons/mob/inhands/equipment/shields_lefthand.dmi' - righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi' - slot_flags = ITEM_SLOT_BACK - force = 10 - throwforce = 5 - throw_speed = 2 - throw_range = 3 - w_class = WEIGHT_CLASS_BULKY - custom_materials = list(/datum/material/glass=7500, /datum/material/iron=1000) - attack_verb = list("shoved", "bashed") - block_chance = 50 - armor = list("melee" = 50, "bullet" = 50, "laser" = 50, "energy" = 0, "bomb" = 30, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 70) - -/obj/item/assembly/flash/shield/flash_recharge(interval=10) - if(times_used >= 4) - burn_out() - return FALSE - return TRUE - -/obj/item/assembly/flash/shield/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/assembly/flash/handheld)) - var/obj/item/assembly/flash/handheld/flash = W - if(flash.crit_fail) - to_chat(user, "No sense replacing it with a broken bulb.") - return - else - to_chat(user, "You begin to replace the bulb.") - if(do_after(user, 20, target = src)) - if(flash.crit_fail || !flash || QDELETED(flash)) - return - crit_fail = FALSE - times_used = 0 - playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE) - update_icon() - flash.crit_fail = TRUE - flash.update_icon() - return - ..() - -/obj/item/assembly/flash/shield/update_icon(flash = FALSE) - icon_state = "flashshield" - item_state = "flashshield" - - if(crit_fail) - icon_state = "riot" - item_state = "riot" - else if(flash) - icon_state = "flashshield_flash" - item_state = "flashshield_flash" - addtimer(CALLBACK(src, /atom/.proc/update_icon), 5) - - if(holder) - holder.update_icon() - -/obj/item/assembly/flash/shield/run_block(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return) - activate() - return ..() - //ported from tg - check to make sure it can't appear where it's not supposed to. /obj/item/assembly/flash/hypnotic desc = "A modified flash device, programmed to emit a sequence of subliminal flashes that can send a vulnerable target into a hypnotic trance." diff --git a/code/modules/cargo/bounties/security.dm b/code/modules/cargo/bounties/security.dm index 6ed86cd4b7..5ddf456573 100644 --- a/code/modules/cargo/bounties/security.dm +++ b/code/modules/cargo/bounties/security.dm @@ -23,7 +23,7 @@ name = "Strobe Shield" description = "One of our Emergency Response Agents thinks there's vampires in a local station. Send him something to help with his fear of the dark and protect him, too." reward = 3000 - wanted_types = list(/obj/item/assembly/flash/shield) + wanted_types = list(/obj/item/shield/riot/flash) /datum/bounty/item/security/sechuds name = "Sec HUDs" diff --git a/code/modules/cargo/exports/weapons.dm b/code/modules/cargo/exports/weapons.dm index dc2703c146..c973ceed26 100644 --- a/code/modules/cargo/exports/weapons.dm +++ b/code/modules/cargo/exports/weapons.dm @@ -16,7 +16,7 @@ /datum/export/weapon/riot_shield cost = 70 unit_name = "flash shield" - export_types = list(/obj/item/assembly/flash/shield) + export_types = list(/obj/item/shield/riot/flash) /datum/export/weapon/tele_shield cost = 100 @@ -138,7 +138,7 @@ export_types = list(/obj/item/gun/energy/xray) /datum/export/weapon/ioncarbine - cost = 200 + cost = 200 unit_name = "ion carbine" export_types = list(/obj/item/gun/energy/ionrifle/carbine)