This commit is contained in:
Ghommie
2020-04-24 20:49:15 +02:00
parent debbd3edab
commit 58fc679cce
19 changed files with 90 additions and 52 deletions

View File

@@ -35,6 +35,7 @@ require only minor tweaks.
#define ZTRAIT_REEBE "Reebe" #define ZTRAIT_REEBE "Reebe"
#define ZTRAIT_RESERVED "Transit/Reserved" #define ZTRAIT_RESERVED "Transit/Reserved"
#define ZTRAIT_AWAY "Away Mission" #define ZTRAIT_AWAY "Away Mission"
#define ZTRAIT_VR "Virtual Reality"
#define ZTRAIT_SPACE_RUINS "Space Ruins" #define ZTRAIT_SPACE_RUINS "Space Ruins"
#define ZTRAIT_LAVA_RUINS "Lava Ruins" #define ZTRAIT_LAVA_RUINS "Lava Ruins"
#define ZTRAIT_ISOLATED_RUINS "Isolated Ruins" //Placing ruins on z levels with this trait will use turf reservation instead of usual placement. #define ZTRAIT_ISOLATED_RUINS "Isolated Ruins" //Placing ruins on z levels with this trait will use turf reservation instead of usual placement.
@@ -102,3 +103,7 @@ require only minor tweaks.
#define PLACE_ISOLATED "isolated" //On isolated ruin z level #define PLACE_ISOLATED "isolated" //On isolated ruin z level
//Map type stuff. //Map type stuff.
#define MAP_TYPE_STATION "station" #define MAP_TYPE_STATION "station"
//Random z-levels name defines.
#define AWAY_MISSION_NAME "Away Mission"
#define VIRT_REALITY_NAME "Virtual Reality"

View File

@@ -12,3 +12,5 @@
#define is_reserved_level(z) SSmapping.level_trait(z, ZTRAIT_RESERVED) #define is_reserved_level(z) SSmapping.level_trait(z, ZTRAIT_RESERVED)
#define is_away_level(z) SSmapping.level_trait(z, ZTRAIT_AWAY) #define is_away_level(z) SSmapping.level_trait(z, ZTRAIT_AWAY)
#define is_vr_level(z) SSmapping.level_trait(z, ZTRAIT_VR)

View File

@@ -50,3 +50,8 @@ GLOBAL_LIST_EMPTY_TYPED(areas_by_type, /area)
GLOBAL_LIST_EMPTY(all_abstract_markers) GLOBAL_LIST_EMPTY(all_abstract_markers)
GLOBAL_LIST_EMPTY(stationroom_landmarks) //List of all spawns for stationrooms GLOBAL_LIST_EMPTY(stationroom_landmarks) //List of all spawns for stationrooms
///Away missions, VR, random z levels stuff.
GLOBAL_LIST_EMPTY(random_zlevels_generated)
GLOBAL_LIST_INIT(potential_away_levels, generateMapList(filename = "[global.config.directory]/awaymissionconfig.txt"))
GLOBAL_LIST_INIT(potential_vr_levels, generateMapList(filename = "[global.config.directory]/vr_config.txt"))

View File

