From 80f2076bccc6b93bde1ad2d816dd802e0479dd59 Mon Sep 17 00:00:00 2001 From: Giacomand Date: Thu, 19 Dec 2013 22:07:52 +0000 Subject: [PATCH] * Fixed the party alarm from only working in areas with a certain light level. * Reduced a lot of duplicated code in the party alarm. * Added a shield range variable for the anti-breach shield generators. * Changed the shield range to 4, making them more useful. * Fixed a bug with the deployed_shields list not being cleared after the shields are down. * Fixed a runtime with shake_camera() --- code/game/gamemodes/meteor/meteors.dm | 3 +- code/game/machinery/alarm.dm | 99 +++++++-------------------- code/game/machinery/shieldgen.dm | 4 +- code/modules/mob/mob_helpers.dm | 11 +-- 4 files changed, 37 insertions(+), 80 deletions(-) diff --git a/code/game/gamemodes/meteor/meteors.dm b/code/game/gamemodes/meteor/meteors.dm index 75b7be1afff..e68da194442 100644 --- a/code/game/gamemodes/meteor/meteors.dm +++ b/code/game/gamemodes/meteor/meteors.dm @@ -133,7 +133,8 @@ var/turf/T = get_turf(M) if(!T || T.z != src.z) continue - shake_camera(M, 3, get_dist(M.loc, src.loc) > 20 ? 1 : 3) + var/dist = get_dist(M.loc, src.loc) + shake_camera(M, dist > 20 ? 3 : 5, dist > 20 ? 1 : 3) M.playsound_local(src.loc, 'sound/effects/meteorimpact.ogg', 50, 1, get_rand_frequency(), 10) explosion(src.loc, 0, 1, 2, 3, 0) diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 2bd09e00f38..307be170319 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -1211,25 +1211,6 @@ Code shamelessly copied from apc_frame flags = FPRINT | TABLEPASS| CONDUCT -/* - * Party button - */ - -/obj/machinery/partyalarm - name = "\improper PARTY BUTTON" - desc = "Cuban Pete is in the house!" - icon = 'icons/obj/monitors.dmi' - icon_state = "fire0" - var/detecting = 1.0 - var/working = 1.0 - var/time = 10.0 - var/timing = 0.0 - var/lockdownbyai = 0 - anchored = 1.0 - use_power = 1 - idle_power_usage = 2 - active_power_usage = 6 - /obj/item/firealarm_frame/attackby(obj/item/weapon/W as obj, mob/user as mob) if (istype(W, /obj/item/weapon/wrench)) new /obj/item/stack/sheet/metal( get_turf(src.loc), 2 ) @@ -1262,16 +1243,22 @@ Code shamelessly copied from apc_frame del(src) -/obj/machinery/partyalarm/attack_paw(mob/user as mob) - return src.attack_hand(user) -/obj/machinery/partyalarm/attack_hand(mob/user as mob) +/* + * Party button + */ + +/obj/machinery/firealarm/partyalarm + name = "\improper PARTY BUTTON" + desc = "Cuban Pete is in the house!" + +/obj/machinery/firealarm/partyalarm/attack_hand(mob/user as mob) if(user.stat || stat & (NOPOWER|BROKEN)) return user.set_machine(src) var/area/A = src.loc var/d1 - var/d2 + var/dat if (istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon/ai)) A = A.loc @@ -1279,76 +1266,40 @@ Code shamelessly copied from apc_frame d1 = text("No Party :(", src) else d1 = text("PARTY!!!", src) - if (src.timing) - d2 = text("Stop Time Lock", src) - else - d2 = text("Initiate Time Lock", src) - var/second = src.time % 60 - var/minute = (src.time - second) / 60 - var/dat = text("Party Button []\n
\nTimer System: []
\nTime Left: [][] - - + +\n
", d1, d2, (minute ? text("[]:", minute) : null), second, src, src, src, src) - user << browse(dat, "window=partyalarm") - onclose(user, "partyalarm") + dat = text("Party Button []", d1) + else A = A.loc if (A.fire) d1 = text("[]", src, stars("No Party :(")) else d1 = text("[]", src, stars("PARTY!!!")) - if (src.timing) - d2 = text("[]", src, stars("Stop Time Lock")) - else - d2 = text("[]", src, stars("Initiate Time Lock")) - var/second = src.time % 60 - var/minute = (src.time - second) / 60 - var/dat = text("[] []\n
\nTimer System: []
\nTime Left: [][] - - + +\n
", stars("Party Button"), d1, d2, (minute ? text("[]:", minute) : null), second, src, src, src, src) - user << browse(dat, "window=partyalarm") - onclose(user, "partyalarm") + dat = text("[] []", stars("Party Button"), d1) + + var/datum/browser/popup = new(user, "firealarm", "Party Alarm") + popup.set_content(dat) + popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state)) + popup.open() return -/obj/machinery/partyalarm/proc/reset() +/obj/machinery/firealarm/partyalarm/reset() if (!( src.working )) return var/area/A = src.loc A = A.loc if (!( istype(A, /area) )) return - A.partyreset() + for(var/area/RA in A.related) + RA.partyreset() return -/obj/machinery/partyalarm/proc/alarm() +/obj/machinery/firealarm/partyalarm/alarm() if (!( src.working )) return var/area/A = src.loc A = A.loc if (!( istype(A, /area) )) return - A.partyalert() - return - -/obj/machinery/partyalarm/Topic(href, href_list) - if(..()) - return - if (usr.stat || stat & (BROKEN|NOPOWER)) - return - if ((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon/ai))) - usr.set_machine(src) - if (href_list["reset"]) - src.reset() - else - if (href_list["alarm"]) - src.alarm() - else - if (href_list["time"]) - src.timing = text2num(href_list["time"]) - else - if (href_list["tp"]) - var/tp = text2num(href_list["tp"]) - src.time += tp - src.time = min(max(round(src.time), 0), 120) - src.updateUsrDialog() - - src.add_fingerprint(usr) - else - usr << browse(null, "window=partyalarm") - return - return + for(var/area/RA in A.related) + RA.partyalert() + return \ No newline at end of file diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 989e897721d..7c2e4f5f39e 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -150,6 +150,7 @@ var/list/deployed_shields = list() var/is_open = 0 //Whether or not the wires are exposed var/locked = 0 + var/shield_range = 4 /obj/machinery/shieldgen/Del() for(var/obj/machinery/shield/shield_tile in deployed_shields) @@ -163,7 +164,7 @@ src.active = 1 update_icon() - for(var/turf/target_tile in range(2, src)) + for(var/turf/target_tile in range(shield_range, src)) if (istype(target_tile,/turf/space) && !(locate(/obj/machinery/shield) in target_tile)) if (malfunction && prob(33) || !malfunction) deployed_shields += new /obj/machinery/shield(target_tile) @@ -176,6 +177,7 @@ for(var/obj/machinery/shield/shield_tile in deployed_shields) del(shield_tile) + deployed_shields.Cut() /obj/machinery/shieldgen/process() if(malfunction && active) diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 9310e32b968..1d109b80f5b 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -271,10 +271,13 @@ It's fairly easy to fix if dealing with single letters but not so much with comp var/x M.shakecamera = 1 for(x=0; x