From fdddd35ee21e4408727244403aada41fc5f2502d Mon Sep 17 00:00:00 2001 From: "mport2004@gmail.com" Date: Tue, 1 Nov 2011 02:48:56 +0000 Subject: [PATCH] Singularity beacons now require a powered cable to function. Minor AI runtime fix. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2469 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/machinery/syndicatebeacon.dm | 72 +++++++++++++++------ code/modules/mob/living/silicon/ai/login.dm | 7 +- 2 files changed, 58 insertions(+), 21 deletions(-) diff --git a/code/game/machinery/syndicatebeacon.dm b/code/game/machinery/syndicatebeacon.dm index a61cfcdadda..44a4f056236 100644 --- a/code/game/machinery/syndicatebeacon.dm +++ b/code/game/machinery/syndicatebeacon.dm @@ -98,6 +98,8 @@ selfdestructing = 1 spawn() explosion(src.loc, rand(3,8), rand(1,3), 1, 10) + + #define SCREWED 32 /obj/machinery/singularity_beacon //not the best place for it but it's a hack job anyway -- Urist @@ -108,13 +110,14 @@ anchored = 0 density = 1 - layer = MOB_LAYER - 0.1 //so people can't hide it and it's REALLY OBVIOUS - stat = 0 - var/active = 0 //It doesn't use up power, so use_power wouldn't really suit it - var/icontype = "beacon" + var + active = 0 //It doesn't use up power, so use_power wouldn't really suit it + icontype = "beacon" + obj/structure/cable/attached = null + proc/Activate(mob/user = null) for(var/obj/machinery/singularity/singulo in world) @@ -124,6 +127,7 @@ active = 1 if(user) user << "\blue You activate the beacon." + proc/Deactivate(mob/user = null) for(var/obj/machinery/singularity/singulo in world) if(singulo.target == src) @@ -132,9 +136,11 @@ active = 0 if(user) user << "\blue You deactivate the beacon." + attack_ai(mob/user as mob) return + attack_hand(var/mob/user as mob) if(stat & SCREWED) return active ? Deactivate(user) : Activate(user) @@ -142,31 +148,61 @@ user << "\red You need to screw the beacon to the floor first!" return + attackby(obj/item/weapon/W as obj, mob/user as mob) if(istype(W,/obj/item/weapon/screwdriver)) - if(stat & SCREWED) - if(active) - user << "\red You need to deactivate the beacon first!" - return - else - stat &= ~SCREWED - anchored = 0 - user << "\blue You unscrew the beacon from the floor." - return - else - stat |= SCREWED - anchored = 1 - user << "\blue You screw the beacon to the floor." + if(active) + user << "\red You need to deactivate the beacon first!" return + if(stat & SCREWED) + stat &= ~SCREWED + anchored = 0 + user << "\blue You unscrew the beacon from the floor." + attached = null + return + else + var/turf/T = loc + if(isturf(T) && !T.intact) + attached = locate() in T + if(!attached) + user << "This device must be placed over an exposed cable." + return + stat |= SCREWED + anchored = 1 + user << "\blue You screw the beacon to the floor and attach the cable." + return ..() + return + Del() if(active) Deactivate() ..() + + process() + if(stat & NOPOWER) + if(active) + Deactivate() + return + + if(!active) + return + + if(attached) + if(!attached.get_powernet()) + Deactivate() + return + use_power(1500) + else + Deactivate() + return + + /obj/machinery/singularity_beacon/syndicate icontype = "beaconsynd" icon_state = "beaconsynd0" -#undef SCREWED \ No newline at end of file +#undef SCREWED + diff --git a/code/modules/mob/living/silicon/ai/login.dm b/code/modules/mob/living/silicon/ai/login.dm index 10d8c678b9a..959a83abcf3 100644 --- a/code/modules/mob/living/silicon/ai/login.dm +++ b/code/modules/mob/living/silicon/ai/login.dm @@ -21,7 +21,8 @@ src.verbs += /mob/proc/ghost else for(var/obj/machinery/ai_status_display/O in world) //change status - spawn( 0 ) - O.mode = 1 - O.emotion = "Neutral" + spawn(0) + if(O) + O.mode = 1 + O.emotion = "Neutral" return \ No newline at end of file