From 3b303f841d1aa233d7cd1151a1f783cdf740e4c4 Mon Sep 17 00:00:00 2001 From: Ikarrus Date: Sun, 2 Jun 2013 23:28:25 -0600 Subject: [PATCH 1/4] -Mounted flashers can now burn out their flashbulbs (5% chance) -Flashbulbs can be removed using wirecutters and replaced with a working flash -Portable flashers now appear disabled when not anchored, if there is no flashbulb, or if the flashbulb is broken -Updated changelog --- code/game/machinery/flasher.dm | 54 ++++++++++++++++++++++++---------- html/changelog.html | 8 +++++ 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index 9de6b2c6aa8..c460076a078 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -5,9 +5,9 @@ desc = "A wall-mounted flashbulb device." icon = 'icons/obj/stationobjs.dmi' icon_state = "mflash1" + var/obj/item/device/flash/bulb = null var/id = null var/range = 2 //this is roughly the size of brig cell - var/disable = 0 var/last_flash = 0 //Don't want it getting spammed like regular flashes var/strength = 10 //How weakened targets are when flashed. var/base_state = "mflash" @@ -16,19 +16,20 @@ /obj/machinery/flasher/portable //Portable version of the flasher. Only flashes when anchored name = "portable flasher" desc = "A portable flashing device. Wrench to activate and deactivate. Cannot detect slow movements." - icon_state = "pflash1" + icon_state = "pflash1-p" strength = 8 anchored = 0 base_state = "pflash" density = 1 -/* /obj/machinery/flasher/New() - sleep(4) //<--- What the fuck are you doing? D= - src.sd_SetLuminosity(2) -*/ + if(isnull(bulb)) + bulb = new /obj/item/device/flash(src) + /obj/machinery/flasher/power_change() - if ( powered() ) + if ( powered() && bulb && anchored) + if(bulb.broken) + return stat &= ~NOPOWER icon_state = "[base_state]1" // src.sd_SetLuminosity(2) @@ -41,11 +42,24 @@ /obj/machinery/flasher/attackby(obj/item/weapon/W as obj, mob/user as mob) if (istype(W, /obj/item/weapon/wirecutters)) add_fingerprint(user) - src.disable = !src.disable - if (src.disable) - user.visible_message("\red [user] has disconnected the [src]'s flashbulb!", "\red You disconnect the [src]'s flashbulb!") - if (!src.disable) - user.visible_message("\red [user] has connected the [src]'s flashbulb!", "\red You connect the [src]'s flashbulb!") + if (bulb) + playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1) + user.visible_message("[user] has disconnected [src]'s flashbulb!", "You disconnect [src]'s flashbulb!") + bulb.loc = src.loc + bulb = null + src.icon_state = "[base_state]1-p" + + if (istype(W, /obj/item/device/flash)) + add_fingerprint(user) + if (isnull(bulb)) + user.visible_message("[user] installs [W] into [src].", "You install [W] into [src].") + user.drop_item() + W.loc = src + bulb = W + if (!bulb.broken && src.anchored) + src.icon_state = "[base_state]1" + else + user << "A flashbulb is already installed in [src]." //Let the AI trigger them directly. /obj/machinery/flasher/attack_ai() @@ -55,10 +69,10 @@ return /obj/machinery/flasher/proc/flash() - if (!(powered())) + if (!(powered()) || (isnull(bulb))) return - if ((src.disable) || (src.last_flash && world.time < src.last_flash + 150)) + if ((bulb.broken) || (src.last_flash && world.time < src.last_flash + 150)) return playsound(src.loc, 'sound/weapons/flash.ogg', 100, 1) @@ -66,6 +80,11 @@ src.last_flash = world.time use_power(1000) + if(prob(5)) //Small chance to burn out on use + bulb.broken = 1 + bulb.icon_state = "flashburnt" + src.icon_state = "[base_state]1-p" + for (var/mob/O in viewers(src, null)) if (get_dist(src, O) > src.range) continue @@ -97,7 +116,7 @@ ..(severity) /obj/machinery/flasher/portable/HasProximity(atom/movable/AM as mob|obj) - if ((src.disable) || (src.last_flash && world.time < src.last_flash + 150)) + if (src.last_flash && world.time < src.last_flash + 150) return if(istype(AM, /mob/living/carbon)) @@ -108,15 +127,20 @@ /obj/machinery/flasher/portable/attackby(obj/item/weapon/W as obj, mob/user as mob) if (istype(W, /obj/item/weapon/wrench)) add_fingerprint(user) + playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1) src.anchored = !src.anchored if (!src.anchored) user.show_message(text("\red [src] can now be moved.")) src.overlays.Cut() + src.power_change() else if (src.anchored) user.show_message(text("\red [src] is now secured.")) src.overlays += "[base_state]-s" + src.power_change() + else + ..() /obj/machinery/flasher_button/attack_ai(mob/user as mob) return src.attack_hand(user) diff --git a/html/changelog.html b/html/changelog.html index ead9bb503ce..1570a1773ce 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -52,6 +52,14 @@ should be listed in the changelog upon commit tho. Thanks. --> +
+

