Files
CHOMPStation2/code/modules/power/singularity/singularity.dm
petethegoat@gmail.com 72c72c47d3 Sieve stuff, this is a stupidly big commit, I'm sorry, I really am.
Full details in this thread:
http://nanotrasen.com/phpBB3/viewtopic.php?f=16&t=8898
And a summary of the most important bits:
-Door animations no longer desync and do the open-close-open thing. That's been around so long most people don't even notice
-Welding tools no longer get their icons desynced
-Fixed unpowered mineral door runtimes
-Chemistry machines now require power to run
-Fixed the proc to apply radiation based on armor, which means that you can actually not die of radiation as quickly if you wear armor that protects against radiation
--By fixing this, it also fixed the singularity, so you might want to be careful next time you run by it naked
--Also means that radiation events take armor into account. How great
-Hopefully have a bugfix to prevent borgs from using lag to enter the game without an AI or laws, but I cannot test it myself other than that it didn't break anything
-Disposal sound can only play once every couple of ticks, so no more ear-rape by disposals!
-Lasertag guns can no longer be used to make lasergun turrets
-Cleaned up stray pixels on several doors and the lasertag guns

-Reworked how falsewalls work, now whenever you attack them with certain tools (drills, welders, etc...) it instantly turns them into a wall and pushes the attackby(), meaning you might not even notice that you just drilled down a falsewall, and at the very least they are much more fitting
-Omni-directional PA console! Never have to worry about rotating that fucking computer again, because now it does it itself!
-The Marisa robe that spawns in the theater no longer protects like armor
-Tweaked coefficient list for fake insulated gloves (misplaced punctuation messed up the list a tad)
-Moved falsewalls out of 'transfer_valve.dm' and into 'structures.dm'
-Tweaked smoothwalls so it only connects walls with like minerals (only seen effect is on the new walls)
--Also added appropriate signs to areas
-Reworked portable turrets to be a lot less laggy, now they determine the projectile type once, then save it so they don't have to go through else if chains every time they fire
-Added many sprites from WJohnston, but many are not fully implemented (Mostly floor ones)
-Added a vending machine for engineering, the Engivend. Apparently it was needed because of the lack of availability of the Autolathe or whatever.
-Added WJohnston's Dark Gygax sprites, then made a Death Squad Gygax out of them. A bit tougher than the standard Gygax, improved battery, and is pre-fit with gear, ideally for 'hit and run' tactics
-New Odysseus construction sprites, also removed the Odysseus Carapace in favor of plasteel like the Ripley, meaning they in terms of construction, a Ripley is equivalent to an Odysseus 
-Added an 'is_hot()' proc, when called it returns the temperature of the item in K, while taking into account things like whether or not the item is active or whatever
-Rewrote the Experimental Welding Tool, now instead of having a super-sized tank, it uses super-concentrated plasma that is turned into gas inside of it as its fuel source. Meaning, it will never have to be refilled, but it takes time for it to fill itself
-Added WJ's firelight sprites and code. Wanted to use them, but haven't had a chance to really implement them, but still, they're there

