Merge pull request #7142 from PsiOmegaDelta/Singularity

Syndicate beacon power consumption and objective.
This commit is contained in:
PsiOmegaDelta
2014-11-26 22:08:48 +01:00
3 changed files with 116 additions and 139 deletions

View File

@@ -19,7 +19,7 @@
var/selfdestructing = 0 var/selfdestructing = 0
var/charges = 1 var/charges = 1
attack_hand(var/mob/user as mob) /obj/machinery/syndicate_beacon/attack_hand(var/mob/user as mob)
usr.set_machine(src) usr.set_machine(src)
var/dat = "<font color=#005500><i>Scanning [pick("retina pattern", "voice print", "fingerprints", "dna sequence")]...<br>Identity confirmed,<br></i></font>" var/dat = "<font color=#005500><i>Scanning [pick("retina pattern", "voice print", "fingerprints", "dna sequence")]...<br>Identity confirmed,<br></i></font>"
if(istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon/ai)) if(istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon/ai))
@@ -38,7 +38,9 @@
user << browse(dat, "window=syndbeacon") user << browse(dat, "window=syndbeacon")
onclose(user, "syndbeacon") onclose(user, "syndbeacon")
Topic(href, href_list) /obj/machinery/syndicate_beacon/Topic(href, href_list)
if(..())
return
if(href_list["betraitor"]) if(href_list["betraitor"])
if(charges < 1) if(charges < 1)
src.updateUsrDialog() src.updateUsrDialog()
@@ -60,6 +62,7 @@
ticker.mode.equip_traitor(N) ticker.mode.equip_traitor(N)
ticker.mode.traitors += N.mind ticker.mode.traitors += N.mind
N.mind.special_role = "traitor" N.mind.special_role = "traitor"
if(!config.objectives_disabled)
var/objective = "Free Objective" var/objective = "Free Objective"
switch(rand(1,100)) switch(rand(1,100))
if(1 to 50) if(1 to 50)
@@ -82,26 +85,23 @@
escape_objective.owner = N.mind escape_objective.owner = N.mind
N.mind.objectives += escape_objective N.mind.objectives += escape_objective
M << "<B>You have joined the ranks of the Syndicate and become a traitor to the station!</B>" M << "<B>You have joined the ranks of the Syndicate and become a traitor to the station!</B>"
message_admins("[N]/([N.ckey]) has accepted a traitor objective from a syndicate beacon.")
show_objectives(M.mind) show_objectives(M.mind)
message_admins("[N]/([N.ckey]) has accepted a traitor objective from a syndicate beacon.")
src.add_fingerprint(usr)
src.updateUsrDialog() src.updateUsrDialog()
return return
proc/selfdestruct() /obj/machinery/syndicate_beacon/proc/selfdestruct()
selfdestructing = 1 selfdestructing = 1
spawn() explosion(src.loc, rand(3,8), rand(1,3), 1, 10) spawn() explosion(src.loc, rand(3,8), rand(1,3), 1, 10)
////////////////////////////////////////
//Singularity beacon
#define SCREWED 32 ////////////////////////////////////////
/obj/machinery/power/singularity_beacon
/obj/machinery/singularity_beacon //not the best place for it but it's a hack job anyway -- Urist
name = "ominous beacon" name = "ominous beacon"
desc = "This looks suspicious..." desc = "This looks suspicious..."
icon = 'icons/obj/singularity.dmi' icon = 'icons/obj/singularity.dmi'
@@ -112,105 +112,82 @@
layer = MOB_LAYER - 0.1 //so people can't hide it and it's REALLY OBVIOUS layer = MOB_LAYER - 0.1 //so people can't hide it and it's REALLY OBVIOUS
stat = 0 stat = 0
var/active = 0 //It doesn't use up power, so use_power wouldn't really suit it var/active = 0
var/icontype = "beacon" var/icontype = "beacon"
var/obj/structure/cable/attached = null
proc/Activate(mob/user = null) /obj/machinery/power/singularity_beacon/proc/Activate(mob/user = null)
if(!checkWirePower()) if(surplus() < 1500)
if(user) user << "\blue The connected wire doesn't have enough current." if(user) user << "<span class='notice'>The connected wire doesn't have enough current.</span>"
return return
for(var/obj/machinery/singularity/singulo in world) for(var/obj/machinery/singularity/singulo in world)
if(singulo.z == z) if(singulo.z == z)
singulo.target = src singulo.target = src
icon_state = "[icontype]1" icon_state = "[icontype]1"
active = 1 active = 1
if(user) user << "\blue You activate the beacon." machines |= src
if(user)
user << "<span class='notice'>You activate the beacon.</span>"
proc/Deactivate(mob/user = null) /obj/machinery/power/singularity_beacon/proc/Deactivate(mob/user = null)
for(var/obj/machinery/singularity/singulo in world) for(var/obj/machinery/singularity/singulo in world)
if(singulo.target == src) if(singulo.target == src)
singulo.target = null singulo.target = null
icon_state = "[icontype]0" icon_state = "[icontype]0"
active = 0 active = 0
if(user) user << "\blue You deactivate the beacon." if(user)
user << "<span class='notice'>You deactivate the beacon.</span>"
attack_ai(mob/user as mob) /obj/machinery/power/singularity_beacon/attack_ai(mob/user as mob)
return return
attack_hand(var/mob/user as mob) /obj/machinery/power/singularity_beacon/attack_hand(var/mob/user as mob)
if(stat & SCREWED) if(anchored)
return active ? Deactivate(user) : Activate(user) return active ? Deactivate(user) : Activate(user)
else else
user << "\red You need to screw the beacon to the floor first!" user << "<span class='danger'>You need to screw the beacon to the floor first!</span>"
return return
attackby(obj/item/weapon/W as obj, mob/user as mob) /obj/machinery/power/singularity_beacon/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W,/obj/item/weapon/screwdriver)) if(istype(W,/obj/item/weapon/screwdriver))
if(active) if(active)
user << "\red You need to deactivate the beacon first!" user << "<span class='danger'>You need to deactivate the beacon first!</span>"
return return
if(stat & SCREWED) if(anchored)
stat &= ~SCREWED
anchored = 0 anchored = 0
user << "\blue You unscrew the beacon from the floor." user << "<span class='notice'>You unscrew the beacon from the floor.</span>"
attached = null disconnect_from_network()
return return
else else
var/turf/T = loc if(!connect_to_network())
if(isturf(T) && !T.intact)
attached = locate() in T
if(!attached)
user << "This device must be placed over an exposed cable." user << "This device must be placed over an exposed cable."
return return
stat |= SCREWED
anchored = 1 anchored = 1
user << "\blue You screw the beacon to the floor and attach the cable." user << "<span class='notice'>You screw the beacon to the floor and attach the cable.</span>"
return return
..() ..()
return return
Del() /obj/machinery/power/singularity_beacon/Del()
if(active) Deactivate() if(active)
..() Deactivate()
..()
/*
* Added for a simple way to check power. Verifies that the beacon //stealth direct power usage
* is connected to a wire, the wire is part of a powernet (that part's /obj/machinery/power/singularity_beacon/process()
* sort of redundant, since all wires either join or create one when placed) if(!active)
* and that the powernet has at least 1500 power units available for use. return PROCESS_KILL
* Doesn't use them, though, just makes sure they're there. else
* - QualityVan, Aug 11 2012 if(draw_power(1500) < 1500)
*/
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(!active)
return
else
if(!checkWirePower())
Deactivate() Deactivate()
return
/obj/machinery/singularity_beacon/syndicate /obj/machinery/power/singularity_beacon/syndicate
icontype = "beaconsynd" icontype = "beaconsynd"
icon_state = "beaconsynd0" icon_state = "beaconsynd0"
#undef SCREWED

View File

@@ -43,7 +43,7 @@
/obj/item/device/radio/beacon/syndicate/attack_self(mob/user as mob) /obj/item/device/radio/beacon/syndicate/attack_self(mob/user as mob)
if(user) if(user)
user << "\blue Locked In" user << "\blue Locked In"
new /obj/machinery/singularity_beacon/syndicate( user.loc ) new /obj/machinery/power/singularity_beacon/syndicate( user.loc )
playsound(src, 'sound/effects/pop.ogg', 100, 1, 1) playsound(src, 'sound/effects/pop.ogg', 100, 1, 1)
del(src) del(src)
return return

View File

@@ -42,7 +42,7 @@ var/global/list/uneatable = list(
spawn(temp) spawn(temp)
del(src) del(src)
..() ..()
for(var/obj/machinery/singularity_beacon/singubeacon in machines) for(var/obj/machinery/power/singularity_beacon/singubeacon in machines)
if(singubeacon.active) if(singubeacon.active)
target = singubeacon target = singubeacon
break break