@@ -81,7 +81,9 @@ SUBSYSTEM_DEF(mapping)
// Pick a random away mission. // Pick a random away mission.
if(CONFIG_GET(flag/roundstart_away)) if(CONFIG_GET(flag/roundstart_away))
createRandomZlevel() createRandomZlevel()
// Pick a random VR level.
if(CONFIG_GET(flag/roundstart_vr))
createRandomZlevel(VIRT_REALITY_NAME, list(ZTRAIT_AWAY = TRUE, ZTRAIT_VR = TRUE), GLOB.potential_vr_levels)
// Generate mining ruins // Generate mining ruins
loading_ruins = TRUE loading_ruins = TRUE
@@ -410,52 +412,65 @@ GLOBAL_LIST_EMPTY(the_station_areas)
//Manual loading of away missions. //Manual loading of away missions.
/client/proc/admin_away() /client/proc/admin_away()
set name = "Load Away Mission" set name = "Load Away Mission / Virtual Reality"
set category = "Fun" set category = "Fun"
if(!holder ||!check_rights(R_FUN)) if(!holder ||!check_rights(R_FUN))
return return
var/choice = alert(src, "What kind of level would you like to load?", "Load Away/VR", AWAY_MISSION_NAME, VIRT_REALITY_NAME, "Cancel")
var/list/possible_options
var/list/ztraits
switch(choice)
if(VIRT_REALITY_NAME)
possible_options = GLOB.potential_vr_levels
ztraits = list(ZTRAIT_AWAY = TRUE, ZTRAIT_VR = TRUE)
if(AWAY_MISSION_NAME)
if(!GLOB.the_gateway) if(!GLOB.the_gateway)
if(alert("There's no home gateway on the station. You sure you want to continue ?", "Uh oh", "Yes", "No") != "Yes") if(alert("There's no home gateway on the station. You sure you want to continue ?", "Uh oh", "Yes", "No") != "Yes")
return return
possible_options = GLOB.potential_away_levels
ztraits = list(ZTRAIT_AWAY = TRUE)
else
return
var/list/possible_options = GLOB.potentialRandomZlevels + "Custom" possible_options += "Custom"
var/away_name var/lvl_name
var/datum/space_level/away_level var/datum/space_level/level
var/answer = input("What kind ? ","Away") as null|anything in possible_options var/answer = input("What kind ? ","Away/VR") as null|anything in possible_options
switch(answer) switch(answer)
if(null)
return
if("Custom") if("Custom")
var/mapfile = input("Pick file:", "File") as null|file var/mapfile = input("Pick file:", "File") as null|file
if(!mapfile) if(!mapfile)
return return
away_name = "[mapfile] custom" lvl_name = "[mapfile] custom"
to_chat(usr,"<span class='notice'>Loading [away_name]...</span>") to_chat(usr,"<span class='notice'>Loading [lvl_name]...</span>")
var/datum/map_template/template = new(mapfile, "Away Mission") var/datum/map_template/template = new(mapfile, choice, ztraits)
away_level = template.load_new_z() level = template.load_new_z()
else else
if(answer in GLOB.potentialRandomZlevels) lvl_name = answer
away_name = answer to_chat(usr,"<span class='notice'>Loading [lvl_name]...</span>")
to_chat(usr,"<span class='notice'>Loading [away_name]...</span>") var/datum/map_template/template = new(lvl_name, choice, ztraits)
var/datum/map_template/template = new(away_name, "Away Mission") level = template.load_new_z()
away_level = template.load_new_z()
else else
return return
message_admins("Admin [key_name_admin(usr)] has loaded [away_name] away mission.") message_admins("Admin [key_name_admin(usr)] has loaded [lvl_name] [choice].")
log_admin("Admin [key_name(usr)] has loaded [away_name] away mission.") log_admin("Admin [key_name(usr)] has loaded [lvl_name] [choice].")
if(!away_level) if(!level)
message_admins("Loading [away_name] failed!") message_admins("Loading [lvl_name] failed!")
return return
if(GLOB.the_gateway) if(choice == AWAY_MISSION_NAME && GLOB.the_gateway)
//Link any found away gate with station gate //Link any found away gate with station gate
var/obj/machinery/gateway/centeraway/new_gate var/obj/machinery/gateway/centeraway/new_gate
for(var/obj/machinery/gateway/centeraway/G in GLOB.machines) for(var/obj/machinery/gateway/centeraway/G in GLOB.machines)
if(G.z == away_level.z_value) //I'll have to refactor gateway shitcode before multi-away support. if(G.z == level.z_value) //I'll have to refactor gateway shitcode before multi-away support.
new_gate = G new_gate = G
break break
//Link station gate with away gate and remove wait time. //Link station gate with away gate and remove wait time.

View File

@@ -1,15 +1,13 @@
// How much "space" we give the edge of the map
GLOBAL_LIST_INIT(potentialRandomZlevels, generateMapList(filename = "[global.config.directory]/awaymissionconfig.txt"))
/proc/createRandomZlevel() /proc/createRandomZlevel(name = AWAY_MISSION_NAME, list/traits = list(ZTRAIT_AWAY = TRUE), list/potential_levels = potential_away_levels)
if(GLOB.awaydestinations.len) //crude, but it saves another var! if(GLOB.random_zlevels_generated[name] || !length(potential_levels))
return return
if(GLOB.potentialRandomZlevels && GLOB.potentialRandomZlevels.len) to_chat(world, "<span class='boldannounce'>Loading [name]...</span>")
to_chat(world, "<span class='boldannounce'>Loading away mission...</span>") var/map = pick(potential_levels)
var/map = pick(GLOB.potentialRandomZlevels) load_new_z_level(map, name, traits)
load_new_z_level(map, "Away Mission") to_chat(world, "<span class='boldannounce'>[name] loaded.</span>")
to_chat(world, "<span class='boldannounce'>Away mission loaded.</span>") random_zlevels_generated[name] = TRUE
/proc/reset_gateway_spawns(reset = FALSE) /proc/reset_gateway_spawns(reset = FALSE)
for(var/obj/machinery/gateway/G in world) for(var/obj/machinery/gateway/G in world)

View File