-Turrets made with lasertag guns now fire their respective team's bolt
-The turrets also automatically target anyone on the opposing team (But will continue to shoot at anyone, for shits n' giggles)
-Turrets get corresponding sprites based on team
-Shooting a turret with a different team's laser will disable it for 10 seconds
-You can also make ED-209's for your lasertag games/pissing off sec
-These are constructed just like a regular ED, but instead of a security vest and taser, it requires a lasertag vest and gun (same colors)
-When geared for lasertag, They will not arrest anyone nor melee them, only patrol (if set) and shoot
-They have their color schemes as well, and can be disabled just like turrets
-For both turrets and EDs, when geared for lasertag, they will not shoot anyone on the ground, this was due to very quickly learning how fucking OP that was for 1 turret to stunlock 3 people for eternity
-And when they are geared for lasertag, both the turrets and EDs have their access changed to maint, clown, and mime (This will not stop any of them from being shot, however)
-As a side note, you can also make lasertag stationary turrets for any map-related things

-Now walls are based on a plating system, meaning all walls have a girder with a mineral plating on top of it.
-As of right now, usable minerals are Silver, Gold, Diamond, Uranium, Plasma, and Sandstone (Lacking sprites for wood, *cough*)
-This also carries over to falsewalls, so you can make falsewalls out of any of those minerals
-Also, this carries over to powered doors, meaning you can construct useful doors out of minerals, so you could have actual diamond forts with doors requiring access to get in or whatever
-All of these are standardized, and for the most part work just like regular walls, meaning if you start slicing a wall, it will drop the mineral, or if you drill it, or whatever
-What was mentioned with the smoothwall tweak above, only walls of the same mineral will connect, so it all looks very nice
-Doors and walls made of uranium emit radiation when interacted with, with walls causing a 'ripple' effect, so the more walls nearby, the more radiation you get hit with
-Doors and walls made of plasma burn. It's a short, quick burn, but can easily be compounded in large structures
--As a note on plasma walls, I cannot get atmos and plasma walls to play nice (Since they are airless turfs), so I can't actually get them to ignite based on air temperature, but when they do ignite, they will auto-magically ignite nearby plasma walls, with a reduced temperature, meaning that if you want a massive chain reaction over a huge area, you better use something a bit hotter than a lighter
--Also, when plasma walls burn, they simply leave behind a girder, while doors leave assemblies
-Lastly, for nearly any kind of destructive action, Diamond walls are much more resilient, meaning they will take twice as long to be destroyed, and are immune to the effects of thermite
(Also, sprites for plasma walls and uranium walls are shite right now, waiting for replacements)
Update:
-Added cult walls as a 'mineral wall', meaning they will work on the same system and 'ReplaceWithMineralWall("cult")' will change any turf into a cult wall, hopefully for some cult-related activities soon

R&D stuff:
-Now instead of 1 sheet or ALL OF THE SHEETS, you enter a number as to how many sheets you want (it's sanitized to hell as well)
-Minerals no longer multiply when inside RnD machines. (Who fucked that one up? Goddamn)
-Mech fabricators are both deconstructable, and putting higher level parts actually improve it, each 'Tier' up is equivalent to +1 tech levels for that, so a High Powered Micro Laser would give the same bonus as +1 Material Research, a Pico Manipulator would give the same bonus as +2 Engineering, etc
-Complete with a shitty opened Mech Fab sprite!
-And not shitty overlays so autolathe's animate the material that is put in them, rather than give everything that's not glass the metal animation

LOL THE JOKES ON YOU I JUST COPY PASTED HIS TOPIC

added a few svn ignores, for thumbs.db and maps/backup

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3751 316c924e-a436-60f5-8080-3fe189b3f50e
2012-06-06 19:45:03 +00:00

539 lines
14 KiB
Plaintext

//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 = 'singularity.dmi'
icon_state = "singularity_s1"
anchored = 1
density = 1
layer = 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
New(loc, var/starting_energy = 50, var/temp = 0)
//CARN: admin-alert for chuckle-fuckery.
last_warning = world.time
var/count = 0
for(var/obj/machinery/containment_field/CF in world)
count = 1
break
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")
src.energy = starting_energy
if(temp)
spawn(temp)
del(src)
..()
for(var/obj/machinery/singularity_beacon/singubeacon in world)
if(singubeacon.active)
target = singubeacon
break
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(25))
del(src)
return
else
energy += 50
if(2.0 to 3.0)
energy += round((rand(20,60)/2),1)
return
return
Bump(atom/A)
consume(A)
return
Bumped(atom/A)
consume(A)
return
process()
eat()
dissipate()
check_energy()
if(current_size >= 3)
move()
if(current_size <= 7)
pulse()
if(current_size >= 5)
if(prob(event_chance))//Chance for it to run a special event TODO:Come up with one or two more that fit
event()
return
attack_ai() //to prevent ais from gibbing themselves when they click on one.
return
proc
dissipate()
if(!dissipate)
return
if(dissipate_track >= dissipate_delay)
src.energy -= dissipate_strength
dissipate_track = 0
else
dissipate_track++
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 = '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 = '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 = '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 = '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 = '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
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
eat()
set background = 1
if(defer_powernet_rebuild != 2)
defer_powernet_rebuild = 1
for(var/atom/movable/X in orange(consume_range,src))
consume(X)
for(var/turf/X in orange(consume_range,src))
consume(X)
for(var/atom/movable/X in orange(grav_pull,src))
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)
if(defer_powernet_rebuild != 2)
defer_powernet_rebuild = 0
return
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))
if(A:mind)
if((A:mind:assigned_role == "Station Engineer") || (A:mind:assigned_role == "Chief Engineer") )
gain = 100
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)
A:ReplaceWithSpace()
gain = 2
src.energy += gain
return
move(var/movement_dir = 0)
if(!move_self)
return 0
if(target && prob(60))
movement_dir = get_dir(src,target) //moves to a singulo beacon, if there is one
else if(!(movement_dir in cardinal))
movement_dir = pick(NORTH, SOUTH, EAST, WEST)
if(movement_dir == last_failed_movement)
var/list/L = new/list(NORTH, SOUTH, EAST, WEST)
L.Remove(last_failed_movement)
movement_dir = pick(L)
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
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
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
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
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))
if(istype(M,/mob/living/))
M.apply_effect(rand(radiationmin,radiation), IRRADIATE)
toxdamage = (toxdamage - (toxdamage*M.getarmor(null, "rad")))
M.apply_effect(toxdamage, TOX)
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."
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
emp_area()
empulse(src, 8, 10)
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
narsie //Moving narsie to a child object of the singularity so it can be made to function differently. --NEO
name = "Tear in the Fabric of Reality"
desc = "Your mind begins to bubble and ooze as it tries to comprehend what it sees."
icon = '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
process()
eat()
if(!target || prob(5))
pickcultist()
move()
if(prob(25))
mezzer()
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:ReplaceWithSpace()
return
ex_act() //No throwing bombs at it either. --NEO
return
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
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 world)
if(food.stat)
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 world)
if(!ghost.client)
continue
cultists += ghost
if(cultists.len)
acquire(pick(cultists))
return
//no living humans, follow a ghost instead.
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>"
/obj/machinery/singularity/narsie/wizard
grav_pull = 0
eat()
set background = 1
if(defer_powernet_rebuild != 2)
defer_powernet_rebuild = 1
for(var/atom/movable/X in orange(consume_range,src))
consume(X)
for(var/turf/X in orange(consume_range,src))
consume(X)
if(defer_powernet_rebuild != 2)
defer_powernet_rebuild = 0
return