2 June 2013

+

Ikarrus updated:

+ +
+

25 May 2013

Ikarrus updated:

From 7000287e50faae09e67b203346582a572aae585c Mon Sep 17 00:00:00 2001 From: Ikarrus Date: Mon, 3 Jun 2013 00:19:36 -0600 Subject: [PATCH 2/4] Reduced code duplication --- code/game/machinery/flasher.dm | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index c460076a078..07b87665b9e 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -28,15 +28,14 @@ /obj/machinery/flasher/power_change() if ( powered() && bulb && anchored) - if(bulb.broken) - return stat &= ~NOPOWER - icon_state = "[base_state]1" -// src.sd_SetLuminosity(2) + if(bulb.broken) + icon_state = "[base_state]1-p" + else + icon_state = "[base_state]1" else stat |= ~NOPOWER icon_state = "[base_state]1-p" -// src.sd_SetLuminosity(0) //Don't want to render prison breaks impossible /obj/machinery/flasher/attackby(obj/item/weapon/W as obj, mob/user as mob) @@ -47,7 +46,7 @@ user.visible_message("[user] has disconnected [src]'s flashbulb!", "You disconnect [src]'s flashbulb!") bulb.loc = src.loc bulb = null - src.icon_state = "[base_state]1-p" + src.power_change() if (istype(W, /obj/item/device/flash)) add_fingerprint(user) @@ -56,8 +55,7 @@ user.drop_item() W.loc = src bulb = W - if (!bulb.broken && src.anchored) - src.icon_state = "[base_state]1" + src.power_change() else user << "A flashbulb is already installed in [src]." @@ -83,7 +81,7 @@ if(prob(5)) //Small chance to burn out on use bulb.broken = 1 bulb.icon_state = "flashburnt" - src.icon_state = "[base_state]1-p" + src.power_change() for (var/mob/O in viewers(src, null)) if (get_dist(src, O) > src.range) From 6e8677165783c891b1819fe98c3bb490feacc567 Mon Sep 17 00:00:00 2001 From: Ikarrus Date: Mon, 3 Jun 2013 08:37:15 -0600 Subject: [PATCH 3/4] Changed it so only portable flashers get burnouts Added spare flashes to security weapons crate. --- code/datums/supplypacks.dm | 5 ++++- code/game/machinery/flasher.dm | 12 +++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/code/datums/supplypacks.dm b/code/datums/supplypacks.dm index 0f8ad25cfe6..0b106ce5bc6 100644 --- a/code/datums/supplypacks.dm +++ b/code/datums/supplypacks.dm @@ -530,7 +530,10 @@ /obj/item/weapon/gun/energy/taser, /obj/item/weapon/gun/energy/taser, /obj/item/weapon/storage/box/flashbangs, - /obj/item/weapon/storage/box/teargas) + /obj/item/weapon/storage/box/teargas, + /obj/item/device/flash, + /obj/item/device/flash, + /obj/item/device/flash) cost = 30 containertype = /obj/structure/closet/crate/secure/weapon containername = "weapons crate" diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index 07b87665b9e..04ea6969c10 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -78,11 +78,6 @@ src.last_flash = world.time use_power(1000) - if(prob(5)) //Small chance to burn out on use - bulb.broken = 1 - bulb.icon_state = "flashburnt" - src.power_change() - for (var/mob/O in viewers(src, null)) if (get_dist(src, O) > src.range) continue @@ -122,6 +117,13 @@ if ((M.m_intent != "walk") && (src.anchored)) src.flash() +/obj/machinery/flasher/portable/flash() + ..() + if(prob(5)) //Small chance to burn out on use + bulb.broken = 1 + bulb.icon_state = "flashburnt" + src.power_change() + /obj/machinery/flasher/portable/attackby(obj/item/weapon/W as obj, mob/user as mob) if (istype(W, /obj/item/weapon/wrench)) add_fingerprint(user) From a1db322934fff4c25632f8d95c326baa2b243988 Mon Sep 17 00:00:00 2001 From: Ikarrus Date: Mon, 3 Jun 2013 20:18:46 -0600 Subject: [PATCH 4/4] Reduced burn out chance to 4% EMPs have a chance of overloading flashbulbs. --- code/game/machinery/flasher.dm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index 04ea6969c10..407dafb47f0 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -106,6 +106,9 @@ return if(prob(75/severity)) flash() + bulb.broken = 1 + bulb.icon_state = "flashburnt" + src.power_change() ..(severity) /obj/machinery/flasher/portable/HasProximity(atom/movable/AM as mob|obj) @@ -119,7 +122,7 @@ /obj/machinery/flasher/portable/flash() ..() - if(prob(5)) //Small chance to burn out on use + if(prob(4)) //Small chance to burn out on use bulb.broken = 1 bulb.icon_state = "flashburnt" src.power_change()