mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-27 23:29:10 +01:00
Merge branch 'release' of https://github.com/VOREStation/VOREStation into izac
This commit is contained in:
+1129
-1124
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
/datum/configuration
|
||||
var/static/list/engine_map // Comma separated list of engines to choose from. Blank means fully random.
|
||||
var/static/time_off = FALSE
|
||||
var/static/pto_job_change = FALSE
|
||||
var/static/limit_interns = -1 //Unlimited by default
|
||||
@@ -42,8 +41,6 @@
|
||||
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")
|
||||
|
||||
@@ -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() // VOREStation EDIT: Re-enable Shelter Capsules
|
||||
// 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) // VOREStation Edit: Re-enable this.
|
||||
loadLateMaps()
|
||||
..()
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/load_map_templates()
|
||||
for(var/T in subtypesof(/datum/map_template))
|
||||
@@ -27,3 +41,84 @@ 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)
|
||||
|
||||
// VOREStation Edit Start: Enable This
|
||||
/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
|
||||
// VOREStation Edit End: Re-enable this
|
||||
|
||||
/datum/controller/subsystem/mapping/stat_entry(msg)
|
||||
if (!Debug2)
|
||||
return // Only show up in stat panel if debugging is enabled.
|
||||
. = ..()
|
||||
@@ -1,126 +0,0 @@
|
||||
//
|
||||
// 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/list/map_templates = list()
|
||||
var/dmm_suite/maploader = null
|
||||
var/obj/effect/landmark/engine_loader/engine_loader
|
||||
var/obj/effect/landmark/engine_loader_pickable/engine_loader_pickable
|
||||
|
||||
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)
|
||||
return
|
||||
world.max_z_changed() // This is to set up the player z-level list, maxz hasn't actually changed (probably)
|
||||
maploader = new()
|
||||
load_map_templates()
|
||||
|
||||
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()
|
||||
// Mining generation probably should be here too
|
||||
// TODO - Other stuff related to maps and areas could be moved here too. Look at /tg
|
||||
if(using_map)
|
||||
loadLateMaps()
|
||||
..()
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/load_map_templates()
|
||||
for(var/T in subtypesof(/datum/map_template))
|
||||
var/datum/map_template/template = T
|
||||
if(!(initial(template.mappath))) // If it's missing the actual path its probably a base type or being used for inheritence.
|
||||
continue
|
||||
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)
|
||||
|
||||
/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.
|
||||
. = ..()
|
||||
@@ -0,0 +1,160 @@
|
||||
#define PLANT_TICK_TIME 75 // Number of ticks between the plant processor cycling.
|
||||
|
||||
SUBSYSTEM_DEF(plants)
|
||||
name = "Plants"
|
||||
init_order = INIT_ORDER_PLANTS
|
||||
priority = FIRE_PRIORITY_PLANTS
|
||||
wait = PLANT_TICK_TIME
|
||||
|
||||
var/list/product_descs = list() // Stores generated fruit descs.
|
||||
var/list/seeds = list() // All seed data stored here.
|
||||
var/list/gene_tag_masks = list() // Gene obfuscation for delicious trial and error goodness.
|
||||
var/list/plant_icon_cache = list() // Stores images of growth, fruits and seeds.
|
||||
var/list/plant_sprites = list() // List of all growth sprites plus number of growth stages.
|
||||
var/list/accessible_plant_sprites = list() // List of all plant sprites allowed to appear in random generation.
|
||||
var/list/plant_product_sprites = list() // List of all harvested product sprites.
|
||||
var/list/accessible_product_sprites = list() // List of all product sprites allowed to appear in random generation.
|
||||
var/list/gene_masked_list = list() // Stored gene masked list, rather than recreating it when needed.
|
||||
var/list/plant_gene_datums = list() // Stored datum versions of the gene masked list.
|
||||
|
||||
// To be clear, the only thing this processes are spreading plants
|
||||
// Hydro trays and growing food normally just chill in SSobj
|
||||
var/list/processing = list()
|
||||
var/list/currentrun = list()
|
||||
|
||||
/datum/controller/subsystem/plants/stat_entry()
|
||||
..("P:[processing.len]|S:[seeds.len]")
|
||||
|
||||
/datum/controller/subsystem/plants/Initialize(timeofday)
|
||||
setup()
|
||||
return ..()
|
||||
|
||||
// Predefined/roundstart varieties use a string key to make it
|
||||
// easier to grab the new variety when mutating. Post-roundstart
|
||||
// and mutant varieties use their uid converted to a string instead.
|
||||
// Looks like shit but it's sort of necessary.
|
||||
/datum/controller/subsystem/plants/proc/setup()
|
||||
// Build the icon lists.
|
||||
for(var/icostate in cached_icon_states('icons/obj/hydroponics_growing.dmi'))
|
||||
var/split = findtext(icostate,"-")
|
||||
if(!split)
|
||||
// invalid icon_state
|
||||
continue
|
||||
|
||||
var/ikey = copytext(icostate,(split+1))
|
||||
if(ikey == "dead")
|
||||
// don't count dead icons
|
||||
continue
|
||||
ikey = text2num(ikey)
|
||||
var/base = copytext(icostate,1,split)
|
||||
|
||||
if(!(plant_sprites[base]) || (plant_sprites[base]<ikey))
|
||||
plant_sprites[base] = ikey
|
||||
if(!(base in GLOB.forbidden_plant_growth_sprites))
|
||||
accessible_plant_sprites[base] = ikey
|
||||
|
||||
for(var/icostate in cached_icon_states('icons/obj/hydroponics_products.dmi'))
|
||||
var/split = findtext(icostate,"-")
|
||||
var/base = copytext(icostate,1,split)
|
||||
if(split)
|
||||
plant_product_sprites |= base
|
||||
if(!(base in GLOB.forbidden_plant_product_sprites))
|
||||
accessible_product_sprites |= base
|
||||
|
||||
// Populate the global seed datum list.
|
||||
for(var/type in typesof(/datum/seed)-/datum/seed)
|
||||
var/datum/seed/S = new type
|
||||
seeds[S.name] = S
|
||||
S.uid = "[seeds.len]"
|
||||
S.roundstart = 1
|
||||
|
||||
// Make sure any seed packets that were mapped in are updated
|
||||
// correctly (since the seed datums did not exist a tick ago).
|
||||
for(var/obj/item/seeds/S in GLOB.all_seed_packs)
|
||||
S.update_seed()
|
||||
|
||||
//Might as well mask the gene types while we're at it.
|
||||
var/list/gene_datums = decls_repository.decls_of_subtype(/decl/plantgene)
|
||||
var/list/used_masks = list()
|
||||
var/list/plant_traits = ALL_GENES
|
||||
while(plant_traits && plant_traits.len)
|
||||
var/gene_tag = pick(plant_traits)
|
||||
var/gene_mask = "[uppertext(num2hex(rand(0,255), 2))]"
|
||||
|
||||
while(gene_mask in used_masks)
|
||||
gene_mask = "[uppertext(num2hex(rand(0,255), 2))]"
|
||||
|
||||
var/decl/plantgene/G
|
||||
|
||||
for(var/D in gene_datums)
|
||||
var/decl/plantgene/P = gene_datums[D]
|
||||
if(gene_tag == P.gene_tag)
|
||||
G = P
|
||||
gene_datums -= D
|
||||
used_masks += gene_mask
|
||||
plant_traits -= gene_tag
|
||||
gene_tag_masks[gene_tag] = gene_mask
|
||||
plant_gene_datums[gene_mask] = G
|
||||
gene_masked_list.Add(list(list("tag" = gene_tag, "mask" = gene_mask)))
|
||||
|
||||
// Proc for creating a random seed type.
|
||||
/datum/controller/subsystem/plants/proc/create_random_seed(var/survive_on_station)
|
||||
var/datum/seed/seed = new()
|
||||
seed.randomize()
|
||||
seed.uid = SSplants.seeds.len + 1
|
||||
seed.name = "[seed.uid]"
|
||||
seeds[seed.name] = seed
|
||||
|
||||
if(survive_on_station)
|
||||
if(seed.consume_gasses)
|
||||
seed.consume_gasses["phoron"] = null
|
||||
seed.consume_gasses["carbon_dioxide"] = null
|
||||
if(seed.chems && !isnull(seed.chems["pacid"]))
|
||||
seed.chems["pacid"] = null // Eating through the hull will make these plants completely inviable, albeit very dangerous.
|
||||
seed.chems -= null // Setting to null does not actually remove the entry, which is weird.
|
||||
seed.set_trait(TRAIT_IDEAL_HEAT,293)
|
||||
seed.set_trait(TRAIT_HEAT_TOLERANCE,20)
|
||||
seed.set_trait(TRAIT_IDEAL_LIGHT,8)
|
||||
seed.set_trait(TRAIT_LIGHT_TOLERANCE,5)
|
||||
seed.set_trait(TRAIT_LOWKPA_TOLERANCE,25)
|
||||
seed.set_trait(TRAIT_HIGHKPA_TOLERANCE,200)
|
||||
return seed
|
||||
|
||||
/datum/controller/subsystem/plants/fire(resumed = 0)
|
||||
if(!resumed)
|
||||
src.currentrun = processing.Copy()
|
||||
|
||||
// Caching
|
||||
var/list/currentrun = src.currentrun
|
||||
|
||||
while(currentrun.len)
|
||||
var/obj/effect/plant/P = currentrun[currentrun.len]
|
||||
--currentrun.len
|
||||
if(!P || QDELETED(P))
|
||||
continue
|
||||
P.process()
|
||||
|
||||
if(MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
/datum/controller/subsystem/plants/proc/add_plant(var/obj/effect/plant/plant)
|
||||
processing |= plant
|
||||
|
||||
/datum/controller/subsystem/plants/proc/remove_plant(var/obj/effect/plant/plant)
|
||||
processing -= plant
|
||||
|
||||
|
||||
// Debug for testing seed genes.
|
||||
/client/proc/show_plant_genes()
|
||||
set category = "Debug"
|
||||
set name = "Show Plant Genes"
|
||||
set desc = "Prints the round's plant gene masks."
|
||||
|
||||
if(!holder) return
|
||||
|
||||
if(!SSplants || !SSplants.gene_tag_masks)
|
||||
to_chat(usr, "Gene masks not set.")
|
||||
return
|
||||
|
||||
for(var/mask in SSplants.gene_tag_masks)
|
||||
to_chat(usr, "[mask]: [SSplants.gene_tag_masks[mask]]")
|
||||
@@ -78,6 +78,7 @@ var/global/datum/controller/subsystem/ticker/ticker
|
||||
/datum/controller/subsystem/ticker/proc/pregame_welcome()
|
||||
to_world("<span class='boldannounce notice'><em>Welcome to the pregame lobby!</em></span>")
|
||||
to_world("<span class='boldannounce notice'>Please set up your character and select ready. The round will start in [pregame_timeleft] seconds.</span>")
|
||||
world << sound('sound/misc/server-ready.ogg', volume = 100)
|
||||
|
||||
// Called during GAME_STATE_PREGAME (RUNLEVEL_LOBBY)
|
||||
/datum/controller/subsystem/ticker/proc/pregame_tick()
|
||||
@@ -402,20 +403,23 @@ var/global/datum/controller/subsystem/ticker/ticker
|
||||
for(var/mob/new_player/player in player_list)
|
||||
if(player && player.ready && player.mind?.assigned_role)
|
||||
var/datum/job/J = SSjob.get_job(player.mind.assigned_role)
|
||||
|
||||
|
||||
// Snowflakey AI treatment
|
||||
if(J?.mob_type & JOB_SILICON_AI)
|
||||
player.close_spawn_windows()
|
||||
player.AIize(move = TRUE)
|
||||
continue
|
||||
|
||||
|
||||
// Ask their new_player mob to spawn them
|
||||
if(!player.spawn_checks_vr(player.mind.assigned_role)) continue //VOREStation Add
|
||||
var/mob/living/carbon/human/new_char = player.create_character()
|
||||
|
||||
|
||||
// Created their playable character, delete their /mob/new_player
|
||||
if(new_char)
|
||||
qdel(player)
|
||||
if(new_char.client)
|
||||
var/obj/screen/splash/S = new(new_char.client, TRUE)
|
||||
S.Fade(TRUE)
|
||||
|
||||
// If they're a carbon, they can get manifested
|
||||
if(J?.mob_type & JOB_CARBON)
|
||||
@@ -431,7 +435,7 @@ var/global/datum/controller/subsystem/ticker/ticker
|
||||
var/captainless=1
|
||||
for(var/mob/living/carbon/human/player in player_list)
|
||||
if(player && player.mind && player.mind.assigned_role)
|
||||
if(player.mind.assigned_role == "Colony Director")
|
||||
if(player.mind.assigned_role == "Site Manager")
|
||||
captainless=0
|
||||
if(!player_is_antag(player.mind, only_offstation_roles = 1))
|
||||
job_master.EquipRank(player, player.mind.assigned_role, 0)
|
||||
@@ -441,7 +445,7 @@ var/global/datum/controller/subsystem/ticker/ticker
|
||||
if(captainless)
|
||||
for(var/mob/M in player_list)
|
||||
if(!istype(M,/mob/new_player))
|
||||
to_chat(M, "<span class='notice'>Colony Directorship not forced on anyone.</span>")
|
||||
to_chat(M, "<span class='notice'>Site Management is not forced on anyone.</span>")
|
||||
|
||||
|
||||
/datum/controller/subsystem/ticker/proc/declare_completion()
|
||||
|
||||
@@ -97,7 +97,6 @@
|
||||
options["LEGACY: cameranet"] = cameranet
|
||||
options["LEGACY: transfer_controller"] = transfer_controller
|
||||
options["LEGACY: gas_data"] = gas_data
|
||||
options["LEGACY: plant_controller"] = plant_controller
|
||||
|
||||
var/pick = input(mob, "Choose a controller to debug/view variables of.", "VV controller:") as null|anything in options
|
||||
if(!pick)
|
||||
|
||||
Reference in New Issue
Block a user