Files
Yogstation/code/controllers/subsystem/parallax.dm
Qustinnus 2c3e250fde Lavaland / Lavaplanet is now visible from space (#36419)
* adds lava planet

* fixes oldcode

* im dumb

* Random position

* UHHHH, I'll take a diet lavaplanet please, no ice.

* fixes init
2018-03-16 19:30:44 +01:00

45 lines
1.1 KiB
Plaintext

SUBSYSTEM_DEF(parallax)
name = "Parallax"
wait = 2
flags = SS_POST_FIRE_TIMING | SS_BACKGROUND
priority = FIRE_PRIORITY_PARALLAX
runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT
var/list/currentrun
var/planet_x_offset = 128
var/planet_y_offset = 128
/datum/controller/subsystem/parallax/Initialize(timeofday)
. = ..()
planet_y_offset = rand(100, 160)
planet_x_offset = rand(100, 160)
/datum/controller/subsystem/parallax/fire(resumed = 0)
if (!resumed)
src.currentrun = GLOB.clients.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(length(currentrun))
var/client/C = currentrun[currentrun.len]
currentrun.len--
if (!C || !C.eye)
if (MC_TICK_CHECK)
return
continue
var/atom/movable/A = C.eye
if(!istype(A))
continue
for (A; isloc(A.loc) && !isturf(A.loc); A = A.loc);
if(A != C.movingmob)
if(C.movingmob != null)
C.movingmob.client_mobs_in_contents -= C.mob
UNSETEMPTY(C.movingmob.client_mobs_in_contents)
LAZYINITLIST(A.client_mobs_in_contents)
A.client_mobs_in_contents += C.mob
C.movingmob = A
if (MC_TICK_CHECK)
return
currentrun = null