mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +01:00
Merge pull request #4780 from Crazylemon64/space_ruins
Crazypilot's Space Ruins Port
This commit is contained in:
@@ -234,6 +234,7 @@
|
||||
|
||||
body += "<option value='?_src_=vars;mark_object=\ref[D]'>Mark Object</option>"
|
||||
body += "<option value='?_src_=vars;proc_call=\ref[D]'>Call Proc</option>"
|
||||
body += "<option value='?_src_=vars;jump_to=\ref[D]'>Jump to Object</option>"
|
||||
if(ismob(D))
|
||||
body += "<option value='?_src_=vars;mob_player_panel=\ref[D]'>Show player panel</option>"
|
||||
|
||||
@@ -394,11 +395,7 @@ body
|
||||
html += "<ul>"
|
||||
var/index = 1
|
||||
for(var/entry in L)
|
||||
if(istext(entry))
|
||||
html += debug_variable(entry, L[entry], level + 1)
|
||||
//html += debug_variable("[index]", L[index], level + 1)
|
||||
else
|
||||
html += debug_variable(index, L[index], level + 1)
|
||||
html += debug_variable(index, L[index], level + 1)
|
||||
index++
|
||||
html += "</ul>"
|
||||
|
||||
@@ -736,6 +733,17 @@ body
|
||||
if(T)
|
||||
callproc_datum(T)
|
||||
|
||||
else if(href_list["jump_to"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
var/atom/A = locate(href_list["jump_to"])
|
||||
var/turf/T = get_turf(A)
|
||||
if(T)
|
||||
usr.client.jumptoturf(T)
|
||||
href_list["datumrefresh"] = href_list["jump_to"]
|
||||
|
||||
|
||||
else if(href_list["rotatedatum"])
|
||||
if(!check_rights(R_DEBUG|R_ADMIN)) return
|
||||
|
||||
@@ -1080,4 +1088,3 @@ body
|
||||
src.debug_variables(DAT)
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
/datum/map_template/New(path = null, map = null, rename = null)
|
||||
if(path)
|
||||
mappath = path
|
||||
if(mappath)
|
||||
preload_size(mappath)
|
||||
if(map)
|
||||
mapfile = map
|
||||
@@ -16,52 +17,145 @@
|
||||
name = rename
|
||||
|
||||
/datum/map_template/proc/preload_size(path)
|
||||
var/quote = ascii2text(34)
|
||||
var/map_file = file2text(path)
|
||||
var/key_len = length(copytext(map_file,2,findtext(map_file,quote,2,0)))
|
||||
//assuming one map per file since more makes no sense for templates anyway
|
||||
var/mapstart = findtext(map_file,"\n(1,1,") //todo replace with something saner
|
||||
var/content = copytext(map_file,findtext(map_file,quote+"\n",mapstart,0)+2,findtext(map_file,"\n"+quote,mapstart,0)+1)
|
||||
var/line_len = length(copytext(content,1,findtext(content,"\n",2,0)))
|
||||
|
||||
width = line_len/key_len
|
||||
height = length(content)/(line_len+1)
|
||||
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 = 0)
|
||||
var/turf/placement = T
|
||||
var/min_x = placement.x
|
||||
var/min_y = placement.y
|
||||
if(centered)
|
||||
T = locate(T.x - round(width / 2), T.y - round(height / 2), T.z)
|
||||
min_x -= round(width/2)
|
||||
min_y -= round(height/2)
|
||||
|
||||
var/max_x = min_x + width - 1
|
||||
var/max_y = min_y + height - 1
|
||||
|
||||
if(!T)
|
||||
return
|
||||
if(T.x+width > world.maxx)
|
||||
return
|
||||
if(T.y+height > world.maxy)
|
||||
return
|
||||
return 0
|
||||
|
||||
var/turf/bot_left = locate(max(1, min_x), max(1, min_y), placement.z)
|
||||
var/turf/top_right = locate(min(world.maxx, max_x), min(world.maxy, max_y), placement.z)
|
||||
|
||||
// 1 bigger, to update the turf smoothing
|
||||
var/turf/ST_bot_left = locate(max(1, min_x-1), max(1, min_y-1), placement.z)
|
||||
var/turf/ST_top_right = locate(min(world.maxx, max_x+1), min(world.maxy, max_y+1), placement.z)
|
||||
// This is to place a freeze on initialization until the map's done loading
|
||||
// otherwise atmos and stuff will start running mid-load
|
||||
// This system will metaphorically snap in half (not postpone init everywhere)
|
||||
// if given a multi-z template
|
||||
// it might need to be adapted for that when that time comes
|
||||
zlevels.add_dirt(placement.z)
|
||||
var/list/bounds = maploader.load_map(get_file(), min_x, min_y, placement.z, cropMap = 1)
|
||||
if(!bounds)
|
||||
return 0
|
||||
if(bot_left == null || top_right == null)
|
||||
log_debug("One of the late setup corners is bust")
|
||||
else
|
||||
log_debug("Late Setup from ([bot_left.x],[bot_left.y]) to ([top_right.x],[top_right.y])")
|
||||
|
||||
if(ST_bot_left == null || ST_top_right == null)
|
||||
log_debug("One of the smoothing corners is bust")
|
||||
else
|
||||
log_debug("Tile smoothing from ([ST_bot_left.x],[ST_bot_left.y]) to ([ST_top_right.x],[ST_top_right.y])")
|
||||
|
||||
maploader.load_map(get_file(), T.x-1, T.y-1, T.z)
|
||||
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)))
|
||||
block(bot_left, top_right),
|
||||
block(ST_bot_left, ST_top_right))
|
||||
zlevels.remove_dirt(placement.z)
|
||||
|
||||
log_game("[name] loaded at at [T.x],[T.y],[T.z]")
|
||||
log_game("[name] loaded at [min_x],[min_y],[placement.z]")
|
||||
return 1
|
||||
|
||||
/datum/map_template/proc/get_file()
|
||||
if(mapfile)
|
||||
return mapfile
|
||||
if(mappath)
|
||||
mapfile = file(mappath)
|
||||
return mapfile
|
||||
. = mapfile
|
||||
else if(mappath)
|
||||
. = file(mappath)
|
||||
|
||||
if(!.)
|
||||
log_to_dd(" The file of [src] appears to be empty/non-existent.")
|
||||
|
||||
/datum/map_template/proc/get_affected_turfs(turf/T, centered = 0)
|
||||
var/turf/placement = T
|
||||
var/min_x = placement.x
|
||||
var/min_y = placement.y
|
||||
if(centered)
|
||||
var/turf/corner = locate(placement.x - round(width/2), placement.y - round(height/2), placement.z)
|
||||
if(corner)
|
||||
placement = corner
|
||||
return block(placement, locate(placement.x+width-1, placement.y+height-1, placement.z))
|
||||
min_x -= round(width/2)
|
||||
min_y -= round(height/2)
|
||||
|
||||
var/max_x = min_x + width-1
|
||||
var/max_y = min_y + height-1
|
||||
placement = locate(max(min_x,1), max(min_y,1), placement.z)
|
||||
return block(placement, locate(min(max_x, world.maxx), min(max_y, world.maxy), placement.z))
|
||||
|
||||
/datum/map_template/proc/fits_in_map_bounds(turf/T, centered = 0)
|
||||
var/turf/placement = T
|
||||
var/min_x = placement.x
|
||||
var/min_y = placement.y
|
||||
if(centered)
|
||||
min_x -= round(width/2)
|
||||
min_y -= round(height/2)
|
||||
|
||||
var/max_x = min_x + width-1
|
||||
var/max_y = min_y + height-1
|
||||
if(min_x < 1 || min_y < 1 || max_x > world.maxx || max_y > world.maxy)
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
|
||||
|
||||
/proc/preloadTemplates(path = "_maps/map_files/templates/") //see master controller setup
|
||||
for(var/map in flist(path))
|
||||
if(cmptext(copytext(map, length(map) - 3), ".dmm"))
|
||||
var/datum/map_template/T = new(path = "[path][map]", rename = "[map]")
|
||||
map_templates[T.name] = T
|
||||
map_templates[T.name] = T
|
||||
|
||||
if(!config.disable_space_ruins) // so we don't unnecessarily clutter start-up
|
||||
preloadRuinTemplates()
|
||||
//preloadShuttleTemplates()
|
||||
|
||||
/proc/preloadRuinTemplates()
|
||||
// Still supporting bans by filename
|
||||
var/list/banned
|
||||
if(fexists("config/spaceRuinBlacklist.txt"))
|
||||
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))
|
||||
var/datum/map_template/ruin/ruin_type = item
|
||||
// screen out the abstract subtypes
|
||||
if(!initial(ruin_type.id))
|
||||
continue
|
||||
var/datum/map_template/ruin/R = new ruin_type()
|
||||
|
||||
if(banned.Find(R.mappath))
|
||||
continue
|
||||
|
||||
map_templates[R.name] = R
|
||||
ruins_templates[R.name] = R
|
||||
|
||||
/*
|
||||
if(istype(R, /datum/map_template/ruin/lavaland))
|
||||
lava_ruins_templates[R.name] = R
|
||||
*/
|
||||
if(istype(R, /datum/map_template/ruin/space))
|
||||
space_ruins_templates[R.name] = R
|
||||
|
||||
/*
|
||||
/proc/preloadShuttleTemplates()
|
||||
for(var/item in subtypesof(/datum/map_template/shuttle))
|
||||
var/datum/map_template/shuttle/shuttle_type = item
|
||||
if(!(initial(shuttle_type.suffix)))
|
||||
continue
|
||||
|
||||
var/datum/map_template/shuttle/S = new shuttle_type()
|
||||
|
||||
shuttle_templates[S.shuttle_id] = S
|
||||
map_templates[S.shuttle_id] = S
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/datum/map_template/ruin
|
||||
//name = "A Chest of Doubloons"
|
||||
name = null
|
||||
var/id = null // For blacklisting purposes, all ruins need an id
|
||||
var/description = "In the middle of a clearing in the rockface, there's a \
|
||||
chest filled with gold coins with Spanish engravings. How is there a \
|
||||
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 = FALSE //A bit boring, don't you think? You can always explicitly allow it on a ruin definition
|
||||
|
||||
var/prefix = null
|
||||
var/suffix = null
|
||||
|
||||
/datum/map_template/ruin/New()
|
||||
if(!name && id)
|
||||
name = id
|
||||
|
||||
mappath = prefix + suffix
|
||||
..(path = mappath)
|
||||
@@ -0,0 +1,162 @@
|
||||
//The bigger ones lag like hell if there is more than one on a z-level, so cost 2 for them
|
||||
/datum/map_template/ruin/space
|
||||
prefix = "_maps/map_files/RandomRuins/SpaceRuins/"
|
||||
cost = 1
|
||||
|
||||
/datum/map_template/ruin/space/zoo
|
||||
id = "zoo"
|
||||
suffix = "abandonedzoo.dmm"
|
||||
name = "Biological Storage Facility"
|
||||
description = "In case society crumbles, we will be able to restore our \
|
||||
zoos to working order with the breeding stock kept in these 100% \
|
||||
secure and unbreachable storage facilities. At no point has anything \
|
||||
escaped. That's our story, and we're sticking to it."
|
||||
cost = 2
|
||||
|
||||
/datum/map_template/ruin/space/asteroid1
|
||||
id = "asteroid1"
|
||||
suffix = "asteroid1.dmm"
|
||||
name = "Asteroid 1"
|
||||
description = "I-spy with my little eye, something beginning with R."
|
||||
|
||||
/datum/map_template/ruin/space/asteroid2
|
||||
id = "asteroid2"
|
||||
suffix = "asteroid2.dmm"
|
||||
name = "Asteroid 2"
|
||||
description = "Oh my god, a giant rock!"
|
||||
|
||||
/datum/map_template/ruin/space/asteroid3
|
||||
id = "asteroid3"
|
||||
suffix = "asteroid3.dmm"
|
||||
name = "Asteroid 3"
|
||||
description = "This asteroid floating in space has no official \
|
||||
designation, because the scientist that discovered it deemed it \
|
||||
'super dull'."
|
||||
|
||||
/datum/map_template/ruin/space/asteroid4
|
||||
id = "asteroid4"
|
||||
suffix = "asteroid4.dmm"
|
||||
name = "Asteroid 4"
|
||||
description = "Nanotrasen Escape Pods have a 100%* success rate, and a \
|
||||
99%* customer satisfaction rate. *Please note that these statistics, \
|
||||
are taken from pods that have successfully docked with a recovery \
|
||||
vessel."
|
||||
|
||||
/datum/map_template/ruin/space/asteroid5
|
||||
id = "asteroid5"
|
||||
suffix = "asteroid5.dmm"
|
||||
name = "Asteroid 5"
|
||||
description = "Oh my god, another giant rock!"
|
||||
|
||||
/datum/map_template/ruin/space/deep_storage
|
||||
id = "deep-storage"
|
||||
suffix = "deepstorage.dmm"
|
||||
name = "Survivalist Bunker"
|
||||
description = "Assume the best, prepare for the worst. Generally, you \
|
||||
should do so by digging a three man heavily fortified bunker into \
|
||||
a giant unused asteroid. Then make it self sufficient, mask any \
|
||||
evidence of construction, hook it covertly into the \
|
||||
telecommunications network and hope for the best."
|
||||
cost = 2
|
||||
|
||||
/datum/map_template/ruin/space/derelict1
|
||||
id = "derelict1"
|
||||
suffix = "derelict1.dmm"
|
||||
name = "Derelict 1"
|
||||
description = "Nothing to see here citizen, move along, certainly no \
|
||||
xeno outbreaks on this piece of station debris. That purple stuff? \
|
||||
It's uh... station nectar. It's a top secret research installation."
|
||||
|
||||
/datum/map_template/ruin/space/derelict2
|
||||
id = "derelict2"
|
||||
suffix = "derelict2.dmm"
|
||||
name = "Dinner for Two"
|
||||
description = "Oh this is the night\n\
|
||||
It's a beautiful night\n\
|
||||
And we call it bella notte"
|
||||
|
||||
/datum/map_template/ruin/space/derelict3
|
||||
id = "derelict3"
|
||||
suffix = "derelict3.dmm"
|
||||
name = "Derelict 3"
|
||||
description = "These hulks were once part of a larger structure, where \
|
||||
the three great \[REDACTED\] were forged."
|
||||
|
||||
/datum/map_template/ruin/space/derelict4
|
||||
id = "derelict4"
|
||||
suffix = "derelict4.dmm"
|
||||
name = "Derelict 4"
|
||||
description = "Centcom ferries have never crashed, will never crash, \
|
||||
there is no current investigation into a crashed ferry, and we \
|
||||
will not let Internal Affairs trample over high security information \
|
||||
in the name of this baseless witchhunt."
|
||||
|
||||
/datum/map_template/ruin/space/derelict5
|
||||
id = "derelict5"
|
||||
suffix = "derelict5.dmm"
|
||||
name = "Derelict 5"
|
||||
description = "The plan is, we put a whole bunch of crates full of \
|
||||
treasure in this disused warehouse, launch it into space, and then \
|
||||
ignore it. Forever."
|
||||
|
||||
/datum/map_template/ruin/space/empty_shell
|
||||
id = "empty-shell"
|
||||
suffix = "emptyshell.dmm"
|
||||
name = "Empty Shell"
|
||||
description = "Cosy, rural property availible for young professional \
|
||||
couple. Only twelve parsecs from the nearest hyperspace lane!"
|
||||
|
||||
/datum/map_template/ruin/space/gas_the_lizards
|
||||
id = "gas-the-lizards"
|
||||
suffix = "gasthelizards.dmm"
|
||||
name = "Disposal Facility 17"
|
||||
description = "Gas efficiency at 95.6%, fluid elimination at 96.2%. \
|
||||
Will require renewed supplies of 'carpet' before the end of the \
|
||||
quarter."
|
||||
|
||||
/datum/map_template/ruin/space/intact_empty_ship
|
||||
id = "intact-empty-ship"
|
||||
suffix = "intactemptyship.dmm"
|
||||
name = "Authorship"
|
||||
description = "Just somewhere quiet, where I can focus on my work with \
|
||||
no interruptions."
|
||||
|
||||
/datum/map_template/ruin/space/mech_transport
|
||||
id = "mech-transport"
|
||||
suffix = "mechtransport.dmm"
|
||||
name = "CF Corsair"
|
||||
description = "Well, when is it getting here? I have bills to pay; very \
|
||||
well-armed clients who want their shipments as soon as possible! I \
|
||||
don't care, just find it!"
|
||||
|
||||
/datum/map_template/ruin/space/onehalf
|
||||
id = "onehalf"
|
||||
suffix = "onehalf.dmm"
|
||||
name = "DK Excavator 453"
|
||||
description = "Based on the trace elements we've detected on the \
|
||||
gutted asteroids, we suspect that a mining ship using a restricted \
|
||||
engine is somewhere in the area. We'd like to request a patrol vessel \
|
||||
to investigate."
|
||||
cost = 2
|
||||
|
||||
/datum/map_template/ruin/space/spacebar
|
||||
id = "spacebar"
|
||||
suffix = "spacebar.dmm"
|
||||
name = "The Rampant Golem and Yellow Hound"
|
||||
description = "No questions asked. No shoes/foot protection, no service. \
|
||||
No tabs. No violence in the inside areas. That's it. Welcome to the \
|
||||
Rampant Golem and Yellow Hound. Can I take your order?"
|
||||
cost = 2
|
||||
|
||||
/datum/map_template/ruin/space/turreted_outpost
|
||||
id = "turreted-outpost"
|
||||
suffix = "turretedoutpost.dmm"
|
||||
name = "Unnamed Turreted Outpost"
|
||||
description = "We'd ask them to stop blaring that ruskiepop music, but \
|
||||
none of us are brave enough to go near those death turrets they have."
|
||||
|
||||
/datum/map_template/ruin/space/way_home
|
||||
id = "way-home"
|
||||
suffix = "way_home.dmm"
|
||||
name = "Salvation"
|
||||
description = "In the darkest times, we will find our way home."
|
||||
Reference in New Issue
Block a user