mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-29 08:11:11 +01:00
[MIRROR] Subsystem For Overmap Shuttle's Star Movement Effects (#10897)
Co-authored-by: Will <7099514+Willburd@users.noreply.github.com>
This commit is contained in:
co-authored by
Will
parent
311364da39
commit
614665210c
@@ -143,6 +143,7 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G
|
||||
#define INIT_ORDER_ATOMS 14
|
||||
#define INIT_ORDER_POIS 13
|
||||
#define INIT_ORDER_MACHINES 10
|
||||
#define INIT_ORDER_STARMOVER 4
|
||||
#define INIT_ORDER_SHUTTLES 3
|
||||
#define INIT_ORDER_TIMER 1
|
||||
#define INIT_ORDER_DEFAULT 0
|
||||
@@ -183,6 +184,7 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G
|
||||
#define FIRE_PRIORITY_PING 10
|
||||
#define FIRE_PRIORITY_SERVER_MAINT 10
|
||||
#define FIRE_PRIORITY_AI 10
|
||||
#define FIRE_PRIORITY_STARMOVER 11
|
||||
#define FIRE_PRIORITY_GARBAGE 15
|
||||
#define FIRE_PRIORITY_ASSETS 20
|
||||
#define FIRE_PRIORITY_POIS 20
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Handles the moving star effects behind overmap shuttles during travel.
|
||||
//
|
||||
SUBSYSTEM_DEF(starmover)
|
||||
name = "Shuttle Star Movement"
|
||||
init_order = INIT_ORDER_STARMOVER
|
||||
priority = FIRE_PRIORITY_STARMOVER
|
||||
wait = 1 // This needs to be done pretty quickly
|
||||
var/list/zqueue = list()
|
||||
var/list/current_movement = null
|
||||
//list used to track which zlevels are being 'moved' by the proc below
|
||||
var/list/moving_levels = list()
|
||||
var/list/currentrun = null
|
||||
var/current_direction = 0
|
||||
|
||||
/datum/controller/subsystem/starmover/Initialize()
|
||||
return SS_INIT_SUCCESS
|
||||
|
||||
#define CR_ZLEVEL 1
|
||||
#define CR_DIRECTION 2
|
||||
#define CR_TURFS 3
|
||||
|
||||
/datum/controller/subsystem/starmover/fire(resumed)
|
||||
// Get next in queue or dropout
|
||||
if(!resumed && !current_movement)
|
||||
if(!zqueue.len)
|
||||
return
|
||||
current_movement = zqueue[1]
|
||||
zqueue[1] = null
|
||||
zqueue -= null
|
||||
// Setup data
|
||||
var/zlevel = current_movement[CR_ZLEVEL]
|
||||
var/new_dir = current_movement[CR_DIRECTION]
|
||||
var/list/turf_list = current_movement[CR_TURFS]
|
||||
if(!turf_list.len || moving_levels["[zlevel]"] == new_dir)
|
||||
clear_movement_run()
|
||||
return
|
||||
moving_levels["[zlevel]"] = new_dir
|
||||
currentrun = turf_list
|
||||
|
||||
// Has a movement queued, process all turfs
|
||||
while(currentrun.len)
|
||||
var/turf/space/T = currentrun[currentrun.len]
|
||||
currentrun.len--
|
||||
if(istype(T))
|
||||
T.toggle_transit(current_movement[CR_DIRECTION])
|
||||
if(MC_TICK_CHECK)
|
||||
return
|
||||
clear_movement_run()
|
||||
|
||||
/datum/controller/subsystem/starmover/proc/clear_movement_run()
|
||||
current_movement.Cut()
|
||||
current_movement = null
|
||||
currentrun = null
|
||||
|
||||
/datum/controller/subsystem/starmover/stat_entry(msg)
|
||||
msg = "Q:[zqueue.len] C:[currentrun ? currentrun.len : "-"]"
|
||||
return ..()
|
||||
|
||||
/// Used to 'move' stars in spess. null direction stops movement
|
||||
/datum/controller/subsystem/starmover/proc/toggle_move_stars(zlevel, direction)
|
||||
if(!zlevel)
|
||||
return
|
||||
var/list/spaceturfs = block(locate(1, 1, zlevel), locate(world.maxx, world.maxy, zlevel))
|
||||
zqueue += list(list(zlevel,direction,spaceturfs))
|
||||
|
||||
#undef CR_ZLEVEL
|
||||
#undef CR_DIRECTION
|
||||
#undef CR_TURFS
|
||||
@@ -133,7 +133,7 @@
|
||||
else if(still)
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
for(var/zz in map_z)
|
||||
toggle_move_stars(zz)
|
||||
SSstarmover.toggle_move_stars(zz)
|
||||
if(last_sound + sound_cooldown >= world.time)
|
||||
return
|
||||
//VOREStation Add Start
|
||||
@@ -148,7 +148,7 @@
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
glide_size = WORLD_ICON_SIZE/max(DS2TICKS(SSprocessing.wait), 1) //Down to whatever decimal
|
||||
for(var/zz in map_z)
|
||||
toggle_move_stars(zz, fore_dir)
|
||||
SSstarmover.toggle_move_stars(zz, fore_dir)
|
||||
if(last_sound + sound_cooldown >= world.time)
|
||||
return
|
||||
//VOREStation Add Start
|
||||
|
||||
@@ -89,20 +89,3 @@ GLOBAL_LIST_EMPTY(map_sectors)
|
||||
..()
|
||||
if(istype(O, /obj/effect/overmap/visitable/ship))
|
||||
GLOB.overmap_event_handler.on_turf_exited(src, O, newloc)
|
||||
|
||||
//list used to track which zlevels are being 'moved' by the proc below
|
||||
var/list/moving_levels = list()
|
||||
//Proc to 'move' stars in spess
|
||||
//yes it looks ugly, but it should only fire when state actually change.
|
||||
//null direction stops movement
|
||||
/proc/toggle_move_stars(zlevel, direction)
|
||||
if(!zlevel)
|
||||
return
|
||||
|
||||
if (moving_levels["[zlevel]"] != direction)
|
||||
moving_levels["[zlevel]"] = direction
|
||||
|
||||
var/list/spaceturfs = block(locate(1, 1, zlevel), locate(world.maxx, world.maxy, zlevel))
|
||||
for(var/turf/space/T in spaceturfs)
|
||||
T.toggle_transit(direction)
|
||||
CHECK_TICK
|
||||
|
||||
@@ -443,6 +443,7 @@
|
||||
#include "code\controllers\subsystems\speech_controller.dm"
|
||||
#include "code\controllers\subsystems\sqlite.dm"
|
||||
#include "code\controllers\subsystems\SSvote.dm"
|
||||
#include "code\controllers\subsystems\starmover.dm"
|
||||
#include "code\controllers\subsystems\statpanel.dm"
|
||||
#include "code\controllers\subsystems\sun.dm"
|
||||
#include "code\controllers\subsystems\supply.dm"
|
||||
|
||||
Reference in New Issue
Block a user