mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-08-23 05:06:50 +01:00
Adds Engine Randomization on Mapload!
Engines will now be randomly placed on mapload, maintainers will need to update the server config to enable the system. Add this to Config: \# Control which submaps are loaded for the Dynamic Engine system ENGINE_MAP Supermatter Engine,Edison's Bane This will load either Supermatter or Tesla based on randomization. If you'd prefer to just stick with SM, remove "Edison's Bane" from the config file and leave in Supermatter Engine. The way this is done DOES require the engine load system to be used, but it should pave the way for more modular engines in the future! This also allows older maps to be loaded with hard-coded engines, if you comment out the line in config to disable it, it will skip engine loading. If there's any issues, refer to the relevant submaps to tweak 'em. <3 TL;DR - Supermatter is now changed to on-mapload, Tesla added as option for mapload engine start. Remove the "Edison's Bane" from config and put the entire line into your config to make the engine work now. :blep: Please merge this quickly, it will produce conflicts.
This commit is contained in:
@@ -215,6 +215,8 @@ var/list/gamemode_cache = list()
|
||||
var/python_path = "" //Path to the python executable. Defaults to "python" on windows and "/usr/bin/env python2" on unix
|
||||
var/use_lib_nudge = 0 //Use the C library nudge instead of the python nudge.
|
||||
var/use_overmap = 0
|
||||
|
||||
var/static/list/engine_map // Comma separated list of engines to choose from. Blank means fully random.
|
||||
|
||||
// Event settings
|
||||
var/expected_round_length = 3 * 60 * 60 * 10 // 3 hours
|
||||
@@ -784,6 +786,9 @@ var/list/gamemode_cache = list()
|
||||
|
||||
if("use_overmap")
|
||||
config.use_overmap = 1
|
||||
|
||||
if("engine_map")
|
||||
config.engine_map = splittext(value, ",")
|
||||
/*
|
||||
if("station_levels")
|
||||
using_map.station_levels = text2numlist(value, ";")
|
||||
|
||||
@@ -6,6 +6,12 @@ SUBSYSTEM_DEF(mapping)
|
||||
|
||||
var/list/map_templates = list()
|
||||
var/dmm_suite/maploader = null
|
||||
var/obj/effect/landmark/engine_loader/engine_loader
|
||||
var/list/shelter_templates = list()
|
||||
|
||||
/datum/controller/subsystem/mapping/Recover()
|
||||
flags |= SS_NO_INIT // Make extra sure we don't initialize twice.
|
||||
shelter_templates = SSmapping.shelter_templates
|
||||
|
||||
/datum/controller/subsystem/mapping/Initialize(timeofday)
|
||||
if(subsystem_initialized)
|
||||
@@ -17,7 +23,15 @@ SUBSYSTEM_DEF(mapping)
|
||||
if(config.generate_map)
|
||||
// Map-gen is still very specific to the map, however putting it here should ensure it loads in the correct order.
|
||||
using_map.perform_map_generation()
|
||||
|
||||
|
||||
loadEngine()
|
||||
// preloadShelterTemplates() // Re-enable this later once shelter capsules are ported upstream
|
||||
// Mining generation probably should be here too
|
||||
// TODO - Other stuff related to maps and areas could be moved here too. Look at /tg
|
||||
// Lateload Code related to Expedition areas.
|
||||
// if(using_map)
|
||||
// loadLateMaps()
|
||||
..()
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/load_map_templates()
|
||||
for(var/T in subtypesof(/datum/map_template))
|
||||
@@ -27,3 +41,85 @@ SUBSYSTEM_DEF(mapping)
|
||||
template = new T()
|
||||
map_templates[template.name] = template
|
||||
return TRUE
|
||||
|
||||
/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 //Don't let anything else happen for now
|
||||
// Actually load it
|
||||
chosen_type.load(T)
|
||||
|
||||
// Commenting out lateload at the moment, this will need to be enabled once Polaris adds lateload maps (Expedition areas offmap)
|
||||
/*
|
||||
/datum/controller/subsystem/mapping/proc/loadLateMaps()
|
||||
var/list/deffo_load = using_map.lateload_z_levels
|
||||
var/list/maybe_load = using_map.lateload_single_pick
|
||||
|
||||
for(var/list/maplist in deffo_load)
|
||||
if(!islist(maplist))
|
||||
error("Lateload Z level [maplist] is not a list! Must be in a list!")
|
||||
continue
|
||||
for(var/mapname in maplist)
|
||||
var/datum/map_template/MT = map_templates[mapname]
|
||||
if(!istype(MT))
|
||||
error("Lateload Z level \"[mapname]\" is not a valid map!")
|
||||
continue
|
||||
MT.load_new_z(centered = FALSE)
|
||||
CHECK_TICK
|
||||
|
||||
if(LAZYLEN(maybe_load))
|
||||
var/picklist = pick(maybe_load)
|
||||
|
||||
if(!picklist) //No lateload maps at all
|
||||
return
|
||||
|
||||
if(!islist(picklist)) //So you can have a 'chain' of z-levels that make up one away mission
|
||||
error("Randompick Z level [picklist] is not a list! Must be in a list!")
|
||||
return
|
||||
|
||||
for(var/map in picklist)
|
||||
var/datum/map_template/MT = map_templates[map]
|
||||
if(!istype(MT))
|
||||
error("Randompick Z level \"[map]\" is not a valid map!")
|
||||
else
|
||||
MT.load_new_z(centered = FALSE)
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/preloadShelterTemplates()
|
||||
for(var/item in subtypesof(/datum/map_template/shelter))
|
||||
var/datum/map_template/shelter/shelter_type = item
|
||||
if(!(initial(shelter_type.mappath)))
|
||||
continue
|
||||
var/datum/map_template/shelter/S = new shelter_type()
|
||||
|
||||
shelter_templates[S.shelter_id] = S
|
||||
*/
|
||||
|
||||
/datum/controller/subsystem/mapping/stat_entry(msg)
|
||||
if (!Debug2)
|
||||
return // Only show up in stat panel if debugging is enabled.
|
||||
. = ..()
|
||||
Reference in New Issue
Block a user