mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-27 06:00:23 +01:00
Add checks to allow Tesla to fully dissipate once it runs out of energy.
This commit is contained in:
@@ -15,5 +15,6 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G
|
||||
// Subsystem init_order, from highest priority to lowest priority
|
||||
// Subsystems shutdown in the reverse of the order they initialize in
|
||||
// The numbers just define the ordering, they are meaningless otherwise.
|
||||
#define INIT_ORDER_MAPPING 20 // VOREStation Edit
|
||||
#define INIT_ORDER_MACHINES 10
|
||||
#define INIT_ORDER_LIGHTING 0
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
// Lets read our settings from the configuration file on startup too!
|
||||
//
|
||||
|
||||
/datum/configuration
|
||||
var/list/engine_map // Comma separated list of engines to choose from. Blank means fully random.
|
||||
|
||||
/hook/startup/proc/read_vs_config()
|
||||
var/list/Lines = file2list("config/config.txt")
|
||||
for(var/t in Lines)
|
||||
@@ -31,6 +34,8 @@
|
||||
config.chat_webhook_url = value
|
||||
if ("chat_webhook_key")
|
||||
config.chat_webhook_key = value
|
||||
if ("engine_map")
|
||||
config.engine_map = splittext(value, ",")
|
||||
if ("fax_export_dir")
|
||||
config.fax_export_dir = value
|
||||
if ("items_survive_digestion")
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// Mapping subsystem handles initialization of random map elements at server start
|
||||
// On VOREStation that means loading our random roundstart engine!
|
||||
//
|
||||
SUBSYSTEM_DEF(mapping)
|
||||
name = "Mapping"
|
||||
init_order = INIT_ORDER_MAPPING
|
||||
flags = SS_NO_FIRE
|
||||
|
||||
var/obj/effect/landmark/engine_loader/engine_loader
|
||||
|
||||
/datum/controller/subsystem/mapping/Recover()
|
||||
flags |= SS_NO_INIT // Make extra sure we don't initialize twice.
|
||||
|
||||
/datum/controller/subsystem/mapping/Initialize(timeofday)
|
||||
loadEngine()
|
||||
// TODO - This probably should be here
|
||||
// // Pick a random away mission.
|
||||
// createRandomZlevel()
|
||||
// Mining generation probably should be here too
|
||||
// TODO - Other stuff related to maps and areas could be moved here too. Look at /tg
|
||||
..()
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/loadEngine()
|
||||
if(!engine_loader)
|
||||
return // Seems this map doesn't need an engine loaded.
|
||||
|
||||
var/turf/T = get_turf(engine_loader)
|
||||
if(!isturf(T))
|
||||
to_world_log("[log_info_line(engine_loader)] not on a turf! Cannot place engine template.")
|
||||
return
|
||||
|
||||
// Choose an engine type
|
||||
var/datum/map_template/engine/chosen_type = null
|
||||
if (LAZYLEN(config.engine_map))
|
||||
var/chosen_name = pick(config.engine_map)
|
||||
chosen_type = map_templates[chosen_name]
|
||||
if(!istype(chosen_type))
|
||||
error("Configured engine map [chosen_name] is not a valid engine map name!")
|
||||
if(!istype(chosen_type))
|
||||
var/list/engine_types = list()
|
||||
for(var/map in map_templates)
|
||||
var/datum/map_template/engine/MT = map_templates[map]
|
||||
if(istype(MT))
|
||||
engine_types += MT
|
||||
chosen_type = pick(engine_types)
|
||||
to_world_log("Chose Engine Map: [chosen_type.name]")
|
||||
admin_notice("<span class='danger'>Chose Engine Map: [chosen_type.name]</span>", R_DEBUG)
|
||||
|
||||
// Annihilate movable atoms
|
||||
engine_loader.annihilate_bounds()
|
||||
CHECK_TICK
|
||||
// Actually load it
|
||||
chosen_type.load(T)
|
||||
|
||||
/datum/controller/subsystem/mapping/stat_entry(msg)
|
||||
if (!Debug2)
|
||||
return // Only show up in stat panel if debugging is enabled.
|
||||
. = ..()
|
||||
@@ -244,3 +244,7 @@
|
||||
|
||||
/area/maintenance/substation/outpost
|
||||
name = "Research Outpost Substation"
|
||||
|
||||
/area/engineering/engine_gas
|
||||
name = "\improper Engine Gas Storage"
|
||||
icon_state = "engine_waste"
|
||||
|
||||
@@ -55,7 +55,8 @@
|
||||
/obj/singularity/energy_ball/process(var/wait = 20)
|
||||
set waitfor = FALSE
|
||||
if(!orbiting)
|
||||
handle_energy()
|
||||
if (handle_energy())
|
||||
return
|
||||
|
||||
move_the_basket_ball(max(wait - 5, 4 + orbiting_balls.len * 1.5))
|
||||
|
||||
@@ -91,6 +92,11 @@
|
||||
sleep(1) // So movement is smooth
|
||||
|
||||
/obj/singularity/energy_ball/proc/handle_energy()
|
||||
if (energy <= 0)
|
||||
investigate_log("collapsed.", I_SINGULO)
|
||||
qdel(src)
|
||||
return TRUE
|
||||
|
||||
if(energy >= energy_to_raise)
|
||||
energy_to_lower = energy_to_raise - 20
|
||||
energy_to_raise = energy_to_raise * 1.25
|
||||
|
||||
Reference in New Issue
Block a user