mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 11:05:03 +01:00
Updated:
Singularity Engine -Recoded some parts, still works mostly the same Welders -Recoded, it works mostly the same but is easier to use in code -Cyborgs have a larger fuel tank -Brought most if not all of the areas that use welders upto spec Moved the changeling chem recharge code into the human life proc New players who log out before spawning in are now deleted New minor Common event Machines around the station use more power, system might need some changes later Likely few other minor changes that I just cant think of atm git-svn-id: http://tgstation13.googlecode.com/svn/trunk@945 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
|
||||
/obj/machinery/power/rad_collector
|
||||
name = "Radiation Collector Array"
|
||||
desc = "A device which uses Hawking Radiation and plasma to produce power."
|
||||
icon = 'singularity.dmi'
|
||||
icon_state = "collector"
|
||||
anchored = 1
|
||||
density = 1
|
||||
directwired = 1
|
||||
var
|
||||
obj/item/weapon/tank/plasma/P = null
|
||||
last_power = 0
|
||||
|
||||
process()
|
||||
if(P)
|
||||
if(P.air_contents.toxins <= 0)
|
||||
P.air_contents.toxins = 0
|
||||
eject()
|
||||
else
|
||||
P.air_contents.toxins -= 0.001
|
||||
return
|
||||
|
||||
|
||||
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
|
||||
if(istype(W, /obj/item/weapon/tank/plasma))
|
||||
if(!src.anchored)
|
||||
user << "The [src] needs to be secured to the floor first."
|
||||
return 1
|
||||
if(src.P)
|
||||
user << "\red There appears to already be a plasma tank loaded!"
|
||||
return 1
|
||||
icon_state = "collector +p"
|
||||
src.P = W
|
||||
W.loc = src
|
||||
if (user.client)
|
||||
user.client.screen -= W
|
||||
user.u_equip(W)
|
||||
else if(istype(W, /obj/item/weapon/crowbar))
|
||||
if(P)
|
||||
eject()
|
||||
return 1
|
||||
else if(istype(W, /obj/item/weapon/wrench))
|
||||
if(P)
|
||||
user << "\red Remove the plasma tank first."
|
||||
return 1
|
||||
playsound(src.loc, '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 ratchet")
|
||||
else
|
||||
..()
|
||||
return 1
|
||||
|
||||
|
||||
ex_act(severity)
|
||||
switch(severity)
|
||||
if(2, 3)
|
||||
eject()
|
||||
return ..()
|
||||
|
||||
|
||||
proc
|
||||
eject()
|
||||
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
|
||||
icon_state = "collector"
|
||||
|
||||
receive_pulse(var/pulse_strength)
|
||||
if(P)
|
||||
var/power_produced = 0
|
||||
power_produced = P.air_contents.toxins*pulse_strength*20
|
||||
add_avail(power_produced)
|
||||
last_power = power_produced
|
||||
return
|
||||
return
|
||||
@@ -0,0 +1,75 @@
|
||||
|
||||
/obj/machinery/containment_field
|
||||
name = "Containment Field"
|
||||
desc = "An energy field."
|
||||
icon = 'singularity.dmi'
|
||||
icon_state = "Contain_F"
|
||||
anchored = 1
|
||||
density = 0
|
||||
unacidable = 1
|
||||
power_usage = 0
|
||||
|
||||
New()
|
||||
spawn(1)
|
||||
src.sd_SetLuminosity(5)
|
||||
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
if(get_dist(src, user) > 1)
|
||||
return 0
|
||||
else
|
||||
shock(user)
|
||||
return 1
|
||||
|
||||
|
||||
blob_act()
|
||||
return
|
||||
|
||||
|
||||
ex_act(severity)
|
||||
return
|
||||
|
||||
|
||||
HasProximity(atom/movable/AM as mob|obj)
|
||||
if(istype(AM,/mob/living/silicon) && prob(40))
|
||||
shock(AM)
|
||||
return
|
||||
if(istype(AM,/mob/living/carbon) && prob(50))
|
||||
shock(AM)
|
||||
return
|
||||
|
||||
|
||||
proc
|
||||
shock(mob/user as mob)
|
||||
if(iscarbon(user))
|
||||
var/datum/effects/system/spark_spread/s = new /datum/effects/system/spark_spread
|
||||
s.set_up(5, 1, user.loc)
|
||||
s.start()
|
||||
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)
|
||||
if(user.stunned < shock_damage) user.stunned = stun
|
||||
if(user.weakened < 10) user.weakened = 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)
|
||||
return
|
||||
else if(issilicon(user))
|
||||
var/datum/effects/system/spark_spread/s = new /datum/effects/system/spark_spread
|
||||
s.set_up(5, 1, user.loc)
|
||||
s.start()
|
||||
var/shock_damage = rand(15,30)
|
||||
user.fireloss += shock_damage
|
||||
user.updatehealth()
|
||||
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))
|
||||
if(user.stunned < 2)
|
||||
user.stunned = 2
|
||||
return
|
||||
return
|
||||
@@ -0,0 +1,179 @@
|
||||
/obj/machinery/emitter
|
||||
name = "Emitter"
|
||||
desc = "A heavy duty industrial laser"
|
||||
icon = 'singularity.dmi'
|
||||
icon_state = "Emitter"
|
||||
anchored = 0
|
||||
density = 1
|
||||
req_access = list(access_engine)
|
||||
var/active = 0
|
||||
var/fire_delay = 100
|
||||
var/last_shot = 0
|
||||
var/shot_number = 0
|
||||
var/state = 0
|
||||
var/locked = 0
|
||||
power_usage = 0
|
||||
|
||||
|
||||
/obj/machinery/emitter/New()
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/emitter/update_icon()
|
||||
if (active && !(stat & (NOPOWER|BROKEN)))
|
||||
icon_state = "Emitter +a"
|
||||
else
|
||||
icon_state = "Emitter"
|
||||
|
||||
|
||||
/obj/machinery/emitter/attack_hand(mob/user as mob)
|
||||
src.add_fingerprint(user)
|
||||
if(state == 2)
|
||||
if(!src.locked || istype(user, /mob/living/silicon))
|
||||
if(src.active==1)
|
||||
src.active = 0
|
||||
user << "You turn off the [src]."
|
||||
src.power_usage = 0
|
||||
else
|
||||
src.active = 1
|
||||
user << "You turn on the [src]."
|
||||
src.shot_number = 0
|
||||
src.fire_delay = 100
|
||||
src.power_usage = 100
|
||||
update_icon()
|
||||
else
|
||||
user << "The controls are locked!"
|
||||
else
|
||||
user << "The [src] needs to be firmly secured to the floor first."
|
||||
return 1
|
||||
|
||||
/obj/machinery/emitter/emp_act()//Emitters are hardened but still might have issues
|
||||
use_power(50)
|
||||
if(prob(1)&&prob(1))
|
||||
if(src.active)
|
||||
src.active = 0
|
||||
src.power_usage = 0
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/emitter/process()
|
||||
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
|
||||
if(src.state != 2)
|
||||
src.active = 0
|
||||
return
|
||||
|
||||
if(((src.last_shot + src.fire_delay) <= world.time) && (src.active == 1))
|
||||
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
|
||||
|
||||
use_power(1000)
|
||||
var/obj/beam/a_laser/A = new /obj/beam/a_laser( src.loc )
|
||||
A.icon_state = "u_laser"
|
||||
playsound(src.loc, 'emitter.ogg', 75, 1)
|
||||
|
||||
if(prob(35))
|
||||
var/datum/effects/system/spark_spread/s = new /datum/effects/system/spark_spread
|
||||
s.set_up(5, 1, src)
|
||||
s.start()
|
||||
A.dir = src.dir
|
||||
if(src.dir == 1)//Up
|
||||
A.yo = 20
|
||||
A.xo = 0
|
||||
|
||||
else if(src.dir == 2)//Down
|
||||
A.yo = -20
|
||||
A.xo = 0
|
||||
|
||||
else if(src.dir == 4)//Right
|
||||
A.yo = 0
|
||||
A.xo = 20
|
||||
|
||||
else if(src.dir == 8)//Left
|
||||
A.yo = 0
|
||||
A.xo = -20
|
||||
|
||||
else // Any other
|
||||
A.yo = -20
|
||||
A.xo = 0
|
||||
|
||||
A.process()
|
||||
|
||||
|
||||
/obj/machinery/emitter/attackby(obj/item/W, mob/user)
|
||||
if(active)
|
||||
user << "Turn off the [src] first."
|
||||
return
|
||||
|
||||
else if(istype(W, /obj/item/weapon/wrench))
|
||||
switch(state)
|
||||
if(0)
|
||||
state = 1
|
||||
playsound(src.loc, '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, '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))
|
||||
switch(state)
|
||||
if(0)
|
||||
user << "\red The [src.name] needs to be wrenched to the floor."
|
||||
return
|
||||
if(1)
|
||||
if (W:remove_fuel(2))
|
||||
playsound(src.loc, '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))
|
||||
state = 2
|
||||
user << "You weld the [src] to the floor."
|
||||
else
|
||||
user << "\blue You need more welding fuel to complete this task."
|
||||
return
|
||||
if(2)
|
||||
if (W:remove_fuel(2))
|
||||
playsound(src.loc, '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))
|
||||
state = 1
|
||||
user << "You cut the [src] free from the floor."
|
||||
else
|
||||
user << "\blue You need more welding fuel to complete this task."
|
||||
return
|
||||
else if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
|
||||
if (src.allowed(user))
|
||||
src.locked = !src.locked
|
||||
user << "Controls are now [src.locked ? "locked." : "unlocked."]"
|
||||
else
|
||||
user << "\red Access denied."
|
||||
return
|
||||
else
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/emitter/power_change()
|
||||
..()
|
||||
update_icon()
|
||||
@@ -0,0 +1,308 @@
|
||||
|
||||
/////FIELD GEN
|
||||
#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 = 'singularity.dmi'
|
||||
icon_state = "Field_Gen"
|
||||
anchored = 0
|
||||
density = 1
|
||||
req_access = list(access_engine)
|
||||
power_usage = 0
|
||||
var
|
||||
Varedit_start = 0
|
||||
Varpower = 0
|
||||
active = 0
|
||||
power = 20
|
||||
state = 0
|
||||
warming_up = 0
|
||||
powerlevel = 0
|
||||
list/obj/machinery/containment_field/fields
|
||||
list/obj/machinery/field_generator/connected_gens
|
||||
|
||||
|
||||
update_icon()
|
||||
if (!active)
|
||||
icon_state = "Field_Gen"
|
||||
return
|
||||
var/level = 3
|
||||
switch (power)
|
||||
if(0 to 60)
|
||||
level = 1
|
||||
if(61 to 220)
|
||||
level = 2
|
||||
if(221 to INFINITY)
|
||||
level = 3
|
||||
level = min(level,warming_up)
|
||||
if (powerlevel!=level)
|
||||
powerlevel = level
|
||||
icon_state = "Field_Gen +a[powerlevel]"
|
||||
|
||||
|
||||
New()
|
||||
..()
|
||||
fields = list()
|
||||
connected_gens = list()
|
||||
return
|
||||
|
||||
|
||||
process()
|
||||
if(src.Varedit_start == 1)
|
||||
if(src.active == 0)
|
||||
src.active = 1
|
||||
src.state = 2
|
||||
src.power = field_generator_max_power
|
||||
src.anchored = 1
|
||||
src.warming_up = 3
|
||||
turn_on()
|
||||
Varedit_start = 0
|
||||
if(src.active == 2)
|
||||
calc_power()
|
||||
|
||||
return
|
||||
|
||||
|
||||
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] once it is online."
|
||||
return 1
|
||||
else
|
||||
user.visible_message("[user.name] turns on the [src.name]", \
|
||||
"You turn on the [src].", \
|
||||
"You hear heavy droning")
|
||||
turn_on()
|
||||
src.add_fingerprint(user)
|
||||
else
|
||||
user << "The [src] needs to be firmly secured to the floor first."
|
||||
return
|
||||
|
||||
|
||||
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, '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, '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))
|
||||
switch(state)
|
||||
if(0)
|
||||
user << "\red The [src.name] needs to be wrenched to the floor."
|
||||
return
|
||||
if(1)
|
||||
if (W:remove_fuel(2,user))
|
||||
playsound(src.loc, '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))
|
||||
state = 2
|
||||
user << "You weld the field generator to the floor."
|
||||
else
|
||||
return
|
||||
if(2)
|
||||
if (W:remove_fuel(2,user))
|
||||
playsound(src.loc, '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))
|
||||
state = 1
|
||||
user << "You cut the [src] free from the floor."
|
||||
else
|
||||
return
|
||||
else
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
emp_act()
|
||||
return 0
|
||||
|
||||
|
||||
bullet_act(flag)
|
||||
if (flag == PROJECTILE_BULLET)
|
||||
src.power -= 100
|
||||
else if (flag == PROJECTILE_WEAKBULLET)
|
||||
src.power -= 50
|
||||
else if (flag == PROJECTILE_LASER)
|
||||
src.power += 20
|
||||
else if (flag == PROJECTILE_TASER)
|
||||
src.power += 5
|
||||
else
|
||||
src.power -= 30
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
Del()
|
||||
src.cleanup()
|
||||
..()
|
||||
|
||||
|
||||
proc
|
||||
turn_off()
|
||||
src.active = 0
|
||||
spawn(1)
|
||||
src.cleanup()
|
||||
update_icon()
|
||||
|
||||
|
||||
turn_on()
|
||||
src.active = 1
|
||||
warming_up = 1
|
||||
powerlevel = 0
|
||||
spawn(1)
|
||||
while (warming_up<3 && active)
|
||||
sleep(50)
|
||||
warming_up++
|
||||
update_icon()
|
||||
if(warming_up >= 3)
|
||||
start_fields()
|
||||
update_icon()
|
||||
|
||||
|
||||
calc_power()
|
||||
if(Varpower)
|
||||
return
|
||||
|
||||
update_icon()
|
||||
if(src.power > field_generator_max_power)
|
||||
src.power = field_generator_max_power
|
||||
|
||||
var/power_draw = 0
|
||||
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()
|
||||
src.power = 0
|
||||
return
|
||||
|
||||
|
||||
draw_power(var/draw = 0,var/obj/machinery/field_generator/G = null, var/obj/machinery/field_generator/last = null)
|
||||
// if(G && G == src)//Loopin, set fail
|
||||
// return 0
|
||||
if(src.power >= draw)//We have enough power
|
||||
src.power -= draw
|
||||
return 1
|
||||
else//Need more power
|
||||
return 0
|
||||
/* draw -= src.power
|
||||
src.power = 0 ill finis this up when not about to pass out
|
||||
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,G,src))//Can you take the load
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
else//We are askin another for power
|
||||
if(FG.draw_power(draw,src,src))
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
*/
|
||||
|
||||
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
|
||||
|
||||
|
||||
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)
|
||||
steps += 1
|
||||
G = locate(/obj/machinery/field_generator) in T
|
||||
if(!isnull(G))
|
||||
steps -= 1
|
||||
if(!G.active)
|
||||
return
|
||||
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()
|
||||
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)
|
||||
|
||||
|
||||
cleanup()
|
||||
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)
|
||||
connected_gens.Remove(FG)
|
||||
connected_gens = list()
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
/////SINGULARITY SPAWNER
|
||||
/obj/machinery/the_singularitygen/
|
||||
name = "Gravitational Singularity Generator"
|
||||
desc = "An Odd Device which produces a Gravitational Singularity when set up."
|
||||
icon = 'singularity.dmi'
|
||||
icon_state = "TheSingGen"
|
||||
anchored = 1
|
||||
density = 1
|
||||
power_usage = 0
|
||||
|
||||
//////////////////////Singularity gen START
|
||||
|
||||
/obj/machinery/the_singularitygen/process()
|
||||
var/turf/T = get_turf(src)
|
||||
if (singularity_is_surrounded(T))
|
||||
new /obj/machinery/singularity/(T, 200)
|
||||
spawn(0)
|
||||
del(src)
|
||||
return
|
||||
|
||||
/obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
anchored = !anchored
|
||||
playsound(src.loc, '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 ratchet")
|
||||
else
|
||||
user.visible_message("[user.name] unsecures [src.name] from the floor.", \
|
||||
"You unsecure the [src.name] from the floor.", \
|
||||
"You hear ratchet")
|
||||
return
|
||||
return ..()
|
||||
|
||||
/proc/singularity_is_surrounded(turf/T)//TODO:Add a timer so we dont need this
|
||||
var/checkpointC = 0
|
||||
for (var/obj/X in orange(4,T)) //TODO: do we need requirement to singularity be actually _surrounded_ by field?
|
||||
if(istype(X, /obj/machinery/containment_field) || istype(X, /obj/machinery/shieldwall))
|
||||
checkpointC ++
|
||||
return checkpointC >= 20
|
||||
@@ -0,0 +1,269 @@
|
||||
var/global/list/uneatable = list(
|
||||
/obj/machinery/singularity,
|
||||
/turf/space,/obj/effects,
|
||||
/obj/overlay)
|
||||
|
||||
/obj/machinery/singularity/
|
||||
name = "Gravitational Singularity"
|
||||
desc = "A Gravitational Singularity."
|
||||
icon = '160x160.dmi'
|
||||
icon_state = "Singularity"
|
||||
anchored = 1
|
||||
density = 1
|
||||
layer = 6
|
||||
unacidable = 1 //Don't comment this out.
|
||||
power_usage = 0
|
||||
var
|
||||
active = 0
|
||||
contained = 1 //Are we going to move around?
|
||||
energy = 100 //How strong are we?
|
||||
dissipate = 0 //Do we lose energy over time? TODO:Set this to 1 when/if the feederthing is finished
|
||||
dissipate_delay = 5
|
||||
dissipate_track = 0
|
||||
dissipate_strength = 10 //How much energy do we lose?
|
||||
move_self = 1 //Do we move on our own?
|
||||
grav_pull = 6 //How many tiles out do we pull?
|
||||
event_chance = 15 //Prob for event each tick
|
||||
|
||||
|
||||
New(loc, var/starting_energy = 200, var/temp = 0)
|
||||
src.energy = starting_energy
|
||||
pixel_x = -64
|
||||
pixel_y = -64
|
||||
if(temp)
|
||||
spawn(temp)
|
||||
del(src)
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
Del()
|
||||
//Could have it do something bad when this happens, explode/implode or something
|
||||
..()
|
||||
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
consume(user)
|
||||
return 1
|
||||
|
||||
|
||||
blob_act(severity)
|
||||
return
|
||||
|
||||
|
||||
ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
if(prob(10))
|
||||
del(src)
|
||||
return
|
||||
if(2.0 to 3.0)
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
Bump(atom/A)
|
||||
consume(A)
|
||||
return
|
||||
|
||||
|
||||
Bumped(atom/A)
|
||||
consume(A)
|
||||
return
|
||||
|
||||
|
||||
process()
|
||||
eat()
|
||||
dissipate()
|
||||
check_energy()
|
||||
move()
|
||||
if(prob(event_chance))//Chance for it to run a special event
|
||||
event()
|
||||
pulse()
|
||||
return
|
||||
|
||||
proc
|
||||
dissipate()
|
||||
if(!dissipate)
|
||||
return
|
||||
if(dissipate_track >= dissipate_delay)
|
||||
src.energy -= dissipate_strength
|
||||
dissipate_track = 0
|
||||
else
|
||||
dissipate_track++
|
||||
|
||||
|
||||
check_energy()
|
||||
if(energy <= 0)
|
||||
del(src)
|
||||
return 0
|
||||
switch(energy)
|
||||
if(1000 to 1999)
|
||||
for(var/obj/machinery/field_generator/F in orange(5,src))
|
||||
F.turn_off()
|
||||
emp_area()
|
||||
toxmob()
|
||||
if(2000 to INFINITY)
|
||||
explosion(src.loc, 4, 8, 15, 0)
|
||||
if(src)
|
||||
del(src)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
|
||||
is_eatable(atom/X)
|
||||
for (var/Type in uneatable)
|
||||
if (istype(X, Type))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
|
||||
eat()
|
||||
for (var/atom/X in orange(grav_pull,src))
|
||||
if(isarea(X))
|
||||
continue
|
||||
if (!is_eatable(X))
|
||||
continue
|
||||
switch(get_dist(src,X))
|
||||
if(0 to 2)
|
||||
consume(X)
|
||||
else if(!isturf(X))
|
||||
if(!X:anchored && !istype(X,/mob/living/carbon/human))//TODO:change the boots to just anchor so we dont have to add this to everything
|
||||
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)
|
||||
return
|
||||
|
||||
|
||||
consume(var/atom/A)
|
||||
var/gain = 0
|
||||
if (!is_eatable(A))
|
||||
return
|
||||
if (istype(A,/mob/living))//Mobs get gibbed
|
||||
gain = 20
|
||||
if(istype(A,/mob/living/carbon/human))
|
||||
if(A:mind)
|
||||
if((A:mind:assigned_role == "Station Engineer") || (A:mind:assigned_role == "Chief Engineer") )
|
||||
gain = 100
|
||||
A:gib()
|
||||
else if(istype(A,/obj/))
|
||||
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)
|
||||
A:ReplaceWithSpace()
|
||||
gain = 2
|
||||
src.energy += gain
|
||||
return
|
||||
|
||||
|
||||
move(var/movement_dir = 0)
|
||||
if(!movement_dir == 1 || !movement_dir == 2 || !movement_dir == 4 || !movement_dir == 8)
|
||||
movement_dir = pick(NORTH, SOUTH, EAST, WEST)
|
||||
var/turf/T = null
|
||||
switch(movement_dir)
|
||||
if(NORTH)
|
||||
T = locate(src.x,src.y+3,src.z)
|
||||
if(SOUTH)
|
||||
T = locate(src.x,src.y-3,src.z)
|
||||
if(EAST)
|
||||
T =locate(src.x+3,src.y,src.z)
|
||||
if(WEST)
|
||||
T = locate(src.x-3,src.y,src.z)
|
||||
if(can_move(T))
|
||||
spawn(0)
|
||||
step(src, movement_dir)
|
||||
|
||||
|
||||
can_move(var/turf/T)
|
||||
if(!T)
|
||||
return 0
|
||||
if(locate(/obj/machinery/containment_field) 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
|
||||
return 1
|
||||
|
||||
|
||||
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
|
||||
//do nothing
|
||||
return
|
||||
|
||||
|
||||
toxmob()
|
||||
var/toxrange = 8
|
||||
if (src.energy>100)
|
||||
toxrange+=round((src.energy-100)/100)
|
||||
var/toxloss = 4
|
||||
var/radiation = 5
|
||||
if (src.energy>150)
|
||||
toxloss += round(((src.energy-150)/50)*4,1)
|
||||
radiation += round(((src.energy-150)/50)*5,1)
|
||||
for(var/mob/living/carbon/M in view(toxrange, src.loc))
|
||||
if(istype(M,/mob/living/carbon/human))
|
||||
if(M:wear_suit) //TODO: check for radiation protection
|
||||
toxloss = round(toxloss/2,1)
|
||||
radiation = round(radiation/2,1)
|
||||
M.toxloss += toxloss
|
||||
M.radiation += radiation
|
||||
M.updatehealth()
|
||||
M << "\red You feel odd."
|
||||
return
|
||||
|
||||
|
||||
mezzer()
|
||||
for(var/mob/living/carbon/M in oviewers(8, src))
|
||||
if(istype(M,/mob/living/carbon/human))
|
||||
if(istype(M:glasses,/obj/item/clothing/glasses/meson))
|
||||
M << "\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."
|
||||
if (M:stunned < 3)
|
||||
M.stunned = 3
|
||||
for(var/mob/O in viewers(M, null))
|
||||
O.show_message(text("\red <B>[] stares blankly at The []!</B>", M, src), 1)
|
||||
return
|
||||
|
||||
|
||||
emp_area()
|
||||
var/turf/myturf = get_turf(src)
|
||||
var/obj/overlay/pulse = new/obj/overlay ( myturf )
|
||||
pulse.icon = 'effects.dmi'
|
||||
pulse.icon_state = "emppulse"
|
||||
pulse.name = "emp pulse"
|
||||
pulse.anchored = 1
|
||||
spawn(20)
|
||||
del(pulse)
|
||||
for (var/atom/X in orange(8,src))
|
||||
X.emp_act()
|
||||
return
|
||||
|
||||
|
||||
pulse()
|
||||
for(var/obj/machinery/power/rad_collector/R in orange(15,src))
|
||||
if(istype(R,/obj/machinery/power/rad_collector))
|
||||
R.receive_pulse(energy)
|
||||
return
|
||||
Reference in New Issue
Block a user