Files
Aurora.3/code/game/turf.dm
mport2004@gmail.com 62e28c2abf Organs:
Moved into their own folder and got split into three files.
Damage  zones have been regrouped slightly to make it easier to deal with them. Currently the organ groups are head, l/r leg, l/r arm, and head.

Attacking:
Armor is properly checked.
Currently aiming for the chest gives a higher chance to stun whereas the head will stun for longer.
Stungloves/Disarm now show up in the attack log.
Stungloves ignore intent.

Silicon:
AI units can now move between cams that are not on the ss13 network.
Cyborg's alert screen should not longer pop up every time they get an alert if they have opened it once during the round.
Robot vision now uses the standard amount of energy.

Gamemodes:
Added Deuryn's unrev message.
Runes can only be examined if you are close to them.
Moved the Loyalty implants to the HoS' locker at the request of HerpA.
Nuke agents now come with explosive implants that will activate upon death.

Projectiles:
Once again went though the gun code and cleaned things up, it is much better now.
Bullet_act fixed up and most mobs now use the one in living, just overload it if they need to do something diff.
Freeze /caplaser/xbow no longer have an infinite loop.
Shotguns have to be pumped manually.

Went though the latest runtime log.

Power cells now use return on their give/use procs

Assemblies have been reworked and are nearly finished, just need to finish up the special assembly code, redo the signalers, and add one or two new assembly items.
Laying down will now only take 3 ticks to get up, from 5.

You can no longer punch people on the spawn screen.

This is a big one and was cleared by two heads, TK will only allow you to pick up items.  If you have an item in your hand it will act normal.

This revision got much larger than originally intended my tests show everything is working fine, but you never know.  Ill likely do more mob teaks in the next few days.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2333 316c924e-a436-60f5-8080-3fe189b3f50e
2011-10-08 10:38:01 +00:00

1414 lines
37 KiB
Plaintext

