Files
CHOMPStation2/code/modules/power/singularity/containment_field.dm
johnsonmt88@gmail.com 26ce5db5b0 Meteors and Space dust (now that they work again) will no longer have an effect on singularity containment. Field generators and Emitters are protected.
I added a check to meteor and space dust Bump() directly because changing ex_act() on the machines themselves would make the machines immune to bombs and C4.
Hopefully fixes issue 716.

light/process() was added back in causing lights to use power as they were meant to. Recently lights have been made brighter causing more power to be drained. As a result the engineering APC would not last very long. The station using a lot of power is a good thing since the singularity produces an incredible amount of power, so to keep this higher power demand but still give engineers a fighting chance to set up the singularity, I've bumped up the engineering APC's starting battery power.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4401 316c924e-a436-60f5-8080-3fe189b3f50e
2012-08-14 16:39:01 +00:00

114 lines
2.8 KiB
Plaintext

//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
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/New()
spawn(1)
src.sd_SetLuminosity(5)
/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