@@ -55,11 +55,11 @@
SSmachines.setup_template_powernets(cables) SSmachines.setup_template_powernets(cables)
SSair.setup_template_machinery(atmos_machines) SSair.setup_template_machinery(atmos_machines)
/datum/map_template/proc/load_new_z() /datum/map_template/proc/load_new_z(list/traits = list(ZTRAIT_AWAY = TRUE))
var/x = round((world.maxx - width)/2) var/x = round((world.maxx - width)/2)
var/y = round((world.maxy - height)/2) var/y = round((world.maxy - height)/2)
var/datum/space_level/level = SSmapping.add_new_zlevel(name, list(ZTRAIT_AWAY = TRUE)) var/datum/space_level/level = SSmapping.add_new_zlevel(name, traits)
var/datum/parsed_map/parsed = load_map(file(mappath), x, y, level.z_value, no_changeturf=(SSatoms.initialized == INITIALIZATION_INSSATOMS), placeOnTop=TRUE) var/datum/parsed_map/parsed = load_map(file(mappath), x, y, level.z_value, no_changeturf=(SSatoms.initialized == INITIALIZATION_INSSATOMS), placeOnTop=TRUE)
var/list/bounds = parsed.bounds var/list/bounds = parsed.bounds
if(!bounds) if(!bounds)
@@ -121,6 +121,6 @@
//for your ever biggening badminnery kevinz000 //for your ever biggening badminnery kevinz000
//❤ - Cyberboss //❤ - Cyberboss
/proc/load_new_z_level(var/file, var/name) /proc/load_new_z_level(file, name, list/traits)
var/datum/map_template/template = new(file, name) var/datum/map_template/template = new(file, name)
template.load_new_z() template.load_new_z(traits)

View File

@@ -7,16 +7,16 @@
#Do NOT tick the maps during compile -- the game uses this list to decide which map to load. Ticking the maps will result in them ALL being loaded at once. #Do NOT tick the maps during compile -- the game uses this list to decide which map to load. Ticking the maps will result in them ALL being loaded at once.
#DO tick the associated code file for the away mission you are enabling. Otherwise, the map will be trying to reference objects which do not exist, which will cause runtime errors! #DO tick the associated code file for the away mission you are enabling. Otherwise, the map will be trying to reference objects which do not exist, which will cause runtime errors!
#_maps/RandomZLevels/blackmarketpackers.dmm #_maps/RandomZLevels/away_mission/blackmarketpackers.dmm
#_maps/RandomZLevels/spacebattle.dmm #_maps/RandomZLevels/away_mission/spacebattle.dmm
#_maps/RandomZLevels/TheBeach.dmm _maps/RandomZLevels/away_mission/TheBeach.dmm
#_maps/RandomZLevels/Academy.dmm _maps/RandomZLevels/away_mission/Academy.dmm
#_maps/RandomZLevels/wildwest.dmm _maps/RandomZLevels/away_mission/wildwest.dmm
#_maps/RandomZLevels/challenge.dmm #_maps/RandomZLevels/away_mission/challenge.dmm
#_maps/RandomZLevels/centcomAway.dmm #_maps/RandomZLevels/away_mission/centcomAway.dmm
#_maps/RandomZLevels/moonoutpost19.dmm #_maps/RandomZLevels/away_mission/moonoutpost19.dmm
#_maps/RandomZLevels/undergroundoutpost45.dmm #_maps/RandomZLevels/away_mission/undergroundoutpost45.dmm
#_maps/RandomZLevels/caves.dmm #_maps/RandomZLevels/away_mission/caves.dmm
#_maps/RandomZLevels/snowdin.dmm #_maps/RandomZLevels/away_mission/snowdin.dmm
#_maps/RandomZLevels/research.dmm #_maps/RandomZLevels/away_mission/research.dmm
#_maps/RandomZLevels/Cabin.dmm #_maps/RandomZLevels/away_mission/Cabin.dmm

13
config/vr_config.txt Normal file
View File

@@ -0,0 +1,13 @@
#List the potential virtual reality Z-levels here. awaymissionconfig copypasta follows.
#Maps must be the full path to them
#Maps should be 255x255 or smaller and be bounded. Falling off the edge of the map will result in undefined behavior.
#SPECIFYING AN INVALID MAP WILL RESULT IN RUNTIMES ON GAME START
#!!IMPORTANT NOTES FOR HOSTING VR MAPS!!:
#Do NOT tick the maps during compile -- the game uses this list to decide which map to load. Ticking the maps will result in them ALL being loaded at once.
#DO tick the associated code file for the virtual reality levels you are enabling. Otherwise, the map will be trying to reference objects which do not exist, which will cause runtime errors!
_maps/RandomZLevels/VR/murderdome.dmm
_maps/RandomZLevels/VR/snowdin_VR.dm
_maps/RandomZLevels/VR/syndicate_trainer.dm