/turf/DblClick()
if(istype(usr, /mob/living/silicon/ai))
return move_camera_by_click()
if(usr.stat || usr.restrained() || usr.lying)
return ..()
if(usr.hand && istype(usr.l_hand, /obj/item/weapon/flamethrower))
var/turflist = getline(usr,src)
var/obj/item/weapon/flamethrower/F = usr.l_hand
F.flame_turf(turflist)
else if(!usr.hand && istype(usr.r_hand, /obj/item/weapon/flamethrower))
var/turflist = getline(usr,src)
var/obj/item/weapon/flamethrower/F = usr.r_hand
F.flame_turf(turflist)
return ..()
/turf/New()
..()
for(var/atom/movable/AM as mob|obj in src)
spawn( 0 )
src.Entered(AM)
return
return
/turf/ex_act(severity)
return 0
/turf/bullet_act(var/obj/item/projectile/Proj)
if(istype(Proj ,/obj/item/projectile/beam/pulse))
src.ex_act(2)
..()
return 0
/turf/Enter(atom/movable/mover as mob|obj, atom/forget as mob|obj|turf|area)
if (!mover || !isturf(mover.loc))
return 1
//First, check objects to block exit that are not on the border
for(var/obj/obstacle in mover.loc)
if((obstacle.flags & ~ON_BORDER) && (mover != obstacle) && (forget != obstacle))
if(!obstacle.CheckExit(mover, src))
mover.Bump(obstacle, 1)
return 0
//Now, check objects to block exit that are on the border
for(var/obj/border_obstacle in mover.loc)
if((border_obstacle.flags & ON_BORDER) && (mover != border_obstacle) && (forget != border_obstacle))
if(!border_obstacle.CheckExit(mover, src))
mover.Bump(border_obstacle, 1)
return 0
//Next, check objects to block entry that are on the border
for(var/obj/border_obstacle in src)
if(border_obstacle.flags & ON_BORDER)
if(!border_obstacle.CanPass(mover, mover.loc, 1, 0) && (forget != border_obstacle))
mover.Bump(border_obstacle, 1)
return 0
//Then, check the turf itself
if (!src.CanPass(mover, src))
mover.Bump(src, 1)
return 0
//Finally, check objects/mobs to block entry that are not on the border
for(var/atom/movable/obstacle in src)
if(obstacle.flags & ~ON_BORDER)
if(!obstacle.CanPass(mover, mover.loc, 1, 0) && (forget != obstacle))
mover.Bump(obstacle, 1)
return 0
return 1 //Nothing found to block so return success!
/turf/Entered(atom/movable/M as mob|obj)
if(ismob(M))
if(M.flags & NOGRAV)
inertial_drift(M)
return
if(!istype(src, /turf/space))
M:inertia_dir = 0
..()
for(var/atom/A as mob|obj|turf|area in src)
spawn( 0 )
if ((A && M))
A.HasEntered(M, 1)
return
for(var/atom/A as mob|obj|turf|area in range(1))
spawn( 0 )
if ((A && M))
A.HasProximity(M, 1)
return
return
/turf/proc/inertial_drift(atom/movable/A as mob|obj)
if (!(A.last_move)) return
if ((istype(A, /mob/) && src.x > 2 && src.x < (world.maxx - 1) && src.y > 2 && src.y < (world.maxy-1)))
var/mob/M = A
if(M.Process_Spacemove()) return
spawn(5)
if((M && !(M.anchored) && (M.loc == src)))
if(M.inertia_dir)
step(M, M.inertia_dir)
else
M.inertia_dir = M.last_move
step(M, M.inertia_dir)
return
/turf/proc/levelupdate()
for(var/obj/O in src)
if(O.level == 1)
O.hide(src.intact)
// override for space turfs, since they should never hide anything
/turf/space/levelupdate()
for(var/obj/O in src)
if(O.level == 1)
O.hide(0)
/turf/proc/ReplaceWithFloor(explode=0)
var/prior_icon = icon_old
var/old_dir = dir
var/turf/simulated/floor/W = new /turf/simulated/floor( locate(src.x, src.y, src.z) )
W.dir = old_dir
if(prior_icon) W.icon_state = prior_icon
else W.icon_state = "floor"
if (!explode)
W.opacity = 1
W.sd_SetOpacity(0)
//This is probably gonna make lighting go a bit wonky in bombed areas, but sd_SetOpacity was the primary reason bombs have been so laggy. --NEO
W.levelupdate()
return W
/turf/proc/ReplaceWithPlating()
var/prior_icon = icon_old
var/old_dir = dir
var/turf/simulated/floor/plating/W = new /turf/simulated/floor/plating( locate(src.x, src.y, src.z) )
W.dir = old_dir
if(prior_icon) W.icon_state = prior_icon
else W.icon_state = "plating"
W.opacity = 1
W.sd_SetOpacity(0)
W.levelupdate()
return W
/turf/proc/ReplaceWithEngineFloor()
var/old_dir = dir
var/turf/simulated/floor/engine/E = new /turf/simulated/floor/engine( locate(src.x, src.y, src.z) )
E.dir = old_dir
E.icon_state = "engine"
/turf/simulated/Entered(atom/A, atom/OL)
if (istype(A,/mob/living/carbon))
var/mob/living/carbon/M = A
if(M.lying) return
if(istype(M, /mob/living/carbon/human)) // Split this into two seperate if checks, when non-humans were being checked it would throw a null error -- TLE
if(istype(M:shoes, /obj/item/clothing/shoes/clown_shoes))
if(M.m_intent == "run")
if(M.footstep >= 2)
M.footstep = 0
else
M.footstep++
if(M.footstep == 0)
playsound(src, "clownstep", 50, 1) // this will get annoying very fast.
else
playsound(src, "clownstep", 20, 1)
switch (src.wet)
if(1)
if(istype(M, /mob/living/carbon/human)) // Added check since monkeys don't have shoes
if ((M.m_intent == "run") && !(istype(M:shoes, /obj/item/clothing/shoes) && M:shoes.flags&NOSLIP))
M.pulling = null
step(M, M.dir)
M << "\blue You slipped on the wet floor!"
playsound(src.loc, 'slip.ogg', 50, 1, -3)
M.stunned = 8
M.weakened = 5
else
M.inertia_dir = 0
return
else if(!istype(M, /mob/living/carbon/metroid))
if (M.m_intent == "run")
M.pulling = null
step(M, M.dir)
M << "\blue You slipped on the wet floor!"
playsound(src.loc, 'slip.ogg', 50, 1, -3)
M.stunned = 8
M.weakened = 5
else
M.inertia_dir = 0
return
if(2) //lube
if(!istype(M, /mob/living/carbon/metroid))
M.pulling = null
step(M, M.dir)
spawn(1) step(M, M.dir)
spawn(2) step(M, M.dir)
spawn(3) step(M, M.dir)
spawn(4) step(M, M.dir)
M.take_organ_damage(2) // Was 5 -- TLE
M << "\blue You slipped on the floor!"
playsound(src.loc, 'slip.ogg', 50, 1, -3)
M.weakened = 10
..()
/turf/proc/ReplaceWithSpace()
var/old_dir = dir
var/turf/space/S = new /turf/space( locate(src.x, src.y, src.z) )
S.dir = old_dir
return S
/turf/proc/ReplaceWithLattice()
var/old_dir = dir
var/turf/space/S = new /turf/space( locate(src.x, src.y, src.z) )
S.dir = old_dir
new /obj/structure/lattice( locate(src.x, src.y, src.z) )
return S
/turf/proc/ReplaceWithWall()
var/old_icon = icon_state
var/turf/simulated/wall/S = new /turf/simulated/wall( locate(src.x, src.y, src.z) )
S.icon_old = old_icon
S.opacity = 0
S.sd_NewOpacity(1)
return S
/turf/proc/ReplaceWithRWall()
var/old_icon = icon_state
var/turf/simulated/wall/r_wall/S = new /turf/simulated/wall/r_wall( locate(src.x, src.y, src.z) )
S.icon_old = old_icon
S.opacity = 0
S.sd_NewOpacity(1)
return S
/turf/simulated/wall/New()
..()
/turf/simulated/wall/proc/dismantle_wall(devastated=0, explode=0)
if(istype(src,/turf/simulated/wall/r_wall))
if(!devastated)
playsound(src.loc, 'Welder.ogg', 100, 1)
new /obj/structure/girder/reinforced(src)
new /obj/item/stack/sheet/r_metal( src )
else
new /obj/item/stack/sheet/metal( src )
new /obj/item/stack/sheet/metal( src )
new /obj/item/stack/sheet/r_metal( src )
else
if(!devastated)
playsound(src.loc, 'Welder.ogg', 100, 1)
new /obj/structure/girder(src)
new /obj/item/stack/sheet/metal( src )
new /obj/item/stack/sheet/metal( src )
else
new /obj/item/stack/sheet/metal( src )
new /obj/item/stack/sheet/metal( src )
new /obj/item/stack/sheet/metal( src )
ReplaceWithFloor(explode)
/turf/simulated/wall/examine()
set src in oview(1)
usr << "It looks like a regular wall."
return
/turf/simulated/wall/ex_act(severity)
switch(severity)
if(1.0)
//SN src = null
src.ReplaceWithSpace()
del(src)
return
if(2.0)
if (prob(50))
dismantle_wall(0,1)
else
dismantle_wall(1,1)
if(3.0)
var/proba
if (istype(src, /turf/simulated/wall/r_wall))
proba = 15
else
proba = 40
if (prob(proba))
dismantle_wall(0,1)
else
return
/turf/simulated/wall/blob_act()
if(prob(50))
dismantle_wall()
/turf/simulated/wall/attack_paw(mob/user as mob)
if ((user.mutations & HULK))
if (prob(40))
usr << text("\blue You smash through the wall.")
dismantle_wall(1)
return
else
usr << text("\blue You punch the wall.")
return
return src.attack_hand(user)
/turf/simulated/wall/attack_hand(mob/user as mob)
if ((user.mutations & HULK))
if (prob(40))
usr << text("\blue You smash through the wall.")
dismantle_wall(1)
return
else
usr << text("\blue You punch the wall.")
return
user << "\blue You push the wall but nothing happens!"
playsound(src.loc, 'Genhit.ogg', 25, 1)
src.add_fingerprint(user)
return
/turf/simulated/wall/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey")
usr << "\red You don't have the dexterity to do this!"
return
if (istype(W, /obj/item/weapon/weldingtool) && W:welding)
var/turf/T = get_turf(user)
if (!( istype(T, /turf) ))
return
if (thermite)
var/obj/effect/overlay/O = new/obj/effect/overlay( src )
O.name = "Thermite"
O.desc = "Looks hot."
O.icon = 'fire.dmi'
O.icon_state = "2"
O.anchored = 1
O.density = 1
O.layer = 5
var/turf/simulated/floor/F = ReplaceWithFloor()
F.burn_tile()
F.icon_state = "wall_thermite"
user << "\red The thermite melts the wall."
spawn(100) del(O)
F.sd_LumReset()
return
if (W:remove_fuel(0,user))
W:welding = 2
user << "\blue Now disassembling the outer wall plating."
playsound(src.loc, 'Welder.ogg', 100, 1)
sleep(100)
if (istype(src, /turf/simulated/wall))
if ((get_turf(user) == T && user.equipped() == W))
user << "\blue You disassembled the outer wall plating."
dismantle_wall()
W:welding = 1
else
user << "\blue You need more welding fuel to complete this task."
return
else if (istype(W, /obj/item/weapon/pickaxe/plasmacutter))
var/turf/T = user.loc
if (!( istype(T, /turf) ))
return
if (thermite)
var/obj/effect/overlay/O = new/obj/effect/overlay( src )
O.name = "Thermite"
O.desc = "Looks hot."
O.icon = 'fire.dmi'
O.icon_state = "2"
O.anchored = 1
O.density = 1
O.layer = 5
var/turf/simulated/floor/F = ReplaceWithFloor()
F.burn_tile()
F.icon_state = "wall_thermite"
user << "\red The thermite melts the wall."
spawn(100) del(O)
F.sd_LumReset()
return
else
user << "\blue Now disassembling the outer wall plating."
playsound(src.loc, 'Welder.ogg', 100, 1)
sleep(60)
if (istype(src, /turf/simulated/wall))
if ((get_turf(user) == T && user.equipped() == W))
user << "\blue You disassembled the outer wall plating."
dismantle_wall()
for(var/mob/O in viewers(user, 5))
O.show_message(text("\blue The wall was sliced apart by []!", user), 1, text("\red You hear metal being sliced apart."), 2)
return
else if(istype(W, /obj/item/weapon/pickaxe/diamonddrill))
var/turf/T = user.loc
user << "\blue Now drilling through wall."
sleep(60)
if ((user.loc == T && user.equipped() == W))
dismantle_wall(1)
for(var/mob/O in viewers(user, 5))
O.show_message(text("\blue The wall was drilled apart by []!", user), 1, text("\red You hear metal being drilled appart."), 2)
return
else if(istype(W, /obj/item/weapon/melee/energy/blade))
var/turf/T = user.loc
user << "\blue Now slicing through wall."
W:spark_system.start()
playsound(src.loc, "sparks", 50, 1)
sleep(70)
if ((user.loc == T && user.equipped() == W))
W:spark_system.start()
playsound(src.loc, "sparks", 50, 1)
playsound(src.loc, 'blade1.ogg', 50, 1)
dismantle_wall(1)
for(var/mob/O in viewers(user, 5))
O.show_message(text("\blue The wall was sliced apart by []!", user), 1, text("\red You hear metal being sliced and sparks flying."), 2)
return
else if(istype(W,/obj/item/apc_frame))
var/obj/item/apc_frame/AH = W
AH.try_build(src)
else
return attack_hand(user)
return
/turf/simulated/wall/r_wall/attackby(obj/item/W as obj, mob/user as mob)
if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey")
usr << "\red You don't have the dexterity to do this!"
return
if (istype(W, /obj/item/weapon/weldingtool) && W:welding)
W:eyecheck(user)
var/turf/T = user.loc
if (!( istype(T, /turf) ))
return
if (thermite)
var/obj/effect/overlay/O = new/obj/effect/overlay( src )
O.name = "Thermite"
O.desc = "Looks hot."
O.icon = 'fire.dmi'
O.icon_state = "2"
O.anchored = 1
O.density = 1
O.layer = 5
var/turf/simulated/floor/F = ReplaceWithFloor()
F.burn_tile()
F.icon_state = "wall_thermite"
user << "\red The thermite melts the wall."
spawn(100) del(O)
F.sd_LumReset()
return
if (src.d_state == 2)
W:welding = 2
user << "\blue Slicing metal cover."
playsound(src.loc, 'Welder.ogg', 100, 1)
sleep(60)
if ((user.loc == T && user.equipped() == W))
src.d_state = 3
user << "\blue You removed the metal cover."
W:welding = 1
else if (src.d_state == 5)
W:welding = 2
user << "\blue Removing support rods."
playsound(src.loc, 'Welder.ogg', 100, 1)
sleep(100)
if ((user.loc == T && user.equipped() == W))
src.d_state = 6
new /obj/item/stack/rods( src )
user << "\blue You removed the support rods."
W:welding = 1
else if(istype(W, /obj/item/weapon/pickaxe/plasmacutter))
var/turf/T = user.loc
if (!( istype(T, /turf) ))
return
if (thermite)
var/obj/effect/overlay/O = new/obj/effect/overlay( src )
O.name = "Thermite"
O.desc = "Looks hot."
O.icon = 'fire.dmi'
O.icon_state = "2"
O.anchored = 1
O.density = 1
O.layer = 5
var/turf/simulated/floor/F = ReplaceWithFloor()
F.burn_tile()
F.icon_state = "wall_thermite"
user << "\red The thermite melts the wall."
spawn(100) del(O)
F.sd_LumReset()
return
if (src.d_state == 2)
user << "\blue Slicing metal cover."
playsound(src.loc, 'Welder.ogg', 100, 1)
sleep(40)
if ((user.loc == T && user.equipped() == W))
src.d_state = 3
user << "\blue You removed the metal cover."
else if (src.d_state == 5)
user << "\blue Removing support rods."
playsound(src.loc, 'Welder.ogg', 100, 1)
sleep(70)
if ((user.loc == T && user.equipped() == W))
src.d_state = 6
new /obj/item/stack/rods( src )
user << "\blue You removed the support rods."
else if(istype(W, /obj/item/weapon/melee/energy/blade))
user << "\blue This wall is too thick to slice through. You will need to find a different path."
return
else if (istype(W, /obj/item/weapon/wrench))
if (src.d_state == 4)
var/turf/T = user.loc
user << "\blue Detaching support rods."
playsound(src.loc, 'Ratchet.ogg', 100, 1)
sleep(40)
if ((user.loc == T && user.equipped() == W))
src.d_state = 5
user << "\blue You detach the support rods."
else if (istype(W, /obj/item/weapon/wirecutters))
if (src.d_state == 0)
playsound(src.loc, 'Wirecutter.ogg', 100, 1)
src.d_state = 1
new /obj/item/stack/rods( src )
else if (istype(W, /obj/item/weapon/screwdriver))
if (src.d_state == 1)
var/turf/T = user.loc
playsound(src.loc, 'Screwdriver.ogg', 100, 1)
user << "\blue Removing support lines."
sleep(40)
if ((user.loc == T && user.equipped() == W))
src.d_state = 2
user << "\blue You removed the support lines."
else if (istype(W, /obj/item/weapon/crowbar))
if (src.d_state == 3)
var/turf/T = user.loc
user << "\blue Prying cover off."
playsound(src.loc, 'Crowbar.ogg', 100, 1)
sleep(100)
if ((user.loc == T && user.equipped() == W))
src.d_state = 4
user << "\blue You removed the cover."
else if (src.d_state == 6)
var/turf/T = user.loc
user << "\blue Prying outer sheath off."
playsound(src.loc, 'Crowbar.ogg', 100, 1)
sleep(100)
if ((user.loc == T && user.equipped() == W))
user << "\blue You removed the outer sheath."
dismantle_wall()
return
else if (istype(W, /obj/item/weapon/pickaxe/diamonddrill))
var/turf/T = user.loc
user << "\blue You begin to drill though, this will take some time."
sleep(200)
if ((user.loc == T && user.equipped() == W))
user << "\blue Your drill tears though the reinforced plating."
dismantle_wall()
return
else if ((istype(W, /obj/item/stack/sheet/metal)) && (src.d_state))
var/turf/T = user.loc
user << "\blue Repairing wall."
sleep(100)
if ((user.loc == T && user.equipped() == W))
src.d_state = 0
src.icon_state = initial(src.icon_state)
user << "\blue You repaired the wall."
if (W:amount > 1)
W:amount--
else
del(W)
if(istype(W,/obj/item/apc_frame))
var/obj/item/apc_frame/AH = W
AH.try_build(src)
return
if(src.d_state > 0)
src.icon_state = "r_wall-[d_state]"
else
return attack_hand(user)
return
/turf/simulated/wall/meteorhit(obj/M as obj)
if (M.icon_state == "flaming")
dismantle_wall()
return 0
//This is so damaged or burnt tiles or platings don't get remembered as the default tile
var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3","damaged4",
"damaged5","panelscorched","floorscorched1","floorscorched2","platingdmg1","platingdmg2",
"platingdmg3","plating","light_on","light_on_flicker1","light_on_flicker2",
"light_on_clicker3","light_on_clicker4","light_on_clicker5","light_broken",
"light_on_broken","light_off","wall_thermite","grass1","grass2","grass3","grass4",
"asteroid","asteroid_dug",
"asteroid0","asteroid1","asteroid2","asteroid3","asteroid4",
"asteroid5","asteroid6","asteroid7","asteroid8",
"burning","oldburning","light-on-r","light-on-y","light-on-g","light-on-b")
var/list/plating_icons = list("plating","platingdmg1","platingdmg2","platingdmg3","asteroid","asteroid_dug")
/turf/simulated/floor
//Note to coders, the 'intact' var can no longer be used to determine if the floor is a plating or not.
//Use the is_plating(), is_sttel_floor() and is_light_floor() procs instead. --Errorage
name = "floor"
icon = 'floors.dmi'
icon_state = "floor"
var/icon_regular_floor = "floor" //used to remember what icon the tile should have by default
var/icon_plating = "plating"
thermal_conductivity = 0.040
heat_capacity = 10000
var/broken = 0
var/burnt = 0
var/obj/item/stack/tile/floor_tile = new/obj/item/stack/tile/steel
airless
icon_state = "floor"
name = "airless floor"
oxygen = 0.01
nitrogen = 0.01
temperature = TCMB
New()
..()
name = "floor"
light
name = "Light floor"
luminosity = 5
icon_state = "light_on"
floor_tile = new/obj/item/stack/tile/light
New()
floor_tile.New() //I guess New() isn't run on objects spawned without the definition of a turf to house them, ah well.
var/n = name //just in case commands rename it in the ..() call
..()
spawn(4)
update_icon()
name = n
grass
name = "Grass patch"
icon_state = "grass1"
floor_tile = new/obj/item/stack/tile/grass
New()
floor_tile.New() //I guess New() isn't run on objects spawned without the definition of a turf to house them, ah well.
icon_state = "grass[pick("1","2","3","4")]"
..()
spawn(4)
update_icon()
for(var/direction in cardinal)
if(istype(get_step(src,direction),/turf/simulated/floor))
var/turf/simulated/floor/FF = get_step(src,direction)
FF.update_icon() //so siding get updated properly
/turf/simulated/floor/vault
icon_state = "rockvault"
New(location,type)
..()
icon_state = "[type]vault"
/turf/simulated/wall/vault
icon_state = "rockvault"
New(location,type)
..()
icon_state = "[type]vault"
/turf/simulated/floor/engine
name = "reinforced floor"
icon_state = "engine"
thermal_conductivity = 0.025
heat_capacity = 325000
/turf/simulated/floor/engine/n20
New()
..()
var/datum/gas_mixture/adding = new
var/datum/gas/sleeping_agent/trace_gas = new
trace_gas.moles = 2000
adding.trace_gases += trace_gas
adding.temperature = T20C
assume_air(adding)
/turf/simulated/floor/engine/vacuum
name = "vacuum floor"
icon_state = "engine"
oxygen = 0
nitrogen = 0.001
temperature = TCMB
/turf/simulated/floor/plating
name = "plating"
icon_state = "plating"
floor_tile = null
intact = 0
/turf/simulated/floor/plating/airless
icon_state = "plating"
name = "airless plating"
oxygen = 0.01
nitrogen = 0.01
temperature = TCMB
New()
..()
name = "plating"
/turf/simulated/floor/grid
icon = 'floors.dmi'
icon_state = "circuit"
/turf/simulated/floor/New()
..()
if(icon_state in icons_to_ignore_at_floor_init) //so damaged/burned tiles or plating icons aren't saved as the default
icon_regular_floor = "floor"
else
icon_regular_floor = icon_state
//turf/simulated/floor/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
// if ((istype(mover, /obj/machinery/vehicle) && !(src.burnt)))
// if (!( locate(/obj/machinery/mass_driver, src) ))
// return 0
// return ..()
/turf/simulated/floor/ex_act(severity)
//set src in oview(1)
switch(severity)
if(1.0)
src.ReplaceWithSpace()
if(2.0)
switch(pick(1,2;75,3))
if (1)
src.ReplaceWithLattice()
if(prob(33)) new /obj/item/stack/sheet/metal(src)
if(2)
src.ReplaceWithSpace()
if(3)
if(prob(80))
src.break_tile_to_plating()
else
src.break_tile()
src.hotspot_expose(1000,CELL_VOLUME)
if(prob(33)) new /obj/item/stack/sheet/metal(src)
if(3.0)
if (prob(50))
src.break_tile()
src.hotspot_expose(1000,CELL_VOLUME)
return
/turf/simulated/floor/blob_act()
return
turf/simulated/floor/proc/update_icon()
if(is_steel_floor())
if(!broken && !burnt)
icon_state = icon_regular_floor
if(is_plating())
if(!broken && !burnt)
icon_state = icon_plating //Because asteroids are 'platings' too.
if(is_light_floor())
var/obj/item/stack/tile/light/T = floor_tile
if(T.on)
switch(T.state)
if(0)
icon_state = "light_on"
sd_SetLuminosity(5)
if(1)
var/num = pick("1","2","3","4")
icon_state = "light_on_flicker[num]"
sd_SetLuminosity(5)
if(2)
icon_state = "light_on_broken"
sd_SetLuminosity(5)
if(3)
icon_state = "light_off"
sd_SetLuminosity(0)
else
sd_SetLuminosity(0)
icon_state = "light_off"
if(is_grass_floor())
if(!broken && !burnt)
if(!(icon_state in list("grass1","grass2","grass3","grass4")))
icon_state = "grass[pick("1","2","3","4")]"
spawn(1)
if(istype(src,/turf/simulated/floor)) //Was throwing runtime errors due to a chance of it changing to space halfway through.
if(air)
update_visuals(air)
turf/simulated/floor/return_siding_icon_state()
..()
if(is_grass_floor())
var/dir_sum = 0
for(var/direction in cardinal)
var/turf/T = get_step(src,direction)
if(!(T.is_grass_floor()))
dir_sum += direction
if(dir_sum)
return "wood_siding[dir_sum]"
else
return 0
/turf/simulated/floor/attack_paw(mob/user as mob)
return src.attack_hand(user)
/turf/simulated/floor/attack_hand(mob/user as mob)
if (is_light_floor())
var/obj/item/stack/tile/light/T = floor_tile
T.on = !T.on
update_icon()
if ((!( user.canmove ) || user.restrained() || !( user.pulling )))
return
if (user.pulling.anchored)
return
if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1))
return
if (ismob(user.pulling))
var/mob/M = user.pulling
var/mob/t = M.pulling
M.pulling = null
step(user.pulling, get_dir(user.pulling.loc, src))
M.pulling = t
else
step(user.pulling, get_dir(user.pulling.loc, src))
return
/turf/simulated/floor/engine/attackby(obj/item/weapon/C as obj, mob/user as mob)
if(!C)
return
if(!user)
return
if(istype(C, /obj/item/weapon/wrench))
user << "\blue Removing rods..."
playsound(src.loc, 'Ratchet.ogg', 80, 1)
if(do_after(user, 30))
new /obj/item/stack/rods(src, 2)
ReplaceWithFloor()
var/turf/simulated/floor/F = src
F.make_plating()
return
/turf/simulated/floor/proc/gets_drilled()
return
/turf/simulated/floor/proc/break_tile_to_plating()
if(!is_plating())
make_plating()
break_tile()
/turf/simulated/floor/is_steel_floor()
if(istype(floor_tile,/obj/item/stack/tile/steel))
return 1
else
return 0
/turf/simulated/floor/is_light_floor()
if(istype(floor_tile,/obj/item/stack/tile/light))
return 1
else
return 0
/turf/simulated/floor/is_grass_floor()
if(istype(floor_tile,/obj/item/stack/tile/grass))
return 1
else
return 0
/turf/simulated/floor/is_plating()
if(!floor_tile)
return 1
return 0
/turf/simulated/floor/proc/break_tile()
if(istype(src,/turf/simulated/floor/engine)) return
if(istype(src,/turf/simulated/floor/mech_bay_recharge_floor))
src.ReplaceWithPlating()
if(broken) return
if(is_steel_floor())
src.icon_state = "damaged[pick(1,2,3,4,5)]"
broken = 1
else if(is_steel_floor())
src.icon_state = "light_broken"
broken = 1
else if(is_plating())
src.icon_state = "platingdmg[pick(1,2,3)]"
broken = 1
else if(is_grass_floor())
src.icon_state = "sand[pick("1","2","3")]"
broken = 1
/turf/simulated/floor/proc/burn_tile()
if(istype(src,/turf/simulated/floor/engine)) return
if(broken || burnt) return
if(is_steel_floor())
src.icon_state = "damaged[pick(1,2,3,4,5)]"
burnt = 1
else if(is_steel_floor())
src.icon_state = "floorscorched[pick(1,2)]"
burnt = 1
else if(is_plating())
src.icon_state = "panelscorched"
burnt = 1
else if(is_grass_floor())
src.icon_state = "sand[pick("1","2","3")]"
burnt = 1
//This proc will delete the floor_tile and the update_iocn() proc will then change the icon_state of the turf
//This proc auto corrects the grass tiles' siding.
/turf/simulated/floor/proc/make_plating()
if(istype(src,/turf/simulated/floor/engine)) return
if(is_grass_floor())
for(var/direction in cardinal)
if(istype(get_step(src,direction),/turf/simulated/floor))
var/turf/simulated/floor/FF = get_step(src,direction)
FF.update_icon() //so siding get updated properly
if(!floor_tile) return
del(floor_tile)
icon_plating = "plating"
sd_SetLuminosity(0)
floor_tile = null
intact = 0
broken = 0
burnt = 0
update_icon()
levelupdate()
//This proc will make the turf a steel floor tile. The expected argument is the tile to make the turf with
//If none is given it will make a new object. dropping or unequipping must be handled before or after calling
//this proc.
/turf/simulated/floor/proc/make_steel_floor(var/obj/item/stack/tile/steel/T = null)
broken = 0
burnt = 0
intact = 1
sd_SetLuminosity(0)
if(T)
if(istype(T,/obj/item/stack/tile/steel))
floor_tile = T
if (icon_regular_floor)
icon_state = icon_regular_floor
else
icon_state = "floor"
icon_regular_floor = icon_state
update_icon()
levelupdate()
return
//if you gave a valid parameter, it won't get thisf ar.
floor_tile = new/obj/item/stack/tile/steel
icon_state = "floor"
icon_regular_floor = icon_state
update_icon()
levelupdate()
//This proc will make the turf a light floor tile. The expected argument is the tile to make the turf with
//If none is given it will make a new object. dropping or unequipping must be handled before or after calling
//this proc.
/turf/simulated/floor/proc/make_light_floor(var/obj/item/stack/tile/light/T = null)
broken = 0
burnt = 0
intact = 1
if(T)
if(istype(T,/obj/item/stack/tile/light))
floor_tile = T
update_icon()
levelupdate()
return
//if you gave a valid parameter, it won't get thisf ar.
floor_tile = new/obj/item/stack/tile/light
update_icon()
levelupdate()
//This proc will make a turf into a grass patch. Fun eh? Insert the grass tile to be used as the argument
//If no argument is given a new one will be made.
/turf/simulated/floor/proc/make_grass_floor(var/obj/item/stack/tile/grass/T = null)
broken = 0
burnt = 0
intact = 1
if(T)
if(istype(T,/obj/item/stack/tile/grass))
floor_tile = T
update_icon()
levelupdate()
return
//if you gave a valid parameter, it won't get thisf ar.
floor_tile = new/obj/item/stack/tile/grass
update_icon()
levelupdate()
/turf/simulated/floor/attackby(obj/item/C as obj, mob/user as mob)
if(!C || !user)
return 0
if(istype(C,/obj/item/weapon/light/bulb)) //only for light tiles
if(is_light_floor())
var/obj/item/stack/tile/light/T = floor_tile
if(T.state)
user.u_equip(C)
del(C)
T.state = C //fixing it by bashing it with a light bulb, fun eh?
update_icon()
user << "\blue You replace the light bulb."
else
user << "\blue The lightbulb seems fine, no need to replace it."
if(istype(C, /obj/item/weapon/crowbar) && (!(is_plating())))
if(broken || burnt)
user << "\red You remove the broken plating."
else
user << "\red You remove the [floor_tile.name]."
new floor_tile.type(src)
make_plating()
playsound(src.loc, 'Crowbar.ogg', 80, 1)
return
if(istype(C, /obj/item/stack/rods))
if (is_plating())
if (C:amount >= 2)
user << "\blue Reinforcing the floor..."
if(do_after(user, 30) && C && C:amount >= 2 && is_plating())
ReplaceWithEngineFloor()
playsound(src.loc, 'Deconstruct.ogg', 80, 1)
C:use(2)
return
else
user << "\red You need more rods."
else
user << "\red You must remove the plating first."
return
if(istype(C, /obj/item/stack/tile))
if(is_plating())
var/obj/item/stack/tile/T = C
floor_tile = new T.type
intact = 1
if(istype(T,/obj/item/stack/tile/light))
floor_tile:state = T:state
floor_tile:on = T:on
if(istype(T,/obj/item/stack/tile/grass))
for(var/direction in cardinal)
if(istype(get_step(src,direction),/turf/simulated/floor))
var/turf/simulated/floor/FF = get_step(src,direction)
FF.update_icon() //so siding get updated properly
T.use(1)
update_icon()
levelupdate()
playsound(src.loc, 'Genhit.ogg', 50, 1)
else
user << "\blue This section already has a tile on it. Use a crowbar to pry it off."
if(istype(C, /obj/item/weapon/cable_coil))
if(is_plating())
var/obj/item/weapon/cable_coil/coil = C
coil.turf_place(src, user)
else
user << "\red You must remove the plating first."
if(istype(C, /obj/item/weapon/shovel))
if(is_grass_floor())
new /obj/item/weapon/ore/glass(src)
new /obj/item/weapon/ore/glass(src) //Make some sand if you shovel grass
user << "\blue You shovel the grass."
make_plating()
else
user << "\red You cannot shovel this."
/turf/unsimulated/floor/attack_paw(user as mob)
return src.attack_hand(user)
/turf/unsimulated/floor/attack_hand(var/mob/user as mob)
if ((!( user.canmove ) || user.restrained() || !( user.pulling )))
return
if (user.pulling.anchored)
return
if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1))
return
if (ismob(user.pulling))
var/mob/M = user.pulling
var/mob/t = M.pulling
M.pulling = null
step(user.pulling, get_dir(user.pulling.loc, src))
M.pulling = t
else
step(user.pulling, get_dir(user.pulling.loc, src))
return
// imported from space.dm
/turf/space/attack_paw(mob/user as mob)
return src.attack_hand(user)
/turf/space/attack_hand(mob/user as mob)
if ((user.restrained() || !( user.pulling )))
return
if (user.pulling.anchored)
return
if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1))
return
if (ismob(user.pulling))
var/mob/M = user.pulling
var/t = M.pulling
M.pulling = null
step(user.pulling, get_dir(user.pulling.loc, src))
M.pulling = t
else
step(user.pulling, get_dir(user.pulling.loc, src))
return
/turf/space/attackby(obj/item/C as obj, mob/user as mob)
if (istype(C, /obj/item/stack/rods))
user << "\blue Constructing support lattice ..."
playsound(src.loc, 'Genhit.ogg', 50, 1)
ReplaceWithLattice()
C:use(1)
return
if (istype(C, /obj/item/stack/tile/steel))
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
if(L)
del(L)
playsound(src.loc, 'Genhit.ogg', 50, 1)
C:build(src)
C:use(1)
return
else
user << "\red The plating is going to need some support."
return
// Ported from unstable r355
/turf/space/Entered(atom/movable/A as mob|obj)
..()
if ((!(A) || src != A.loc || istype(null, /obj/effect/beam))) return
inertial_drift(A)
if(ticker && ticker.mode)
if(ticker.mode.name == "nuclear emergency") return
else if(ticker.mode.name == "extended"||ticker.mode.name == "sandbox") Sandbox_Spacemove(A)
else
if (src.x <= 2)
if(istype(A, /obj/effect/meteor)||istype(A, /obj/effect/space_dust))
del(A)
return
var/move_to_z_str = pickweight(accessable_z_levels)
var/move_to_z = text2num(move_to_z_str)
if(!move_to_z)
return
A.z = move_to_z
A.x = world.maxx - 2
spawn (0)
if ((A && A.loc))
A.loc.Entered(A)
else if (A.x >= (world.maxx - 1))
if(istype(A, /obj/effect/meteor)||istype(A, /obj/effect/space_dust))
del(A)
return
var/move_to_z_str = pickweight(accessable_z_levels)
var/move_to_z = text2num(move_to_z_str)
if(!move_to_z)
return
A.z = move_to_z
A.x = 3
spawn (0)
if ((A && A.loc))
A.loc.Entered(A)
else if (src.y <= 2)
if(istype(A, /obj/effect/meteor)||istype(A, /obj/effect/space_dust))
del(A)
return
var/move_to_z_str = pickweight(accessable_z_levels)
var/move_to_z = text2num(move_to_z_str)
if(!move_to_z)
return
A.z = move_to_z
A.y = world.maxy - 2
spawn (0)
if ((A && A.loc))
A.loc.Entered(A)
else if (A.y >= (world.maxy - 1))
if(istype(A, /obj/effect/meteor)||istype(A, /obj/effect/space_dust))
del(A)
return
var/move_to_z_str = pickweight(accessable_z_levels)
var/move_to_z = text2num(move_to_z_str)
if(!move_to_z)
return
A.z = move_to_z
A.y = 3
spawn (0)
if ((A && A.loc))
A.loc.Entered(A)
/turf/space/proc/Sandbox_Spacemove(atom/movable/A as mob|obj)
var/cur_x
var/cur_y
var/next_x
var/next_y
var/target_z
var/list/y_arr
if(src.x <= 1)
if(istype(A, /obj/effect/meteor)||istype(A, /obj/effect/space_dust))
del(A)
return
var/list/cur_pos = src.get_global_map_pos()
if(!cur_pos) return
cur_x = cur_pos["x"]
cur_y = cur_pos["y"]
next_x = (--cur_x||global_map.len)
y_arr = global_map[next_x]
target_z = y_arr[cur_y]
/*
//debug
world << "Src.z = [src.z] in global map X = [cur_x], Y = [cur_y]"
world << "Target Z = [target_z]"
world << "Next X = [next_x]"
//debug
*/
if(target_z)
A.z = target_z
A.x = world.maxx - 2
spawn (0)
if ((A && A.loc))
A.loc.Entered(A)
else if (src.x >= world.maxx)
if(istype(A, /obj/effect/meteor))
del(A)
return
var/list/cur_pos = src.get_global_map_pos()
if(!cur_pos) return
cur_x = cur_pos["x"]
cur_y = cur_pos["y"]
next_x = (++cur_x > global_map.len ? 1 : cur_x)
y_arr = global_map[next_x]
target_z = y_arr[cur_y]
/*
//debug
world << "Src.z = [src.z] in global map X = [cur_x], Y = [cur_y]"
world << "Target Z = [target_z]"
world << "Next X = [next_x]"
//debug
*/
if(target_z)
A.z = target_z
A.x = 3
spawn (0)
if ((A && A.loc))
A.loc.Entered(A)
else if (src.y <= 1)
if(istype(A, /obj/effect/meteor))
del(A)
return
var/list/cur_pos = src.get_global_map_pos()
if(!cur_pos) return
cur_x = cur_pos["x"]
cur_y = cur_pos["y"]
y_arr = global_map[cur_x]
next_y = (--cur_y||y_arr.len)
target_z = y_arr[next_y]
/*
//debug
world << "Src.z = [src.z] in global map X = [cur_x], Y = [cur_y]"
world << "Next Y = [next_y]"
world << "Target Z = [target_z]"
//debug
*/
if(target_z)
A.z = target_z
A.y = world.maxy - 2
spawn (0)
if ((A && A.loc))
A.loc.Entered(A)
else if (src.y >= world.maxy)
if(istype(A, /obj/effect/meteor)||istype(A, /obj/effect/space_dust))
del(A)
return
var/list/cur_pos = src.get_global_map_pos()
if(!cur_pos) return
cur_x = cur_pos["x"]
cur_y = cur_pos["y"]
y_arr = global_map[cur_x]
next_y = (++cur_y > y_arr.len ? 1 : cur_y)
target_z = y_arr[next_y]
/*
//debug
world << "Src.z = [src.z] in global map X = [cur_x], Y = [cur_y]"
world << "Next Y = [next_y]"
world << "Target Z = [target_z]"
//debug
*/
if(target_z)
A.z = target_z
A.y = 3
spawn (0)
if ((A && A.loc))
A.loc.Entered(A)
return
/obj/effect/vaultspawner
var/maxX = 6
var/maxY = 6
var/minX = 2
var/minY = 2
/obj/effect/vaultspawner/New(turf/location as turf,lX = minX,uX = maxX,lY = minY,uY = maxY,var/type = null)
if(!type)
type = pick("sandstone","rock","alien")
var/lowBoundX = location.x
var/lowBoundY = location.y
var/hiBoundX = location.x + rand(lX,uX)
var/hiBoundY = location.y + rand(lY,uY)
var/z = location.z
for(var/i = lowBoundX,i<=hiBoundX,i++)
for(var/j = lowBoundY,j<=hiBoundY,j++)
if(i == lowBoundX || i == hiBoundX || j == lowBoundY || j == hiBoundY)
new /turf/simulated/wall/vault(locate(i,j,z),type)
else
new /turf/simulated/floor/vault(locate(i,j,z),type)
del(src)
/turf/proc/kill_creatures(mob/U = null)//Will kill people/creatures and damage mechs./N
//Useful to batch-add creatures to the list.
for(var/mob/living/M in src)
if(M==U) continue//Will not harm U. Since null != M, can be excluded to kill everyone.
spawn(0)
M.gib()
for(var/obj/mecha/M in src)//Mecha are not gibbed but are damaged.
spawn(0)
M.take_damage(100, "brute")
for(var/obj/effect/alien/facehugger/M in src)//These really need to be mobs.
spawn(0)
M.death()
for(var/obj/effect/critter/M in src)
spawn(0)
M.Die()
/turf/proc/Bless()
flags |= NOJAUNT
overlays += image('water.dmi',src,"holywater")