mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-17 01:54:25 +01:00
Whitespace Standardization [MDB IGNORE] (#15748)
* Update settings * Whitespace changes * Comment out merger hooks in gitattributes Corrupt maps would have to be resolved in repo before hooks could be updated * Revert "Whitespace changes" This reverts commitafbdd1d844. * Whitespace again minus example * Gitignore example changelog * Restore changelog merge setting * Keep older dmi hook attribute until hooks can be updated * update vscode settings too * Renormalize remaining * Revert "Gitignore example changelog" This reverts commitde22ad375d. * Attempt to normalize example.yml (and another file I guess) * Try again
This commit is contained in:
@@ -1,125 +1,125 @@
|
||||
#define I_SINGULO "singulo"
|
||||
|
||||
/atom/proc/singularity_act()
|
||||
return
|
||||
|
||||
/atom/proc/singularity_pull(S, current_size)
|
||||
return
|
||||
|
||||
/mob/living/singularity_act()
|
||||
investigate_log("has been consumed by a singularity", I_SINGULO)
|
||||
gib()
|
||||
return 20
|
||||
|
||||
/mob/living/singularity_pull(S, current_size)
|
||||
step_towards(src, S)
|
||||
apply_effect(current_size * 3, IRRADIATE, blocked = getarmor(null, "rad"))
|
||||
|
||||
/mob/living/carbon/human/singularity_act()
|
||||
var/gain = 20
|
||||
if(mind)
|
||||
if((mind.assigned_role == "Engineer") || (mind.assigned_role == "Chief Engineer"))
|
||||
gain = 100
|
||||
if(mind.assigned_role == USELESS_JOB) //VOREStation Edit - Visitor not Assistant
|
||||
gain = rand(0, 300)
|
||||
investigate_log(I_SINGULO,"has been consumed by a singularity", I_SINGULO)
|
||||
gib()
|
||||
return gain
|
||||
|
||||
/mob/living/carbon/human/singularity_pull(S, current_size)
|
||||
if(current_size >= STAGE_THREE)
|
||||
var/list/handlist = list(l_hand, r_hand)
|
||||
for(var/obj/item/hand in handlist)
|
||||
if(prob(current_size*5) && hand.w_class >= ((11-current_size)/2) && unEquip(hand))
|
||||
step_towards(hand, S)
|
||||
to_chat(src, "<span class = 'warning'>The [S] pulls \the [hand] from your grip!</span>")
|
||||
|
||||
if(!lying && (!shoes || !(shoes.item_flags & NOSLIP)) && (!species || !(species.flags & NOSLIP)) && prob(current_size*5))
|
||||
to_chat(src, "<span class='danger'>A strong gravitational force slams you to the ground!</span>")
|
||||
Weaken(current_size)
|
||||
..()
|
||||
|
||||
/obj/singularity_act()
|
||||
if(simulated)
|
||||
ex_act(1)
|
||||
if(src)
|
||||
qdel(src)
|
||||
return 2
|
||||
|
||||
/obj/singularity_pull(S, current_size)
|
||||
set waitfor = 0
|
||||
|
||||
if(anchored)
|
||||
return
|
||||
|
||||
sleep(0) //this is needed or multiple items will be thrown sequentially and not simultaneously
|
||||
if(current_size >= STAGE_FOUR)
|
||||
step_towards(src,S)
|
||||
sleep(1)
|
||||
step_towards(src,S)
|
||||
else if(current_size > STAGE_ONE)
|
||||
step_towards(src,S)
|
||||
else ..()
|
||||
|
||||
/obj/effect/beam/singularity_pull()
|
||||
return
|
||||
|
||||
/obj/effect/overlay/singularity_pull()
|
||||
return
|
||||
|
||||
/obj/machinery/power/supermatter/shard/singularity_act()
|
||||
qdel(src)
|
||||
return 5000
|
||||
|
||||
/obj/machinery/power/supermatter/singularity_act()
|
||||
if(!src.loc)
|
||||
return
|
||||
|
||||
var/prints = ""
|
||||
if(src.fingerprintshidden)
|
||||
prints = ", all touchers : " + src.fingerprintshidden
|
||||
|
||||
SetUniversalState(/datum/universal_state/supermatter_cascade)
|
||||
log_admin("New super singularity made by eating a SM crystal [prints]. Last touched by [src.fingerprintslast].")
|
||||
message_admins("New super singularity made by eating a SM crystal [prints]. Last touched by [src.fingerprintslast].")
|
||||
qdel(src)
|
||||
return 50000
|
||||
|
||||
/obj/item/projectile/beam/emitter/singularity_pull()
|
||||
return
|
||||
|
||||
/obj/effect/projectile/emitter/singularity_pull()
|
||||
return
|
||||
|
||||
/obj/item/weapon/storage/backpack/holding/singularity_act(S, current_size)
|
||||
var/dist = max((current_size - 2), 1)
|
||||
explosion(src.loc,(dist),(dist*2),(dist*4))
|
||||
return 1000
|
||||
|
||||
/turf/singularity_act(S, current_size)
|
||||
if(!is_plating())
|
||||
for(var/obj/O in contents)
|
||||
if(O.level != 1)
|
||||
continue
|
||||
if(O.invisibility == 101)
|
||||
O.singularity_act(src, current_size)
|
||||
ChangeTurf(get_base_turf_by_area(src))
|
||||
return 2
|
||||
|
||||
/turf/space/singularity_act()
|
||||
return
|
||||
|
||||
/turf/simulated/open/singularity_act()
|
||||
return
|
||||
|
||||
/*******************
|
||||
* Nar-Sie Act/Pull *
|
||||
*******************/
|
||||
/atom/proc/singuloCanEat()
|
||||
return 1
|
||||
|
||||
/mob/observer/singuloCanEat()
|
||||
return 0
|
||||
|
||||
/mob/new_player/singuloCanEat()
|
||||
return 0
|
||||
#define I_SINGULO "singulo"
|
||||
|
||||
/atom/proc/singularity_act()
|
||||
return
|
||||
|
||||
/atom/proc/singularity_pull(S, current_size)
|
||||
return
|
||||
|
||||
/mob/living/singularity_act()
|
||||
investigate_log("has been consumed by a singularity", I_SINGULO)
|
||||
gib()
|
||||
return 20
|
||||
|
||||
/mob/living/singularity_pull(S, current_size)
|
||||
step_towards(src, S)
|
||||
apply_effect(current_size * 3, IRRADIATE, blocked = getarmor(null, "rad"))
|
||||
|
||||
/mob/living/carbon/human/singularity_act()
|
||||
var/gain = 20
|
||||
if(mind)
|
||||
if((mind.assigned_role == "Engineer") || (mind.assigned_role == "Chief Engineer"))
|
||||
gain = 100
|
||||
if(mind.assigned_role == USELESS_JOB) //VOREStation Edit - Visitor not Assistant
|
||||
gain = rand(0, 300)
|
||||
investigate_log(I_SINGULO,"has been consumed by a singularity", I_SINGULO)
|
||||
gib()
|
||||
return gain
|
||||
|
||||
/mob/living/carbon/human/singularity_pull(S, current_size)
|
||||
if(current_size >= STAGE_THREE)
|
||||
var/list/handlist = list(l_hand, r_hand)
|
||||
for(var/obj/item/hand in handlist)
|
||||
if(prob(current_size*5) && hand.w_class >= ((11-current_size)/2) && unEquip(hand))
|
||||
step_towards(hand, S)
|
||||
to_chat(src, "<span class = 'warning'>The [S] pulls \the [hand] from your grip!</span>")
|
||||
|
||||
if(!lying && (!shoes || !(shoes.item_flags & NOSLIP)) && (!species || !(species.flags & NOSLIP)) && prob(current_size*5))
|
||||
to_chat(src, "<span class='danger'>A strong gravitational force slams you to the ground!</span>")
|
||||
Weaken(current_size)
|
||||
..()
|
||||
|
||||
/obj/singularity_act()
|
||||
if(simulated)
|
||||
ex_act(1)
|
||||
if(src)
|
||||
qdel(src)
|
||||
return 2
|
||||
|
||||
/obj/singularity_pull(S, current_size)
|
||||
set waitfor = 0
|
||||
|
||||
if(anchored)
|
||||
return
|
||||
|
||||
sleep(0) //this is needed or multiple items will be thrown sequentially and not simultaneously
|
||||
if(current_size >= STAGE_FOUR)
|
||||
step_towards(src,S)
|
||||
sleep(1)
|
||||
step_towards(src,S)
|
||||
else if(current_size > STAGE_ONE)
|
||||
step_towards(src,S)
|
||||
else ..()
|
||||
|
||||
/obj/effect/beam/singularity_pull()
|
||||
return
|
||||
|
||||
/obj/effect/overlay/singularity_pull()
|
||||
return
|
||||
|
||||
/obj/machinery/power/supermatter/shard/singularity_act()
|
||||
qdel(src)
|
||||
return 5000
|
||||
|
||||
/obj/machinery/power/supermatter/singularity_act()
|
||||
if(!src.loc)
|
||||
return
|
||||
|
||||
var/prints = ""
|
||||
if(src.fingerprintshidden)
|
||||
prints = ", all touchers : " + src.fingerprintshidden
|
||||
|
||||
SetUniversalState(/datum/universal_state/supermatter_cascade)
|
||||
log_admin("New super singularity made by eating a SM crystal [prints]. Last touched by [src.fingerprintslast].")
|
||||
message_admins("New super singularity made by eating a SM crystal [prints]. Last touched by [src.fingerprintslast].")
|
||||
qdel(src)
|
||||
return 50000
|
||||
|
||||
/obj/item/projectile/beam/emitter/singularity_pull()
|
||||
return
|
||||
|
||||
/obj/effect/projectile/emitter/singularity_pull()
|
||||
return
|
||||
|
||||
/obj/item/weapon/storage/backpack/holding/singularity_act(S, current_size)
|
||||
var/dist = max((current_size - 2), 1)
|
||||
explosion(src.loc,(dist),(dist*2),(dist*4))
|
||||
return 1000
|
||||
|
||||
/turf/singularity_act(S, current_size)
|
||||
if(!is_plating())
|
||||
for(var/obj/O in contents)
|
||||
if(O.level != 1)
|
||||
continue
|
||||
if(O.invisibility == 101)
|
||||
O.singularity_act(src, current_size)
|
||||
ChangeTurf(get_base_turf_by_area(src))
|
||||
return 2
|
||||
|
||||
/turf/space/singularity_act()
|
||||
return
|
||||
|
||||
/turf/simulated/open/singularity_act()
|
||||
return
|
||||
|
||||
/*******************
|
||||
* Nar-Sie Act/Pull *
|
||||
*******************/
|
||||
/atom/proc/singuloCanEat()
|
||||
return 1
|
||||
|
||||
/mob/observer/singuloCanEat()
|
||||
return 0
|
||||
|
||||
/mob/new_player/singuloCanEat()
|
||||
return 0
|
||||
|
||||
@@ -1,159 +1,159 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
var/global/list/rad_collectors = list()
|
||||
|
||||
/obj/machinery/power/rad_collector
|
||||
name = "Radiation Collector Array"
|
||||
desc = "A device which uses Hawking Radiation and phoron to produce power."
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
icon_state = "ca"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
req_access = list(access_engine_equip)
|
||||
// use_power = 0
|
||||
var/obj/item/weapon/tank/phoron/P = null
|
||||
var/last_power = 0
|
||||
var/last_power_new = 0
|
||||
var/active = 0
|
||||
var/locked = 0
|
||||
var/drainratio = 1
|
||||
|
||||
/obj/machinery/power/rad_collector/New()
|
||||
..()
|
||||
rad_collectors += src
|
||||
|
||||
/obj/machinery/power/rad_collector/Destroy()
|
||||
rad_collectors -= src
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/rad_collector/process()
|
||||
//so that we don't zero out the meter if the SM is processed first.
|
||||
last_power = last_power_new
|
||||
last_power_new = 0
|
||||
|
||||
|
||||
if(P && active)
|
||||
var/rads = SSradiation.get_rads_at_turf(get_turf(src))
|
||||
if(rads)
|
||||
receive_pulse(rads * 5) //Maths is hard
|
||||
|
||||
if(P)
|
||||
if(P.air_contents.gas["phoron"] == 0)
|
||||
investigate_log("<font color='red'>out of fuel</font>.","singulo")
|
||||
eject()
|
||||
else
|
||||
P.air_contents.adjust_gas("phoron", -0.001*drainratio)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/rad_collector/attack_hand(mob/user as mob)
|
||||
if(anchored)
|
||||
if(!src.locked)
|
||||
toggle_power()
|
||||
user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
|
||||
"You turn the [src.name] [active? "on":"off"].")
|
||||
investigate_log("turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [user.key]. [P?"Fuel: [round(P.air_contents.gas["phoron"]/0.29)]%":"<font color='red'>It is empty</font>"].","singulo")
|
||||
return
|
||||
else
|
||||
to_chat(user, span_red("The controls are locked!"))
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/rad_collector/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/weapon/tank/phoron))
|
||||
if(!src.anchored)
|
||||
to_chat(user, span_red("The [src] needs to be secured to the floor first."))
|
||||
return 1
|
||||
if(src.P)
|
||||
to_chat(user, span_red("There's already a phoron tank loaded."))
|
||||
return 1
|
||||
user.drop_item()
|
||||
src.P = W
|
||||
W.loc = src
|
||||
update_icons()
|
||||
return 1
|
||||
else if(W.has_tool_quality(TOOL_CROWBAR))
|
||||
if(P && !src.locked)
|
||||
eject()
|
||||
return 1
|
||||
else if(W.has_tool_quality(TOOL_WRENCH))
|
||||
if(P)
|
||||
to_chat(user, span_blue("Remove the phoron tank first."))
|
||||
return 1
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
src.anchored = !src.anchored
|
||||
user.visible_message("[user.name] [anchored? "secures":"unsecures"] the [src.name].", \
|
||||
"You [anchored? "secure":"undo"] the external bolts.", \
|
||||
"You hear a ratchet.")
|
||||
if(anchored)
|
||||
connect_to_network()
|
||||
else
|
||||
disconnect_from_network()
|
||||
return 1
|
||||
else if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
|
||||
if (src.allowed(user))
|
||||
if(active)
|
||||
src.locked = !src.locked
|
||||
to_chat(user, "The controls are now [src.locked ? "locked." : "unlocked."]")
|
||||
else
|
||||
src.locked = 0 //just in case it somehow gets locked
|
||||
to_chat(user, span_red("The controls can only be locked when the [src] is active."))
|
||||
else
|
||||
to_chat(user, span_red("Access denied!"))
|
||||
return 1
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/rad_collector/examine(mob/user)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 3)
|
||||
. += "The meter indicates that it is collecting [last_power] W."
|
||||
|
||||
/obj/machinery/power/rad_collector/ex_act(severity)
|
||||
switch(severity)
|
||||
if(2, 3)
|
||||
eject()
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/machinery/power/rad_collector/proc/eject()
|
||||
locked = 0
|
||||
var/obj/item/weapon/tank/phoron/Z = src.P
|
||||
if (!Z)
|
||||
return
|
||||
Z.loc = get_turf(src)
|
||||
Z.layer = initial(Z.layer)
|
||||
src.P = null
|
||||
if(active)
|
||||
toggle_power()
|
||||
else
|
||||
update_icons()
|
||||
|
||||
/obj/machinery/power/rad_collector/proc/receive_pulse(var/pulse_strength)
|
||||
if(P && active)
|
||||
var/power_produced = 0
|
||||
power_produced = P.air_contents.gas["phoron"]*pulse_strength*20
|
||||
add_avail(power_produced)
|
||||
last_power_new = power_produced
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/rad_collector/proc/update_icons()
|
||||
cut_overlays()
|
||||
if(P)
|
||||
add_overlay("ptank")
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if(active)
|
||||
add_overlay("on")
|
||||
|
||||
|
||||
/obj/machinery/power/rad_collector/proc/toggle_power()
|
||||
active = !active
|
||||
if(active)
|
||||
icon_state = "ca_on"
|
||||
flick("ca_active", src)
|
||||
else
|
||||
icon_state = "ca"
|
||||
flick("ca_deactive", src)
|
||||
update_icons()
|
||||
return
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
var/global/list/rad_collectors = list()
|
||||
|
||||
/obj/machinery/power/rad_collector
|
||||
name = "Radiation Collector Array"
|
||||
desc = "A device which uses Hawking Radiation and phoron to produce power."
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
icon_state = "ca"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
req_access = list(access_engine_equip)
|
||||
// use_power = 0
|
||||
var/obj/item/weapon/tank/phoron/P = null
|
||||
var/last_power = 0
|
||||
var/last_power_new = 0
|
||||
var/active = 0
|
||||
var/locked = 0
|
||||
var/drainratio = 1
|
||||
|
||||
/obj/machinery/power/rad_collector/New()
|
||||
..()
|
||||
rad_collectors += src
|
||||
|
||||
/obj/machinery/power/rad_collector/Destroy()
|
||||
rad_collectors -= src
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/rad_collector/process()
|
||||
//so that we don't zero out the meter if the SM is processed first.
|
||||
last_power = last_power_new
|
||||
last_power_new = 0
|
||||
|
||||
|
||||
if(P && active)
|
||||
var/rads = SSradiation.get_rads_at_turf(get_turf(src))
|
||||
if(rads)
|
||||
receive_pulse(rads * 5) //Maths is hard
|
||||
|
||||
if(P)
|
||||
if(P.air_contents.gas["phoron"] == 0)
|
||||
investigate_log("<font color='red'>out of fuel</font>.","singulo")
|
||||
eject()
|
||||
else
|
||||
P.air_contents.adjust_gas("phoron", -0.001*drainratio)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/rad_collector/attack_hand(mob/user as mob)
|
||||
if(anchored)
|
||||
if(!src.locked)
|
||||
toggle_power()
|
||||
user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
|
||||
"You turn the [src.name] [active? "on":"off"].")
|
||||
investigate_log("turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [user.key]. [P?"Fuel: [round(P.air_contents.gas["phoron"]/0.29)]%":"<font color='red'>It is empty</font>"].","singulo")
|
||||
return
|
||||
else
|
||||
to_chat(user, span_red("The controls are locked!"))
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/rad_collector/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/weapon/tank/phoron))
|
||||
if(!src.anchored)
|
||||
to_chat(user, span_red("The [src] needs to be secured to the floor first."))
|
||||
return 1
|
||||
if(src.P)
|
||||
to_chat(user, span_red("There's already a phoron tank loaded."))
|
||||
return 1
|
||||
user.drop_item()
|
||||
src.P = W
|
||||
W.loc = src
|
||||
update_icons()
|
||||
return 1
|
||||
else if(W.has_tool_quality(TOOL_CROWBAR))
|
||||
if(P && !src.locked)
|
||||
eject()
|
||||
return 1
|
||||
else if(W.has_tool_quality(TOOL_WRENCH))
|
||||
if(P)
|
||||
to_chat(user, span_blue("Remove the phoron tank first."))
|
||||
return 1
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
src.anchored = !src.anchored
|
||||
user.visible_message("[user.name] [anchored? "secures":"unsecures"] the [src.name].", \
|
||||
"You [anchored? "secure":"undo"] the external bolts.", \
|
||||
"You hear a ratchet.")
|
||||
if(anchored)
|
||||
connect_to_network()
|
||||
else
|
||||
disconnect_from_network()
|
||||
return 1
|
||||
else if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
|
||||
if (src.allowed(user))
|
||||
if(active)
|
||||
src.locked = !src.locked
|
||||
to_chat(user, "The controls are now [src.locked ? "locked." : "unlocked."]")
|
||||
else
|
||||
src.locked = 0 //just in case it somehow gets locked
|
||||
to_chat(user, span_red("The controls can only be locked when the [src] is active."))
|
||||
else
|
||||
to_chat(user, span_red("Access denied!"))
|
||||
return 1
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/rad_collector/examine(mob/user)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 3)
|
||||
. += "The meter indicates that it is collecting [last_power] W."
|
||||
|
||||
/obj/machinery/power/rad_collector/ex_act(severity)
|
||||
switch(severity)
|
||||
if(2, 3)
|
||||
eject()
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/machinery/power/rad_collector/proc/eject()
|
||||
locked = 0
|
||||
var/obj/item/weapon/tank/phoron/Z = src.P
|
||||
if (!Z)
|
||||
return
|
||||
Z.loc = get_turf(src)
|
||||
Z.layer = initial(Z.layer)
|
||||
src.P = null
|
||||
if(active)
|
||||
toggle_power()
|
||||
else
|
||||
update_icons()
|
||||
|
||||
/obj/machinery/power/rad_collector/proc/receive_pulse(var/pulse_strength)
|
||||
if(P && active)
|
||||
var/power_produced = 0
|
||||
power_produced = P.air_contents.gas["phoron"]*pulse_strength*20
|
||||
add_avail(power_produced)
|
||||
last_power_new = power_produced
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/rad_collector/proc/update_icons()
|
||||
cut_overlays()
|
||||
if(P)
|
||||
add_overlay("ptank")
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if(active)
|
||||
add_overlay("on")
|
||||
|
||||
|
||||
/obj/machinery/power/rad_collector/proc/toggle_power()
|
||||
active = !active
|
||||
if(active)
|
||||
icon_state = "ca_on"
|
||||
flick("ca_active", src)
|
||||
else
|
||||
icon_state = "ca"
|
||||
flick("ca_deactive", src)
|
||||
update_icons()
|
||||
return
|
||||
|
||||
@@ -1,88 +1,88 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
/obj/machinery/containment_field
|
||||
name = "Containment Field"
|
||||
desc = "An energy field."
|
||||
icon = 'icons/obj/machines/field_generator.dmi'
|
||||
icon_state = "Contain_F"
|
||||
anchored = TRUE
|
||||
density = FALSE
|
||||
unacidable = TRUE
|
||||
use_power = USE_POWER_OFF
|
||||
light_on = TRUE
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#5BA8FF"
|
||||
var/obj/machinery/field_generator/FG1 = null
|
||||
var/obj/machinery/field_generator/FG2 = null
|
||||
var/list/shockdirs
|
||||
var/hasShocked = 0 //Used to add a delay between shocks. In some cases this used to crash servers by spawning hundreds of sparks every second.
|
||||
|
||||
/obj/machinery/containment_field/Initialize()
|
||||
. = ..()
|
||||
shockdirs = list(turn(dir,90),turn(dir,-90))
|
||||
sense_proximity(callback = /atom/proc/HasProximity)
|
||||
|
||||
/obj/machinery/containment_field/set_dir(new_dir)
|
||||
. = ..()
|
||||
if(.)
|
||||
shockdirs = list(turn(dir,90),turn(dir,-90))
|
||||
|
||||
/obj/machinery/containment_field/Destroy()
|
||||
unsense_proximity(callback = /atom/proc/HasProximity)
|
||||
if(FG1 && !FG1.clean_up)
|
||||
FG1.cleanup()
|
||||
if(FG2 && !FG2.clean_up)
|
||||
FG2.cleanup()
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/containment_field/attack_hand(mob/user as mob)
|
||||
if(get_dist(src, user) > 1)
|
||||
return 0
|
||||
else
|
||||
shock(user)
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/containment_field/ex_act(severity)
|
||||
return 0
|
||||
|
||||
/obj/machinery/containment_field/Crossed(mob/living/L)
|
||||
if(!istype(L) || L.incorporeal_move)
|
||||
return
|
||||
shock(L)
|
||||
|
||||
/obj/machinery/containment_field/HasProximity(turf/T, atom/movable/AM, old_loc)
|
||||
if(!istype(AM, /mob/living) || AM:incorporeal_move)
|
||||
return 0
|
||||
if(!(get_dir(src,AM) in shockdirs))
|
||||
return 0
|
||||
if(issilicon(AM) ? prob(40) : prob(50))
|
||||
shock(AM)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/containment_field/shock(mob/living/user as mob)
|
||||
if(hasShocked)
|
||||
return 0
|
||||
if(!FG1 || !FG2)
|
||||
qdel(src)
|
||||
return 0
|
||||
if(isliving(user))
|
||||
hasShocked = 1
|
||||
var/shock_damage = min(rand(30,40),rand(30,40))
|
||||
user.electrocute_act(shock_damage, src, 1, BP_TORSO)
|
||||
|
||||
var/atom/target = get_edge_target_turf(user, get_dir(src, get_step_away(user, src)))
|
||||
user.throw_at(target, 200, 4)
|
||||
|
||||
sleep(20)
|
||||
|
||||
hasShocked = 0
|
||||
|
||||
/obj/machinery/containment_field/proc/set_master(var/master1,var/master2)
|
||||
if(!master1 || !master2)
|
||||
return 0
|
||||
FG1 = master1
|
||||
FG2 = master2
|
||||
return 1
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
/obj/machinery/containment_field
|
||||
name = "Containment Field"
|
||||
desc = "An energy field."
|
||||
icon = 'icons/obj/machines/field_generator.dmi'
|
||||
icon_state = "Contain_F"
|
||||
anchored = TRUE
|
||||
density = FALSE
|
||||
unacidable = TRUE
|
||||
use_power = USE_POWER_OFF
|
||||
light_on = TRUE
|
||||
light_range = 2
|
||||
light_power = 0.5
|
||||
light_color = "#5BA8FF"
|
||||
var/obj/machinery/field_generator/FG1 = null
|
||||
var/obj/machinery/field_generator/FG2 = null
|
||||
var/list/shockdirs
|
||||
var/hasShocked = 0 //Used to add a delay between shocks. In some cases this used to crash servers by spawning hundreds of sparks every second.
|
||||
|
||||
/obj/machinery/containment_field/Initialize()
|
||||
. = ..()
|
||||
shockdirs = list(turn(dir,90),turn(dir,-90))
|
||||
sense_proximity(callback = /atom/proc/HasProximity)
|
||||
|
||||
/obj/machinery/containment_field/set_dir(new_dir)
|
||||
. = ..()
|
||||
if(.)
|
||||
shockdirs = list(turn(dir,90),turn(dir,-90))
|
||||
|
||||
/obj/machinery/containment_field/Destroy()
|
||||
unsense_proximity(callback = /atom/proc/HasProximity)
|
||||
if(FG1 && !FG1.clean_up)
|
||||
FG1.cleanup()
|
||||
if(FG2 && !FG2.clean_up)
|
||||
FG2.cleanup()
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/containment_field/attack_hand(mob/user as mob)
|
||||
if(get_dist(src, user) > 1)
|
||||
return 0
|
||||
else
|
||||
shock(user)
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/containment_field/ex_act(severity)
|
||||
return 0
|
||||
|
||||
/obj/machinery/containment_field/Crossed(mob/living/L)
|
||||
if(!istype(L) || L.incorporeal_move)
|
||||
return
|
||||
shock(L)
|
||||
|
||||
/obj/machinery/containment_field/HasProximity(turf/T, atom/movable/AM, old_loc)
|
||||
if(!istype(AM, /mob/living) || AM:incorporeal_move)
|
||||
return 0
|
||||
if(!(get_dir(src,AM) in shockdirs))
|
||||
return 0
|
||||
if(issilicon(AM) ? prob(40) : prob(50))
|
||||
shock(AM)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/containment_field/shock(mob/living/user as mob)
|
||||
if(hasShocked)
|
||||
return 0
|
||||
if(!FG1 || !FG2)
|
||||
qdel(src)
|
||||
return 0
|
||||
if(isliving(user))
|
||||
hasShocked = 1
|
||||
var/shock_damage = min(rand(30,40),rand(30,40))
|
||||
user.electrocute_act(shock_damage, src, 1, BP_TORSO)
|
||||
|
||||
var/atom/target = get_edge_target_turf(user, get_dir(src, get_step_away(user, src)))
|
||||
user.throw_at(target, 200, 4)
|
||||
|
||||
sleep(20)
|
||||
|
||||
hasShocked = 0
|
||||
|
||||
/obj/machinery/containment_field/proc/set_master(var/master1,var/master2)
|
||||
if(!master1 || !master2)
|
||||
return 0
|
||||
FG1 = master1
|
||||
FG2 = master2
|
||||
return 1
|
||||
|
||||
@@ -1,312 +1,312 @@
|
||||
#define EMITTER_DAMAGE_POWER_TRANSFER 450 //used to transfer power to containment field generators
|
||||
|
||||
/obj/machinery/power/emitter
|
||||
name = "emitter"
|
||||
desc = "It is a heavy duty industrial laser."
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
icon_state = "emitter"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
unacidable = TRUE
|
||||
req_access = list(access_engine_equip)
|
||||
var/id = null
|
||||
|
||||
use_power = USE_POWER_OFF //uses powernet power, not APC power
|
||||
active_power_usage = 30000 //30 kW laser. I guess that means 30 kJ per shot.
|
||||
|
||||
var/active = 0
|
||||
var/powered = 0
|
||||
var/fire_delay = 100
|
||||
var/max_burst_delay = 100
|
||||
var/min_burst_delay = 20
|
||||
var/burst_shots = 3
|
||||
var/last_shot = 0
|
||||
var/shot_number = 0
|
||||
var/state = 0
|
||||
var/locked = 0
|
||||
|
||||
var/burst_delay = 2
|
||||
var/initial_fire_delay = 100
|
||||
|
||||
var/integrity = 80
|
||||
|
||||
/obj/machinery/power/emitter/verb/rotate_clockwise()
|
||||
set name = "Rotate Emitter Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/emitter/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Emitter Counter-Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/emitter/Initialize()
|
||||
. = ..()
|
||||
if(state == 2 && anchored)
|
||||
connect_to_network()
|
||||
|
||||
/obj/machinery/power/emitter/Destroy()
|
||||
message_admins("Emitter deleted at ([x],[y],[z] - <A HREF='?_src_=holder;[HrefToken()];adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
log_game("EMITTER([x],[y],[z]) Destroyed/deleted.")
|
||||
investigate_log("<font color='red'>deleted</font> at ([x],[y],[z])","singulo")
|
||||
..()
|
||||
|
||||
/obj/machinery/power/emitter/update_icon()
|
||||
if (active && powernet && avail(active_power_usage))
|
||||
icon_state = "emitter_+a"
|
||||
else
|
||||
icon_state = "emitter"
|
||||
|
||||
/obj/machinery/power/emitter/attack_hand(mob/user as mob)
|
||||
src.add_fingerprint(user)
|
||||
activate(user)
|
||||
|
||||
/obj/machinery/power/emitter/proc/activate(mob/user as mob)
|
||||
if(state == 2)
|
||||
if(!powernet)
|
||||
to_chat(user, "\The [src] isn't connected to a wire.")
|
||||
return 1
|
||||
if(!src.locked)
|
||||
if(src.active==1)
|
||||
src.active = 0
|
||||
to_chat(user, "You turn off [src].")
|
||||
message_admins("Emitter turned off by [key_name(user, user.client)](<A HREF='?_src_=holder;[HrefToken()];adminmoreinfo=\ref[user]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;[HrefToken()];adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
log_game("EMITTER([x],[y],[z]) OFF by [key_name(user)]")
|
||||
investigate_log("turned <font color='red'>off</font> by [user.key]","singulo")
|
||||
else
|
||||
src.active = 1
|
||||
to_chat(user, "You turn on [src].")
|
||||
src.shot_number = 0
|
||||
src.fire_delay = get_initial_fire_delay()
|
||||
message_admins("Emitter turned on by [key_name(user, user.client)](<A HREF='?_src_=holder;[HrefToken()];adminmoreinfo=\ref[user]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;[HrefToken()];adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
log_game("EMITTER([x],[y],[z]) ON by [key_name(user)]")
|
||||
investigate_log("turned <font color='green'>on</font> by [user.key]","singulo")
|
||||
update_icon()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The controls are locked!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>\The [src] needs to be firmly secured to the floor first.</span>")
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/power/emitter/emp_act(var/severity)//Emitters are hardened but still might have issues
|
||||
// add_load(1000)
|
||||
/* if((severity == 1)&&prob(1)&&prob(1))
|
||||
if(src.active)
|
||||
src.active = 0
|
||||
src.use_power = 1 */
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/emitter/process()
|
||||
if(stat & (BROKEN))
|
||||
return
|
||||
if(src.state != 2 || (!powernet && active_power_usage))
|
||||
src.active = 0
|
||||
update_icon()
|
||||
return
|
||||
if(((src.last_shot + src.fire_delay) <= world.time) && (src.active == 1))
|
||||
|
||||
var/actual_load = draw_power(active_power_usage)
|
||||
if(actual_load >= active_power_usage) //does the laser have enough power to shoot?
|
||||
if(!powered)
|
||||
powered = 1
|
||||
update_icon()
|
||||
log_game("EMITTER([x],[y],[z]) Regained power and is ON.")
|
||||
investigate_log("regained power and turned <font color='green'>on</font>","singulo")
|
||||
else
|
||||
if(powered)
|
||||
powered = 0
|
||||
update_icon()
|
||||
log_game("EMITTER([x],[y],[z]) Lost power and was ON.")
|
||||
investigate_log("lost power and turned <font color='red'>off</font>","singulo")
|
||||
return
|
||||
|
||||
src.last_shot = world.time
|
||||
if(src.shot_number < burst_shots)
|
||||
src.fire_delay = get_burst_delay() //R-UST port
|
||||
src.shot_number ++
|
||||
else
|
||||
src.fire_delay = get_rand_burst_delay() //R-UST port
|
||||
src.shot_number = 0
|
||||
|
||||
//need to calculate the power per shot as the emitter doesn't fire continuously.
|
||||
var/burst_time = (min_burst_delay + max_burst_delay)/2 + 2*(burst_shots-1)
|
||||
var/power_per_shot = active_power_usage * (burst_time/10) / burst_shots
|
||||
|
||||
playsound(src, 'sound/weapons/emitter.ogg', 25, 1)
|
||||
if(prob(35))
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(5, 1, src)
|
||||
s.start()
|
||||
|
||||
var/obj/item/projectile/beam/emitter/A = get_emitter_beam()
|
||||
A.damage = round(power_per_shot/EMITTER_DAMAGE_POWER_TRANSFER)
|
||||
A.firer = src
|
||||
A.fire(dir2angle(dir))
|
||||
|
||||
/obj/machinery/power/emitter/attackby(obj/item/W, mob/user)
|
||||
|
||||
if(W.has_tool_quality(TOOL_WRENCH))
|
||||
if(active)
|
||||
to_chat(user, "Turn off [src] first.")
|
||||
return
|
||||
switch(state)
|
||||
if(0)
|
||||
state = 1
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
user.visible_message("[user.name] secures [src] to the floor.", \
|
||||
"You secure the external reinforcing bolts to the floor.", \
|
||||
"You hear a ratchet.")
|
||||
src.anchored = TRUE
|
||||
if(1)
|
||||
state = 0
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
user.visible_message("[user.name] unsecures [src] reinforcing bolts from the floor.", \
|
||||
"You undo the external reinforcing bolts.", \
|
||||
"You hear a ratchet.")
|
||||
src.anchored = FALSE
|
||||
disconnect_from_network()
|
||||
if(2)
|
||||
to_chat(user, "<span class='warning'>\The [src] needs to be unwelded from the floor.</span>")
|
||||
update_icon() // VOREStation Add
|
||||
return
|
||||
|
||||
if(W.has_tool_quality(TOOL_WELDER))
|
||||
var/obj/item/weapon/weldingtool/WT = W.get_welder()
|
||||
if(active)
|
||||
to_chat(user, "Turn off [src] first.")
|
||||
return
|
||||
switch(state)
|
||||
if(0)
|
||||
to_chat(user, "<span class='warning'>\The [src] needs to be wrenched to the floor.</span>")
|
||||
if(1)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src, WT.usesound, 50, 1)
|
||||
user.visible_message("[user.name] starts to weld [src] to the floor.", \
|
||||
"You start to weld [src] to the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20 * WT.toolspeed))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 2
|
||||
to_chat(user, "You weld [src] to the floor.")
|
||||
connect_to_network()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need more welding fuel to complete this task.</span>")
|
||||
if(2)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src, WT.usesound, 50, 1)
|
||||
user.visible_message("[user.name] starts to cut [src] free from the floor.", \
|
||||
"You start to cut [src] free from the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20 * WT.toolspeed))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 1
|
||||
to_chat(user, "You cut [src] free from the floor.")
|
||||
disconnect_from_network()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need more welding fuel to complete this task.</span>")
|
||||
update_icon() // VOREStation Add
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/stack/material) && W.get_material_name() == MAT_STEEL)
|
||||
var/amt = CEILING(( initial(integrity) - integrity)/10, 1)
|
||||
if(!amt)
|
||||
to_chat(user, "<span class='notice'>\The [src] is already fully repaired.</span>")
|
||||
return
|
||||
var/obj/item/stack/P = W
|
||||
if(!P.can_use(amt))
|
||||
to_chat(user, "<span class='warning'>You don't have enough sheets to repair this! You need at least [amt] sheets.</span>")
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You begin repairing \the [src]...</span>")
|
||||
if(do_after(user, 30))
|
||||
if(P.use(amt))
|
||||
to_chat(user, "<span class='notice'>You have repaired \the [src].</span>")
|
||||
integrity = initial(integrity)
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You don't have enough sheets to repair this! You need at least [amt] sheets.</span>")
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda))
|
||||
if(emagged)
|
||||
to_chat(user, "<span class='warning'>The lock seems to be broken.</span>")
|
||||
return
|
||||
if(src.allowed(user))
|
||||
src.locked = !src.locked
|
||||
to_chat(user, "The controls are now [src.locked ? "locked." : "unlocked."]")
|
||||
update_icon() // VOREStation Add
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/machinery/power/emitter/emag_act(var/remaining_charges, var/mob/user)
|
||||
if(!emagged)
|
||||
locked = 0
|
||||
emagged = 1
|
||||
user.visible_message("[user.name] emags [src].","<span class='warning'>You short out the lock.</span>")
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/emitter/bullet_act(var/obj/item/projectile/P)
|
||||
if(!P || !P.damage || P.get_structure_damage() <= 0 )
|
||||
return
|
||||
|
||||
adjust_integrity(-P.get_structure_damage())
|
||||
|
||||
/obj/machinery/power/emitter/blob_act()
|
||||
adjust_integrity(-1000) // This kills the emitter.
|
||||
|
||||
/obj/machinery/power/emitter/proc/adjust_integrity(amount)
|
||||
integrity = between(0, integrity + amount, initial(integrity))
|
||||
if(integrity == 0)
|
||||
if(powernet && avail(active_power_usage)) // If it's powered, it goes boom if killed.
|
||||
visible_message(src, "<span class='danger'>\The [src] explodes violently!</span>", "<span class='danger'>You hear an explosion!</span>")
|
||||
explosion(get_turf(src), 1, 2, 4)
|
||||
else
|
||||
src.visible_message("<span class='danger'>\The [src] crumples apart!</span>", "<span class='warning'>You hear metal collapsing.</span>")
|
||||
if(src)
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/power/emitter/examine(mob/user)
|
||||
. = ..()
|
||||
switch(state)
|
||||
if(0)
|
||||
. += "<span class='warning'>It is not secured in place!</span>"
|
||||
if(1)
|
||||
. += "<span class='warning'>It has been bolted down securely, but not welded into place.</span>"
|
||||
if(2)
|
||||
. += "<span class='notice'>It has been bolted down securely and welded down into place.</span>"
|
||||
var/integrity_percentage = round((integrity / initial(integrity)) * 100)
|
||||
switch(integrity_percentage)
|
||||
if(0 to 30)
|
||||
. += "<span class='danger'>It is close to falling apart!</span>"
|
||||
if(31 to 70)
|
||||
. += "<span class='danger'>It is damaged.</span>"
|
||||
if(77 to 99)
|
||||
. += "<span class='warning'>It is slightly damaged.</span>"
|
||||
|
||||
//R-UST port
|
||||
/obj/machinery/power/emitter/proc/get_initial_fire_delay()
|
||||
return initial_fire_delay
|
||||
|
||||
/obj/machinery/power/emitter/proc/get_rand_burst_delay()
|
||||
return rand(min_burst_delay, max_burst_delay)
|
||||
|
||||
/obj/machinery/power/emitter/proc/get_burst_delay()
|
||||
return burst_delay
|
||||
|
||||
/obj/machinery/power/emitter/proc/get_emitter_beam()
|
||||
return new /obj/item/projectile/beam/emitter(get_turf(src))
|
||||
#define EMITTER_DAMAGE_POWER_TRANSFER 450 //used to transfer power to containment field generators
|
||||
|
||||
/obj/machinery/power/emitter
|
||||
name = "emitter"
|
||||
desc = "It is a heavy duty industrial laser."
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
icon_state = "emitter"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
unacidable = TRUE
|
||||
req_access = list(access_engine_equip)
|
||||
var/id = null
|
||||
|
||||
use_power = USE_POWER_OFF //uses powernet power, not APC power
|
||||
active_power_usage = 30000 //30 kW laser. I guess that means 30 kJ per shot.
|
||||
|
||||
var/active = 0
|
||||
var/powered = 0
|
||||
var/fire_delay = 100
|
||||
var/max_burst_delay = 100
|
||||
var/min_burst_delay = 20
|
||||
var/burst_shots = 3
|
||||
var/last_shot = 0
|
||||
var/shot_number = 0
|
||||
var/state = 0
|
||||
var/locked = 0
|
||||
|
||||
var/burst_delay = 2
|
||||
var/initial_fire_delay = 100
|
||||
|
||||
var/integrity = 80
|
||||
|
||||
/obj/machinery/power/emitter/verb/rotate_clockwise()
|
||||
set name = "Rotate Emitter Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/emitter/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Emitter Counter-Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/emitter/Initialize()
|
||||
. = ..()
|
||||
if(state == 2 && anchored)
|
||||
connect_to_network()
|
||||
|
||||
/obj/machinery/power/emitter/Destroy()
|
||||
message_admins("Emitter deleted at ([x],[y],[z] - <A HREF='?_src_=holder;[HrefToken()];adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
log_game("EMITTER([x],[y],[z]) Destroyed/deleted.")
|
||||
investigate_log("<font color='red'>deleted</font> at ([x],[y],[z])","singulo")
|
||||
..()
|
||||
|
||||
/obj/machinery/power/emitter/update_icon()
|
||||
if (active && powernet && avail(active_power_usage))
|
||||
icon_state = "emitter_+a"
|
||||
else
|
||||
icon_state = "emitter"
|
||||
|
||||
/obj/machinery/power/emitter/attack_hand(mob/user as mob)
|
||||
src.add_fingerprint(user)
|
||||
activate(user)
|
||||
|
||||
/obj/machinery/power/emitter/proc/activate(mob/user as mob)
|
||||
if(state == 2)
|
||||
if(!powernet)
|
||||
to_chat(user, "\The [src] isn't connected to a wire.")
|
||||
return 1
|
||||
if(!src.locked)
|
||||
if(src.active==1)
|
||||
src.active = 0
|
||||
to_chat(user, "You turn off [src].")
|
||||
message_admins("Emitter turned off by [key_name(user, user.client)](<A HREF='?_src_=holder;[HrefToken()];adminmoreinfo=\ref[user]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;[HrefToken()];adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
log_game("EMITTER([x],[y],[z]) OFF by [key_name(user)]")
|
||||
investigate_log("turned <font color='red'>off</font> by [user.key]","singulo")
|
||||
else
|
||||
src.active = 1
|
||||
to_chat(user, "You turn on [src].")
|
||||
src.shot_number = 0
|
||||
src.fire_delay = get_initial_fire_delay()
|
||||
message_admins("Emitter turned on by [key_name(user, user.client)](<A HREF='?_src_=holder;[HrefToken()];adminmoreinfo=\ref[user]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;[HrefToken()];adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
log_game("EMITTER([x],[y],[z]) ON by [key_name(user)]")
|
||||
investigate_log("turned <font color='green'>on</font> by [user.key]","singulo")
|
||||
update_icon()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The controls are locked!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>\The [src] needs to be firmly secured to the floor first.</span>")
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/power/emitter/emp_act(var/severity)//Emitters are hardened but still might have issues
|
||||
// add_load(1000)
|
||||
/* if((severity == 1)&&prob(1)&&prob(1))
|
||||
if(src.active)
|
||||
src.active = 0
|
||||
src.use_power = 1 */
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/emitter/process()
|
||||
if(stat & (BROKEN))
|
||||
return
|
||||
if(src.state != 2 || (!powernet && active_power_usage))
|
||||
src.active = 0
|
||||
update_icon()
|
||||
return
|
||||
if(((src.last_shot + src.fire_delay) <= world.time) && (src.active == 1))
|
||||
|
||||
var/actual_load = draw_power(active_power_usage)
|
||||
if(actual_load >= active_power_usage) //does the laser have enough power to shoot?
|
||||
if(!powered)
|
||||
powered = 1
|
||||
update_icon()
|
||||
log_game("EMITTER([x],[y],[z]) Regained power and is ON.")
|
||||
investigate_log("regained power and turned <font color='green'>on</font>","singulo")
|
||||
else
|
||||
if(powered)
|
||||
powered = 0
|
||||
update_icon()
|
||||
log_game("EMITTER([x],[y],[z]) Lost power and was ON.")
|
||||
investigate_log("lost power and turned <font color='red'>off</font>","singulo")
|
||||
return
|
||||
|
||||
src.last_shot = world.time
|
||||
if(src.shot_number < burst_shots)
|
||||
src.fire_delay = get_burst_delay() //R-UST port
|
||||
src.shot_number ++
|
||||
else
|
||||
src.fire_delay = get_rand_burst_delay() //R-UST port
|
||||
src.shot_number = 0
|
||||
|
||||
//need to calculate the power per shot as the emitter doesn't fire continuously.
|
||||
var/burst_time = (min_burst_delay + max_burst_delay)/2 + 2*(burst_shots-1)
|
||||
var/power_per_shot = active_power_usage * (burst_time/10) / burst_shots
|
||||
|
||||
playsound(src, 'sound/weapons/emitter.ogg', 25, 1)
|
||||
if(prob(35))
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(5, 1, src)
|
||||
s.start()
|
||||
|
||||
var/obj/item/projectile/beam/emitter/A = get_emitter_beam()
|
||||
A.damage = round(power_per_shot/EMITTER_DAMAGE_POWER_TRANSFER)
|
||||
A.firer = src
|
||||
A.fire(dir2angle(dir))
|
||||
|
||||
/obj/machinery/power/emitter/attackby(obj/item/W, mob/user)
|
||||
|
||||
if(W.has_tool_quality(TOOL_WRENCH))
|
||||
if(active)
|
||||
to_chat(user, "Turn off [src] first.")
|
||||
return
|
||||
switch(state)
|
||||
if(0)
|
||||
state = 1
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
user.visible_message("[user.name] secures [src] to the floor.", \
|
||||
"You secure the external reinforcing bolts to the floor.", \
|
||||
"You hear a ratchet.")
|
||||
src.anchored = TRUE
|
||||
if(1)
|
||||
state = 0
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
user.visible_message("[user.name] unsecures [src] reinforcing bolts from the floor.", \
|
||||
"You undo the external reinforcing bolts.", \
|
||||
"You hear a ratchet.")
|
||||
src.anchored = FALSE
|
||||
disconnect_from_network()
|
||||
if(2)
|
||||
to_chat(user, "<span class='warning'>\The [src] needs to be unwelded from the floor.</span>")
|
||||
update_icon() // VOREStation Add
|
||||
return
|
||||
|
||||
if(W.has_tool_quality(TOOL_WELDER))
|
||||
var/obj/item/weapon/weldingtool/WT = W.get_welder()
|
||||
if(active)
|
||||
to_chat(user, "Turn off [src] first.")
|
||||
return
|
||||
switch(state)
|
||||
if(0)
|
||||
to_chat(user, "<span class='warning'>\The [src] needs to be wrenched to the floor.</span>")
|
||||
if(1)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src, WT.usesound, 50, 1)
|
||||
user.visible_message("[user.name] starts to weld [src] to the floor.", \
|
||||
"You start to weld [src] to the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20 * WT.toolspeed))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 2
|
||||
to_chat(user, "You weld [src] to the floor.")
|
||||
connect_to_network()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need more welding fuel to complete this task.</span>")
|
||||
if(2)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src, WT.usesound, 50, 1)
|
||||
user.visible_message("[user.name] starts to cut [src] free from the floor.", \
|
||||
"You start to cut [src] free from the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20 * WT.toolspeed))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 1
|
||||
to_chat(user, "You cut [src] free from the floor.")
|
||||
disconnect_from_network()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need more welding fuel to complete this task.</span>")
|
||||
update_icon() // VOREStation Add
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/stack/material) && W.get_material_name() == MAT_STEEL)
|
||||
var/amt = CEILING(( initial(integrity) - integrity)/10, 1)
|
||||
if(!amt)
|
||||
to_chat(user, "<span class='notice'>\The [src] is already fully repaired.</span>")
|
||||
return
|
||||
var/obj/item/stack/P = W
|
||||
if(!P.can_use(amt))
|
||||
to_chat(user, "<span class='warning'>You don't have enough sheets to repair this! You need at least [amt] sheets.</span>")
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You begin repairing \the [src]...</span>")
|
||||
if(do_after(user, 30))
|
||||
if(P.use(amt))
|
||||
to_chat(user, "<span class='notice'>You have repaired \the [src].</span>")
|
||||
integrity = initial(integrity)
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You don't have enough sheets to repair this! You need at least [amt] sheets.</span>")
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda))
|
||||
if(emagged)
|
||||
to_chat(user, "<span class='warning'>The lock seems to be broken.</span>")
|
||||
return
|
||||
if(src.allowed(user))
|
||||
src.locked = !src.locked
|
||||
to_chat(user, "The controls are now [src.locked ? "locked." : "unlocked."]")
|
||||
update_icon() // VOREStation Add
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/machinery/power/emitter/emag_act(var/remaining_charges, var/mob/user)
|
||||
if(!emagged)
|
||||
locked = 0
|
||||
emagged = 1
|
||||
user.visible_message("[user.name] emags [src].","<span class='warning'>You short out the lock.</span>")
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/emitter/bullet_act(var/obj/item/projectile/P)
|
||||
if(!P || !P.damage || P.get_structure_damage() <= 0 )
|
||||
return
|
||||
|
||||
adjust_integrity(-P.get_structure_damage())
|
||||
|
||||
/obj/machinery/power/emitter/blob_act()
|
||||
adjust_integrity(-1000) // This kills the emitter.
|
||||
|
||||
/obj/machinery/power/emitter/proc/adjust_integrity(amount)
|
||||
integrity = between(0, integrity + amount, initial(integrity))
|
||||
if(integrity == 0)
|
||||
if(powernet && avail(active_power_usage)) // If it's powered, it goes boom if killed.
|
||||
visible_message(src, "<span class='danger'>\The [src] explodes violently!</span>", "<span class='danger'>You hear an explosion!</span>")
|
||||
explosion(get_turf(src), 1, 2, 4)
|
||||
else
|
||||
src.visible_message("<span class='danger'>\The [src] crumples apart!</span>", "<span class='warning'>You hear metal collapsing.</span>")
|
||||
if(src)
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/power/emitter/examine(mob/user)
|
||||
. = ..()
|
||||
switch(state)
|
||||
if(0)
|
||||
. += "<span class='warning'>It is not secured in place!</span>"
|
||||
if(1)
|
||||
. += "<span class='warning'>It has been bolted down securely, but not welded into place.</span>"
|
||||
if(2)
|
||||
. += "<span class='notice'>It has been bolted down securely and welded down into place.</span>"
|
||||
var/integrity_percentage = round((integrity / initial(integrity)) * 100)
|
||||
switch(integrity_percentage)
|
||||
if(0 to 30)
|
||||
. += "<span class='danger'>It is close to falling apart!</span>"
|
||||
if(31 to 70)
|
||||
. += "<span class='danger'>It is damaged.</span>"
|
||||
if(77 to 99)
|
||||
. += "<span class='warning'>It is slightly damaged.</span>"
|
||||
|
||||
//R-UST port
|
||||
/obj/machinery/power/emitter/proc/get_initial_fire_delay()
|
||||
return initial_fire_delay
|
||||
|
||||
/obj/machinery/power/emitter/proc/get_rand_burst_delay()
|
||||
return rand(min_burst_delay, max_burst_delay)
|
||||
|
||||
/obj/machinery/power/emitter/proc/get_burst_delay()
|
||||
return burst_delay
|
||||
|
||||
/obj/machinery/power/emitter/proc/get_emitter_beam()
|
||||
return new /obj/item/projectile/beam/emitter(get_turf(src))
|
||||
|
||||
@@ -1,359 +1,359 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
|
||||
/*
|
||||
field_generator power level display
|
||||
The icon used for the field_generator need to have 'num_power_levels' number of icon states
|
||||
named 'Field_Gen +p[num]' where 'num' ranges from 1 to 'num_power_levels'
|
||||
|
||||
The power level is displayed using overlays. The current displayed power level is stored in 'powerlevel'.
|
||||
The overlay in use and the powerlevel variable must be kept in sync. A powerlevel equal to 0 means that
|
||||
no power level overlay is currently in the overlays list.
|
||||
-Aygar
|
||||
*/
|
||||
|
||||
#define field_generator_max_power 250000
|
||||
/obj/machinery/field_generator
|
||||
name = "Field Generator"
|
||||
desc = "A large thermal battery that projects a high amount of energy when powered."
|
||||
icon = 'icons/obj/machines/field_generator.dmi'
|
||||
icon_state = "Field_Gen"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = USE_POWER_OFF
|
||||
var/const/num_power_levels = 6 // Total number of power level icon has
|
||||
var/Varedit_start = 0
|
||||
var/Varpower = 0
|
||||
var/active = 0
|
||||
var/power = 30000 // Current amount of power
|
||||
var/state = 0
|
||||
var/warming_up = 0
|
||||
var/list/obj/machinery/containment_field/fields
|
||||
var/list/obj/machinery/field_generator/connected_gens
|
||||
var/clean_up = 0
|
||||
|
||||
//If keeping field generators powered is hard then increase the emitter active power usage.
|
||||
var/gen_power_draw = 5500 //power needed per generator
|
||||
var/field_power_draw = 2000 //power needed per field object
|
||||
|
||||
var/light_range_on = 3
|
||||
var/light_power_on = 1
|
||||
light_color = "#5BA8FF"
|
||||
|
||||
/obj/machinery/field_generator/examine()
|
||||
. = ..()
|
||||
switch(state)
|
||||
if(0)
|
||||
. += "<span class='warning'>It is not secured in place!</span>"
|
||||
if(1)
|
||||
. += "<span class='warning'>It has been bolted down securely, but not welded into place.</span>"
|
||||
if(2)
|
||||
. += "<span class='notice'>It has been bolted down securely and welded down into place.</span>"
|
||||
|
||||
/obj/machinery/field_generator/update_icon()
|
||||
cut_overlays()
|
||||
if(!active)
|
||||
if(warming_up)
|
||||
add_overlay("+a[warming_up]")
|
||||
if(fields.len)
|
||||
add_overlay("+on")
|
||||
// Power level indicator
|
||||
// Scale % power to % num_power_levels and truncate value
|
||||
var/level = round(num_power_levels * power / field_generator_max_power)
|
||||
// Clamp between 0 and num_power_levels for out of range power values
|
||||
level = between(0, level, num_power_levels)
|
||||
if(level)
|
||||
add_overlay("+p[level]")
|
||||
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/field_generator/New()
|
||||
..()
|
||||
fields = list()
|
||||
connected_gens = list()
|
||||
return
|
||||
|
||||
/obj/machinery/field_generator/process()
|
||||
if(Varedit_start == 1)
|
||||
if(active == 0)
|
||||
active = 1
|
||||
state = 2
|
||||
power = field_generator_max_power
|
||||
anchored = TRUE
|
||||
warming_up = 3
|
||||
start_fields()
|
||||
update_icon()
|
||||
Varedit_start = 0
|
||||
|
||||
if(src.active == 2)
|
||||
calc_power()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/field_generator/attack_hand(mob/user as mob)
|
||||
if(state == 2)
|
||||
if(get_dist(src, user) <= 1)//Need to actually touch the thing to turn it on
|
||||
if(src.active >= 1)
|
||||
to_chat(user, "You are unable to turn off the [src.name] once it is online.")
|
||||
return 1
|
||||
else
|
||||
user.visible_message("[user.name] turns on the [src.name]", \
|
||||
"You turn on the [src.name].", \
|
||||
"You hear heavy droning")
|
||||
turn_on()
|
||||
log_game("FIELDGEN([x],[y],[z]) Activated by [key_name(user)]")
|
||||
investigate_log("<font color='green'>activated</font> by [user.key].","singulo")
|
||||
|
||||
src.add_fingerprint(user)
|
||||
else
|
||||
to_chat(user, "The [src] needs to be firmly secured to the floor first.")
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/field_generator/attackby(obj/item/W, mob/user)
|
||||
if(active)
|
||||
to_chat(user, "The [src] needs to be off.")
|
||||
return
|
||||
else if(W.has_tool_quality(TOOL_WRENCH))
|
||||
switch(state)
|
||||
if(0)
|
||||
state = 1
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
user.visible_message("[user.name] secures [src.name] to the floor.", \
|
||||
"You secure the external reinforcing bolts to the floor.", \
|
||||
"You hear ratchet")
|
||||
src.anchored = TRUE
|
||||
if(1)
|
||||
state = 0
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
user.visible_message("[user.name] unsecures [src.name] reinforcing bolts from the floor.", \
|
||||
"You undo the external reinforcing bolts.", \
|
||||
"You hear ratchet")
|
||||
src.anchored = FALSE
|
||||
if(2)
|
||||
to_chat(user, span_red("The [src.name] needs to be unwelded from the floor."))
|
||||
return
|
||||
else if(W.has_tool_quality(TOOL_WELDER))
|
||||
var/obj/item/weapon/weldingtool/WT = W.get_welder()
|
||||
switch(state)
|
||||
if(0)
|
||||
to_chat(user, span_red("The [src.name] needs to be wrenched to the floor."))
|
||||
return
|
||||
if(1)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src, WT.usesound, 50, 1)
|
||||
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
|
||||
"You start to weld the [src] to the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20 * WT.toolspeed))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 2
|
||||
to_chat(user, "You weld the field generator to the floor.")
|
||||
else
|
||||
return
|
||||
if(2)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src, WT.usesound, 50, 1)
|
||||
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
|
||||
"You start to cut the [src] free from the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20 * WT.toolspeed))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 1
|
||||
to_chat(user, "You cut the [src] free from the floor.")
|
||||
else
|
||||
return
|
||||
else
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/field_generator/emp_act()
|
||||
return 0
|
||||
|
||||
/obj/machinery/field_generator/bullet_act(var/obj/item/projectile/Proj)
|
||||
if(istype(Proj, /obj/item/projectile/beam))
|
||||
power += Proj.damage * EMITTER_DAMAGE_POWER_TRANSFER
|
||||
update_icon()
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/field_generator/Destroy()
|
||||
src.cleanup()
|
||||
. = ..()
|
||||
|
||||
|
||||
|
||||
/obj/machinery/field_generator/proc/turn_off()
|
||||
active = 0
|
||||
spawn(1)
|
||||
src.cleanup()
|
||||
set_light(0)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/field_generator/proc/turn_on()
|
||||
active = 1
|
||||
warming_up = 1
|
||||
spawn(1)
|
||||
while (warming_up<3 && active)
|
||||
sleep(50)
|
||||
warming_up++
|
||||
update_icon()
|
||||
if(warming_up >= 3)
|
||||
start_fields()
|
||||
set_light(light_range_on, light_power_on)
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/machinery/field_generator/proc/calc_power()
|
||||
if(Varpower)
|
||||
return 1
|
||||
|
||||
update_icon()
|
||||
if(src.power > field_generator_max_power)
|
||||
src.power = field_generator_max_power
|
||||
|
||||
var/power_draw = gen_power_draw
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
if (!isnull(FG))
|
||||
power_draw += gen_power_draw
|
||||
for (var/obj/machinery/containment_field/F in fields)
|
||||
if (!isnull(F))
|
||||
power_draw += field_power_draw
|
||||
power_draw /= 2 //because this will be mirrored for both generators
|
||||
if(draw_power(round(power_draw)) >= power_draw)
|
||||
return 1
|
||||
else
|
||||
for(var/mob/M in viewers(src))
|
||||
M.show_message(span_red("\The [src] shuts down!"))
|
||||
turn_off()
|
||||
log_game("FIELDGEN([x],[y],[z]) Lost power and was ON.")
|
||||
investigate_log("ran out of power and <font color='red'>deactivated</font>","singulo")
|
||||
src.power = 0
|
||||
return 0
|
||||
|
||||
//Tries to draw the needed power from our own power reserve, or connected generators if we can. Returns the amount of power we were able to get.
|
||||
/obj/machinery/field_generator/proc/draw_power(var/draw = 0, var/list/flood_list = list())
|
||||
flood_list += src
|
||||
|
||||
if(src.power >= draw)//We have enough power
|
||||
src.power -= draw
|
||||
return draw
|
||||
|
||||
//Need more power
|
||||
var/actual_draw = src.power //already checked that power < draw
|
||||
src.power = 0
|
||||
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
if (FG in flood_list)
|
||||
continue
|
||||
actual_draw += FG.draw_power(draw - actual_draw, flood_list) //since the flood list reference is shared this actually works.
|
||||
if (actual_draw >= draw)
|
||||
return actual_draw
|
||||
|
||||
return actual_draw
|
||||
|
||||
/obj/machinery/field_generator/proc/start_fields()
|
||||
if(!src.state == 2 || !anchored)
|
||||
turn_off()
|
||||
return
|
||||
spawn(1)
|
||||
setup_field(1)
|
||||
spawn(2)
|
||||
setup_field(2)
|
||||
spawn(3)
|
||||
setup_field(4)
|
||||
spawn(4)
|
||||
setup_field(8)
|
||||
src.active = 2
|
||||
|
||||
|
||||
/obj/machinery/field_generator/proc/setup_field(var/NSEW)
|
||||
var/turf/T = src.loc
|
||||
var/obj/machinery/field_generator/G
|
||||
var/steps = 0
|
||||
if(!NSEW)//Make sure its ran right
|
||||
return
|
||||
for(var/dist = 0, dist <= 9, dist += 1) // checks out to 8 tiles away for another generator
|
||||
T = get_step(T, NSEW)
|
||||
if(T.density)//We cant shoot a field though this
|
||||
return 0
|
||||
for(var/atom/A in T.contents)
|
||||
if(ismob(A))
|
||||
continue
|
||||
if(!istype(A,/obj/machinery/field_generator))
|
||||
if((istype(A,/obj/machinery/door)||istype(A,/obj/machinery/the_singularitygen))&&(A.density))
|
||||
return 0
|
||||
steps += 1
|
||||
G = locate(/obj/machinery/field_generator) in T
|
||||
if(!isnull(G))
|
||||
steps -= 1
|
||||
if(!G.active)
|
||||
return 0
|
||||
break
|
||||
if(isnull(G))
|
||||
return
|
||||
T = src.loc
|
||||
for(var/dist = 0, dist < steps, dist += 1) // creates each field tile
|
||||
var/field_dir = get_dir(T,get_step(G.loc, NSEW))
|
||||
T = get_step(T, NSEW)
|
||||
if(!locate(/obj/machinery/containment_field) in T)
|
||||
var/obj/machinery/containment_field/CF = new/obj/machinery/containment_field(T)
|
||||
CF.set_master(src,G)
|
||||
fields += CF
|
||||
G.fields += CF
|
||||
CF.set_dir(field_dir)
|
||||
var/listcheck = 0
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
if (isnull(FG))
|
||||
continue
|
||||
if(FG == G)
|
||||
listcheck = 1
|
||||
break
|
||||
if(!listcheck)
|
||||
connected_gens.Add(G)
|
||||
listcheck = 0
|
||||
for(var/obj/machinery/field_generator/FG2 in G.connected_gens)
|
||||
if (isnull(FG2))
|
||||
continue
|
||||
if(FG2 == src)
|
||||
listcheck = 1
|
||||
break
|
||||
if(!listcheck)
|
||||
G.connected_gens.Add(src)
|
||||
|
||||
|
||||
/obj/machinery/field_generator/proc/cleanup()
|
||||
clean_up = 1
|
||||
for (var/obj/machinery/containment_field/F in fields)
|
||||
if (QDELETED(F))
|
||||
continue
|
||||
qdel(F)
|
||||
fields = list()
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
if (QDELETED(FG))
|
||||
continue
|
||||
FG.connected_gens.Remove(src)
|
||||
if(!FG.clean_up)//Makes the other gens clean up as well
|
||||
FG.cleanup()
|
||||
connected_gens.Remove(FG)
|
||||
connected_gens = list()
|
||||
clean_up = 0
|
||||
update_icon()
|
||||
|
||||
//This is here to help fight the "hurr durr, release singulo cos nobody will notice before the
|
||||
//singulo eats the evidence". It's not fool-proof but better than nothing.
|
||||
//I want to avoid using global variables.
|
||||
spawn(1)
|
||||
var/temp = 1 //stops spam
|
||||
for(var/obj/singularity/O in machines)
|
||||
if(O.last_warning && temp)
|
||||
if((world.time - O.last_warning) > 50) //to stop message-spam
|
||||
temp = 0
|
||||
admin_chat_message(message = "SINGUL/TESLOOSE!", color = "#FF2222") //VOREStation Add
|
||||
message_admins("A singulo exists and a containment field has failed.",1)
|
||||
investigate_log("has <font color='red'>failed</font> whilst a singulo exists.","singulo")
|
||||
log_game("FIELDGEN([x],[y],[z]) Containment failed while singulo/tesla exists.")
|
||||
O.last_warning = world.time
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
|
||||
/*
|
||||
field_generator power level display
|
||||
The icon used for the field_generator need to have 'num_power_levels' number of icon states
|
||||
named 'Field_Gen +p[num]' where 'num' ranges from 1 to 'num_power_levels'
|
||||
|
||||
The power level is displayed using overlays. The current displayed power level is stored in 'powerlevel'.
|
||||
The overlay in use and the powerlevel variable must be kept in sync. A powerlevel equal to 0 means that
|
||||
no power level overlay is currently in the overlays list.
|
||||
-Aygar
|
||||
*/
|
||||
|
||||
#define field_generator_max_power 250000
|
||||
/obj/machinery/field_generator
|
||||
name = "Field Generator"
|
||||
desc = "A large thermal battery that projects a high amount of energy when powered."
|
||||
icon = 'icons/obj/machines/field_generator.dmi'
|
||||
icon_state = "Field_Gen"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = USE_POWER_OFF
|
||||
var/const/num_power_levels = 6 // Total number of power level icon has
|
||||
var/Varedit_start = 0
|
||||
var/Varpower = 0
|
||||
var/active = 0
|
||||
var/power = 30000 // Current amount of power
|
||||
var/state = 0
|
||||
var/warming_up = 0
|
||||
var/list/obj/machinery/containment_field/fields
|
||||
var/list/obj/machinery/field_generator/connected_gens
|
||||
var/clean_up = 0
|
||||
|
||||
//If keeping field generators powered is hard then increase the emitter active power usage.
|
||||
var/gen_power_draw = 5500 //power needed per generator
|
||||
var/field_power_draw = 2000 //power needed per field object
|
||||
|
||||
var/light_range_on = 3
|
||||
var/light_power_on = 1
|
||||
light_color = "#5BA8FF"
|
||||
|
||||
/obj/machinery/field_generator/examine()
|
||||
. = ..()
|
||||
switch(state)
|
||||
if(0)
|
||||
. += "<span class='warning'>It is not secured in place!</span>"
|
||||
if(1)
|
||||
. += "<span class='warning'>It has been bolted down securely, but not welded into place.</span>"
|
||||
if(2)
|
||||
. += "<span class='notice'>It has been bolted down securely and welded down into place.</span>"
|
||||
|
||||
/obj/machinery/field_generator/update_icon()
|
||||
cut_overlays()
|
||||
if(!active)
|
||||
if(warming_up)
|
||||
add_overlay("+a[warming_up]")
|
||||
if(fields.len)
|
||||
add_overlay("+on")
|
||||
// Power level indicator
|
||||
// Scale % power to % num_power_levels and truncate value
|
||||
var/level = round(num_power_levels * power / field_generator_max_power)
|
||||
// Clamp between 0 and num_power_levels for out of range power values
|
||||
level = between(0, level, num_power_levels)
|
||||
if(level)
|
||||
add_overlay("+p[level]")
|
||||
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/field_generator/New()
|
||||
..()
|
||||
fields = list()
|
||||
connected_gens = list()
|
||||
return
|
||||
|
||||
/obj/machinery/field_generator/process()
|
||||
if(Varedit_start == 1)
|
||||
if(active == 0)
|
||||
active = 1
|
||||
state = 2
|
||||
power = field_generator_max_power
|
||||
anchored = TRUE
|
||||
warming_up = 3
|
||||
start_fields()
|
||||
update_icon()
|
||||
Varedit_start = 0
|
||||
|
||||
if(src.active == 2)
|
||||
calc_power()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/field_generator/attack_hand(mob/user as mob)
|
||||
if(state == 2)
|
||||
if(get_dist(src, user) <= 1)//Need to actually touch the thing to turn it on
|
||||
if(src.active >= 1)
|
||||
to_chat(user, "You are unable to turn off the [src.name] once it is online.")
|
||||
return 1
|
||||
else
|
||||
user.visible_message("[user.name] turns on the [src.name]", \
|
||||
"You turn on the [src.name].", \
|
||||
"You hear heavy droning")
|
||||
turn_on()
|
||||
log_game("FIELDGEN([x],[y],[z]) Activated by [key_name(user)]")
|
||||
investigate_log("<font color='green'>activated</font> by [user.key].","singulo")
|
||||
|
||||
src.add_fingerprint(user)
|
||||
else
|
||||
to_chat(user, "The [src] needs to be firmly secured to the floor first.")
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/field_generator/attackby(obj/item/W, mob/user)
|
||||
if(active)
|
||||
to_chat(user, "The [src] needs to be off.")
|
||||
return
|
||||
else if(W.has_tool_quality(TOOL_WRENCH))
|
||||
switch(state)
|
||||
if(0)
|
||||
state = 1
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
user.visible_message("[user.name] secures [src.name] to the floor.", \
|
||||
"You secure the external reinforcing bolts to the floor.", \
|
||||
"You hear ratchet")
|
||||
src.anchored = TRUE
|
||||
if(1)
|
||||
state = 0
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
user.visible_message("[user.name] unsecures [src.name] reinforcing bolts from the floor.", \
|
||||
"You undo the external reinforcing bolts.", \
|
||||
"You hear ratchet")
|
||||
src.anchored = FALSE
|
||||
if(2)
|
||||
to_chat(user, span_red("The [src.name] needs to be unwelded from the floor."))
|
||||
return
|
||||
else if(W.has_tool_quality(TOOL_WELDER))
|
||||
var/obj/item/weapon/weldingtool/WT = W.get_welder()
|
||||
switch(state)
|
||||
if(0)
|
||||
to_chat(user, span_red("The [src.name] needs to be wrenched to the floor."))
|
||||
return
|
||||
if(1)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src, WT.usesound, 50, 1)
|
||||
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
|
||||
"You start to weld the [src] to the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20 * WT.toolspeed))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 2
|
||||
to_chat(user, "You weld the field generator to the floor.")
|
||||
else
|
||||
return
|
||||
if(2)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src, WT.usesound, 50, 1)
|
||||
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
|
||||
"You start to cut the [src] free from the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20 * WT.toolspeed))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 1
|
||||
to_chat(user, "You cut the [src] free from the floor.")
|
||||
else
|
||||
return
|
||||
else
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/field_generator/emp_act()
|
||||
return 0
|
||||
|
||||
/obj/machinery/field_generator/bullet_act(var/obj/item/projectile/Proj)
|
||||
if(istype(Proj, /obj/item/projectile/beam))
|
||||
power += Proj.damage * EMITTER_DAMAGE_POWER_TRANSFER
|
||||
update_icon()
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/field_generator/Destroy()
|
||||
src.cleanup()
|
||||
. = ..()
|
||||
|
||||
|
||||
|
||||
/obj/machinery/field_generator/proc/turn_off()
|
||||
active = 0
|
||||
spawn(1)
|
||||
src.cleanup()
|
||||
set_light(0)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/field_generator/proc/turn_on()
|
||||
active = 1
|
||||
warming_up = 1
|
||||
spawn(1)
|
||||
while (warming_up<3 && active)
|
||||
sleep(50)
|
||||
warming_up++
|
||||
update_icon()
|
||||
if(warming_up >= 3)
|
||||
start_fields()
|
||||
set_light(light_range_on, light_power_on)
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/machinery/field_generator/proc/calc_power()
|
||||
if(Varpower)
|
||||
return 1
|
||||
|
||||
update_icon()
|
||||
if(src.power > field_generator_max_power)
|
||||
src.power = field_generator_max_power
|
||||
|
||||
var/power_draw = gen_power_draw
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
if (!isnull(FG))
|
||||
power_draw += gen_power_draw
|
||||
for (var/obj/machinery/containment_field/F in fields)
|
||||
if (!isnull(F))
|
||||
power_draw += field_power_draw
|
||||
power_draw /= 2 //because this will be mirrored for both generators
|
||||
if(draw_power(round(power_draw)) >= power_draw)
|
||||
return 1
|
||||
else
|
||||
for(var/mob/M in viewers(src))
|
||||
M.show_message(span_red("\The [src] shuts down!"))
|
||||
turn_off()
|
||||
log_game("FIELDGEN([x],[y],[z]) Lost power and was ON.")
|
||||
investigate_log("ran out of power and <font color='red'>deactivated</font>","singulo")
|
||||
src.power = 0
|
||||
return 0
|
||||
|
||||
//Tries to draw the needed power from our own power reserve, or connected generators if we can. Returns the amount of power we were able to get.
|
||||
/obj/machinery/field_generator/proc/draw_power(var/draw = 0, var/list/flood_list = list())
|
||||
flood_list += src
|
||||
|
||||
if(src.power >= draw)//We have enough power
|
||||
src.power -= draw
|
||||
return draw
|
||||
|
||||
//Need more power
|
||||
var/actual_draw = src.power //already checked that power < draw
|
||||
src.power = 0
|
||||
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
if (FG in flood_list)
|
||||
continue
|
||||
actual_draw += FG.draw_power(draw - actual_draw, flood_list) //since the flood list reference is shared this actually works.
|
||||
if (actual_draw >= draw)
|
||||
return actual_draw
|
||||
|
||||
return actual_draw
|
||||
|
||||
/obj/machinery/field_generator/proc/start_fields()
|
||||
if(!src.state == 2 || !anchored)
|
||||
turn_off()
|
||||
return
|
||||
spawn(1)
|
||||
setup_field(1)
|
||||
spawn(2)
|
||||
setup_field(2)
|
||||
spawn(3)
|
||||
setup_field(4)
|
||||
spawn(4)
|
||||
setup_field(8)
|
||||
src.active = 2
|
||||
|
||||
|
||||
/obj/machinery/field_generator/proc/setup_field(var/NSEW)
|
||||
var/turf/T = src.loc
|
||||
var/obj/machinery/field_generator/G
|
||||
var/steps = 0
|
||||
if(!NSEW)//Make sure its ran right
|
||||
return
|
||||
for(var/dist = 0, dist <= 9, dist += 1) // checks out to 8 tiles away for another generator
|
||||
T = get_step(T, NSEW)
|
||||
if(T.density)//We cant shoot a field though this
|
||||
return 0
|
||||
for(var/atom/A in T.contents)
|
||||
if(ismob(A))
|
||||
continue
|
||||
if(!istype(A,/obj/machinery/field_generator))
|
||||
if((istype(A,/obj/machinery/door)||istype(A,/obj/machinery/the_singularitygen))&&(A.density))
|
||||
return 0
|
||||
steps += 1
|
||||
G = locate(/obj/machinery/field_generator) in T
|
||||
if(!isnull(G))
|
||||
steps -= 1
|
||||
if(!G.active)
|
||||
return 0
|
||||
break
|
||||
if(isnull(G))
|
||||
return
|
||||
T = src.loc
|
||||
for(var/dist = 0, dist < steps, dist += 1) // creates each field tile
|
||||
var/field_dir = get_dir(T,get_step(G.loc, NSEW))
|
||||
T = get_step(T, NSEW)
|
||||
if(!locate(/obj/machinery/containment_field) in T)
|
||||
var/obj/machinery/containment_field/CF = new/obj/machinery/containment_field(T)
|
||||
CF.set_master(src,G)
|
||||
fields += CF
|
||||
G.fields += CF
|
||||
CF.set_dir(field_dir)
|
||||
var/listcheck = 0
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
if (isnull(FG))
|
||||
continue
|
||||
if(FG == G)
|
||||
listcheck = 1
|
||||
break
|
||||
if(!listcheck)
|
||||
connected_gens.Add(G)
|
||||
listcheck = 0
|
||||
for(var/obj/machinery/field_generator/FG2 in G.connected_gens)
|
||||
if (isnull(FG2))
|
||||
continue
|
||||
if(FG2 == src)
|
||||
listcheck = 1
|
||||
break
|
||||
if(!listcheck)
|
||||
G.connected_gens.Add(src)
|
||||
|
||||
|
||||
/obj/machinery/field_generator/proc/cleanup()
|
||||
clean_up = 1
|
||||
for (var/obj/machinery/containment_field/F in fields)
|
||||
if (QDELETED(F))
|
||||
continue
|
||||
qdel(F)
|
||||
fields = list()
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
if (QDELETED(FG))
|
||||
continue
|
||||
FG.connected_gens.Remove(src)
|
||||
if(!FG.clean_up)//Makes the other gens clean up as well
|
||||
FG.cleanup()
|
||||
connected_gens.Remove(FG)
|
||||
connected_gens = list()
|
||||
clean_up = 0
|
||||
update_icon()
|
||||
|
||||
//This is here to help fight the "hurr durr, release singulo cos nobody will notice before the
|
||||
//singulo eats the evidence". It's not fool-proof but better than nothing.
|
||||
//I want to avoid using global variables.
|
||||
spawn(1)
|
||||
var/temp = 1 //stops spam
|
||||
for(var/obj/singularity/O in machines)
|
||||
if(O.last_warning && temp)
|
||||
if((world.time - O.last_warning) > 50) //to stop message-spam
|
||||
temp = 0
|
||||
admin_chat_message(message = "SINGUL/TESLOOSE!", color = "#FF2222") //VOREStation Add
|
||||
message_admins("A singulo exists and a containment field has failed.",1)
|
||||
investigate_log("has <font color='red'>failed</font> whilst a singulo exists.","singulo")
|
||||
log_game("FIELDGEN([x],[y],[z]) Containment failed while singulo/tesla exists.")
|
||||
O.last_warning = world.time
|
||||
|
||||
@@ -1,60 +1,60 @@
|
||||
/////SINGULARITY SPAWNER
|
||||
/obj/machinery/the_singularitygen/
|
||||
name = "Gravitational Singularity Generator"
|
||||
desc = "An Odd Device which produces a Gravitational Singularity when set up."
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
icon_state = "TheSingGen"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = USE_POWER_OFF
|
||||
var/energy = 0
|
||||
var/creation_type = /obj/singularity
|
||||
|
||||
/obj/machinery/the_singularitygen/examine()
|
||||
. = ..()
|
||||
if(anchored)
|
||||
. += "<span class='notice'>It has been securely bolted down and is ready for operation.</span>"
|
||||
else
|
||||
. += "<span class='warning'>It is not secured!</span>"
|
||||
|
||||
/obj/machinery/the_singularitygen/process()
|
||||
var/turf/T = get_turf(src)
|
||||
if(src.energy >= 200)
|
||||
new creation_type(T, 50)
|
||||
if(src) qdel(src)
|
||||
|
||||
/obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user)
|
||||
if(W.has_tool_quality(TOOL_WRENCH))
|
||||
anchored = !anchored
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
if(anchored)
|
||||
user.visible_message("[user.name] secures [src.name] to the floor.", \
|
||||
"You secure the [src.name] to the floor.", \
|
||||
"You hear a ratchet.")
|
||||
else
|
||||
user.visible_message("[user.name] unsecures [src.name] from the floor.", \
|
||||
"You unsecure the [src.name] from the floor.", \
|
||||
"You hear a ratchet.")
|
||||
return
|
||||
if(W.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
panel_open = !panel_open
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
visible_message("<b>\The [user]</b> adjusts \the [src]'s mechanisms.")
|
||||
if(panel_open && do_after(user, 30))
|
||||
to_chat(user, "<span class='notice'>\The [src] looks like it could be modified.</span>")
|
||||
if(panel_open && do_after(user, 80 * W.toolspeed)) // We don't have skills, so a delayed hint for engineers will have to do for now. (Panel open check for sanity)
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
to_chat(user, "<span class='cult'>\The [src] looks like it could be adapted to forge advanced materials via particle acceleration, somehow..</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>\The [src]'s mechanisms look secure.</span>")
|
||||
if(istype(W, /obj/item/weapon/smes_coil/super_io) && panel_open)
|
||||
visible_message("<b>\The [user]</b> begins to modify \the [src] with \the [W].")
|
||||
if(do_after(user, 300))
|
||||
user.drop_from_inventory(W)
|
||||
visible_message("<b>\The [user]</b> installs \the [W] onto \the [src].")
|
||||
qdel(W)
|
||||
var/turf/T = get_turf(src)
|
||||
var/new_machine = /obj/machinery/particle_smasher
|
||||
new new_machine(T)
|
||||
qdel(src)
|
||||
return ..()
|
||||
/////SINGULARITY SPAWNER
|
||||
/obj/machinery/the_singularitygen/
|
||||
name = "Gravitational Singularity Generator"
|
||||
desc = "An Odd Device which produces a Gravitational Singularity when set up."
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
icon_state = "TheSingGen"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = USE_POWER_OFF
|
||||
var/energy = 0
|
||||
var/creation_type = /obj/singularity
|
||||
|
||||
/obj/machinery/the_singularitygen/examine()
|
||||
. = ..()
|
||||
if(anchored)
|
||||
. += "<span class='notice'>It has been securely bolted down and is ready for operation.</span>"
|
||||
else
|
||||
. += "<span class='warning'>It is not secured!</span>"
|
||||
|
||||
/obj/machinery/the_singularitygen/process()
|
||||
var/turf/T = get_turf(src)
|
||||
if(src.energy >= 200)
|
||||
new creation_type(T, 50)
|
||||
if(src) qdel(src)
|
||||
|
||||
/obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user)
|
||||
if(W.has_tool_quality(TOOL_WRENCH))
|
||||
anchored = !anchored
|
||||
playsound(src, W.usesound, 75, 1)
|
||||
if(anchored)
|
||||
user.visible_message("[user.name] secures [src.name] to the floor.", \
|
||||
"You secure the [src.name] to the floor.", \
|
||||
"You hear a ratchet.")
|
||||
else
|
||||
user.visible_message("[user.name] unsecures [src.name] from the floor.", \
|
||||
"You unsecure the [src.name] from the floor.", \
|
||||
"You hear a ratchet.")
|
||||
return
|
||||
if(W.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
panel_open = !panel_open
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
visible_message("<b>\The [user]</b> adjusts \the [src]'s mechanisms.")
|
||||
if(panel_open && do_after(user, 30))
|
||||
to_chat(user, "<span class='notice'>\The [src] looks like it could be modified.</span>")
|
||||
if(panel_open && do_after(user, 80 * W.toolspeed)) // We don't have skills, so a delayed hint for engineers will have to do for now. (Panel open check for sanity)
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
to_chat(user, "<span class='cult'>\The [src] looks like it could be adapted to forge advanced materials via particle acceleration, somehow..</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>\The [src]'s mechanisms look secure.</span>")
|
||||
if(istype(W, /obj/item/weapon/smes_coil/super_io) && panel_open)
|
||||
visible_message("<b>\The [user]</b> begins to modify \the [src] with \the [W].")
|
||||
if(do_after(user, 300))
|
||||
user.drop_from_inventory(W)
|
||||
visible_message("<b>\The [user]</b> installs \the [W] onto \the [src].")
|
||||
qdel(W)
|
||||
var/turf/T = get_turf(src)
|
||||
var/new_machine = /obj/machinery/particle_smasher
|
||||
new new_machine(T)
|
||||
qdel(src)
|
||||
return ..()
|
||||
|
||||
@@ -1,103 +1,103 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
/obj/effect/accelerated_particle
|
||||
name = "Accelerated Particles"
|
||||
desc = "Small things moving very fast."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "particle1"//Need a new icon for this
|
||||
anchored = TRUE
|
||||
density = TRUE
|
||||
movement_type = UNSTOPPABLE // for bumps to trigger
|
||||
var/movement_range = 10
|
||||
var/energy = 10 //energy in eV
|
||||
var/mega_energy = 0 //energy in MeV
|
||||
var/frequency = 1
|
||||
var/ionizing = 0
|
||||
var/particle_type
|
||||
var/additional_particles = 0
|
||||
var/turf/target
|
||||
var/turf/source
|
||||
var/movetotarget = 1
|
||||
|
||||
/obj/effect/accelerated_particle/weak
|
||||
icon_state = "particle0"
|
||||
movement_range = 8
|
||||
energy = 5
|
||||
|
||||
/obj/effect/accelerated_particle/strong
|
||||
icon_state = "particle2"
|
||||
movement_range = 15
|
||||
energy = 15
|
||||
|
||||
/obj/effect/accelerated_particle/powerful
|
||||
icon_state = "particle3"
|
||||
movement_range = 25
|
||||
energy = 50
|
||||
|
||||
/obj/effect/accelerated_particle/New(loc, dir = 2)
|
||||
src.loc = loc
|
||||
src.set_dir(dir)
|
||||
spawn(0)
|
||||
move(1)
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/Bump(atom/A)
|
||||
if (A)
|
||||
if(ismob(A))
|
||||
toxmob(A)
|
||||
if((istype(A,/obj/machinery/the_singularitygen))||(istype(A,/obj/singularity/))||(istype(A, /obj/machinery/particle_smasher)))
|
||||
A:energy += energy
|
||||
//R-UST port
|
||||
else if(istype(A,/obj/machinery/power/fusion_core))
|
||||
var/obj/machinery/power/fusion_core/collided_core = A
|
||||
if(particle_type && particle_type != "neutron")
|
||||
if(collided_core.AddParticles(particle_type, 1 + additional_particles))
|
||||
collided_core.owned_field.plasma_temperature += mega_energy
|
||||
collided_core.owned_field.energy += energy
|
||||
loc = null
|
||||
else if(istype(A, /obj/effect/fusion_particle_catcher))
|
||||
var/obj/effect/fusion_particle_catcher/PC = A
|
||||
if(particle_type && particle_type != "neutron")
|
||||
if(PC.parent.owned_core.AddParticles(particle_type, 1 + additional_particles))
|
||||
PC.parent.plasma_temperature += mega_energy
|
||||
PC.parent.energy += energy
|
||||
loc = null
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/Bumped(atom/A)
|
||||
if(ismob(A))
|
||||
Bump(A)
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/ex_act(severity)
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/accelerated_particle/singularity_act()
|
||||
return
|
||||
|
||||
/obj/effect/accelerated_particle/proc/toxmob(var/mob/living/M)
|
||||
var/radiation = (energy*2)
|
||||
M.apply_effect((radiation*3),IRRADIATE,0)
|
||||
M.updatehealth()
|
||||
//to_chat(M, "<font color='red'>You feel odd.</font>")
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/proc/move(var/lag)
|
||||
if(target)
|
||||
if(movetotarget)
|
||||
if(!step_towards(src,target))
|
||||
src.loc = get_step(src, get_dir(src,target))
|
||||
if(get_dist(src,target) < 1)
|
||||
movetotarget = 0
|
||||
else
|
||||
if(!step(src, get_step_away(src,source)))
|
||||
src.loc = get_step(src, get_step_away(src,source))
|
||||
else
|
||||
if(!step(src,dir))
|
||||
src.loc = get_step(src,dir)
|
||||
movement_range--
|
||||
if(movement_range <= 0)
|
||||
qdel(src)
|
||||
else
|
||||
sleep(lag)
|
||||
move(lag)
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
/obj/effect/accelerated_particle
|
||||
name = "Accelerated Particles"
|
||||
desc = "Small things moving very fast."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "particle1"//Need a new icon for this
|
||||
anchored = TRUE
|
||||
density = TRUE
|
||||
movement_type = UNSTOPPABLE // for bumps to trigger
|
||||
var/movement_range = 10
|
||||
var/energy = 10 //energy in eV
|
||||
var/mega_energy = 0 //energy in MeV
|
||||
var/frequency = 1
|
||||
var/ionizing = 0
|
||||
var/particle_type
|
||||
var/additional_particles = 0
|
||||
var/turf/target
|
||||
var/turf/source
|
||||
var/movetotarget = 1
|
||||
|
||||
/obj/effect/accelerated_particle/weak
|
||||
icon_state = "particle0"
|
||||
movement_range = 8
|
||||
energy = 5
|
||||
|
||||
/obj/effect/accelerated_particle/strong
|
||||
icon_state = "particle2"
|
||||
movement_range = 15
|
||||
energy = 15
|
||||
|
||||
/obj/effect/accelerated_particle/powerful
|
||||
icon_state = "particle3"
|
||||
movement_range = 25
|
||||
energy = 50
|
||||
|
||||
/obj/effect/accelerated_particle/New(loc, dir = 2)
|
||||
src.loc = loc
|
||||
src.set_dir(dir)
|
||||
spawn(0)
|
||||
move(1)
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/Bump(atom/A)
|
||||
if (A)
|
||||
if(ismob(A))
|
||||
toxmob(A)
|
||||
if((istype(A,/obj/machinery/the_singularitygen))||(istype(A,/obj/singularity/))||(istype(A, /obj/machinery/particle_smasher)))
|
||||
A:energy += energy
|
||||
//R-UST port
|
||||
else if(istype(A,/obj/machinery/power/fusion_core))
|
||||
var/obj/machinery/power/fusion_core/collided_core = A
|
||||
if(particle_type && particle_type != "neutron")
|
||||
if(collided_core.AddParticles(particle_type, 1 + additional_particles))
|
||||
collided_core.owned_field.plasma_temperature += mega_energy
|
||||
collided_core.owned_field.energy += energy
|
||||
loc = null
|
||||
else if(istype(A, /obj/effect/fusion_particle_catcher))
|
||||
var/obj/effect/fusion_particle_catcher/PC = A
|
||||
if(particle_type && particle_type != "neutron")
|
||||
if(PC.parent.owned_core.AddParticles(particle_type, 1 + additional_particles))
|
||||
PC.parent.plasma_temperature += mega_energy
|
||||
PC.parent.energy += energy
|
||||
loc = null
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/Bumped(atom/A)
|
||||
if(ismob(A))
|
||||
Bump(A)
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/ex_act(severity)
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/accelerated_particle/singularity_act()
|
||||
return
|
||||
|
||||
/obj/effect/accelerated_particle/proc/toxmob(var/mob/living/M)
|
||||
var/radiation = (energy*2)
|
||||
M.apply_effect((radiation*3),IRRADIATE,0)
|
||||
M.updatehealth()
|
||||
//to_chat(M, "<font color='red'>You feel odd.</font>")
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/proc/move(var/lag)
|
||||
if(target)
|
||||
if(movetotarget)
|
||||
if(!step_towards(src,target))
|
||||
src.loc = get_step(src, get_dir(src,target))
|
||||
if(get_dist(src,target) < 1)
|
||||
movetotarget = 0
|
||||
else
|
||||
if(!step(src, get_step_away(src,source)))
|
||||
src.loc = get_step(src, get_step_away(src,source))
|
||||
else
|
||||
if(!step(src,dir))
|
||||
src.loc = get_step(src,dir)
|
||||
movement_range--
|
||||
if(movement_range <= 0)
|
||||
qdel(src)
|
||||
else
|
||||
sleep(lag)
|
||||
move(lag)
|
||||
|
||||
@@ -1,385 +1,385 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
/*Composed of 7 parts
|
||||
3 Particle emitters
|
||||
proc
|
||||
emit_particle()
|
||||
|
||||
1 power box
|
||||
the only part of this thing that uses power, can hack to mess with the pa/make it better.
|
||||
Lies, only the control computer draws power.
|
||||
|
||||
1 fuel chamber
|
||||
contains procs for mixing gas and whatever other fuel it uses
|
||||
mix_gas()
|
||||
|
||||
1 gas holder WIP
|
||||
acts like a tank valve on the ground that you wrench gas tanks onto
|
||||
proc
|
||||
extract_gas()
|
||||
return_gas()
|
||||
attach_tank()
|
||||
remove_tank()
|
||||
get_available_mix()
|
||||
|
||||
1 End Cap
|
||||
|
||||
1 Control computer
|
||||
interface for the pa, acts like a computer with an html menu for diff parts and a status report
|
||||
all other parts contain only a ref to this
|
||||
a /machine/, tells the others to do work
|
||||
contains ref for all parts
|
||||
proc
|
||||
process()
|
||||
check_build()
|
||||
|
||||
Setup map
|
||||
|EC|
|
||||
CC|FC|
|
||||
|PB|
|
||||
PE|PE|PE
|
||||
|
||||
|
||||
Icon Addemdum
|
||||
Icon system is much more robust, and the icons are all variable based.
|
||||
Each part has a reference string, powered, strength, and contruction values.
|
||||
Using this the update_icon() proc is simplified a bit (using for absolutely was problematic with naming),
|
||||
so the icon_state comes out be:
|
||||
"[reference][strength]", with a switch controlling construction_states and ensuring that it doesn't
|
||||
power on while being contructed, and all these variables are set by the computer through it's scan list
|
||||
Essential order of the icons:
|
||||
Standard - [reference]
|
||||
Wrenched - [reference]
|
||||
Wired - [reference]w
|
||||
Closed - [reference]c
|
||||
Powered - [reference]p[strength]
|
||||
Strength being set by the computer and a null strength (Computer is powered off or inactive) returns a 'null', counting as empty
|
||||
So, hopefully this is helpful if any more icons are to be added/changed/wondering what the hell is going on here
|
||||
|
||||
*/
|
||||
|
||||
/obj/structure/particle_accelerator
|
||||
name = "Particle Accelerator"
|
||||
desc = "Part of a Particle Accelerator."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "none"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
var/obj/machinery/particle_accelerator/control_box/master = null
|
||||
var/construction_state = 0
|
||||
var/reference = null
|
||||
var/powered = 0
|
||||
var/strength = null
|
||||
var/desc_holder = null
|
||||
|
||||
/obj/structure/particle_accelerator/Destroy()
|
||||
construction_state = 0
|
||||
if(master)
|
||||
master.part_scan()
|
||||
..()
|
||||
|
||||
/obj/structure/particle_accelerator/end_cap
|
||||
name = "Alpha Particle Generation Array"
|
||||
desc_holder = "This is where Alpha particles are generated from \[REDACTED\]"
|
||||
icon_state = "end_cap"
|
||||
reference = "end_cap"
|
||||
|
||||
/obj/structure/particle_accelerator/update_icon()
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/verb/rotate_clockwise()
|
||||
set name = "Rotate Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
return 1
|
||||
|
||||
/obj/structure/particle_accelerator/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Counter Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
return 1
|
||||
|
||||
/obj/structure/particle_accelerator/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
switch(construction_state)
|
||||
if(0)
|
||||
. += "Looks like it's not attached to the flooring."
|
||||
if(1)
|
||||
. += "It is missing some cables."
|
||||
if(2)
|
||||
. += "The panel is open."
|
||||
if(3)
|
||||
. += "It is assembled."
|
||||
|
||||
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user)
|
||||
if(istool(W))
|
||||
if(src.process_tool_hit(W,user))
|
||||
return
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/Moved(atom/old_loc, direction, forced = FALSE)
|
||||
. = ..()
|
||||
if(master?.active)
|
||||
master.toggle_power()
|
||||
log_game("PACCEL([x],[y],[z]) Was moved while active and turned off.")
|
||||
investigate_log("was moved whilst active; it <font color='red'>powered down</font>.","singulo")
|
||||
|
||||
/obj/structure/particle_accelerator/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(25))
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
/obj/structure/particle_accelerator/update_icon()
|
||||
switch(construction_state)
|
||||
if(0,1)
|
||||
icon_state="[reference]"
|
||||
if(2)
|
||||
icon_state="[reference]w"
|
||||
if(3)
|
||||
if(powered)
|
||||
icon_state="[reference]p[strength]"
|
||||
else
|
||||
icon_state="[reference]c"
|
||||
return
|
||||
|
||||
/obj/structure/particle_accelerator/proc/update_state()
|
||||
if(master)
|
||||
master.update_state()
|
||||
return 0
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/proc/report_ready(var/obj/O)
|
||||
if(O && (O == master))
|
||||
if(construction_state >= 3)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/proc/report_master()
|
||||
if(master)
|
||||
return master
|
||||
return 0
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/proc/connect_master(var/obj/O)
|
||||
if(O && istype(O,/obj/machinery/particle_accelerator/control_box))
|
||||
if(O.dir == src.dir)
|
||||
master = O
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/proc/process_tool_hit(var/obj/item/O, var/mob/user)
|
||||
if(!(O) || !(user))
|
||||
return 0
|
||||
if(!ismob(user) || !isobj(O))
|
||||
return 0
|
||||
var/temp_state = src.construction_state
|
||||
|
||||
switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
|
||||
if(0)
|
||||
if(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = TRUE
|
||||
user.visible_message("[user.name] secures the [src.name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
temp_state++
|
||||
if(1)
|
||||
if(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = FALSE
|
||||
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
|
||||
"You remove the external bolts.")
|
||||
temp_state--
|
||||
else if(istype(O, /obj/item/stack/cable_coil))
|
||||
if(O:use(1,user))
|
||||
user.visible_message("[user.name] adds wires to the [src.name].", \
|
||||
"You add some wires.")
|
||||
temp_state++
|
||||
if(2)
|
||||
if(O.has_tool_quality(TOOL_WIRECUTTER))//TODO:Shock user if its on?
|
||||
user.visible_message("[user.name] removes some wires from the [src.name].", \
|
||||
"You remove some wires.")
|
||||
temp_state--
|
||||
else if(O.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
temp_state++
|
||||
if(3)
|
||||
if(O.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
user.visible_message("[user.name] opens the [src.name]'s access panel.", \
|
||||
"You open the access panel.")
|
||||
temp_state--
|
||||
if(temp_state == src.construction_state)//Nothing changed
|
||||
return 0
|
||||
else
|
||||
src.construction_state = temp_state
|
||||
if(src.construction_state < 3)//Was taken apart, update state
|
||||
update_state()
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator
|
||||
name = "Particle Accelerator"
|
||||
desc = "Part of a Particle Accelerator."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "none"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = USE_POWER_OFF
|
||||
idle_power_usage = 0
|
||||
active_power_usage = 0
|
||||
var/construction_state = 0
|
||||
var/active = 0
|
||||
var/reference = null
|
||||
var/powered = null
|
||||
var/strength = 0
|
||||
var/desc_holder = null
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/verb/rotate_clockwise()
|
||||
set name = "Rotate Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Counter-Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/update_icon()
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
switch(construction_state)
|
||||
if(0)
|
||||
. += "Looks like it's not attached to the flooring."
|
||||
if(1)
|
||||
. += "It is missing some cables."
|
||||
if(2)
|
||||
. += "The panel is open."
|
||||
if(3)
|
||||
. += "It is assembled."
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/attackby(obj/item/W, mob/user)
|
||||
if(istool(W))
|
||||
if(src.process_tool_hit(W,user))
|
||||
return
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(25))
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/proc/update_state()
|
||||
return 0
|
||||
|
||||
/obj/machinery/particle_accelerator/proc/process_tool_hit(var/obj/item/O, var/mob/user)
|
||||
if(!(O) || !(user))
|
||||
return 0
|
||||
if(!ismob(user) || !isobj(O))
|
||||
return 0
|
||||
var/temp_state = src.construction_state
|
||||
switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
|
||||
if(0)
|
||||
if(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = TRUE
|
||||
user.visible_message("[user.name] secures the [src.name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
temp_state++
|
||||
if(1)
|
||||
if(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = FALSE
|
||||
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
|
||||
"You remove the external bolts.")
|
||||
temp_state--
|
||||
else if(istype(O, /obj/item/stack/cable_coil))
|
||||
if(O:use(1))
|
||||
user.visible_message("[user.name] adds wires to the [src.name].", \
|
||||
"You add some wires.")
|
||||
temp_state++
|
||||
if(2)
|
||||
if(O.has_tool_quality(TOOL_WIRECUTTER))//TODO:Shock user if its on?
|
||||
user.visible_message("[user.name] removes some wires from the [src.name].", \
|
||||
"You remove some wires.")
|
||||
temp_state--
|
||||
else if(O.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
temp_state++
|
||||
if(3)
|
||||
if(O.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
user.visible_message("[user.name] opens the [src.name]'s access panel.", \
|
||||
"You open the access panel.")
|
||||
temp_state--
|
||||
active = 0
|
||||
if(temp_state == src.construction_state)//Nothing changed
|
||||
return 0
|
||||
else
|
||||
if(src.construction_state < 3)//Was taken apart, update state
|
||||
update_state()
|
||||
if(use_power)
|
||||
update_use_power(USE_POWER_OFF)
|
||||
src.construction_state = temp_state
|
||||
if(src.construction_state >= 3)
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
update_icon()
|
||||
return 1
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
/*Composed of 7 parts
|
||||
3 Particle emitters
|
||||
proc
|
||||
emit_particle()
|
||||
|
||||
1 power box
|
||||
the only part of this thing that uses power, can hack to mess with the pa/make it better.
|
||||
Lies, only the control computer draws power.
|
||||
|
||||
1 fuel chamber
|
||||
contains procs for mixing gas and whatever other fuel it uses
|
||||
mix_gas()
|
||||
|
||||
1 gas holder WIP
|
||||
acts like a tank valve on the ground that you wrench gas tanks onto
|
||||
proc
|
||||
extract_gas()
|
||||
return_gas()
|
||||
attach_tank()
|
||||
remove_tank()
|
||||
get_available_mix()
|
||||
|
||||
1 End Cap
|
||||
|
||||
1 Control computer
|
||||
interface for the pa, acts like a computer with an html menu for diff parts and a status report
|
||||
all other parts contain only a ref to this
|
||||
a /machine/, tells the others to do work
|
||||
contains ref for all parts
|
||||
proc
|
||||
process()
|
||||
check_build()
|
||||
|
||||
Setup map
|
||||
|EC|
|
||||
CC|FC|
|
||||
|PB|
|
||||
PE|PE|PE
|
||||
|
||||
|
||||
Icon Addemdum
|
||||
Icon system is much more robust, and the icons are all variable based.
|
||||
Each part has a reference string, powered, strength, and contruction values.
|
||||
Using this the update_icon() proc is simplified a bit (using for absolutely was problematic with naming),
|
||||
so the icon_state comes out be:
|
||||
"[reference][strength]", with a switch controlling construction_states and ensuring that it doesn't
|
||||
power on while being contructed, and all these variables are set by the computer through it's scan list
|
||||
Essential order of the icons:
|
||||
Standard - [reference]
|
||||
Wrenched - [reference]
|
||||
Wired - [reference]w
|
||||
Closed - [reference]c
|
||||
Powered - [reference]p[strength]
|
||||
Strength being set by the computer and a null strength (Computer is powered off or inactive) returns a 'null', counting as empty
|
||||
So, hopefully this is helpful if any more icons are to be added/changed/wondering what the hell is going on here
|
||||
|
||||
*/
|
||||
|
||||
/obj/structure/particle_accelerator
|
||||
name = "Particle Accelerator"
|
||||
desc = "Part of a Particle Accelerator."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "none"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
var/obj/machinery/particle_accelerator/control_box/master = null
|
||||
var/construction_state = 0
|
||||
var/reference = null
|
||||
var/powered = 0
|
||||
var/strength = null
|
||||
var/desc_holder = null
|
||||
|
||||
/obj/structure/particle_accelerator/Destroy()
|
||||
construction_state = 0
|
||||
if(master)
|
||||
master.part_scan()
|
||||
..()
|
||||
|
||||
/obj/structure/particle_accelerator/end_cap
|
||||
name = "Alpha Particle Generation Array"
|
||||
desc_holder = "This is where Alpha particles are generated from \[REDACTED\]"
|
||||
icon_state = "end_cap"
|
||||
reference = "end_cap"
|
||||
|
||||
/obj/structure/particle_accelerator/update_icon()
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/verb/rotate_clockwise()
|
||||
set name = "Rotate Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
return 1
|
||||
|
||||
/obj/structure/particle_accelerator/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Counter Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
return 1
|
||||
|
||||
/obj/structure/particle_accelerator/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
switch(construction_state)
|
||||
if(0)
|
||||
. += "Looks like it's not attached to the flooring."
|
||||
if(1)
|
||||
. += "It is missing some cables."
|
||||
if(2)
|
||||
. += "The panel is open."
|
||||
if(3)
|
||||
. += "It is assembled."
|
||||
|
||||
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user)
|
||||
if(istool(W))
|
||||
if(src.process_tool_hit(W,user))
|
||||
return
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/Moved(atom/old_loc, direction, forced = FALSE)
|
||||
. = ..()
|
||||
if(master?.active)
|
||||
master.toggle_power()
|
||||
log_game("PACCEL([x],[y],[z]) Was moved while active and turned off.")
|
||||
investigate_log("was moved whilst active; it <font color='red'>powered down</font>.","singulo")
|
||||
|
||||
/obj/structure/particle_accelerator/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(25))
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
/obj/structure/particle_accelerator/update_icon()
|
||||
switch(construction_state)
|
||||
if(0,1)
|
||||
icon_state="[reference]"
|
||||
if(2)
|
||||
icon_state="[reference]w"
|
||||
if(3)
|
||||
if(powered)
|
||||
icon_state="[reference]p[strength]"
|
||||
else
|
||||
icon_state="[reference]c"
|
||||
return
|
||||
|
||||
/obj/structure/particle_accelerator/proc/update_state()
|
||||
if(master)
|
||||
master.update_state()
|
||||
return 0
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/proc/report_ready(var/obj/O)
|
||||
if(O && (O == master))
|
||||
if(construction_state >= 3)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/proc/report_master()
|
||||
if(master)
|
||||
return master
|
||||
return 0
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/proc/connect_master(var/obj/O)
|
||||
if(O && istype(O,/obj/machinery/particle_accelerator/control_box))
|
||||
if(O.dir == src.dir)
|
||||
master = O
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/proc/process_tool_hit(var/obj/item/O, var/mob/user)
|
||||
if(!(O) || !(user))
|
||||
return 0
|
||||
if(!ismob(user) || !isobj(O))
|
||||
return 0
|
||||
var/temp_state = src.construction_state
|
||||
|
||||
switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
|
||||
if(0)
|
||||
if(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = TRUE
|
||||
user.visible_message("[user.name] secures the [src.name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
temp_state++
|
||||
if(1)
|
||||
if(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = FALSE
|
||||
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
|
||||
"You remove the external bolts.")
|
||||
temp_state--
|
||||
else if(istype(O, /obj/item/stack/cable_coil))
|
||||
if(O:use(1,user))
|
||||
user.visible_message("[user.name] adds wires to the [src.name].", \
|
||||
"You add some wires.")
|
||||
temp_state++
|
||||
if(2)
|
||||
if(O.has_tool_quality(TOOL_WIRECUTTER))//TODO:Shock user if its on?
|
||||
user.visible_message("[user.name] removes some wires from the [src.name].", \
|
||||
"You remove some wires.")
|
||||
temp_state--
|
||||
else if(O.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
temp_state++
|
||||
if(3)
|
||||
if(O.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
user.visible_message("[user.name] opens the [src.name]'s access panel.", \
|
||||
"You open the access panel.")
|
||||
temp_state--
|
||||
if(temp_state == src.construction_state)//Nothing changed
|
||||
return 0
|
||||
else
|
||||
src.construction_state = temp_state
|
||||
if(src.construction_state < 3)//Was taken apart, update state
|
||||
update_state()
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator
|
||||
name = "Particle Accelerator"
|
||||
desc = "Part of a Particle Accelerator."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "none"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = USE_POWER_OFF
|
||||
idle_power_usage = 0
|
||||
active_power_usage = 0
|
||||
var/construction_state = 0
|
||||
var/active = 0
|
||||
var/reference = null
|
||||
var/powered = null
|
||||
var/strength = 0
|
||||
var/desc_holder = null
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/verb/rotate_clockwise()
|
||||
set name = "Rotate Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Counter-Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/update_icon()
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
switch(construction_state)
|
||||
if(0)
|
||||
. += "Looks like it's not attached to the flooring."
|
||||
if(1)
|
||||
. += "It is missing some cables."
|
||||
if(2)
|
||||
. += "The panel is open."
|
||||
if(3)
|
||||
. += "It is assembled."
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/attackby(obj/item/W, mob/user)
|
||||
if(istool(W))
|
||||
if(src.process_tool_hit(W,user))
|
||||
return
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(25))
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/proc/update_state()
|
||||
return 0
|
||||
|
||||
/obj/machinery/particle_accelerator/proc/process_tool_hit(var/obj/item/O, var/mob/user)
|
||||
if(!(O) || !(user))
|
||||
return 0
|
||||
if(!ismob(user) || !isobj(O))
|
||||
return 0
|
||||
var/temp_state = src.construction_state
|
||||
switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
|
||||
if(0)
|
||||
if(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = TRUE
|
||||
user.visible_message("[user.name] secures the [src.name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
temp_state++
|
||||
if(1)
|
||||
if(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = FALSE
|
||||
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
|
||||
"You remove the external bolts.")
|
||||
temp_state--
|
||||
else if(istype(O, /obj/item/stack/cable_coil))
|
||||
if(O:use(1))
|
||||
user.visible_message("[user.name] adds wires to the [src.name].", \
|
||||
"You add some wires.")
|
||||
temp_state++
|
||||
if(2)
|
||||
if(O.has_tool_quality(TOOL_WIRECUTTER))//TODO:Shock user if its on?
|
||||
user.visible_message("[user.name] removes some wires from the [src.name].", \
|
||||
"You remove some wires.")
|
||||
temp_state--
|
||||
else if(O.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
temp_state++
|
||||
if(3)
|
||||
if(O.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
user.visible_message("[user.name] opens the [src.name]'s access panel.", \
|
||||
"You open the access panel.")
|
||||
temp_state--
|
||||
active = 0
|
||||
if(temp_state == src.construction_state)//Nothing changed
|
||||
return 0
|
||||
else
|
||||
if(src.construction_state < 3)//Was taken apart, update state
|
||||
update_state()
|
||||
if(use_power)
|
||||
update_use_power(USE_POWER_OFF)
|
||||
src.construction_state = temp_state
|
||||
if(src.construction_state >= 3)
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/obj/structure/particle_accelerator/fuel_chamber
|
||||
name = "EM Acceleration Chamber"
|
||||
desc_holder = "This is where the Alpha particles are accelerated to <b><i>radical speeds</i></b>."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "fuel_chamber"
|
||||
/obj/structure/particle_accelerator/fuel_chamber
|
||||
name = "EM Acceleration Chamber"
|
||||
desc_holder = "This is where the Alpha particles are accelerated to <b><i>radical speeds</i></b>."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "fuel_chamber"
|
||||
reference = "fuel_chamber"
|
||||
@@ -1,253 +1,253 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box
|
||||
name = "Particle Accelerator Control Computer"
|
||||
desc = "This controls the density of the particles."
|
||||
icon = 'icons/obj/machines/particle_accelerator_vr.dmi' //VOREStation Edit
|
||||
icon_state = "control_box"
|
||||
reference = "control_box"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = USE_POWER_OFF
|
||||
idle_power_usage = 500
|
||||
active_power_usage = 70000 //70 kW per unit of strength
|
||||
construction_state = 0
|
||||
active = 0
|
||||
dir = 1
|
||||
var/strength_upper_limit = 2
|
||||
var/interface_control = 1
|
||||
var/list/obj/structure/particle_accelerator/connected_parts
|
||||
var/assembled = 0
|
||||
var/parts = null
|
||||
var/datum/wires/particle_acc/control_box/wires = null
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/New()
|
||||
wires = new(src)
|
||||
connected_parts = list()
|
||||
update_active_power_usage(initial(active_power_usage) * (strength + 1))
|
||||
..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Destroy()
|
||||
if(active)
|
||||
toggle_power()
|
||||
qdel(wires)
|
||||
wires = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/attack_hand(mob/user as mob)
|
||||
if(construction_state >= 3)
|
||||
tgui_interact(user)
|
||||
else if(construction_state == 2) // Wires exposed
|
||||
wires.Interact(user)
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_state()
|
||||
if(construction_state < 3)
|
||||
update_use_power(USE_POWER_OFF)
|
||||
assembled = 0
|
||||
active = 0
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.update_icon()
|
||||
connected_parts = list()
|
||||
return
|
||||
if(!part_scan())
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
active = 0
|
||||
connected_parts = list()
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_icon()
|
||||
if(active)
|
||||
icon_state = "[reference]p[strength]"
|
||||
else
|
||||
if(use_power)
|
||||
if(assembled)
|
||||
icon_state = "[reference]p"
|
||||
else
|
||||
icon_state = "u[reference]p"
|
||||
else
|
||||
switch(construction_state)
|
||||
if(0)
|
||||
icon_state = "[reference]"
|
||||
if(1)
|
||||
icon_state = "[reference]"
|
||||
if(2)
|
||||
icon_state = "[reference]w"
|
||||
else
|
||||
icon_state = "[reference]c"
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/strength_change()
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = strength
|
||||
part.update_icon()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/add_strength(var/s)
|
||||
if(assembled)
|
||||
strength++
|
||||
if(strength > strength_upper_limit)
|
||||
strength = strength_upper_limit
|
||||
else
|
||||
message_admins("PA Control Computer increased to [strength] by [key_name(usr, usr.client)][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [key_name(usr)] increased to [strength]")
|
||||
investigate_log("increased to <font color='red'>[strength]</font> by [usr.key]","singulo")
|
||||
strength_change()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/remove_strength(var/s)
|
||||
if(assembled)
|
||||
strength--
|
||||
if(strength < 0)
|
||||
strength = 0
|
||||
else
|
||||
message_admins("PA Control Computer decreased to [strength] by [key_name(usr, usr.client)][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [key_name(usr)] decreased to [strength]")
|
||||
investigate_log("decreased to <font color='green'>[strength]</font> by [usr.key]","singulo")
|
||||
strength_change()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/power_change()
|
||||
..()
|
||||
if(stat & NOPOWER)
|
||||
active = 0
|
||||
update_use_power(USE_POWER_OFF)
|
||||
else if(!stat && construction_state == 3)
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/process()
|
||||
if(src.active)
|
||||
//a part is missing!
|
||||
if( length(connected_parts) < 6 )
|
||||
log_game("PACCEL([x],[y],[z]) Failed due to missing parts.")
|
||||
investigate_log("lost a connected part; It <font color='red'>powered down</font>.","singulo")
|
||||
toggle_power()
|
||||
return
|
||||
//emit some particles
|
||||
for(var/obj/structure/particle_accelerator/particle_emitter/PE in connected_parts)
|
||||
if(PE)
|
||||
PE.emit_particle(src.strength)
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/part_scan()
|
||||
for(var/obj/structure/particle_accelerator/fuel_chamber/F in orange(1,src))
|
||||
src.set_dir(F.dir)
|
||||
break
|
||||
|
||||
connected_parts = list()
|
||||
assembled = 0
|
||||
var/ldir = turn(dir,90)
|
||||
var/rdir = turn(dir,-90)
|
||||
var/odir = turn(dir,180)
|
||||
var/turf/T = src.loc
|
||||
|
||||
T = get_step(T,ldir)
|
||||
if(!check_part(T,/obj/structure/particle_accelerator/fuel_chamber))
|
||||
return 0
|
||||
|
||||
T = get_step(T,odir)
|
||||
if(!check_part(T,/obj/structure/particle_accelerator/end_cap))
|
||||
return 0
|
||||
|
||||
T = get_step(T,dir)
|
||||
T = get_step(T,dir)
|
||||
if(!check_part(T,/obj/structure/particle_accelerator/power_box))
|
||||
return 0
|
||||
|
||||
T = get_step(T,dir)
|
||||
if(!check_part(T,/obj/structure/particle_accelerator/particle_emitter/center))
|
||||
return 0
|
||||
|
||||
T = get_step(T,ldir)
|
||||
if(!check_part(T,/obj/structure/particle_accelerator/particle_emitter/left))
|
||||
return 0
|
||||
|
||||
T = get_step(T,rdir)
|
||||
T = get_step(T,rdir)
|
||||
if(!check_part(T,/obj/structure/particle_accelerator/particle_emitter/right))
|
||||
return 0
|
||||
|
||||
assembled = 1
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/check_part(var/turf/T, var/type)
|
||||
if(!(T)||!(type))
|
||||
return 0
|
||||
|
||||
var/obj/structure/particle_accelerator/PA = locate(/obj/structure/particle_accelerator) in T
|
||||
if(istype(PA, type) && PA.connect_master(src) && PA.report_ready(src))
|
||||
src.connected_parts.Add(PA)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/toggle_power()
|
||||
active = !active
|
||||
investigate_log("turned [active?"<font color='red'>ON</font>":"<font color='green'>OFF</font>"] by [usr ? usr.key : "outside forces"]","singulo")
|
||||
message_admins("PA Control Computer turned [active ?"ON":"OFF"] by [usr ? key_name(usr, usr.client) : "outside forces"][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [usr ? key_name(usr, usr.client) : "outside forces"] turned [active?"ON":"OFF"].")
|
||||
if(active)
|
||||
update_use_power(USE_POWER_ACTIVE)
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = src.strength
|
||||
part.powered = 1
|
||||
part.update_icon()
|
||||
else
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.update_icon()
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/is_interactive(mob/user)
|
||||
if(!interface_control)
|
||||
to_chat(user, "<span class='alert'>ERROR: Request timed out. Check wire contacts.</span>")
|
||||
return FALSE
|
||||
if(construction_state != 3)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_status(mob/user)
|
||||
if(is_interactive(user))
|
||||
return ..()
|
||||
return STATUS_CLOSE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "ParticleAccelerator", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["assembled"] = assembled
|
||||
data["power"] = active
|
||||
data["strength"] = strength
|
||||
return data
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
if(wires.is_cut(WIRE_POWER))
|
||||
return
|
||||
toggle_power()
|
||||
. = TRUE
|
||||
if("scan")
|
||||
part_scan()
|
||||
. = TRUE
|
||||
if("add_strength")
|
||||
if(wires.is_cut(WIRE_PARTICLE_STRENGTH))
|
||||
return
|
||||
add_strength()
|
||||
. = TRUE
|
||||
if("remove_strength")
|
||||
if(wires.is_cut(WIRE_PARTICLE_STRENGTH))
|
||||
return
|
||||
remove_strength()
|
||||
. = TRUE
|
||||
|
||||
update_icon()
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box
|
||||
name = "Particle Accelerator Control Computer"
|
||||
desc = "This controls the density of the particles."
|
||||
icon = 'icons/obj/machines/particle_accelerator_vr.dmi' //VOREStation Edit
|
||||
icon_state = "control_box"
|
||||
reference = "control_box"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = USE_POWER_OFF
|
||||
idle_power_usage = 500
|
||||
active_power_usage = 70000 //70 kW per unit of strength
|
||||
construction_state = 0
|
||||
active = 0
|
||||
dir = 1
|
||||
var/strength_upper_limit = 2
|
||||
var/interface_control = 1
|
||||
var/list/obj/structure/particle_accelerator/connected_parts
|
||||
var/assembled = 0
|
||||
var/parts = null
|
||||
var/datum/wires/particle_acc/control_box/wires = null
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/New()
|
||||
wires = new(src)
|
||||
connected_parts = list()
|
||||
update_active_power_usage(initial(active_power_usage) * (strength + 1))
|
||||
..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Destroy()
|
||||
if(active)
|
||||
toggle_power()
|
||||
qdel(wires)
|
||||
wires = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/attack_hand(mob/user as mob)
|
||||
if(construction_state >= 3)
|
||||
tgui_interact(user)
|
||||
else if(construction_state == 2) // Wires exposed
|
||||
wires.Interact(user)
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_state()
|
||||
if(construction_state < 3)
|
||||
update_use_power(USE_POWER_OFF)
|
||||
assembled = 0
|
||||
active = 0
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.update_icon()
|
||||
connected_parts = list()
|
||||
return
|
||||
if(!part_scan())
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
active = 0
|
||||
connected_parts = list()
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_icon()
|
||||
if(active)
|
||||
icon_state = "[reference]p[strength]"
|
||||
else
|
||||
if(use_power)
|
||||
if(assembled)
|
||||
icon_state = "[reference]p"
|
||||
else
|
||||
icon_state = "u[reference]p"
|
||||
else
|
||||
switch(construction_state)
|
||||
if(0)
|
||||
icon_state = "[reference]"
|
||||
if(1)
|
||||
icon_state = "[reference]"
|
||||
if(2)
|
||||
icon_state = "[reference]w"
|
||||
else
|
||||
icon_state = "[reference]c"
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/strength_change()
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = strength
|
||||
part.update_icon()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/add_strength(var/s)
|
||||
if(assembled)
|
||||
strength++
|
||||
if(strength > strength_upper_limit)
|
||||
strength = strength_upper_limit
|
||||
else
|
||||
message_admins("PA Control Computer increased to [strength] by [key_name(usr, usr.client)][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [key_name(usr)] increased to [strength]")
|
||||
investigate_log("increased to <font color='red'>[strength]</font> by [usr.key]","singulo")
|
||||
strength_change()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/remove_strength(var/s)
|
||||
if(assembled)
|
||||
strength--
|
||||
if(strength < 0)
|
||||
strength = 0
|
||||
else
|
||||
message_admins("PA Control Computer decreased to [strength] by [key_name(usr, usr.client)][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [key_name(usr)] decreased to [strength]")
|
||||
investigate_log("decreased to <font color='green'>[strength]</font> by [usr.key]","singulo")
|
||||
strength_change()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/power_change()
|
||||
..()
|
||||
if(stat & NOPOWER)
|
||||
active = 0
|
||||
update_use_power(USE_POWER_OFF)
|
||||
else if(!stat && construction_state == 3)
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/process()
|
||||
if(src.active)
|
||||
//a part is missing!
|
||||
if( length(connected_parts) < 6 )
|
||||
log_game("PACCEL([x],[y],[z]) Failed due to missing parts.")
|
||||
investigate_log("lost a connected part; It <font color='red'>powered down</font>.","singulo")
|
||||
toggle_power()
|
||||
return
|
||||
//emit some particles
|
||||
for(var/obj/structure/particle_accelerator/particle_emitter/PE in connected_parts)
|
||||
if(PE)
|
||||
PE.emit_particle(src.strength)
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/part_scan()
|
||||
for(var/obj/structure/particle_accelerator/fuel_chamber/F in orange(1,src))
|
||||
src.set_dir(F.dir)
|
||||
break
|
||||
|
||||
connected_parts = list()
|
||||
assembled = 0
|
||||
var/ldir = turn(dir,90)
|
||||
var/rdir = turn(dir,-90)
|
||||
var/odir = turn(dir,180)
|
||||
var/turf/T = src.loc
|
||||
|
||||
T = get_step(T,ldir)
|
||||
if(!check_part(T,/obj/structure/particle_accelerator/fuel_chamber))
|
||||
return 0
|
||||
|
||||
T = get_step(T,odir)
|
||||
if(!check_part(T,/obj/structure/particle_accelerator/end_cap))
|
||||
return 0
|
||||
|
||||
T = get_step(T,dir)
|
||||
T = get_step(T,dir)
|
||||
if(!check_part(T,/obj/structure/particle_accelerator/power_box))
|
||||
return 0
|
||||
|
||||
T = get_step(T,dir)
|
||||
if(!check_part(T,/obj/structure/particle_accelerator/particle_emitter/center))
|
||||
return 0
|
||||
|
||||
T = get_step(T,ldir)
|
||||
if(!check_part(T,/obj/structure/particle_accelerator/particle_emitter/left))
|
||||
return 0
|
||||
|
||||
T = get_step(T,rdir)
|
||||
T = get_step(T,rdir)
|
||||
if(!check_part(T,/obj/structure/particle_accelerator/particle_emitter/right))
|
||||
return 0
|
||||
|
||||
assembled = 1
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/check_part(var/turf/T, var/type)
|
||||
if(!(T)||!(type))
|
||||
return 0
|
||||
|
||||
var/obj/structure/particle_accelerator/PA = locate(/obj/structure/particle_accelerator) in T
|
||||
if(istype(PA, type) && PA.connect_master(src) && PA.report_ready(src))
|
||||
src.connected_parts.Add(PA)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/toggle_power()
|
||||
active = !active
|
||||
investigate_log("turned [active?"<font color='red'>ON</font>":"<font color='green'>OFF</font>"] by [usr ? usr.key : "outside forces"]","singulo")
|
||||
message_admins("PA Control Computer turned [active ?"ON":"OFF"] by [usr ? key_name(usr, usr.client) : "outside forces"][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [usr ? key_name(usr, usr.client) : "outside forces"] turned [active?"ON":"OFF"].")
|
||||
if(active)
|
||||
update_use_power(USE_POWER_ACTIVE)
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = src.strength
|
||||
part.powered = 1
|
||||
part.update_icon()
|
||||
else
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.update_icon()
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/is_interactive(mob/user)
|
||||
if(!interface_control)
|
||||
to_chat(user, "<span class='alert'>ERROR: Request timed out. Check wire contacts.</span>")
|
||||
return FALSE
|
||||
if(construction_state != 3)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_status(mob/user)
|
||||
if(is_interactive(user))
|
||||
return ..()
|
||||
return STATUS_CLOSE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "ParticleAccelerator", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["assembled"] = assembled
|
||||
data["power"] = active
|
||||
data["strength"] = strength
|
||||
return data
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
if(wires.is_cut(WIRE_POWER))
|
||||
return
|
||||
toggle_power()
|
||||
. = TRUE
|
||||
if("scan")
|
||||
part_scan()
|
||||
. = TRUE
|
||||
if("add_strength")
|
||||
if(wires.is_cut(WIRE_PARTICLE_STRENGTH))
|
||||
return
|
||||
add_strength()
|
||||
. = TRUE
|
||||
if("remove_strength")
|
||||
if(wires.is_cut(WIRE_PARTICLE_STRENGTH))
|
||||
return
|
||||
remove_strength()
|
||||
. = TRUE
|
||||
|
||||
update_icon()
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter
|
||||
name = "EM Containment Grid"
|
||||
desc_holder = "This launchs the Alpha particles, might not want to stand near this end."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "none"
|
||||
var/fire_delay = 50
|
||||
var/last_shot = 0
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/center
|
||||
icon_state = "emitter_center"
|
||||
reference = "emitter_center"
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/right // It's looking for these in opposite directions.
|
||||
icon_state = "emitter_left"
|
||||
reference = "emitter_left"
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/left
|
||||
icon_state = "emitter_right"
|
||||
reference = "emitter_right"
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/proc/set_delay(var/delay)
|
||||
if(delay && delay >= 0)
|
||||
fire_delay = delay
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/proc/emit_particle(var/strength = 0)
|
||||
if((last_shot + fire_delay) <= world.time)
|
||||
last_shot = world.time
|
||||
var/obj/effect/accelerated_particle/A = null
|
||||
var/turf/T = src.loc // if it doesn't spawn here, it won't bump stuff directly infront of the PA
|
||||
switch(strength)
|
||||
if(0)
|
||||
A = new/obj/effect/accelerated_particle/weak(T, dir)
|
||||
if(1)
|
||||
A = new/obj/effect/accelerated_particle(T, dir)
|
||||
if(2)
|
||||
A = new/obj/effect/accelerated_particle/strong(T, dir)
|
||||
if(3)
|
||||
A = new/obj/effect/accelerated_particle/powerful(T, dir)
|
||||
if(A)
|
||||
A.set_dir(src.dir)
|
||||
return 1
|
||||
return 0
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter
|
||||
name = "EM Containment Grid"
|
||||
desc_holder = "This launchs the Alpha particles, might not want to stand near this end."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "none"
|
||||
var/fire_delay = 50
|
||||
var/last_shot = 0
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/center
|
||||
icon_state = "emitter_center"
|
||||
reference = "emitter_center"
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/right // It's looking for these in opposite directions.
|
||||
icon_state = "emitter_left"
|
||||
reference = "emitter_left"
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/left
|
||||
icon_state = "emitter_right"
|
||||
reference = "emitter_right"
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/proc/set_delay(var/delay)
|
||||
if(delay && delay >= 0)
|
||||
fire_delay = delay
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/proc/emit_particle(var/strength = 0)
|
||||
if((last_shot + fire_delay) <= world.time)
|
||||
last_shot = world.time
|
||||
var/obj/effect/accelerated_particle/A = null
|
||||
var/turf/T = src.loc // if it doesn't spawn here, it won't bump stuff directly infront of the PA
|
||||
switch(strength)
|
||||
if(0)
|
||||
A = new/obj/effect/accelerated_particle/weak(T, dir)
|
||||
if(1)
|
||||
A = new/obj/effect/accelerated_particle(T, dir)
|
||||
if(2)
|
||||
A = new/obj/effect/accelerated_particle/strong(T, dir)
|
||||
if(3)
|
||||
A = new/obj/effect/accelerated_particle/powerful(T, dir)
|
||||
if(A)
|
||||
A.set_dir(src.dir)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/obj/structure/particle_accelerator/power_box
|
||||
name = "Particle Focusing EM Lens"
|
||||
desc_holder = "This uses electromagnetic waves to focus the Alpha-Particles."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "power_box"
|
||||
/obj/structure/particle_accelerator/power_box
|
||||
name = "Particle Focusing EM Lens"
|
||||
desc_holder = "This uses electromagnetic waves to focus the Alpha-Particles."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "power_box"
|
||||
reference = "power_box"
|
||||
@@ -1,490 +1,490 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
GLOBAL_LIST_BOILERPLATE(all_singularities, /obj/singularity)
|
||||
|
||||
/obj/singularity/
|
||||
name = "gravitational singularity"
|
||||
desc = "A gravitational singularity."
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
icon_state = "singularity_s1"
|
||||
anchored = TRUE
|
||||
density = TRUE
|
||||
plane = ABOVE_PLANE
|
||||
light_range = 6
|
||||
unacidable = TRUE //Don't comment this out.
|
||||
|
||||
var/current_size = 1
|
||||
var/allowed_size = 1
|
||||
var/contained = 1 //Are we going to move around?
|
||||
var/energy = 100 //How strong are we?
|
||||
var/dissipate = 1 //Do we lose energy over time?
|
||||
var/dissipate_delay = 10
|
||||
var/dissipate_track = 0
|
||||
var/dissipate_strength = 1 //How much energy do we lose?
|
||||
var/move_self = 1 //Do we move on our own?
|
||||
var/grav_pull = 4 //How many tiles out do we pull?
|
||||
var/consume_range = 0 //How many tiles out do we eat.
|
||||
var/event_chance = 15 //Prob for event each tick.
|
||||
var/target = null //Its target. Moves towards the target if it has one.
|
||||
var/last_failed_movement = 0 //Will not move in the same dir if it couldnt before, will help with the getting stuck on fields thing.
|
||||
var/last_warning
|
||||
|
||||
var/chained = 0//Adminbus chain-grab
|
||||
|
||||
/obj/singularity/New(loc, var/starting_energy = 50)
|
||||
//CARN: admin-alert for chuckle-fuckery.
|
||||
admin_investigate_setup()
|
||||
energy = starting_energy
|
||||
|
||||
..()
|
||||
START_PROCESSING(SSobj, src)
|
||||
for(var/obj/machinery/power/singularity_beacon/singubeacon in machines)
|
||||
if(singubeacon.active)
|
||||
target = singubeacon
|
||||
break
|
||||
|
||||
/obj/singularity/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return ..()
|
||||
|
||||
/obj/singularity/attack_hand(mob/user as mob)
|
||||
consume(user)
|
||||
return 1
|
||||
|
||||
/obj/singularity/ex_act(severity)
|
||||
if(current_size == STAGE_SUPER)//IT'S UNSTOPPABLE
|
||||
return
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
if(prob(25))
|
||||
investigate_log("has been destroyed by an explosion.", I_SINGULO)
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
energy += 50
|
||||
if(2.0 to 3.0)
|
||||
energy += round((rand(20,60)/2),1)
|
||||
return
|
||||
|
||||
/obj/singularity/bullet_act(obj/item/projectile/P)
|
||||
return 0 //Will there be an impact? Who knows. Will we see it? No.
|
||||
|
||||
/obj/singularity/Bump(atom/A)
|
||||
consume(A)
|
||||
|
||||
/obj/singularity/Bumped(atom/A)
|
||||
consume(A)
|
||||
|
||||
/obj/singularity/process()
|
||||
eat()
|
||||
dissipate()
|
||||
check_energy()
|
||||
|
||||
if (current_size >= STAGE_TWO)
|
||||
move()
|
||||
pulse()
|
||||
|
||||
if (prob(event_chance)) //Chance for it to run a special event TODO: Come up with one or two more that fit.
|
||||
event()
|
||||
|
||||
/obj/singularity/attack_ai() //To prevent ais from gibbing themselves when they click on one.
|
||||
return
|
||||
|
||||
/obj/singularity/proc/admin_investigate_setup()
|
||||
last_warning = world.time
|
||||
var/count = locate(/obj/machinery/containment_field) in orange(30, src)
|
||||
|
||||
if (!count)
|
||||
message_admins("A singulo has been created without containment fields active ([x], [y], [z] - <A HREF='?_src_=holder;[HrefToken()];adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>).")
|
||||
|
||||
investigate_log("was created. [count ? "" : "<font color='red'>No containment fields were active.</font>"]", I_SINGULO)
|
||||
|
||||
/obj/singularity/proc/dissipate()
|
||||
if (!dissipate)
|
||||
return
|
||||
|
||||
if(dissipate_track >= dissipate_delay)
|
||||
energy -= dissipate_strength
|
||||
dissipate_track = 0
|
||||
else
|
||||
dissipate_track++
|
||||
|
||||
/obj/singularity/proc/expand(var/force_size = 0, var/growing = 1)
|
||||
if(current_size == STAGE_SUPER)//if this is happening, this is an error
|
||||
message_admins("expand() was called on a super singulo. This should not happen. Contact a coder immediately!")
|
||||
return
|
||||
var/temp_allowed_size = allowed_size
|
||||
|
||||
if (force_size)
|
||||
temp_allowed_size = force_size
|
||||
|
||||
switch (temp_allowed_size)
|
||||
if (STAGE_ONE)
|
||||
name = "gravitational singularity"
|
||||
desc = "A gravitational singularity."
|
||||
current_size = STAGE_ONE
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
icon_state = "singularity_s1"
|
||||
pixel_x = 0
|
||||
pixel_y = 0
|
||||
grav_pull = 4
|
||||
consume_range = 0
|
||||
dissipate_delay = 10
|
||||
dissipate_track = 0
|
||||
dissipate_strength = 1
|
||||
overlays = 0
|
||||
if(chained)
|
||||
overlays = "chain_s1"
|
||||
visible_message("<span class='notice'>The singularity has shrunk to a rather pitiful size.</span>")
|
||||
if (STAGE_TWO) //1 to 3 does not check for the turfs if you put the gens right next to a 1x1 then its going to eat them.
|
||||
name = "gravitational singularity"
|
||||
desc = "A gravitational singularity."
|
||||
current_size = STAGE_TWO
|
||||
icon = 'icons/effects/96x96.dmi'
|
||||
icon_state = "singularity_s3"
|
||||
pixel_x = -32
|
||||
pixel_y = -32
|
||||
grav_pull = 6
|
||||
consume_range = 1
|
||||
dissipate_delay = 10
|
||||
dissipate_track = 0
|
||||
dissipate_strength = 5
|
||||
overlays = 0
|
||||
if(chained)
|
||||
overlays = "chain_s3"
|
||||
if(growing)
|
||||
visible_message("<span class='notice'>The singularity noticeably grows in size.</span>")
|
||||
else
|
||||
visible_message("<span class='notice'>The singularity has shrunk to a less powerful size.</span>")
|
||||
if (STAGE_THREE)
|
||||
if ((check_turfs_in(1, 2)) && (check_turfs_in(2, 2)) && (check_turfs_in(4, 2)) && (check_turfs_in(8, 2)))
|
||||
name = "gravitational singularity"
|
||||
desc = "A gravitational singularity."
|
||||
current_size = STAGE_THREE
|
||||
icon = 'icons/effects/160x160.dmi'
|
||||
icon_state = "singularity_s5"
|
||||
pixel_x = -64
|
||||
pixel_y = -64
|
||||
grav_pull = 8
|
||||
consume_range = 2
|
||||
dissipate_delay = 4
|
||||
dissipate_track = 0
|
||||
dissipate_strength = 20
|
||||
overlays = 0
|
||||
if(chained)
|
||||
overlays = "chain_s5"
|
||||
if(growing)
|
||||
visible_message("<span class='notice'>The singularity expands to a reasonable size.</span>")
|
||||
else
|
||||
visible_message("<span class='notice'>The singularity has returned to a safe size.</span>")
|
||||
if(STAGE_FOUR)
|
||||
if ((check_turfs_in(1, 3)) && (check_turfs_in(2, 3)) && (check_turfs_in(4, 3)) && (check_turfs_in(8, 3)))
|
||||
name = "gravitational singularity"
|
||||
desc = "A gravitational singularity."
|
||||
current_size = STAGE_FOUR
|
||||
icon = 'icons/effects/224x224.dmi'
|
||||
icon_state = "singularity_s7"
|
||||
pixel_x = -96
|
||||
pixel_y = -96
|
||||
grav_pull = 10
|
||||
consume_range = 3
|
||||
dissipate_delay = 10
|
||||
dissipate_track = 0
|
||||
dissipate_strength = 8
|
||||
overlays = 0
|
||||
if(chained)
|
||||
overlays = "chain_s7"
|
||||
if(growing)
|
||||
visible_message("<span class='warning'>The singularity expands to a dangerous size.</span>")
|
||||
else
|
||||
visible_message("<span class='notice'>Miraculously, the singularity reduces in size, and can be contained.</span>")
|
||||
if(STAGE_FIVE) //This one also lacks a check for gens because it eats everything.
|
||||
name = "gravitational singularity"
|
||||
desc = "A gravitational singularity."
|
||||
current_size = STAGE_FIVE
|
||||
icon = 'icons/effects/288x288.dmi'
|
||||
icon_state = "singularity_s9"
|
||||
pixel_x = -128
|
||||
pixel_y = -128
|
||||
grav_pull = 10
|
||||
consume_range = 4
|
||||
dissipate = 0 //It cant go smaller due to e loss.
|
||||
overlays = 0
|
||||
if(chained)
|
||||
overlays = "chain_s9"
|
||||
if(growing)
|
||||
visible_message("<span class='danger'><font size='2'>The singularity has grown out of control!</font></span>")
|
||||
else
|
||||
visible_message("<span class='warning'>The singularity miraculously reduces in size and loses its supermatter properties.</span>")
|
||||
if(STAGE_SUPER)//SUPERSINGULO
|
||||
name = "super gravitational singularity"
|
||||
desc = "A gravitational singularity with the properties of supermatter. <b>It has the power to destroy worlds.</b>"
|
||||
current_size = STAGE_SUPER
|
||||
icon = 'icons/effects/352x352.dmi'
|
||||
icon_state = "singularity_s11"//uh, whoever drew that, you know that black holes are supposed to look dark right? What's this, the clown's singulo?
|
||||
pixel_x = -160
|
||||
pixel_y = -160
|
||||
grav_pull = 16
|
||||
consume_range = 5
|
||||
dissipate = 0 //It cant go smaller due to e loss
|
||||
event_chance = 25 //Events will fire off more often.
|
||||
if(chained)
|
||||
overlays = "chain_s9"
|
||||
visible_message("<span class='sinister'><font size='3'>You witness the creation of a destructive force that cannot possibly be stopped by human hands.</font></span>")
|
||||
|
||||
if (current_size == allowed_size)
|
||||
investigate_log("<font color='red'>grew to size [current_size].</font>", I_SINGULO)
|
||||
return 1
|
||||
else if (current_size < (--temp_allowed_size) && current_size != STAGE_SUPER)
|
||||
expand(temp_allowed_size)
|
||||
else
|
||||
return 0
|
||||
|
||||
/obj/singularity/proc/check_energy()
|
||||
if (energy <= 0)
|
||||
investigate_log("collapsed.", I_SINGULO)
|
||||
qdel(src)
|
||||
return 0
|
||||
|
||||
switch (energy) //Some of these numbers might need to be changed up later -Mport.
|
||||
if (1 to 199)
|
||||
allowed_size = STAGE_ONE
|
||||
if (200 to 499)
|
||||
allowed_size = STAGE_TWO
|
||||
if (500 to 999)
|
||||
allowed_size = STAGE_THREE
|
||||
if (1000 to 1999)
|
||||
allowed_size = STAGE_FOUR
|
||||
if(2000 to 49999)
|
||||
allowed_size = STAGE_FIVE
|
||||
if(50000 to INFINITY)
|
||||
allowed_size = STAGE_SUPER
|
||||
|
||||
if (current_size != allowed_size && current_size != STAGE_SUPER)
|
||||
expand(null, current_size > allowed_size)
|
||||
return 1
|
||||
|
||||
/obj/singularity/proc/eat()
|
||||
for(var/atom/X as anything in orange(grav_pull, src))
|
||||
if(!X.simulated)
|
||||
continue
|
||||
var/dist = get_dist(X, src)
|
||||
if(dist > consume_range)
|
||||
X.singularity_pull(src, current_size)
|
||||
else
|
||||
consume(X)
|
||||
return
|
||||
|
||||
/obj/singularity/proc/consume(const/atom/A)
|
||||
src.energy += A.singularity_act(src, current_size)
|
||||
return
|
||||
|
||||
/obj/singularity/proc/move(var/force_move = 0)
|
||||
if(!move_self)
|
||||
return 0
|
||||
|
||||
var/movement_dir = pick(alldirs - last_failed_movement)
|
||||
|
||||
if(force_move)
|
||||
movement_dir = force_move
|
||||
|
||||
if(target && prob(60))
|
||||
movement_dir = get_dir(src,target) //moves to a singulo beacon, if there is one
|
||||
|
||||
if(current_size >= STAGE_FIVE)//The superlarge one does not care about things in its way
|
||||
spawn(0)
|
||||
step(src, movement_dir)
|
||||
spawn(1)
|
||||
step(src, movement_dir)
|
||||
return 1
|
||||
else if(check_turfs_in(movement_dir))
|
||||
last_failed_movement = 0//Reset this because we moved
|
||||
spawn(0)
|
||||
step(src, movement_dir)
|
||||
return 1
|
||||
else
|
||||
last_failed_movement = movement_dir
|
||||
return 0
|
||||
|
||||
/obj/singularity/proc/check_turfs_in(var/direction = 0, var/step = 0)
|
||||
if(!direction)
|
||||
return 0
|
||||
var/steps = 0
|
||||
if(!step)
|
||||
switch(current_size)
|
||||
if(STAGE_ONE)
|
||||
steps = 1
|
||||
if(STAGE_TWO)
|
||||
steps = 3//Yes this is right
|
||||
if(STAGE_THREE)
|
||||
steps = 3
|
||||
if(STAGE_FOUR)
|
||||
steps = 4
|
||||
if(STAGE_FIVE)
|
||||
steps = 5
|
||||
if(STAGE_SUPER)
|
||||
steps = 6
|
||||
else
|
||||
steps = step
|
||||
var/list/turfs = list()
|
||||
var/turf/T = src.loc
|
||||
for(var/i = 1 to steps)
|
||||
T = get_step(T,direction)
|
||||
if(!isturf(T))
|
||||
return 0
|
||||
turfs.Add(T)
|
||||
var/dir2 = 0
|
||||
var/dir3 = 0
|
||||
switch(direction)
|
||||
if(NORTH,SOUTH)
|
||||
dir2 = 4
|
||||
dir3 = 8
|
||||
if(EAST,WEST)
|
||||
dir2 = 1
|
||||
dir3 = 2
|
||||
var/turf/T2 = T
|
||||
for(var/j = 1 to steps)
|
||||
T2 = get_step(T2,dir2)
|
||||
if(!isturf(T2))
|
||||
return 0
|
||||
turfs.Add(T2)
|
||||
for(var/k = 1 to steps)
|
||||
T = get_step(T,dir3)
|
||||
if(!isturf(T))
|
||||
return 0
|
||||
turfs.Add(T)
|
||||
for(var/turf/T3 in turfs)
|
||||
if(isnull(T3))
|
||||
continue
|
||||
if(!can_move(T3))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/singularity/proc/can_move(const/turf/T)
|
||||
if (!isturf(T))
|
||||
return 0
|
||||
|
||||
// VOREStation Edit Start
|
||||
var/area/A = get_area(T)
|
||||
if(A.forbid_singulo) //No going to dorms
|
||||
return 0
|
||||
// VOREStation Edit End
|
||||
|
||||
if ((locate(/obj/machinery/containment_field) in T) || (locate(/obj/machinery/shieldwall) in T))
|
||||
return 0
|
||||
else if (locate(/obj/machinery/field_generator) in T)
|
||||
var/obj/machinery/field_generator/G = locate(/obj/machinery/field_generator) in T
|
||||
|
||||
if (G && G.active)
|
||||
return 0
|
||||
else if (locate(/obj/machinery/shieldwallgen) in T)
|
||||
var/obj/machinery/shieldwallgen/S = locate(/obj/machinery/shieldwallgen) in T
|
||||
|
||||
if (S && S.active)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/singularity/proc/event()
|
||||
var/numb = pick(1, 2, 3, 4, 5, 6)
|
||||
|
||||
switch (numb)
|
||||
if (1) //EMP.
|
||||
emp_area()
|
||||
if (2, 3) //Tox damage all carbon mobs in area.
|
||||
toxmob()
|
||||
if (4) //Stun mobs who lack optic scanners.
|
||||
mezzer()
|
||||
else
|
||||
return 0
|
||||
if(current_size == STAGE_SUPER)
|
||||
smwave()
|
||||
return 1
|
||||
|
||||
|
||||
/obj/singularity/proc/toxmob()
|
||||
var/toxrange = 10
|
||||
var/toxdamage = 4
|
||||
var/radiation = 15
|
||||
if (src.energy>200)
|
||||
toxdamage = round(((src.energy-150)/50)*4,1)
|
||||
radiation = round(((src.energy-150)/50)*5,1)
|
||||
SSradiation.radiate(src, radiation) //Always radiate at max, so a decent dose of radiation is applied
|
||||
for(var/mob/living/M in view(toxrange, src.loc))
|
||||
if(M.status_flags & GODMODE)
|
||||
continue
|
||||
toxdamage = (toxdamage - (toxdamage*M.getarmor(null, "rad")))
|
||||
M.apply_effect(toxdamage, TOX)
|
||||
return
|
||||
|
||||
|
||||
/obj/singularity/proc/mezzer()
|
||||
for(var/mob/living/carbon/M in oviewers(8, src))
|
||||
if(istype(M, /mob/living/carbon/brain)) //Ignore brains
|
||||
continue
|
||||
if(M.status_flags & GODMODE)
|
||||
continue
|
||||
if(M.stat == CONSCIOUS)
|
||||
if (istype(M,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = M
|
||||
if(istype(H.glasses,/obj/item/clothing/glasses/meson) && current_size != STAGE_SUPER)
|
||||
to_chat(H, "<span class=\"notice\">You look directly into The [src.name], good thing you had your protective eyewear on!</span>")
|
||||
return
|
||||
else
|
||||
to_chat(H, "<span class=\"warning\">You look directly into The [src.name], but your eyewear does absolutely nothing to protect you from it!</span>")
|
||||
to_chat(M, "<span class='danger'>You look directly into The [src.name] and feel [current_size == STAGE_SUPER ? "helpless" : "weak"].</span>")
|
||||
M.apply_effect(3, STUN)
|
||||
for(var/mob/O in viewers(M, null))
|
||||
O.show_message(text("<span class='danger'>[] stares blankly at The []!</span>", M, src), 1)
|
||||
|
||||
/obj/singularity/proc/emp_area()
|
||||
if(current_size != STAGE_SUPER)
|
||||
empulse(src, 4, 6, 8, 10)
|
||||
else
|
||||
empulse(src, 12, 14, 16, 18)
|
||||
|
||||
/obj/singularity/proc/smwave()
|
||||
for(var/mob/living/M in view(10, src.loc))
|
||||
if(prob(67))
|
||||
to_chat(M, "<span class=\"warning\">You hear an uneartly ringing, then what sounds like a shrilling kettle as you are washed with a wave of heat.</span>")
|
||||
to_chat(M, "<span class=\"notice\">Miraculously, it fails to kill you.</span>")
|
||||
else
|
||||
to_chat(M, "<span class=\"danger\">You hear an uneartly ringing, then what sounds like a shrilling kettle as you are washed with a wave of heat.</span>")
|
||||
to_chat(M, "<span class=\"danger\">You don't even have a moment to react as you are reduced to ashes by the intense radiation.</span>")
|
||||
M.dust()
|
||||
SSradiation.radiate(src, rand(energy))
|
||||
return
|
||||
|
||||
/obj/singularity/proc/pulse()
|
||||
for(var/obj/machinery/power/rad_collector/R in rad_collectors)
|
||||
if (get_dist(R, src) <= 15) //Better than using orange() every process.
|
||||
R.receive_pulse(energy)
|
||||
|
||||
/obj/singularity/proc/on_capture()
|
||||
chained = 1
|
||||
overlays = 0
|
||||
move_self = 0
|
||||
switch (current_size)
|
||||
if(STAGE_ONE)
|
||||
add_overlay(image('icons/obj/singularity.dmi',"chain_s1"))
|
||||
if(STAGE_TWO)
|
||||
add_overlay(image('icons/effects/96x96.dmi',"chain_s3"))
|
||||
if(STAGE_THREE)
|
||||
add_overlay(image('icons/effects/160x160.dmi',"chain_s5"))
|
||||
if(STAGE_FOUR)
|
||||
add_overlay(image('icons/effects/224x224.dmi',"chain_s7"))
|
||||
if(STAGE_FIVE)
|
||||
add_overlay(image('icons/effects/288x288.dmi',"chain_s9"))
|
||||
|
||||
/obj/singularity/proc/on_release()
|
||||
chained = 0
|
||||
overlays = 0
|
||||
move_self = 1
|
||||
|
||||
/obj/singularity/singularity_act(S, size)
|
||||
if(current_size <= size)
|
||||
var/gain = (energy/2)
|
||||
var/dist = max((current_size - 2), 1)
|
||||
explosion(src.loc,(dist),(dist*2),(dist*4))
|
||||
spawn(0)
|
||||
qdel(src)
|
||||
return gain
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
GLOBAL_LIST_BOILERPLATE(all_singularities, /obj/singularity)
|
||||
|
||||
/obj/singularity/
|
||||
name = "gravitational singularity"
|
||||
desc = "A gravitational singularity."
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
icon_state = "singularity_s1"
|
||||
anchored = TRUE
|
||||
density = TRUE
|
||||
plane = ABOVE_PLANE
|
||||
light_range = 6
|
||||
unacidable = TRUE //Don't comment this out.
|
||||
|
||||
var/current_size = 1
|
||||
var/allowed_size = 1
|
||||
var/contained = 1 //Are we going to move around?
|
||||
var/energy = 100 //How strong are we?
|
||||
var/dissipate = 1 //Do we lose energy over time?
|
||||
var/dissipate_delay = 10
|
||||
var/dissipate_track = 0
|
||||
var/dissipate_strength = 1 //How much energy do we lose?
|
||||
var/move_self = 1 //Do we move on our own?
|
||||
var/grav_pull = 4 //How many tiles out do we pull?
|
||||
var/consume_range = 0 //How many tiles out do we eat.
|
||||
var/event_chance = 15 //Prob for event each tick.
|
||||
var/target = null //Its target. Moves towards the target if it has one.
|
||||
var/last_failed_movement = 0 //Will not move in the same dir if it couldnt before, will help with the getting stuck on fields thing.
|
||||
var/last_warning
|
||||
|
||||
var/chained = 0//Adminbus chain-grab
|
||||
|
||||
/obj/singularity/New(loc, var/starting_energy = 50)
|
||||
//CARN: admin-alert for chuckle-fuckery.
|
||||
admin_investigate_setup()
|
||||
energy = starting_energy
|
||||
|
||||
..()
|
||||
START_PROCESSING(SSobj, src)
|
||||
for(var/obj/machinery/power/singularity_beacon/singubeacon in machines)
|
||||
if(singubeacon.active)
|
||||
target = singubeacon
|
||||
break
|
||||
|
||||
/obj/singularity/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return ..()
|
||||
|
||||
/obj/singularity/attack_hand(mob/user as mob)
|
||||
consume(user)
|
||||
return 1
|
||||
|
||||
/obj/singularity/ex_act(severity)
|
||||
if(current_size == STAGE_SUPER)//IT'S UNSTOPPABLE
|
||||
return
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
if(prob(25))
|
||||
investigate_log("has been destroyed by an explosion.", I_SINGULO)
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
energy += 50
|
||||
if(2.0 to 3.0)
|
||||
energy += round((rand(20,60)/2),1)
|
||||
return
|
||||
|
||||
/obj/singularity/bullet_act(obj/item/projectile/P)
|
||||
return 0 //Will there be an impact? Who knows. Will we see it? No.
|
||||
|
||||
/obj/singularity/Bump(atom/A)
|
||||
consume(A)
|
||||
|
||||
/obj/singularity/Bumped(atom/A)
|
||||
consume(A)
|
||||
|
||||
/obj/singularity/process()
|
||||
eat()
|
||||
dissipate()
|
||||
check_energy()
|
||||
|
||||
if (current_size >= STAGE_TWO)
|
||||
move()
|
||||
pulse()
|
||||
|
||||
if (prob(event_chance)) //Chance for it to run a special event TODO: Come up with one or two more that fit.
|
||||
event()
|
||||
|
||||
/obj/singularity/attack_ai() //To prevent ais from gibbing themselves when they click on one.
|
||||
return
|
||||
|
||||
/obj/singularity/proc/admin_investigate_setup()
|
||||
last_warning = world.time
|
||||
var/count = locate(/obj/machinery/containment_field) in orange(30, src)
|
||||
|
||||
if (!count)
|
||||
message_admins("A singulo has been created without containment fields active ([x], [y], [z] - <A HREF='?_src_=holder;[HrefToken()];adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>).")
|
||||
|
||||
investigate_log("was created. [count ? "" : "<font color='red'>No containment fields were active.</font>"]", I_SINGULO)
|
||||
|
||||
/obj/singularity/proc/dissipate()
|
||||
if (!dissipate)
|
||||
return
|
||||
|
||||
if(dissipate_track >= dissipate_delay)
|
||||
energy -= dissipate_strength
|
||||
dissipate_track = 0
|
||||
else
|
||||
dissipate_track++
|
||||
|
||||
/obj/singularity/proc/expand(var/force_size = 0, var/growing = 1)
|
||||
if(current_size == STAGE_SUPER)//if this is happening, this is an error
|
||||
message_admins("expand() was called on a super singulo. This should not happen. Contact a coder immediately!")
|
||||
return
|
||||
var/temp_allowed_size = allowed_size
|
||||
|
||||
if (force_size)
|
||||
temp_allowed_size = force_size
|
||||
|
||||
switch (temp_allowed_size)
|
||||
if (STAGE_ONE)
|
||||
name = "gravitational singularity"
|
||||
desc = "A gravitational singularity."
|
||||
current_size = STAGE_ONE
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
icon_state = "singularity_s1"
|
||||
pixel_x = 0
|
||||
pixel_y = 0
|
||||
grav_pull = 4
|
||||
consume_range = 0
|
||||
dissipate_delay = 10
|
||||
dissipate_track = 0
|
||||
dissipate_strength = 1
|
||||
overlays = 0
|
||||
if(chained)
|
||||
overlays = "chain_s1"
|
||||
visible_message("<span class='notice'>The singularity has shrunk to a rather pitiful size.</span>")
|
||||
if (STAGE_TWO) //1 to 3 does not check for the turfs if you put the gens right next to a 1x1 then its going to eat them.
|
||||
name = "gravitational singularity"
|
||||
desc = "A gravitational singularity."
|
||||
current_size = STAGE_TWO
|
||||
icon = 'icons/effects/96x96.dmi'
|
||||
icon_state = "singularity_s3"
|
||||
pixel_x = -32
|
||||
pixel_y = -32
|
||||
grav_pull = 6
|
||||
consume_range = 1
|
||||
dissipate_delay = 10
|
||||
dissipate_track = 0
|
||||
dissipate_strength = 5
|
||||
overlays = 0
|
||||
if(chained)
|
||||
overlays = "chain_s3"
|
||||
if(growing)
|
||||
visible_message("<span class='notice'>The singularity noticeably grows in size.</span>")
|
||||
else
|
||||
visible_message("<span class='notice'>The singularity has shrunk to a less powerful size.</span>")
|
||||
if (STAGE_THREE)
|
||||
if ((check_turfs_in(1, 2)) && (check_turfs_in(2, 2)) && (check_turfs_in(4, 2)) && (check_turfs_in(8, 2)))
|
||||
name = "gravitational singularity"
|
||||
desc = "A gravitational singularity."
|
||||
current_size = STAGE_THREE
|
||||
icon = 'icons/effects/160x160.dmi'
|
||||
icon_state = "singularity_s5"
|
||||
pixel_x = -64
|
||||
pixel_y = -64
|
||||
grav_pull = 8
|
||||
consume_range = 2
|
||||
dissipate_delay = 4
|
||||
dissipate_track = 0
|
||||
dissipate_strength = 20
|
||||
overlays = 0
|
||||
if(chained)
|
||||
overlays = "chain_s5"
|
||||
if(growing)
|
||||
visible_message("<span class='notice'>The singularity expands to a reasonable size.</span>")
|
||||
else
|
||||
visible_message("<span class='notice'>The singularity has returned to a safe size.</span>")
|
||||
if(STAGE_FOUR)
|
||||
if ((check_turfs_in(1, 3)) && (check_turfs_in(2, 3)) && (check_turfs_in(4, 3)) && (check_turfs_in(8, 3)))
|
||||
name = "gravitational singularity"
|
||||
desc = "A gravitational singularity."
|
||||
current_size = STAGE_FOUR
|
||||
icon = 'icons/effects/224x224.dmi'
|
||||
icon_state = "singularity_s7"
|
||||
pixel_x = -96
|
||||
pixel_y = -96
|
||||
grav_pull = 10
|
||||
consume_range = 3
|
||||
dissipate_delay = 10
|
||||
dissipate_track = 0
|
||||
dissipate_strength = 8
|
||||
overlays = 0
|
||||
if(chained)
|
||||
overlays = "chain_s7"
|
||||
if(growing)
|
||||
visible_message("<span class='warning'>The singularity expands to a dangerous size.</span>")
|
||||
else
|
||||
visible_message("<span class='notice'>Miraculously, the singularity reduces in size, and can be contained.</span>")
|
||||
if(STAGE_FIVE) //This one also lacks a check for gens because it eats everything.
|
||||
name = "gravitational singularity"
|
||||
desc = "A gravitational singularity."
|
||||
current_size = STAGE_FIVE
|
||||
icon = 'icons/effects/288x288.dmi'
|
||||
icon_state = "singularity_s9"
|
||||
pixel_x = -128
|
||||
pixel_y = -128
|
||||
grav_pull = 10
|
||||
consume_range = 4
|
||||
dissipate = 0 //It cant go smaller due to e loss.
|
||||
overlays = 0
|
||||
if(chained)
|
||||
overlays = "chain_s9"
|
||||
if(growing)
|
||||
visible_message("<span class='danger'><font size='2'>The singularity has grown out of control!</font></span>")
|
||||
else
|
||||
visible_message("<span class='warning'>The singularity miraculously reduces in size and loses its supermatter properties.</span>")
|
||||
if(STAGE_SUPER)//SUPERSINGULO
|
||||
name = "super gravitational singularity"
|
||||
desc = "A gravitational singularity with the properties of supermatter. <b>It has the power to destroy worlds.</b>"
|
||||
current_size = STAGE_SUPER
|
||||
icon = 'icons/effects/352x352.dmi'
|
||||
icon_state = "singularity_s11"//uh, whoever drew that, you know that black holes are supposed to look dark right? What's this, the clown's singulo?
|
||||
pixel_x = -160
|
||||
pixel_y = -160
|
||||
grav_pull = 16
|
||||
consume_range = 5
|
||||
dissipate = 0 //It cant go smaller due to e loss
|
||||
event_chance = 25 //Events will fire off more often.
|
||||
if(chained)
|
||||
overlays = "chain_s9"
|
||||
visible_message("<span class='sinister'><font size='3'>You witness the creation of a destructive force that cannot possibly be stopped by human hands.</font></span>")
|
||||
|
||||
if (current_size == allowed_size)
|
||||
investigate_log("<font color='red'>grew to size [current_size].</font>", I_SINGULO)
|
||||
return 1
|
||||
else if (current_size < (--temp_allowed_size) && current_size != STAGE_SUPER)
|
||||
expand(temp_allowed_size)
|
||||
else
|
||||
return 0
|
||||
|
||||
/obj/singularity/proc/check_energy()
|
||||
if (energy <= 0)
|
||||
investigate_log("collapsed.", I_SINGULO)
|
||||
qdel(src)
|
||||
return 0
|
||||
|
||||
switch (energy) //Some of these numbers might need to be changed up later -Mport.
|
||||
if (1 to 199)
|
||||
allowed_size = STAGE_ONE
|
||||
if (200 to 499)
|
||||
allowed_size = STAGE_TWO
|
||||
if (500 to 999)
|
||||
allowed_size = STAGE_THREE
|
||||
if (1000 to 1999)
|
||||
allowed_size = STAGE_FOUR
|
||||
if(2000 to 49999)
|
||||
allowed_size = STAGE_FIVE
|
||||
if(50000 to INFINITY)
|
||||
allowed_size = STAGE_SUPER
|
||||
|
||||
if (current_size != allowed_size && current_size != STAGE_SUPER)
|
||||
expand(null, current_size > allowed_size)
|
||||
return 1
|
||||
|
||||
/obj/singularity/proc/eat()
|
||||
for(var/atom/X as anything in orange(grav_pull, src))
|
||||
if(!X.simulated)
|
||||
continue
|
||||
var/dist = get_dist(X, src)
|
||||
if(dist > consume_range)
|
||||
X.singularity_pull(src, current_size)
|
||||
else
|
||||
consume(X)
|
||||
return
|
||||
|
||||
/obj/singularity/proc/consume(const/atom/A)
|
||||
src.energy += A.singularity_act(src, current_size)
|
||||
return
|
||||
|
||||
/obj/singularity/proc/move(var/force_move = 0)
|
||||
if(!move_self)
|
||||
return 0
|
||||
|
||||
var/movement_dir = pick(alldirs - last_failed_movement)
|
||||
|
||||
if(force_move)
|
||||
movement_dir = force_move
|
||||
|
||||
if(target && prob(60))
|
||||
movement_dir = get_dir(src,target) //moves to a singulo beacon, if there is one
|
||||
|
||||
if(current_size >= STAGE_FIVE)//The superlarge one does not care about things in its way
|
||||
spawn(0)
|
||||
step(src, movement_dir)
|
||||
spawn(1)
|
||||
step(src, movement_dir)
|
||||
return 1
|
||||
else if(check_turfs_in(movement_dir))
|
||||
last_failed_movement = 0//Reset this because we moved
|
||||
spawn(0)
|
||||
step(src, movement_dir)
|
||||
return 1
|
||||
else
|
||||
last_failed_movement = movement_dir
|
||||
return 0
|
||||
|
||||
/obj/singularity/proc/check_turfs_in(var/direction = 0, var/step = 0)
|
||||
if(!direction)
|
||||
return 0
|
||||
var/steps = 0
|
||||
if(!step)
|
||||
switch(current_size)
|
||||
if(STAGE_ONE)
|
||||
steps = 1
|
||||
if(STAGE_TWO)
|
||||
steps = 3//Yes this is right
|
||||
if(STAGE_THREE)
|
||||
steps = 3
|
||||
if(STAGE_FOUR)
|
||||
steps = 4
|
||||
if(STAGE_FIVE)
|
||||
steps = 5
|
||||
if(STAGE_SUPER)
|
||||
steps = 6
|
||||
else
|
||||
steps = step
|
||||
var/list/turfs = list()
|
||||
var/turf/T = src.loc
|
||||
for(var/i = 1 to steps)
|
||||
T = get_step(T,direction)
|
||||
if(!isturf(T))
|
||||
return 0
|
||||
turfs.Add(T)
|
||||
var/dir2 = 0
|
||||
var/dir3 = 0
|
||||
switch(direction)
|
||||
if(NORTH,SOUTH)
|
||||
dir2 = 4
|
||||
dir3 = 8
|
||||
if(EAST,WEST)
|
||||
dir2 = 1
|
||||
dir3 = 2
|
||||
var/turf/T2 = T
|
||||
for(var/j = 1 to steps)
|
||||
T2 = get_step(T2,dir2)
|
||||
if(!isturf(T2))
|
||||
return 0
|
||||
turfs.Add(T2)
|
||||
for(var/k = 1 to steps)
|
||||
T = get_step(T,dir3)
|
||||
if(!isturf(T))
|
||||
return 0
|
||||
turfs.Add(T)
|
||||
for(var/turf/T3 in turfs)
|
||||
if(isnull(T3))
|
||||
continue
|
||||
if(!can_move(T3))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/singularity/proc/can_move(const/turf/T)
|
||||
if (!isturf(T))
|
||||
return 0
|
||||
|
||||
// VOREStation Edit Start
|
||||
var/area/A = get_area(T)
|
||||
if(A.forbid_singulo) //No going to dorms
|
||||
return 0
|
||||
// VOREStation Edit End
|
||||
|
||||
if ((locate(/obj/machinery/containment_field) in T) || (locate(/obj/machinery/shieldwall) in T))
|
||||
return 0
|
||||
else if (locate(/obj/machinery/field_generator) in T)
|
||||
var/obj/machinery/field_generator/G = locate(/obj/machinery/field_generator) in T
|
||||
|
||||
if (G && G.active)
|
||||
return 0
|
||||
else if (locate(/obj/machinery/shieldwallgen) in T)
|
||||
var/obj/machinery/shieldwallgen/S = locate(/obj/machinery/shieldwallgen) in T
|
||||
|
||||
if (S && S.active)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/singularity/proc/event()
|
||||
var/numb = pick(1, 2, 3, 4, 5, 6)
|
||||
|
||||
switch (numb)
|
||||
if (1) //EMP.
|
||||
emp_area()
|
||||
if (2, 3) //Tox damage all carbon mobs in area.
|
||||
toxmob()
|
||||
if (4) //Stun mobs who lack optic scanners.
|
||||
mezzer()
|
||||
else
|
||||
return 0
|
||||
if(current_size == STAGE_SUPER)
|
||||
smwave()
|
||||
return 1
|
||||
|
||||
|
||||
/obj/singularity/proc/toxmob()
|
||||
var/toxrange = 10
|
||||
var/toxdamage = 4
|
||||
var/radiation = 15
|
||||
if (src.energy>200)
|
||||
toxdamage = round(((src.energy-150)/50)*4,1)
|
||||
radiation = round(((src.energy-150)/50)*5,1)
|
||||
SSradiation.radiate(src, radiation) //Always radiate at max, so a decent dose of radiation is applied
|
||||
for(var/mob/living/M in view(toxrange, src.loc))
|
||||
if(M.status_flags & GODMODE)
|
||||
continue
|
||||
toxdamage = (toxdamage - (toxdamage*M.getarmor(null, "rad")))
|
||||
M.apply_effect(toxdamage, TOX)
|
||||
return
|
||||
|
||||
|
||||
/obj/singularity/proc/mezzer()
|
||||
for(var/mob/living/carbon/M in oviewers(8, src))
|
||||
if(istype(M, /mob/living/carbon/brain)) //Ignore brains
|
||||
continue
|
||||
if(M.status_flags & GODMODE)
|
||||
continue
|
||||
if(M.stat == CONSCIOUS)
|
||||
if (istype(M,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = M
|
||||
if(istype(H.glasses,/obj/item/clothing/glasses/meson) && current_size != STAGE_SUPER)
|
||||
to_chat(H, "<span class=\"notice\">You look directly into The [src.name], good thing you had your protective eyewear on!</span>")
|
||||
return
|
||||
else
|
||||
to_chat(H, "<span class=\"warning\">You look directly into The [src.name], but your eyewear does absolutely nothing to protect you from it!</span>")
|
||||
to_chat(M, "<span class='danger'>You look directly into The [src.name] and feel [current_size == STAGE_SUPER ? "helpless" : "weak"].</span>")
|
||||
M.apply_effect(3, STUN)
|
||||
for(var/mob/O in viewers(M, null))
|
||||
O.show_message(text("<span class='danger'>[] stares blankly at The []!</span>", M, src), 1)
|
||||
|
||||
/obj/singularity/proc/emp_area()
|
||||
if(current_size != STAGE_SUPER)
|
||||
empulse(src, 4, 6, 8, 10)
|
||||
else
|
||||
empulse(src, 12, 14, 16, 18)
|
||||
|
||||
/obj/singularity/proc/smwave()
|
||||
for(var/mob/living/M in view(10, src.loc))
|
||||
if(prob(67))
|
||||
to_chat(M, "<span class=\"warning\">You hear an uneartly ringing, then what sounds like a shrilling kettle as you are washed with a wave of heat.</span>")
|
||||
to_chat(M, "<span class=\"notice\">Miraculously, it fails to kill you.</span>")
|
||||
else
|
||||
to_chat(M, "<span class=\"danger\">You hear an uneartly ringing, then what sounds like a shrilling kettle as you are washed with a wave of heat.</span>")
|
||||
to_chat(M, "<span class=\"danger\">You don't even have a moment to react as you are reduced to ashes by the intense radiation.</span>")
|
||||
M.dust()
|
||||
SSradiation.radiate(src, rand(energy))
|
||||
return
|
||||
|
||||
/obj/singularity/proc/pulse()
|
||||
for(var/obj/machinery/power/rad_collector/R in rad_collectors)
|
||||
if (get_dist(R, src) <= 15) //Better than using orange() every process.
|
||||
R.receive_pulse(energy)
|
||||
|
||||
/obj/singularity/proc/on_capture()
|
||||
chained = 1
|
||||
overlays = 0
|
||||
move_self = 0
|
||||
switch (current_size)
|
||||
if(STAGE_ONE)
|
||||
add_overlay(image('icons/obj/singularity.dmi',"chain_s1"))
|
||||
if(STAGE_TWO)
|
||||
add_overlay(image('icons/effects/96x96.dmi',"chain_s3"))
|
||||
if(STAGE_THREE)
|
||||
add_overlay(image('icons/effects/160x160.dmi',"chain_s5"))
|
||||
if(STAGE_FOUR)
|
||||
add_overlay(image('icons/effects/224x224.dmi',"chain_s7"))
|
||||
if(STAGE_FIVE)
|
||||
add_overlay(image('icons/effects/288x288.dmi',"chain_s9"))
|
||||
|
||||
/obj/singularity/proc/on_release()
|
||||
chained = 0
|
||||
overlays = 0
|
||||
move_self = 1
|
||||
|
||||
/obj/singularity/singularity_act(S, size)
|
||||
if(current_size <= size)
|
||||
var/gain = (energy/2)
|
||||
var/dist = max((current_size - 2), 1)
|
||||
explosion(src.loc,(dist),(dist*2),(dist*4))
|
||||
spawn(0)
|
||||
qdel(src)
|
||||
return gain
|
||||
|
||||
Reference in New Issue
Block a user