mirror of
https://github.com/Aurorastation/Aurora-Old.git
synced 2026-08-22 20:26:17 +01:00
Initial Commit
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
//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 plasma to produce power."
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
icon_state = "ca"
|
||||
anchored = 0
|
||||
density = 1
|
||||
directwired = 1
|
||||
req_access = list(access_engine_equip)
|
||||
// use_power = 0
|
||||
var/obj/item/weapon/tank/plasma/P = null
|
||||
var/last_power = 0
|
||||
var/active = 0
|
||||
var/locked = 0
|
||||
var/drainratio = 1
|
||||
|
||||
/obj/machinery/power/rad_collector/New()
|
||||
..()
|
||||
rad_collectors += src
|
||||
|
||||
/obj/machinery/power/rad_collector/Del()
|
||||
rad_collectors -= src
|
||||
..()
|
||||
|
||||
/obj/machinery/power/rad_collector/process()
|
||||
if(P)
|
||||
if(P.air_contents.toxins <= 0)
|
||||
investigate_log("<font color='red'>out of fuel</font>.","singulo")
|
||||
P.air_contents.toxins = 0
|
||||
eject()
|
||||
else
|
||||
P.air_contents.adjust(tx = -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.toxins/0.29)]%":"<font color='red'>It is empty</font>"].","singulo")
|
||||
return
|
||||
else
|
||||
user << "\red The controls are locked!"
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
/obj/machinery/power/rad_collector/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/device/analyzer))
|
||||
user << "\blue The [W.name] detects that [last_power]W were recently produced."
|
||||
return 1
|
||||
else if(istype(W, /obj/item/weapon/tank/plasma))
|
||||
if(!src.anchored)
|
||||
user << "\red The [src] needs to be secured to the floor first."
|
||||
return 1
|
||||
if(src.P)
|
||||
user << "\red There's already a plasma tank loaded."
|
||||
return 1
|
||||
user.drop_item()
|
||||
src.P = W
|
||||
W.loc = src
|
||||
update_icons()
|
||||
else if(istype(W, /obj/item/weapon/crowbar))
|
||||
if(P && !src.locked)
|
||||
eject()
|
||||
return 1
|
||||
else if(istype(W, /obj/item/weapon/wrench))
|
||||
if(P)
|
||||
user << "\blue Remove the plasma tank first."
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 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()
|
||||
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
|
||||
user << "The controls are now [src.locked ? "locked." : "unlocked."]"
|
||||
else
|
||||
src.locked = 0 //just in case it somehow gets locked
|
||||
user << "\red The controls can only be locked when the [src] is active"
|
||||
else
|
||||
user << "\red Access denied!"
|
||||
return 1
|
||||
else
|
||||
..()
|
||||
return 1
|
||||
|
||||
|
||||
/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/plasma/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.toxins*pulse_strength*20
|
||||
add_avail(power_produced)
|
||||
last_power = power_produced
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/rad_collector/proc/update_icons()
|
||||
overlays.Cut()
|
||||
if(P)
|
||||
overlays += image('icons/obj/singularity.dmi', "ptank")
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if(active)
|
||||
overlays += image('icons/obj/singularity.dmi', "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
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
//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/singularity.dmi'
|
||||
icon_state = "Contain_F"
|
||||
anchored = 1
|
||||
density = 0
|
||||
unacidable = 1
|
||||
use_power = 0
|
||||
luminosity = 4
|
||||
var/obj/machinery/field_generator/FG1 = null
|
||||
var/obj/machinery/field_generator/FG2 = null
|
||||
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/Del()
|
||||
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/blob_act()
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/containment_field/ex_act(severity)
|
||||
return 0
|
||||
|
||||
/obj/machinery/containment_field/meteorhit()
|
||||
return 0
|
||||
|
||||
/obj/machinery/containment_field/HasProximity(atom/movable/AM as mob|obj)
|
||||
if(istype(AM,/mob/living/silicon) && prob(40))
|
||||
shock(AM)
|
||||
return 1
|
||||
if(istype(AM,/mob/living/carbon) && prob(50))
|
||||
shock(AM)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
/obj/machinery/containment_field/proc/shock(mob/living/user as mob)
|
||||
if(hasShocked)
|
||||
return 0
|
||||
if(!FG1 || !FG2)
|
||||
del(src)
|
||||
return 0
|
||||
if(iscarbon(user))
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(5, 1, user.loc)
|
||||
s.start()
|
||||
|
||||
hasShocked = 1
|
||||
var/shock_damage = min(rand(30,40),rand(30,40))
|
||||
user.burn_skin(shock_damage)
|
||||
user.updatehealth()
|
||||
user.visible_message("\red [user.name] was shocked by the [src.name]!", \
|
||||
"\red <B>You feel a powerful shock course through your body sending you flying!</B>", \
|
||||
"\red You hear a heavy electrical crack")
|
||||
|
||||
var/stun = min(shock_damage, 15)
|
||||
user.Stun(stun)
|
||||
user.Weaken(10)
|
||||
|
||||
user.updatehealth()
|
||||
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
|
||||
return
|
||||
|
||||
else if(issilicon(user))
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(5, 1, user.loc)
|
||||
s.start()
|
||||
|
||||
hasShocked = 1
|
||||
var/shock_damage = rand(15,30)
|
||||
user.take_overall_damage(0,shock_damage)
|
||||
user.visible_message("\red [user.name] was shocked by the [src.name]!", \
|
||||
"\red <B>Energy pulse detected, system damaged!</B>", \
|
||||
"\red You hear an electrical crack")
|
||||
if(prob(20))
|
||||
user.Stun(2)
|
||||
|
||||
sleep(20)
|
||||
hasShocked = 0
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/containment_field/proc/set_master(var/master1,var/master2)
|
||||
if(!master1 || !master2)
|
||||
return 0
|
||||
FG1 = master1
|
||||
FG2 = master2
|
||||
return 1
|
||||
@@ -0,0 +1,233 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
/obj/machinery/power/emitter
|
||||
name = "Emitter"
|
||||
desc = "A heavy duty industrial laser"
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
icon_state = "emitter"
|
||||
anchored = 0
|
||||
density = 1
|
||||
req_access = list(access_engine_equip)
|
||||
|
||||
use_power = 0
|
||||
idle_power_usage = 10
|
||||
active_power_usage = 300
|
||||
|
||||
var/active = 0
|
||||
var/powered = 0
|
||||
var/fire_delay = 100
|
||||
var/last_shot = 0
|
||||
var/shot_number = 0
|
||||
var/state = 0
|
||||
var/locked = 0
|
||||
|
||||
|
||||
/obj/machinery/power/emitter/verb/rotate()
|
||||
set name = "Rotate"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
usr << "It is fastened to the floor!"
|
||||
return 0
|
||||
src.dir = turn(src.dir, 90)
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/emitter/initialize()
|
||||
..()
|
||||
if(state == 2 && anchored)
|
||||
connect_to_network()
|
||||
src.directwired = 1
|
||||
|
||||
/obj/machinery/power/emitter/Del()
|
||||
message_admins("Emitter deleted at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
log_game("Emitter deleted at ([x],[y],[z])")
|
||||
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)
|
||||
if(state == 2)
|
||||
if(!powernet)
|
||||
user << "The emitter isn't connected to a wire."
|
||||
return 1
|
||||
if(!src.locked)
|
||||
if(src.active==1)
|
||||
src.active = 0
|
||||
user << "You turn off the [src]."
|
||||
message_admins("Emitter turned off by [key_name(user, user.client)](<A HREF='?_src_=holder;adminmoreinfo=\ref[user]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
log_game("Emitter turned off by [user.ckey]([user]) in ([x],[y],[z])")
|
||||
investigate_log("turned <font color='red'>off</font> by [user.key]","singulo")
|
||||
else
|
||||
src.active = 1
|
||||
user << "You turn on the [src]."
|
||||
src.shot_number = 0
|
||||
src.fire_delay = 100
|
||||
message_admins("Emitter turned on by [key_name(user, user.client)](<A HREF='?_src_=holder;adminmoreinfo=\ref[user]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
log_game("Emitter turned on by [user.ckey]([user]) in ([x],[y],[z])")
|
||||
investigate_log("turned <font color='green'>on</font> by [user.key]","singulo")
|
||||
update_icon()
|
||||
else
|
||||
user << "\red The controls are locked!"
|
||||
else
|
||||
user << "\red The [src] needs to be firmly secured to the floor first."
|
||||
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/containment_field/meteorhit()
|
||||
return 0
|
||||
|
||||
/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))
|
||||
|
||||
if(!active_power_usage || avail(active_power_usage))
|
||||
add_load(active_power_usage)
|
||||
if(!powered)
|
||||
powered = 1
|
||||
update_icon()
|
||||
investigate_log("regained power and turned <font color='green'>on</font>","singulo")
|
||||
else
|
||||
if(powered)
|
||||
powered = 0
|
||||
update_icon()
|
||||
investigate_log("lost power and turned <font color='red'>off</font>","singulo")
|
||||
return
|
||||
|
||||
src.last_shot = world.time
|
||||
if(src.shot_number < 3)
|
||||
src.fire_delay = 2
|
||||
src.shot_number ++
|
||||
else
|
||||
src.fire_delay = rand(20,100)
|
||||
src.shot_number = 0
|
||||
var/obj/item/projectile/beam/emitter/A = new /obj/item/projectile/beam/emitter( src.loc )
|
||||
playsound(src.loc, '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()
|
||||
A.dir = src.dir
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
A.yo = 20
|
||||
A.xo = 0
|
||||
if(EAST)
|
||||
A.yo = 0
|
||||
A.xo = 20
|
||||
if(WEST)
|
||||
A.yo = 0
|
||||
A.xo = -20
|
||||
else // Any other
|
||||
A.yo = -20
|
||||
A.xo = 0
|
||||
A.process() //TODO: Carn: check this out
|
||||
|
||||
|
||||
/obj/machinery/power/emitter/attackby(obj/item/W, mob/user)
|
||||
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
if(active)
|
||||
user << "Turn off the [src] first."
|
||||
return
|
||||
switch(state)
|
||||
if(0)
|
||||
state = 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
user.visible_message("[user.name] secures [src.name] to the floor.", \
|
||||
"You secure the external reinforcing bolts to the floor.", \
|
||||
"You hear a ratchet")
|
||||
src.anchored = 1
|
||||
if(1)
|
||||
state = 0
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
user.visible_message("[user.name] unsecures [src.name] reinforcing bolts from the floor.", \
|
||||
"You undo the external reinforcing bolts.", \
|
||||
"You hear a ratchet")
|
||||
src.anchored = 0
|
||||
if(2)
|
||||
user << "\red The [src.name] needs to be unwelded from the floor."
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/weldingtool))
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if(active)
|
||||
user << "Turn off the [src] first."
|
||||
return
|
||||
switch(state)
|
||||
if(0)
|
||||
user << "\red The [src.name] needs to be wrenched to the floor."
|
||||
if(1)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src.loc, 'sound/items/Welder2.ogg', 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))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 2
|
||||
user << "You weld the [src] to the floor."
|
||||
connect_to_network()
|
||||
src.directwired = 1
|
||||
else
|
||||
user << "\red You need more welding fuel to complete this task."
|
||||
if(2)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src.loc, 'sound/items/Welder2.ogg', 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))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 1
|
||||
user << "You cut the [src] free from the floor."
|
||||
disconnect_from_network()
|
||||
src.directwired = 0
|
||||
else
|
||||
user << "\red You need more welding fuel to complete this task."
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda))
|
||||
if(emagged)
|
||||
user << "\red The lock seems to be broken"
|
||||
return
|
||||
if(src.allowed(user))
|
||||
if(active)
|
||||
src.locked = !src.locked
|
||||
user << "The controls are now [src.locked ? "locked." : "unlocked."]"
|
||||
else
|
||||
src.locked = 0 //just in case it somehow gets locked
|
||||
user << "\red The controls can only be locked when the [src] is online"
|
||||
else
|
||||
user << "\red Access denied."
|
||||
return
|
||||
|
||||
|
||||
if(istype(W, /obj/item/weapon/card/emag) && !emagged)
|
||||
locked = 0
|
||||
emagged = 1
|
||||
user.visible_message("[user.name] emags the [src.name].","\red You short out the lock.")
|
||||
return
|
||||
|
||||
..()
|
||||
return
|
||||
@@ -0,0 +1,355 @@
|
||||
//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 250
|
||||
/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 = 0
|
||||
density = 1
|
||||
use_power = 0
|
||||
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 = 20 // 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
|
||||
|
||||
|
||||
/obj/machinery/field_generator/update_icon()
|
||||
overlays.Cut()
|
||||
if(!active)
|
||||
if(warming_up)
|
||||
overlays += "+a[warming_up]"
|
||||
if(fields.len)
|
||||
overlays += "+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)
|
||||
overlays += "+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 = 1
|
||||
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)
|
||||
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()
|
||||
investigate_log("<font color='green'>activated</font> by [user.key].","singulo")
|
||||
|
||||
src.add_fingerprint(user)
|
||||
else
|
||||
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)
|
||||
user << "The [src] needs to be off."
|
||||
return
|
||||
else if(istype(W, /obj/item/weapon/wrench))
|
||||
switch(state)
|
||||
if(0)
|
||||
state = 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 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 = 1
|
||||
if(1)
|
||||
state = 0
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 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 = 0
|
||||
if(2)
|
||||
user << "\red The [src.name] needs to be unwelded from the floor."
|
||||
return
|
||||
else if(istype(W, /obj/item/weapon/weldingtool))
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
switch(state)
|
||||
if(0)
|
||||
user << "\red The [src.name] needs to be wrenched to the floor."
|
||||
return
|
||||
if(1)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src.loc, 'sound/items/Welder2.ogg', 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))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 2
|
||||
user << "You weld the field generator to the floor."
|
||||
else
|
||||
return
|
||||
if(2)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src.loc, 'sound/items/Welder2.ogg', 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))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 1
|
||||
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/blob_act()
|
||||
if(active)
|
||||
return 0
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/machinery/containment_field/meteorhit()
|
||||
return 0
|
||||
|
||||
/obj/machinery/field_generator/bullet_act(var/obj/item/projectile/Proj)
|
||||
if(Proj.flag != "bullet")
|
||||
power += Proj.damage
|
||||
update_icon()
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/field_generator/Del()
|
||||
src.cleanup()
|
||||
..()
|
||||
|
||||
|
||||
|
||||
/obj/machinery/field_generator/proc/turn_off()
|
||||
active = 0
|
||||
spawn(1)
|
||||
src.cleanup()
|
||||
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()
|
||||
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 = 2
|
||||
for (var/obj/machinery/containment_field/F in fields)
|
||||
if (isnull(F))
|
||||
continue
|
||||
power_draw++
|
||||
if(draw_power(round(power_draw/2,1)))
|
||||
return 1
|
||||
else
|
||||
for(var/mob/M in viewers(src))
|
||||
M.show_message("\red The [src.name] shuts down!")
|
||||
turn_off()
|
||||
investigate_log("ran out of power and <font color='red'>deactivated</font>","singulo")
|
||||
src.power = 0
|
||||
return 0
|
||||
|
||||
//This could likely be better, it tends to start loopin if you have a complex generator loop setup. Still works well enough to run the engine fields will likely recode the field gens and fields sometime -Mport
|
||||
/obj/machinery/field_generator/proc/draw_power(var/draw = 0, var/failsafe = 0, var/obj/machinery/field_generator/G = null, var/obj/machinery/field_generator/last = null)
|
||||
if(Varpower)
|
||||
return 1
|
||||
if((G && G == src) || (failsafe >= 8))//Loopin, set fail
|
||||
return 0
|
||||
else
|
||||
failsafe++
|
||||
if(src.power >= draw)//We have enough power
|
||||
src.power -= draw
|
||||
return 1
|
||||
else//Need more power
|
||||
draw -= src.power
|
||||
src.power = 0
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
if(isnull(FG))
|
||||
continue
|
||||
if(FG == last)//We just asked you
|
||||
continue
|
||||
if(G)//Another gen is askin for power and we dont have it
|
||||
if(FG.draw_power(draw,failsafe,G,src))//Can you take the load
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
else//We are askin another for power
|
||||
if(FG.draw_power(draw,failsafe,src,src))
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
|
||||
/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()
|
||||
CF.set_master(src,G)
|
||||
fields += CF
|
||||
G.fields += CF
|
||||
CF.loc = T
|
||||
CF.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 (isnull(F))
|
||||
continue
|
||||
del(F)
|
||||
fields = list()
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
if (isnull(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/machinery/singularity/O in machines)
|
||||
if(O.last_warning && temp)
|
||||
if((world.time - O.last_warning) > 50) //to stop message-spam
|
||||
temp = 0
|
||||
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")
|
||||
O.last_warning = world.time
|
||||
@@ -0,0 +1,31 @@
|
||||
/////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 = 0
|
||||
density = 1
|
||||
use_power = 0
|
||||
var/energy = 0
|
||||
|
||||
/obj/machinery/the_singularitygen/process()
|
||||
var/turf/T = get_turf(src)
|
||||
if(src.energy >= 200)
|
||||
new /obj/machinery/singularity/(T, 50)
|
||||
if(src) del(src)
|
||||
|
||||
/obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
anchored = !anchored
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 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
|
||||
return ..()
|
||||
@@ -0,0 +1,4 @@
|
||||
/area/engine/engineering/poweralert(var/state, var/source)
|
||||
if (state != poweralm)
|
||||
investigate_log("has a power alarm!","singulo")
|
||||
..()
|
||||
@@ -0,0 +1,107 @@
|
||||
//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 = "particle"//Need a new icon for this
|
||||
anchored = 1
|
||||
density = 1
|
||||
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
|
||||
movement_range = 8
|
||||
energy = 5
|
||||
|
||||
/obj/effect/accelerated_particle/strong
|
||||
movement_range = 15
|
||||
energy = 15
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/New(loc, dir = 2)
|
||||
src.loc = loc
|
||||
src.dir = dir
|
||||
if(movement_range > 20)
|
||||
movement_range = 20
|
||||
spawn(0)
|
||||
move(1)
|
||||
return
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/Bump(atom/A)
|
||||
if (A)
|
||||
if(ismob(A))
|
||||
toxmob(A)
|
||||
if((istype(A,/obj/machinery/the_singularitygen))||(istype(A,/obj/machinery/singularity/)))
|
||||
A:energy += energy
|
||||
else if( istype(A,/obj/effect/rust_particle_catcher) )
|
||||
var/obj/effect/rust_particle_catcher/collided_catcher = A
|
||||
if(particle_type && particle_type != "neutron")
|
||||
if(collided_catcher.AddParticles(particle_type, 1 + additional_particles))
|
||||
collided_catcher.parent.AddEnergy(energy,mega_energy)
|
||||
del (src)
|
||||
else if( istype(A,/obj/machinery/power/rust_core) )
|
||||
var/obj/machinery/power/rust_core/collided_core = A
|
||||
if(particle_type && particle_type != "neutron")
|
||||
if(collided_core.AddParticles(particle_type, 1 + additional_particles))
|
||||
var/energy_loss_ratio = abs(collided_core.owned_field.frequency - frequency) / 1e9
|
||||
collided_core.owned_field.mega_energy += mega_energy - mega_energy * energy_loss_ratio
|
||||
collided_core.owned_field.energy += energy - energy * energy_loss_ratio
|
||||
del (src)
|
||||
return
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/Bumped(atom/A)
|
||||
if(ismob(A))
|
||||
Bump(A)
|
||||
return
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/ex_act(severity)
|
||||
del(src)
|
||||
return
|
||||
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/proc/toxmob(var/mob/living/M)
|
||||
var/radiation = (energy*2)
|
||||
/* if(istype(M,/mob/living/carbon/human))
|
||||
if(M:wear_suit) //TODO: check for radiation protection
|
||||
radiation = round(radiation/2,1)
|
||||
if(istype(M,/mob/living/carbon/monkey))
|
||||
if(M:wear_suit) //TODO: check for radiation protection
|
||||
radiation = round(radiation/2,1)*/
|
||||
M.apply_effect((radiation*3),IRRADIATE,0)
|
||||
M.updatehealth()
|
||||
//M << "\red You feel odd."
|
||||
return
|
||||
|
||||
|
||||
/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)
|
||||
del(src)
|
||||
else
|
||||
sleep(lag)
|
||||
move(lag)
|
||||
@@ -0,0 +1,410 @@
|
||||
//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
|
||||
|
||||
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 = 0
|
||||
density = 1
|
||||
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/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()
|
||||
set name = "Rotate Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
usr << "It is fastened to the floor!"
|
||||
return 0
|
||||
src.dir = turn(src.dir, 270)
|
||||
return 1
|
||||
|
||||
/obj/structure/particle_accelerator/verb/rotateccw()
|
||||
set name = "Rotate Counter Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
usr << "It is fastened to the floor!"
|
||||
return 0
|
||||
src.dir = turn(src.dir, 90)
|
||||
return 1
|
||||
|
||||
/obj/structure/particle_accelerator/examine()
|
||||
switch(src.construction_state)
|
||||
if(0)
|
||||
src.desc = text("A [name], looks like it's not attached to the flooring")
|
||||
if(1)
|
||||
src.desc = text("A [name], it is missing some cables")
|
||||
if(2)
|
||||
src.desc = text("A [name], the panel is open")
|
||||
if(3)
|
||||
src.desc = text("The [name] is assembled")
|
||||
if(powered)
|
||||
src.desc = src.desc_holder
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/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/Move()
|
||||
..()
|
||||
if(master && master.active)
|
||||
master.toggle_power()
|
||||
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)
|
||||
del(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
del(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(25))
|
||||
del(src)
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/blob_act()
|
||||
if(prob(50))
|
||||
del(src)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/meteorhit()
|
||||
if(prob(50))
|
||||
del(src)
|
||||
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/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(iswrench(O))
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
src.anchored = 1
|
||||
user.visible_message("[user.name] secures the [src.name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
temp_state++
|
||||
if(1)
|
||||
if(iswrench(O))
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
src.anchored = 0
|
||||
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
|
||||
"You remove the external bolts.")
|
||||
temp_state--
|
||||
else if(iscoil(O))
|
||||
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(iswirecutter(O))//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(isscrewdriver(O))
|
||||
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
temp_state++
|
||||
if(3)
|
||||
if(isscrewdriver(O))
|
||||
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
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator
|
||||
name = "Particle Accelerator"
|
||||
desc = "Part of a Particle Accelerator."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "none"
|
||||
anchored = 0
|
||||
density = 1
|
||||
use_power = 0
|
||||
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()
|
||||
set name = "Rotate Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
usr << "It is fastened to the floor!"
|
||||
return 0
|
||||
src.dir = turn(src.dir, 270)
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/verb/rotateccw()
|
||||
set name = "Rotate Counter-Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
usr << "It is fastened to the floor!"
|
||||
return 0
|
||||
src.dir = turn(src.dir, 90)
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/update_icon()
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/examine()
|
||||
switch(src.construction_state)
|
||||
if(0)
|
||||
src.desc = text("A [name], looks like it's not attached to the flooring")
|
||||
if(1)
|
||||
src.desc = text("A [name], it is missing some cables")
|
||||
if(2)
|
||||
src.desc = text("A [name], the panel is open")
|
||||
if(3)
|
||||
src.desc = text("The [name] is assembled")
|
||||
if(powered)
|
||||
src.desc = src.desc_holder
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/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)
|
||||
del(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
del(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(25))
|
||||
del(src)
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/blob_act()
|
||||
if(prob(50))
|
||||
del(src)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/meteorhit()
|
||||
if(prob(50))
|
||||
del(src)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/proc/update_state()
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/proc/process_tool_hit(var/obj/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(iswrench(O))
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
src.anchored = 1
|
||||
user.visible_message("[user.name] secures the [src.name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
temp_state++
|
||||
if(1)
|
||||
if(iswrench(O))
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
src.anchored = 0
|
||||
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
|
||||
"You remove the external bolts.")
|
||||
temp_state--
|
||||
else if(iscoil(O))
|
||||
if(O:use(1))
|
||||
user.visible_message("[user.name] adds wires to the [src.name].", \
|
||||
"You add some wires.")
|
||||
temp_state++
|
||||
if(2)
|
||||
if(iswirecutter(O))//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(isscrewdriver(O))
|
||||
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
temp_state++
|
||||
if(3)
|
||||
if(isscrewdriver(O))
|
||||
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)
|
||||
use_power = 0
|
||||
src.construction_state = temp_state
|
||||
if(src.construction_state >= 3)
|
||||
use_power = 1
|
||||
update_icon()
|
||||
return 1
|
||||
return 0
|
||||
@@ -0,0 +1,10 @@
|
||||
/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"
|
||||
|
||||
/obj/structure/particle_accelerator/fuel_chamber/update_icon()
|
||||
..()
|
||||
return
|
||||
@@ -0,0 +1,233 @@
|
||||
//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_accelerator2.dmi'
|
||||
icon_state = "control_box"
|
||||
reference = "control_box"
|
||||
anchored = 0
|
||||
density = 1
|
||||
use_power = 0
|
||||
idle_power_usage = 500
|
||||
active_power_usage = 10000
|
||||
construction_state = 0
|
||||
active = 0
|
||||
dir = 1
|
||||
var/list/obj/structure/particle_accelerator/connected_parts
|
||||
var/assembled = 0
|
||||
var/parts = null
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/New()
|
||||
connected_parts = list()
|
||||
..()
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/attack_hand(mob/user as mob)
|
||||
if(construction_state >= 3)
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_state()
|
||||
if(construction_state < 3)
|
||||
use_power = 0
|
||||
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())
|
||||
use_power = 1
|
||||
active = 0
|
||||
connected_parts = list()
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_icon()
|
||||
if(active)
|
||||
icon_state = "[reference]p1"
|
||||
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"
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Topic(href, href_list)
|
||||
..()
|
||||
//Ignore input if we are broken, !silicon guy cant touch us, or nonai controlling from super far away
|
||||
if(stat & (BROKEN|NOPOWER) || (get_dist(src, usr) > 1 && !istype(usr, /mob/living/silicon)) || (get_dist(src, usr) > 8 && !istype(usr, /mob/living/silicon/ai)))
|
||||
usr.unset_machine()
|
||||
usr << browse(null, "window=pacontrol")
|
||||
return
|
||||
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=pacontrol")
|
||||
usr.unset_machine()
|
||||
return
|
||||
if(href_list["togglep"])
|
||||
src.toggle_power()
|
||||
investigate_log("turned [active?"<font color='red'>ON</font>":"<font color='green'>OFF</font>"] by [usr.key]","singulo")
|
||||
if (active)
|
||||
message_admins("PA Control Computer turned ON by [key_name(usr, usr.client)](<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
log_game("PA Control Computer turned ON by [usr.ckey]([usr]) in ([x],[y],[z])")
|
||||
else if(href_list["scan"])
|
||||
src.part_scan()
|
||||
else if(href_list["strengthup"])
|
||||
strength++
|
||||
if(strength > 2)
|
||||
strength = 2
|
||||
else
|
||||
message_admins("PA Control Computer increased to [strength] by [key_name(usr, usr.client)](<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
log_game("PA Control Computer increased to [strength] by [usr.ckey]([usr]) in ([x],[y],[z])")
|
||||
investigate_log("increased to <font color='red'>[strength]</font> by [usr.key]","singulo")
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = strength
|
||||
part.update_icon()
|
||||
|
||||
else if(href_list["strengthdown"])
|
||||
strength--
|
||||
if(strength < 0)
|
||||
strength = 0
|
||||
else
|
||||
investigate_log("decreased to <font color='green'>[strength]</font> by [usr.key]","singulo")
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = strength
|
||||
part.update_icon()
|
||||
src.updateDialog()
|
||||
src.update_icon()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/power_change()
|
||||
..()
|
||||
if(stat & NOPOWER)
|
||||
active = 0
|
||||
use_power = 0
|
||||
else if(!stat && construction_state == 3)
|
||||
use_power = 1
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/process()
|
||||
if(src.active)
|
||||
//a part is missing!
|
||||
if( length(connected_parts) < 6 )
|
||||
investigate_log("lost a connected part; It <font color='red'>powered down</font>.","singulo")
|
||||
src.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)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/part_scan()
|
||||
for(var/obj/structure/particle_accelerator/fuel_chamber/F in orange(1,src))
|
||||
src.dir = F.dir
|
||||
connected_parts = list()
|
||||
var/tally = 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,rdir)
|
||||
if(check_part(T,/obj/structure/particle_accelerator/fuel_chamber))
|
||||
tally++
|
||||
T = get_step(T,odir)
|
||||
if(check_part(T,/obj/structure/particle_accelerator/end_cap))
|
||||
tally++
|
||||
T = get_step(T,dir)
|
||||
T = get_step(T,dir)
|
||||
if(check_part(T,/obj/structure/particle_accelerator/power_box))
|
||||
tally++
|
||||
T = get_step(T,dir)
|
||||
if(check_part(T,/obj/structure/particle_accelerator/particle_emitter/center))
|
||||
tally++
|
||||
T = get_step(T,ldir)
|
||||
if(check_part(T,/obj/structure/particle_accelerator/particle_emitter/left))
|
||||
tally++
|
||||
T = get_step(T,rdir)
|
||||
T = get_step(T,rdir)
|
||||
if(check_part(T,/obj/structure/particle_accelerator/particle_emitter/right))
|
||||
tally++
|
||||
if(tally >= 6)
|
||||
assembled = 1
|
||||
return 1
|
||||
else
|
||||
assembled = 0
|
||||
return 0
|
||||
|
||||
|
||||
/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))
|
||||
if(PA.connect_master(src))
|
||||
if(PA.report_ready(src))
|
||||
src.connected_parts.Add(PA)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/toggle_power()
|
||||
src.active = !src.active
|
||||
if(src.active)
|
||||
src.use_power = 2
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = src.strength
|
||||
part.powered = 1
|
||||
part.update_icon()
|
||||
else
|
||||
src.use_power = 1
|
||||
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/interact(mob/user)
|
||||
if((get_dist(src, user) > 1) || (stat & (BROKEN|NOPOWER)))
|
||||
if(!istype(user, /mob/living/silicon))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=pacontrol")
|
||||
return
|
||||
user.set_machine(src)
|
||||
|
||||
var/dat = ""
|
||||
dat += "Particle Accelerator Control Panel<BR>"
|
||||
dat += "<A href='?src=\ref[src];close=1'>Close</A><BR><BR>"
|
||||
dat += "Status:<BR>"
|
||||
if(!assembled)
|
||||
dat += "Unable to detect all parts!<BR>"
|
||||
dat += "<A href='?src=\ref[src];scan=1'>Run Scan</A><BR><BR>"
|
||||
else
|
||||
dat += "All parts in place.<BR><BR>"
|
||||
dat += "Power:"
|
||||
if(active)
|
||||
dat += "On<BR>"
|
||||
else
|
||||
dat += "Off <BR>"
|
||||
dat += "<A href='?src=\ref[src];togglep=1'>Toggle Power</A><BR><BR>"
|
||||
dat += "Particle Strength: [src.strength] "
|
||||
dat += "<A href='?src=\ref[src];strengthdown=1'>--</A>|<A href='?src=\ref[src];strengthup=1'>++</A><BR><BR>"
|
||||
|
||||
user << browse(dat, "window=pacontrol;size=420x500")
|
||||
onclose(user, "pacontrol")
|
||||
return
|
||||
@@ -0,0 +1,49 @@
|
||||
//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/left
|
||||
icon_state = "emitter_left"
|
||||
reference = "emitter_left"
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/right
|
||||
icon_state = "emitter_right"
|
||||
reference = "emitter_right"
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/update_icon()
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/proc/set_delay(var/delay)
|
||||
if(delay && delay >= 0)
|
||||
src.fire_delay = delay
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/proc/emit_particle(var/strength = 0)
|
||||
if((src.last_shot + src.fire_delay) <= world.time)
|
||||
src.last_shot = world.time
|
||||
var/obj/effect/accelerated_particle/A = null
|
||||
var/turf/T = get_step(src,dir)
|
||||
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(A)
|
||||
A.dir = src.dir
|
||||
return 1
|
||||
return 0
|
||||
@@ -0,0 +1,10 @@
|
||||
/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"
|
||||
|
||||
/obj/structure/particle_accelerator/power_box/update_icon()
|
||||
..()
|
||||
return
|
||||
@@ -0,0 +1,570 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
var/global/list/uneatable = list(
|
||||
/turf/space,
|
||||
/obj/effect/overlay
|
||||
)
|
||||
|
||||
/obj/machinery/singularity/
|
||||
name = "Gravitational Singularity"
|
||||
desc = "A Gravitational Singularity."
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
icon_state = "singularity_s1"
|
||||
anchored = 1
|
||||
density = 1
|
||||
layer = 6
|
||||
luminosity = 6
|
||||
unacidable = 1 //Don't comment this out.
|
||||
use_power = 0
|
||||
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/teleport_del = 0
|
||||
var/last_warning
|
||||
|
||||
/obj/machinery/singularity/New(loc, var/starting_energy = 50, var/temp = 0)
|
||||
//CARN: admin-alert for chuckle-fuckery.
|
||||
admin_investigate_setup()
|
||||
|
||||
src.energy = starting_energy
|
||||
if(temp)
|
||||
spawn(temp)
|
||||
del(src)
|
||||
..()
|
||||
for(var/obj/machinery/singularity_beacon/singubeacon in machines)
|
||||
if(singubeacon.active)
|
||||
target = singubeacon
|
||||
break
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/singularity/attack_hand(mob/user as mob)
|
||||
consume(user)
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/singularity/blob_act(severity)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/singularity/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
if(prob(25))
|
||||
del(src)
|
||||
return
|
||||
else
|
||||
energy += 50
|
||||
if(2.0 to 3.0)
|
||||
energy += round((rand(20,60)/2),1)
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/singularity/Bump(atom/A)
|
||||
consume(A)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/singularity/Bumped(atom/A)
|
||||
consume(A)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/singularity/process()
|
||||
eat()
|
||||
dissipate()
|
||||
check_energy()
|
||||
|
||||
if(current_size >= 3)
|
||||
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()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/singularity/attack_ai() //to prevent ais from gibbing themselves when they click on one.
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/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])",1)
|
||||
investigate_log("was created. [count?"":"<font color='red'>No containment fields were active</font>"]","singulo")
|
||||
|
||||
/obj/machinery/singularity/proc/dissipate()
|
||||
if(!dissipate)
|
||||
return
|
||||
if(dissipate_track >= dissipate_delay)
|
||||
src.energy -= dissipate_strength
|
||||
dissipate_track = 0
|
||||
else
|
||||
dissipate_track++
|
||||
|
||||
|
||||
/obj/machinery/singularity/proc/expand(var/force_size = 0)
|
||||
var/temp_allowed_size = src.allowed_size
|
||||
if(force_size)
|
||||
temp_allowed_size = force_size
|
||||
switch(temp_allowed_size)
|
||||
if(1)
|
||||
current_size = 1
|
||||
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
|
||||
if(3)//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
|
||||
current_size = 3
|
||||
icon = 'icons/effects/96x96.dmi'
|
||||
icon_state = "singularity_s3"
|
||||
pixel_x = -32
|
||||
pixel_y = -32
|
||||
grav_pull = 6
|
||||
consume_range = 1
|
||||
dissipate_delay = 5
|
||||
dissipate_track = 0
|
||||
dissipate_strength = 5
|
||||
if(5)
|
||||
if((check_turfs_in(1,2))&&(check_turfs_in(2,2))&&(check_turfs_in(4,2))&&(check_turfs_in(8,2)))
|
||||
current_size = 5
|
||||
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
|
||||
if(7)
|
||||
if((check_turfs_in(1,3))&&(check_turfs_in(2,3))&&(check_turfs_in(4,3))&&(check_turfs_in(8,3)))
|
||||
current_size = 7
|
||||
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 = 10
|
||||
if(9)//this one also lacks a check for gens because it eats everything
|
||||
current_size = 9
|
||||
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
|
||||
if(current_size == allowed_size)
|
||||
investigate_log("<font color='red'>grew to size [current_size]</font>","singulo")
|
||||
return 1
|
||||
else if(current_size < (--temp_allowed_size))
|
||||
expand(temp_allowed_size)
|
||||
else
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/singularity/proc/check_energy()
|
||||
if(energy <= 0)
|
||||
del(src)
|
||||
return 0
|
||||
switch(energy)//Some of these numbers might need to be changed up later -Mport
|
||||
if(1 to 199)
|
||||
allowed_size = 1
|
||||
if(200 to 499)
|
||||
allowed_size = 3
|
||||
if(500 to 999)
|
||||
allowed_size = 5
|
||||
if(1000 to 1999)
|
||||
allowed_size = 7
|
||||
if(2000 to INFINITY)
|
||||
allowed_size = 9
|
||||
if(current_size != allowed_size)
|
||||
expand()
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/singularity/proc/eat()
|
||||
set background = 1
|
||||
if(defer_powernet_rebuild != 2)
|
||||
defer_powernet_rebuild = 1
|
||||
// Let's just make this one loop.
|
||||
for(var/atom/X in orange(grav_pull,src))
|
||||
var/dist = get_dist(X, src)
|
||||
// Movable atoms only
|
||||
if(dist > consume_range && istype(X, /atom/movable))
|
||||
if(is_type_in_list(X, uneatable)) continue
|
||||
if(((X) &&(!X:anchored) && (!istype(X,/mob/living/carbon/human)))|| (src.current_size >= 9))
|
||||
step_towards(X,src)
|
||||
else if(istype(X,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = X
|
||||
if(istype(H.shoes,/obj/item/clothing/shoes/magboots))
|
||||
var/obj/item/clothing/shoes/magboots/M = H.shoes
|
||||
if(M.magpulse)
|
||||
continue
|
||||
step_towards(H,src)
|
||||
// Turf and movable atoms
|
||||
else if(dist <= consume_range && (isturf(X) || istype(X, /atom/movable)))
|
||||
consume(X)
|
||||
|
||||
if(defer_powernet_rebuild != 2)
|
||||
defer_powernet_rebuild = 0
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/singularity/proc/consume(var/atom/A)
|
||||
var/gain = 0
|
||||
if(is_type_in_list(A, uneatable))
|
||||
return 0
|
||||
if (istype(A,/mob/living))//Mobs get gibbed
|
||||
gain = 20
|
||||
if(istype(A,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = A
|
||||
if(H.mind)
|
||||
|
||||
if((H.mind.assigned_role == "Station Engineer") || (H.mind.assigned_role == "Chief Engineer") )
|
||||
gain = 100
|
||||
|
||||
if(H.mind.assigned_role == "Clown")
|
||||
gain = rand(-300, 300) // HONK
|
||||
|
||||
spawn()
|
||||
A:gib()
|
||||
sleep(1)
|
||||
else if(istype(A,/obj/))
|
||||
|
||||
if (istype(A,/obj/item/weapon/storage/backpack/holding))
|
||||
var/dist = max((current_size - 2),1)
|
||||
explosion(src.loc,(dist),(dist*2),(dist*4))
|
||||
return
|
||||
|
||||
if(istype(A, /obj/machinery/singularity))//Welp now you did it
|
||||
var/obj/machinery/singularity/S = A
|
||||
src.energy += (S.energy/2)//Absorb most of it
|
||||
del(S)
|
||||
var/dist = max((current_size - 2),1)
|
||||
explosion(src.loc,(dist),(dist*2),(dist*4))
|
||||
return//Quits here, the obj should be gone, hell we might be
|
||||
|
||||
if((teleport_del) && (!istype(A, /obj/machinery)))//Going to see if it does not lag less to tele items over to Z 2
|
||||
var/obj/O = A
|
||||
O.x = 2
|
||||
O.y = 2
|
||||
O.z = 2
|
||||
else
|
||||
A.ex_act(1.0)
|
||||
if(A) del(A)
|
||||
gain = 2
|
||||
else if(isturf(A))
|
||||
var/turf/T = A
|
||||
if(T.intact)
|
||||
for(var/obj/O in T.contents)
|
||||
if(O.level != 1)
|
||||
continue
|
||||
if(O.invisibility == 101)
|
||||
src.consume(O)
|
||||
T.ChangeTurf(/turf/space)
|
||||
gain = 2
|
||||
src.energy += gain
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/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 >= 9)//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/machinery/singularity/proc/check_turfs_in(var/direction = 0, var/step = 0)
|
||||
if(!direction)
|
||||
return 0
|
||||
var/steps = 0
|
||||
if(!step)
|
||||
switch(current_size)
|
||||
if(1)
|
||||
steps = 1
|
||||
if(3)
|
||||
steps = 3//Yes this is right
|
||||
if(5)
|
||||
steps = 3
|
||||
if(7)
|
||||
steps = 4
|
||||
if(9)
|
||||
steps = 5
|
||||
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/machinery/singularity/proc/can_move(var/turf/T)
|
||||
if(!T)
|
||||
return 0
|
||||
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/machinery/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
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/singularity/proc/toxmob()
|
||||
var/toxrange = 10
|
||||
var/toxdamage = 4
|
||||
var/radiation = 15
|
||||
var/radiationmin = 3
|
||||
if (src.energy>200)
|
||||
toxdamage = round(((src.energy-150)/50)*4,1)
|
||||
radiation = round(((src.energy-150)/50)*5,1)
|
||||
radiationmin = round((radiation/5),1)//
|
||||
for(var/mob/living/M in view(toxrange, src.loc))
|
||||
M.apply_effect(rand(radiationmin,radiation), IRRADIATE)
|
||||
toxdamage = (toxdamage - (toxdamage*M.getarmor(null, "rad")))
|
||||
M.apply_effect(toxdamage, TOX)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/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.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))
|
||||
H << "\blue You look directly into The [src.name], good thing you had your protective eyewear on!"
|
||||
return
|
||||
M << "\red You look directly into The [src.name] and feel weak."
|
||||
M.apply_effect(3, STUN)
|
||||
for(var/mob/O in viewers(M, null))
|
||||
O.show_message(text("\red <B>[] stares blankly at The []!</B>", M, src), 1)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/singularity/proc/emp_area()
|
||||
empulse(src, 8, 10)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/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)
|
||||
return
|
||||
|
||||
|
||||
|
||||
/obj/machinery/singularity/narsie //Moving narsie to a child object of the singularity so it can be made to function differently. --NEO
|
||||
name = "Nar-Sie"
|
||||
desc = "Your mind begins to bubble and ooze as it tries to comprehend what it sees."
|
||||
icon = 'icons/obj/magic_terror.dmi'
|
||||
pixel_x = -89
|
||||
pixel_y = -85
|
||||
current_size = 9 //It moves/eats like a max-size singulo, aside from range. --NEO
|
||||
contained = 0 //Are we going to move around?
|
||||
dissipate = 0 //Do we lose energy over time?
|
||||
move_self = 1 //Do we move on our own?
|
||||
grav_pull = 10 //How many tiles out do we pull?
|
||||
consume_range = 3 //How many tiles out do we eat
|
||||
|
||||
/obj/machinery/singularity/narsie/large
|
||||
name = "Nar-Sie"
|
||||
icon = 'icons/obj/narsie.dmi'
|
||||
// Pixel stuff centers Narsie.
|
||||
pixel_x = -236
|
||||
pixel_y = -256
|
||||
current_size = 12
|
||||
move_self = 1 //Do we move on our own?
|
||||
consume_range = 12 //How many tiles out do we eat
|
||||
|
||||
/obj/machinery/singularity/narsie/large/New()
|
||||
..()
|
||||
world << "<font size='28' color='red'><b>NAR-SIE HAS RISEN</b></font>"
|
||||
if(emergency_shuttle)
|
||||
emergency_shuttle.incall(0.5) // Cannot recall
|
||||
|
||||
/obj/machinery/singularity/narsie/process()
|
||||
eat()
|
||||
if(!target || prob(5))
|
||||
pickcultist()
|
||||
move()
|
||||
if(prob(25))
|
||||
mezzer()
|
||||
|
||||
/obj/machinery/singularity/narsie/consume(var/atom/A) //Has its own consume proc because it doesn't need energy and I don't want BoHs to explode it. --NEO
|
||||
if(is_type_in_list(A, uneatable))
|
||||
return 0
|
||||
if (istype(A,/mob/living))//Mobs get gibbed
|
||||
A:gib()
|
||||
else if(istype(A,/obj/))
|
||||
A:ex_act(1.0)
|
||||
if(A) del(A)
|
||||
else if(isturf(A))
|
||||
var/turf/T = A
|
||||
if(T.intact)
|
||||
for(var/obj/O in T.contents)
|
||||
if(O.level != 1)
|
||||
continue
|
||||
if(O.invisibility == 101)
|
||||
src.consume(O)
|
||||
A:ChangeTurf(/turf/space)
|
||||
return
|
||||
|
||||
/obj/machinery/singularity/narsie/ex_act() //No throwing bombs at it either. --NEO
|
||||
return
|
||||
|
||||
/obj/machinery/singularity/narsie/proc/pickcultist() //Narsie rewards his cultists with being devoured first, then picks a ghost to follow. --NEO
|
||||
var/list/cultists = list()
|
||||
for(var/datum/mind/cult_nh_mind in ticker.mode.cult)
|
||||
if(!cult_nh_mind.current)
|
||||
continue
|
||||
if(cult_nh_mind.current.stat)
|
||||
continue
|
||||
var/turf/pos = get_turf(cult_nh_mind.current)
|
||||
if(pos.z != src.z)
|
||||
continue
|
||||
cultists += cult_nh_mind.current
|
||||
if(cultists.len)
|
||||
acquire(pick(cultists))
|
||||
return
|
||||
//If there was living cultists, it picks one to follow.
|
||||
for(var/mob/living/carbon/human/food in living_mob_list)
|
||||
if(food.stat)
|
||||
continue
|
||||
var/turf/pos = get_turf(food)
|
||||
if(pos.z != src.z)
|
||||
continue
|
||||
cultists += food
|
||||
if(cultists.len)
|
||||
acquire(pick(cultists))
|
||||
return
|
||||
//no living cultists, pick a living human instead.
|
||||
for(var/mob/dead/observer/ghost in player_list)
|
||||
if(!ghost.client)
|
||||
continue
|
||||
var/turf/pos = get_turf(ghost)
|
||||
if(pos.z != src.z)
|
||||
continue
|
||||
cultists += ghost
|
||||
if(cultists.len)
|
||||
acquire(pick(cultists))
|
||||
return
|
||||
//no living humans, follow a ghost instead.
|
||||
|
||||
/obj/machinery/singularity/narsie/proc/acquire(var/mob/food)
|
||||
target << "\blue <b>NAR-SIE HAS LOST INTEREST IN YOU</b>"
|
||||
target = food
|
||||
if(ishuman(target))
|
||||
target << "\red <b>NAR-SIE HUNGERS FOR YOUR SOUL</b>"
|
||||
else
|
||||
target << "\red <b>NAR-SIE HAS CHOSEN YOU TO LEAD HIM TO HIS NEXT MEAL</b>"
|
||||
|
||||
//Wizard narsie
|
||||
|
||||
/obj/machinery/singularity/narsie/wizard
|
||||
grav_pull = 0
|
||||
|
||||
/obj/machinery/singularity/narsie/wizard/eat()
|
||||
set background = 1
|
||||
if(defer_powernet_rebuild != 2)
|
||||
defer_powernet_rebuild = 1
|
||||
for(var/atom/X in orange(consume_range,src))
|
||||
if(isturf(X) || istype(X, /atom/movable))
|
||||
consume(X)
|
||||
if(defer_powernet_rebuild != 2)
|
||||
defer_powernet_rebuild = 0
|
||||
return
|
||||
Reference in New Issue
Block a user