mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-25 21:19:00 +01:00
Back where we started...
This commit is contained in:
@@ -59,4 +59,4 @@ var/list/datum/map_template/map_templates = list()
|
||||
|
||||
var/list/datum/map_template/ruins_templates = list()
|
||||
var/list/datum/map_template/space_ruins_templates = list()
|
||||
var/list/datum/map_template/lava_ruins_templates = list()
|
||||
//var/list/datum/map_template/lava_ruins_templates = list()
|
||||
|
||||
@@ -45,7 +45,7 @@ datum/controller/game_controller/proc/setup()
|
||||
if(!config.disable_away_missions)
|
||||
createRandomZlevel()
|
||||
if(!config.disable_space_ruins)
|
||||
seedRuins(7, rand(0, 5), /area/space, space_ruins_templates)
|
||||
seedRuins(7, rand(0, 2), /area/space, space_ruins_templates)
|
||||
|
||||
setup_objects()
|
||||
setupgenetics()
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
name = rename
|
||||
|
||||
/datum/map_template/proc/preload_size(path)
|
||||
var/bounds = maploader.load_map(file(path), 1, 1, 1, cropMap=FALSE, measureOnly=TRUE)
|
||||
var/bounds = maploader.load_map(file(path), 1, 1, 1, cropMap=0, measureOnly=1)
|
||||
if(bounds)
|
||||
width = bounds[MAP_MAXX] // Assumes all templates are rectangular, have a single Z level, and begin at 1,1,1
|
||||
height = bounds[MAP_MAXY]
|
||||
return bounds
|
||||
|
||||
/datum/map_template/proc/load(turf/T, centered = FALSE)
|
||||
/datum/map_template/proc/load(turf/T, centered = 0)
|
||||
if(centered)
|
||||
T = locate(T.x - round(width/2) , T.y - round(height/2) , T.z)
|
||||
T = locate(T.x - round(width/2), T.y - round(height/2), T.z)
|
||||
if(!T)
|
||||
return
|
||||
if(T.x+width > world.maxx)
|
||||
@@ -33,12 +33,12 @@
|
||||
if(T.y+height > world.maxy)
|
||||
return
|
||||
|
||||
var/list/bounds = maploader.load_map(get_file(), T.x, T.y, T.z, cropMap=TRUE)
|
||||
var/list/bounds = maploader.load_map(get_file(), T.x, T.y, T.z, cropMap=1)
|
||||
if(!bounds)
|
||||
return 0
|
||||
|
||||
for(var/L in block(locate(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ]),
|
||||
locate(bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ])))
|
||||
late_setup_level(
|
||||
block(T, locate(T.x + width - 1, T.y + height - 1, T.z)),
|
||||
block(locate(T.x - 1, T.y - 1, T.z), locate(T.x + width, T.y + height, T.z)))
|
||||
|
||||
log_game("[name] loaded at at [T.x],[T.y],[T.z]")
|
||||
return 1
|
||||
@@ -72,7 +72,11 @@
|
||||
|
||||
/proc/preloadRuinTemplates()
|
||||
// Still supporting bans by filename
|
||||
var/list/banned = generateMapList("config/spaceRuinBlacklist.txt")
|
||||
var/list/banned
|
||||
if(fexists("config/spaceRuinBlacklist"))
|
||||
banned = generateMapList("config/spaceRuinBlacklist.txt")
|
||||
else
|
||||
banned = generateMapList("config/example/spaceRuinBlacklist.txt")
|
||||
//banned += generateMapList("config/lavaRuinBlacklist.txt")
|
||||
|
||||
for(var/item in subtypesof(/datum/map_template/ruin))
|
||||
@@ -82,9 +86,8 @@
|
||||
continue
|
||||
var/datum/map_template/ruin/R = new ruin_type()
|
||||
|
||||
if(banned)
|
||||
if(banned.Find(R.mappath))
|
||||
continue
|
||||
if(banned.Find(R.mappath))
|
||||
continue
|
||||
|
||||
map_templates[R.name] = R
|
||||
ruins_templates[R.name] = R
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
wooden container filled with 18th century coinage in the middle of a \
|
||||
lavawracked hellscape? It is clearly a mystery."
|
||||
|
||||
var/cost = null
|
||||
var/allow_duplicates = TRUE
|
||||
|
||||
var/prefix = null
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/datum/map_template/ruin/space
|
||||
prefix = "_maps/RandomRuins/SpaceRuins/"
|
||||
cost = 1
|
||||
|
||||
/datum/map_template/ruin/space/zoo
|
||||
id = "zoo"
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
return
|
||||
|
||||
var/list/preview = list()
|
||||
for(var/S in template.get_affected_turfs(T,centered = TRUE))
|
||||
for(var/S in template.get_affected_turfs(T,centered = 1))
|
||||
preview += image('icons/turf/overlays.dmi',S,"greenOverlay")
|
||||
usr.client.images += preview
|
||||
if(alert(usr,"Confirm location.","Template Confirm","Yes","No") == "Yes")
|
||||
template.load(T, centered = TRUE)
|
||||
template.load(T, centered = 1)
|
||||
message_admins("[key_name_admin(usr)] has placed a map template ([template.name]) at <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[T.x];Y=[T.y];Z=[T.z]'>(JMP)</A>")
|
||||
usr.client.images -= preview
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//SS13 Optimized Map loader
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
//As pf 3.6.2016
|
||||
//As of 3.6.2016
|
||||
//global datum that will preload variables on atoms instanciation
|
||||
var/global/use_preloader = FALSE
|
||||
var/global/dmm_suite/preloader/_preloader = new
|
||||
|
||||
@@ -1,17 +1,37 @@
|
||||
var/global/list/potentialRandomZlevels = generateMapList(filename = "config/away_mission_config.txt")
|
||||
|
||||
/proc/late_setup_level(turfs, smoothTurfs)
|
||||
if(!smoothTurfs)
|
||||
smoothTurfs = turfs
|
||||
|
||||
if(air_master)
|
||||
air_master.setup_allturfs(turfs)
|
||||
for(var/turf/T in turfs)
|
||||
if(T.dynamic_lighting)
|
||||
T.lighting_build_overlays()
|
||||
for(var/obj/structure/cable/PC in T)
|
||||
makepowernet_for(PC)
|
||||
for(var/turf/T in smoothTurfs)
|
||||
if(T.smooth)
|
||||
smooth_icon(T)
|
||||
for(var/R in T)
|
||||
var/atom/A = R
|
||||
if(A.smooth)
|
||||
smooth_icon(A)
|
||||
|
||||
/proc/createRandomZlevel()
|
||||
if(awaydestinations.len) //crude, but it saves another var!
|
||||
return
|
||||
|
||||
if(potentialRandomZlevels && potentialRandomZlevels.len)
|
||||
var/watch = start_watch()
|
||||
log_startup_progress(" Loading away mission...")
|
||||
|
||||
var/map = pick(potentialRandomZlevels)
|
||||
var/file = file(map)
|
||||
if(isfile(file))
|
||||
maploader.load_map(file)
|
||||
smooth_zlevel(world.maxz)
|
||||
late_setup_level(block(locate(1, 1, world.maxz), locate(world.maxx, world.maxy, world.maxz)))
|
||||
log_to_dd(" Away mission loaded: [map]")
|
||||
|
||||
//map_transition_config.Add(AWAY_MISSION_LIST)
|
||||
@@ -21,7 +41,7 @@ var/global/list/potentialRandomZlevels = generateMapList(filename = "config/away
|
||||
continue
|
||||
awaydestinations.Add(L)
|
||||
|
||||
log_startup_progress(" Away mission loaded.")
|
||||
log_startup_progress(" Away mission loaded in [stop_watch(watch)]s.")
|
||||
|
||||
else
|
||||
log_startup_progress(" No away missions found.")
|
||||
@@ -61,36 +81,43 @@ var/global/list/potentialRandomZlevels = generateMapList(filename = "config/away
|
||||
return potentialMaps
|
||||
|
||||
|
||||
/proc/seedRuins(z_level = 1, whitelist = /area/space, list/potentialRuins = space_ruins_templates)
|
||||
/proc/seedRuins(z_level = 1, budget = 0, whitelist = /area/space, list/potentialRuins = space_ruins_templates)
|
||||
var/overall_sanity = 100
|
||||
var/ruins = potentialRuins.Copy()
|
||||
var/watch = start_watch()
|
||||
|
||||
log_startup_progress(" Loading ruins...")
|
||||
|
||||
while(overall_sanity > 0)
|
||||
while(budget > 0 && overall_sanity > 0)
|
||||
// Pick a ruin
|
||||
var/datum/map_template/ruin/ruin = ruins[pick(ruins)]
|
||||
// Can we afford it
|
||||
if(ruin.cost > budget)
|
||||
overall_sanity--
|
||||
continue
|
||||
// If so, try to place it
|
||||
var/sanity = 100
|
||||
// And if we can't fit it anywhere, give up, try again
|
||||
|
||||
while(sanity > 0)
|
||||
sanity--
|
||||
var/turf/T = locate(rand(25, world.maxx - 25), rand(25, world.maxy - 25), z_level)
|
||||
var/valid = TRUE
|
||||
var/valid = 1
|
||||
|
||||
for(var/turf/check in ruin.get_affected_turfs(T,1))
|
||||
var/area/new_area = get_area(check)
|
||||
if(!(istype(new_area, whitelist)))
|
||||
valid = FALSE
|
||||
valid = 0
|
||||
break
|
||||
|
||||
if(!valid)
|
||||
continue
|
||||
|
||||
log_to_dd(" Ruin \"[ruin.name]\" placed at ([T.x], [T.y], [T.z])")
|
||||
log_to_dd(" Ruin \"[ruin.name]\" placed at ([T.x], [T.y], [T.z]) in [stop_watch(watch)]s.")
|
||||
|
||||
var/obj/effect/ruin_loader/R = new /obj/effect/ruin_loader(T)
|
||||
R.Load(ruins,ruin)
|
||||
budget -= ruin.cost
|
||||
if(!ruin.allow_duplicates)
|
||||
ruins -= ruin.name
|
||||
break
|
||||
@@ -111,8 +138,8 @@ var/global/list/potentialRandomZlevels = generateMapList(filename = "config/away
|
||||
if(!template && possible_ruins.len)
|
||||
template = safepick(possible_ruins)
|
||||
if(!template)
|
||||
return FALSE
|
||||
template.load(get_turf(src),centered = TRUE)
|
||||
return 0
|
||||
template.load(get_turf(src),centered = 1)
|
||||
template.loaded++
|
||||
qdel(src)
|
||||
return TRUE
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user