mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-01-03 22:13:24 +00:00
The state of maintenance is now randomly generated. This includes patches of oil, trash, spiderwebs, dirt, and so forth. Utilizes a system which makes it possible to apply custom turf initializers per area.
219 lines
5.4 KiB
Plaintext
219 lines
5.4 KiB
Plaintext
/turf
|
|
icon = 'icons/turf/floors.dmi'
|
|
level = 1
|
|
var/holy = 0
|
|
|
|
// Initial air contents (in moles)
|
|
var/oxygen = 0
|
|
var/carbon_dioxide = 0
|
|
var/nitrogen = 0
|
|
var/phoron = 0
|
|
|
|
//Properties for airtight tiles (/wall)
|
|
var/thermal_conductivity = 0.05
|
|
var/heat_capacity = 1
|
|
|
|
//Properties for both
|
|
var/temperature = T20C // Initial turf temperature.
|
|
var/blocks_air = 0 // Does this turf contain air/let air through?
|
|
|
|
// General properties.
|
|
var/icon_old = null
|
|
var/pathweight = 1 // How much does it cost to pathfind over this turf?
|
|
var/blessed = 0 // Has the turf been blessed?
|
|
var/dynamic_lighting = 1 // Does the turf use dynamic lighting?
|
|
|
|
var/list/decals
|
|
|
|
/turf/New()
|
|
..()
|
|
for(var/atom/movable/AM as mob|obj in src)
|
|
spawn( 0 )
|
|
src.Entered(AM)
|
|
return
|
|
turfs |= src
|
|
|
|
if(dynamic_lighting)
|
|
luminosity = 0
|
|
else
|
|
luminosity = 1
|
|
|
|
/turf/proc/update_icon()
|
|
return
|
|
|
|
/turf/Destroy()
|
|
turfs -= src
|
|
..()
|
|
|
|
/turf/ex_act(severity)
|
|
return 0
|
|
|
|
/turf/proc/is_space()
|
|
return 0
|
|
|
|
/turf/proc/is_intact()
|
|
return 0
|
|
|
|
/turf/attack_hand(mob/user)
|
|
if(!(user.canmove) || user.restrained() || !(user.pulling))
|
|
return 0
|
|
if(user.pulling.anchored || !isturf(user.pulling.loc))
|
|
return 0
|
|
if(user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1)
|
|
return 0
|
|
if(ismob(user.pulling))
|
|
var/mob/M = user.pulling
|
|
var/atom/movable/t = M.pulling
|
|
M.stop_pulling()
|
|
step(user.pulling, get_dir(user.pulling.loc, src))
|
|
M.start_pulling(t)
|
|
else
|
|
step(user.pulling, get_dir(user.pulling.loc, src))
|
|
return 1
|
|
|
|
/turf/Enter(atom/movable/mover as mob|obj, atom/forget as mob|obj|turf|area)
|
|
if(movement_disabled && usr.ckey != movement_disabled_exception)
|
|
usr << "<span class='warning'>Movement is admin-disabled.</span>" //This is to identify lag problems
|
|
return
|
|
|
|
..()
|
|
|
|
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!
|
|
|
|
var/const/enterloopsanity = 100
|
|
/turf/Entered(atom/atom as mob|obj)
|
|
|
|
if(movement_disabled)
|
|
usr << "<span class='warning'>Movement is admin-disabled.</span>" //This is to identify lag problems
|
|
return
|
|
..()
|
|
|
|
if(!istype(atom, /atom/movable))
|
|
return
|
|
|
|
var/atom/movable/A = atom
|
|
|
|
if(ismob(A))
|
|
var/mob/M = A
|
|
if(!M.lastarea)
|
|
M.lastarea = get_area(M.loc)
|
|
if(M.lastarea.has_gravity == 0)
|
|
inertial_drift(M)
|
|
else if(is_space())
|
|
M.inertia_dir = 0
|
|
M.make_floating(0)
|
|
..()
|
|
var/objects = 0
|
|
if(A && (A.flags & PROXMOVE))
|
|
for(var/atom/thing as mob|obj|turf|area in range(1))
|
|
if(objects > enterloopsanity) break
|
|
objects++
|
|
spawn(0)
|
|
A.HasProximity(thing, 1)
|
|
if ((thing && A) && (thing.flags & PROXMOVE))
|
|
thing.HasProximity(A, 1)
|
|
return
|
|
|
|
/turf/proc/adjacent_fire_act(turf/simulated/floor/source, temperature, volume)
|
|
return
|
|
|
|
/turf/proc/is_plating()
|
|
return 0
|
|
|
|
/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(1))
|
|
M.inertia_dir = 0
|
|
return
|
|
spawn(5)
|
|
if((M && !(M.anchored) && !(M.pulledby) && (M.loc == src)))
|
|
if(M.inertia_dir)
|
|
step(M, M.inertia_dir)
|
|
return
|
|
M.inertia_dir = M.last_move
|
|
step(M, M.inertia_dir)
|
|
return
|
|
|
|
/turf/proc/levelupdate()
|
|
for(var/obj/O in src)
|
|
O.hide(O.hides_under_flooring() && !is_plating())
|
|
|
|
/turf/proc/AdjacentTurfs()
|
|
var/L[] = new()
|
|
for(var/turf/simulated/t in oview(src,1))
|
|
if(!t.density)
|
|
if(!LinkBlocked(src, t) && !TurfBlockedNonWindow(t))
|
|
L.Add(t)
|
|
return L
|
|
|
|
/turf/proc/CardinalTurfs()
|
|
var/L[] = new()
|
|
for(var/turf/simulated/T in AdjacentTurfs())
|
|
if(T.x == src.x || T.y == src.y)
|
|
L.Add(T)
|
|
return L
|
|
|
|
/turf/proc/Distance(turf/t)
|
|
if(get_dist(src,t) == 1)
|
|
var/cost = (src.x - t.x) * (src.x - t.x) + (src.y - t.y) * (src.y - t.y)
|
|
cost *= (pathweight+t.pathweight)/2
|
|
return cost
|
|
else
|
|
return get_dist(src,t)
|
|
|
|
/turf/proc/AdjacentTurfsSpace()
|
|
var/L[] = new()
|
|
for(var/turf/t in oview(src,1))
|
|
if(!t.density)
|
|
if(!LinkBlocked(src, t) && !TurfBlockedNonWindow(t))
|
|
L.Add(t)
|
|
return L
|
|
|
|
/turf/proc/process()
|
|
return PROCESS_KILL
|
|
|
|
/turf/proc/contains_dense_objects()
|
|
if(density)
|
|
return 1
|
|
for(var/atom/A in src)
|
|
if(A.density && !(A.flags & ON_BORDER))
|
|
return 1
|
|
return 0
|