diff --git a/code/game/machinery/syndicatebeacon.dm b/code/game/machinery/syndicatebeacon.dm index 205886991aa..ecf707cc2e8 100644 --- a/code/game/machinery/syndicatebeacon.dm +++ b/code/game/machinery/syndicatebeacon.dm @@ -100,7 +100,101 @@ selfdestructing = 1 spawn() explosion(src.loc, rand(3,8), rand(1,3), 1, 10) +//////////////////////////////////////// +//Singularity beacon +//////////////////////////////////////// +/obj/machinery/power/singularity_beacon + name = "ominous beacon" + desc = "This looks suspicious..." + icon = 'icons/obj/singularity.dmi' + icon_state = "beacon" + 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 + var/icontype = "beacon" + + +/obj/machinery/power/singularity_beacon/proc/Activate(mob/user = null) + if(surplus() < 1500) + if(user) user << "The connected wire doesn't have enough current." + return + for(var/obj/machinery/singularity/singulo in world) + if(singulo.z == z) + singulo.target = src + icon_state = "[icontype]1" + active = 1 + machines |= src + if(user) + user << "You activate the beacon." + + +/obj/machinery/power/singularity_beacon/proc/Deactivate(mob/user = null) + for(var/obj/machinery/singularity/singulo in world) + if(singulo.target == src) + singulo.target = null + icon_state = "[icontype]0" + active = 0 + if(user) + user << "You deactivate the beacon." + + +/obj/machinery/power/singularity_beacon/attack_ai(mob/user as mob) + return + + +/obj/machinery/power/singularity_beacon/attack_hand(var/mob/user as mob) + if(anchored) + return active ? Deactivate(user) : Activate(user) + else + user << "You need to screw the beacon to the floor first!" + return + + +/obj/machinery/power/singularity_beacon/attackby(obj/item/weapon/W as obj, mob/user as mob) + if(istype(W,/obj/item/weapon/screwdriver)) + if(active) + user << "You need to deactivate the beacon first!" + return + + if(anchored) + anchored = 0 + user << "You unscrew the beacon from the floor." + disconnect_from_network() + return + else + if(!connect_to_network()) + user << "This device must be placed over an exposed cable." + return + anchored = 1 + user << "You screw the beacon to the floor and attach the cable." + return + ..() + return + + +/obj/machinery/power/singularity_beacon/Destroy() + if(active) + Deactivate() + ..() + +//stealth direct power usage +/obj/machinery/power/singularity_beacon/process() + if(!active) + return PROCESS_KILL + else + if(surplus() > 1500) + add_load(1500) + else + Deactivate() + + +/obj/machinery/power/singularity_beacon/syndicate + icontype = "beaconsynd" + icon_state = "beaconsynd0" // SINGULO BEACON SPAWNER /obj/item/device/sbeacondrop @@ -110,7 +204,7 @@ desc = "A label on it reads: Warning: Activating this device will send a special beacon to your location." origin_tech = "bluespace=1;syndicate=7" w_class = 2 - var/droptype = /obj/machinery/singularity_beacon/syndicate + var/droptype = /obj/machinery/power/singularity_beacon/syndicate /obj/item/device/sbeacondrop/attack_self(mob/user as mob) @@ -124,119 +218,3 @@ /obj/item/device/sbeacondrop/bomb desc = "A label on it reads: Warning: Activating this device will send a high-ordinance explosive to your location." droptype = /obj/machinery/syndicatebomb - -#define SCREWED 32 - -/obj/machinery/singularity_beacon //not the best place for it but it's a hack job anyway -- Urist - name = "ominous beacon" - desc = "This looks suspicious..." - icon = 'icons/obj/singularity.dmi' - icon_state = "beacon" - - 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/obj/structure/cable/attached = null - - -/obj/machinery/singularity_beacon/proc/Activate(mob/user = null) - if(!checkWirePower()) - if(user) user << "The connected wire doesn't have enough current." - return - for(var/obj/machinery/singularity/singulo in world) - if(singulo.z == z) - singulo.target = src - icon_state = "[icontype]1" - active = 1 - if(user) user << "You activate the beacon." - - -/obj/machinery/singularity_beacon/proc/Deactivate(mob/user = null) - for(var/obj/machinery/singularity/singulo in world) - if(singulo.target == src) - singulo.target = null - icon_state = "[icontype]0" - active = 0 - if(user) user << "You deactivate the beacon." - - -/obj/machinery/singularity_beacon/attack_ai(mob/user as mob) - return - - -/obj/machinery/singularity_beacon/attack_hand(var/mob/user as mob) - if(stat & SCREWED) - return active ? Deactivate(user) : Activate(user) - else - user << "You need to screw the beacon to the floor first!" - return - - -/obj/machinery/singularity_beacon/attackby(obj/item/weapon/W as obj, mob/user as mob) - if(istype(W,/obj/item/weapon/screwdriver)) - if(active) - user << "You need to deactivate the beacon first!" - return - - if(stat & SCREWED) - stat &= ~SCREWED - anchored = 0 - user << "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 << "You screw the beacon to the floor and attach the cable." - return - ..() - return - - -/obj/machinery/singularity_beacon/Destroy() - 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 - */ -/obj/machinery/singularity_beacon/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 - -/obj/machinery/singularity_beacon/process() - if(!active) - return - else - if(!checkWirePower()) - Deactivate() - return - - -/obj/machinery/singularity_beacon/syndicate - icontype = "beaconsynd" - icon_state = "beaconsynd0" - -#undef SCREWED - diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 5b585786bd0..6c538429169 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -33,7 +33,7 @@ src.energy = starting_energy ..() - for(var/obj/machinery/singularity_beacon/singubeacon in world) + for(var/obj/machinery/power/singularity_beacon/singubeacon in world) if(singubeacon.active) target = singubeacon break