From 755c98d8b663058b66c1427292e4353cccda8bfc Mon Sep 17 00:00:00 2001 From: "petethegoat@gmail.com" Date: Tue, 14 Aug 2012 13:59:21 +0000 Subject: [PATCH] Committing for QualityVan! Fixes issue 458. Changes singularity beacons to consume zero power but require a certain amount to function, check the attached wire rather than the area for that power, and most importantly, not work in space(normally). git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4399 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/machinery/syndicatebeacon.dm | 34 +++++++++++++------- code/modules/power/sd_DynamicAreaLighting.dm | 4 +-- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/code/game/machinery/syndicatebeacon.dm b/code/game/machinery/syndicatebeacon.dm index 927d4b787c..98c65aca57 100644 --- a/code/game/machinery/syndicatebeacon.dm +++ b/code/game/machinery/syndicatebeacon.dm @@ -120,6 +120,9 @@ proc/Activate(mob/user = null) + if(!checkWirePower()) + if(user) user << "\blue The connected wire doesn't have enough current." + return for(var/obj/machinery/singularity/singulo in world) if(singulo.z == z) singulo.target = src @@ -180,23 +183,30 @@ if(active) Deactivate() ..() + /* + * Added for a simple way to check power. Verifies that the beacon + * is connected to a wire, the wire is part of a powernet (that part's + * sort of redundant, since all wires either join or create one when placed) + * and that the powernet has at least 1500 power units available for use. + * Doesn't use them, though, just makes sure they're there. + * - QualityVan, Aug 11 2012 + */ + proc/checkWirePower() + if(!attached) + return 0 + var/datum/powernet/PN = attached.get_powernet() + if(!PN) + return 0 + if(PN.avail < 1500) + return 0 + return 1 process() - if(stat & NOPOWER) - if(active) - Deactivate() - return - if(!active) return - - if(attached) - if(!attached.get_powernet()) - Deactivate() - return - use_power(1500) else - Deactivate() + if(!checkWirePower()) + Deactivate() return diff --git a/code/modules/power/sd_DynamicAreaLighting.dm b/code/modules/power/sd_DynamicAreaLighting.dm index 64d1ad66aa..eff490a23c 100644 --- a/code/modules/power/sd_DynamicAreaLighting.dm +++ b/code/modules/power/sd_DynamicAreaLighting.dm @@ -576,7 +576,7 @@ mob/sd_ApplyLum(list/V, center = src) if(isturf(loc)) V = view(luminosity,loc) else - V = view(luminosity,src) + V = view(luminosity,get_turf(src)) . = ..(V, center) mob/sd_StripLum(list/V, center = src) @@ -584,7 +584,7 @@ mob/sd_StripLum(list/V, center = src) if(isturf(loc)) V = view(luminosity,loc) else - V = view(luminosity,src) + V = view(luminosity,get_turf(src)) . = ..(V, center) mob/sd_ApplyLocalLum(list/affected)