mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Move Xenoarcheology globals and initialization into a subsystem
* Move the global spawning_turfs lists from master_controller into SSxenoarch. Rename all references. * Move the call to SetupXenoarch from master_controller.setup() to SSxenoarch.Initialize() Put SSxenoarch init order near the end to match current behavior.
This commit is contained in:
@@ -29,3 +29,4 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G
|
||||
#define INIT_ORDER_SHUTTLES 3
|
||||
#define INIT_ORDER_LIGHTING 0
|
||||
#define INIT_ORDER_AIR -1
|
||||
#define INIT_ORDER_XENOARCH -20
|
||||
|
||||
@@ -37,7 +37,7 @@ datum/controller/game_controller/proc/setup()
|
||||
|
||||
setup_objects()
|
||||
// setupgenetics() Moved to SSatoms
|
||||
SetupXenoarch()
|
||||
// SetupXenoarch() - Moved to SSxenoarch
|
||||
|
||||
transfer_controller = new
|
||||
admin_notice("<span class='danger'>Initializations complete.</span>", R_DEBUG)
|
||||
|
||||
@@ -1,14 +1,35 @@
|
||||
/datum/controller/game_controller
|
||||
var/list/artifact_spawning_turfs = list()
|
||||
var/list/digsite_spawning_turfs = list()
|
||||
|
||||
#define XENOARCH_SPAWN_CHANCE 0.5
|
||||
#define DIGSITESIZE_LOWER 4
|
||||
#define DIGSITESIZE_UPPER 12
|
||||
#define ARTIFACTSPAWNNUM_LOWER 6
|
||||
#define ARTIFACTSPAWNNUM_UPPER 12
|
||||
|
||||
/datum/controller/game_controller/proc/SetupXenoarch()
|
||||
//
|
||||
// Xenoarch subsystem handles initialization of Xenoarcheaology artifacts and digsites.
|
||||
//
|
||||
SUBSYSTEM_DEF(xenoarch)
|
||||
name = "Xenoarch"
|
||||
init_order = INIT_ORDER_XENOARCH
|
||||
flags = SS_NO_FIRE
|
||||
var/list/artifact_spawning_turfs = list()
|
||||
var/list/digsite_spawning_turfs = list()
|
||||
|
||||
/datum/controller/subsystem/xenoarch/Initialize(timeofday)
|
||||
SetupXenoarch()
|
||||
..()
|
||||
|
||||
/datum/controller/subsystem/xenoarch/Recover()
|
||||
if (istype(SSxenoarch.artifact_spawning_turfs))
|
||||
artifact_spawning_turfs = SSxenoarch.artifact_spawning_turfs
|
||||
if (istype(SSxenoarch.digsite_spawning_turfs))
|
||||
digsite_spawning_turfs = SSxenoarch.digsite_spawning_turfs
|
||||
|
||||
/datum/controller/subsystem/xenoarch/stat_entry(msg)
|
||||
if (!Debug2)
|
||||
return // Only show up in stat panel if debugging is enabled.
|
||||
. = ..()
|
||||
|
||||
/datum/controller/subsystem/xenoarch/proc/SetupXenoarch()
|
||||
for(var/turf/simulated/mineral/M in world)
|
||||
if(!M.density)
|
||||
continue
|
||||
@@ -70,15 +70,15 @@
|
||||
artifact_distance = rand()
|
||||
artifact_id = container.artifact_find.artifact_id
|
||||
else
|
||||
if(master_controller) //Sanity check due to runtimes ~Z
|
||||
for(var/turf/simulated/mineral/T in master_controller.artifact_spawning_turfs)
|
||||
if(SSxenoarch) //Sanity check due to runtimes ~Z
|
||||
for(var/turf/simulated/mineral/T in SSxenoarch.artifact_spawning_turfs)
|
||||
if(T.artifact_find)
|
||||
var/cur_dist = get_dist(container, T) * 2
|
||||
if( (artifact_distance < 0 || cur_dist < artifact_distance))
|
||||
artifact_distance = cur_dist + rand() * 2 - 1
|
||||
artifact_id = T.artifact_find.artifact_id
|
||||
else
|
||||
master_controller.artifact_spawning_turfs.Remove(T)
|
||||
SSxenoarch.artifact_spawning_turfs.Remove(T)
|
||||
|
||||
/obj/item/device/core_sampler
|
||||
name = "core sampler"
|
||||
|
||||
@@ -57,8 +57,8 @@
|
||||
var/nearestSimpleTargetDist = -1
|
||||
var/turf/cur_turf = get_turf(src)
|
||||
|
||||
if(master_controller) //Sanity check due to runtimes ~Z
|
||||
for(var/A in master_controller.artifact_spawning_turfs)
|
||||
if(SSxenoarch) //Sanity check due to runtimes ~Z
|
||||
for(var/A in SSxenoarch.artifact_spawning_turfs)
|
||||
var/turf/simulated/mineral/T = A
|
||||
if(T.density && T.artifact_find)
|
||||
if(T.z == cur_turf.z)
|
||||
@@ -67,9 +67,9 @@
|
||||
nearestTargetDist = cur_dist + rand() * 2 - 1
|
||||
nearestTargetId = T.artifact_find.artifact_id
|
||||
else
|
||||
master_controller.artifact_spawning_turfs.Remove(T)
|
||||
SSxenoarch.artifact_spawning_turfs.Remove(T)
|
||||
|
||||
for(var/A in master_controller.digsite_spawning_turfs)
|
||||
for(var/A in SSxenoarch.digsite_spawning_turfs)
|
||||
var/turf/simulated/mineral/T = A
|
||||
if(T.density && T.finds && T.finds.len)
|
||||
if(T.z == cur_turf.z)
|
||||
@@ -77,7 +77,7 @@
|
||||
if(nearestSimpleTargetDist < 0 || cur_dist < nearestSimpleTargetDist)
|
||||
nearestSimpleTargetDist = cur_dist + rand() * 2 - 1
|
||||
else
|
||||
master_controller.digsite_spawning_turfs.Remove(T)
|
||||
SSxenoarch.digsite_spawning_turfs.Remove(T)
|
||||
|
||||
if(nearestTargetDist >= 0)
|
||||
user << "Exotic energy detected on wavelength '[nearestTargetId]' in a radius of [nearestTargetDist]m[nearestSimpleTargetDist > 0 ? "; small anomaly detected in a radius of [nearestSimpleTargetDist]m" : ""]"
|
||||
|
||||
@@ -180,6 +180,7 @@
|
||||
#include "code\controllers\subsystems\machines.dm"
|
||||
#include "code\controllers\subsystems\orbits.dm"
|
||||
#include "code\controllers\subsystems\shuttles.dm"
|
||||
#include "code\controllers\subsystems\xenoarch.dm"
|
||||
#include "code\datums\ai_law_sets.dm"
|
||||
#include "code\datums\ai_laws.dm"
|
||||
#include "code\datums\beam.dm"
|
||||
@@ -2316,7 +2317,6 @@
|
||||
#include "code\modules\xenoarcheaology\boulder.dm"
|
||||
#include "code\modules\xenoarcheaology\effect.dm"
|
||||
#include "code\modules\xenoarcheaology\manuals.dm"
|
||||
#include "code\modules\xenoarcheaology\master_controller.dm"
|
||||
#include "code\modules\xenoarcheaology\misc.dm"
|
||||
#include "code\modules\xenoarcheaology\sampling.dm"
|
||||
#include "code\modules\xenoarcheaology\artifacts\artifact.dm"
|
||||
|
||||
Reference in New Issue
Block a user