Files
CHOMPStation2/code/modules/awaymissions/zlevel.dm
cib 5360915221 Fixes issue #2032
The proc to get zlevel map files used lowertext on the filename. That is bad, for obvious reasons(breaks uppercase paths on linux).
2012-12-16 18:16:21 +01:00

62 lines
1.2 KiB
Plaintext

proc/createRandomZlevel()
if(awaydestinations.len) //crude, but it saves another var!
return
var/list/potentialRandomZlevels = list()
var/text = file2text("maps/RandomZLevels/fileList.txt")
if (!text) // No random Z-levels for you.
return
world << "\red \b Searching for away missions..."
var/list/CL = dd_text2list(text, "\n")
for (var/t in CL)
if (!t)
continue
t = trim(t)
if (length(t) == 0)
continue
else if (copytext(t, 1, 2) == "#")
continue
var/pos = findtext(t, " ")
var/name = null
// var/value = null
if (pos)
// No, don't do lowertext here, that breaks paths on linux
name = copytext(t, 1, pos)
// value = copytext(t, pos + 1)
else
// No, don't do lowertext here, that breaks paths on linux
name = t
if (!name)
continue
potentialRandomZlevels.Add(name)
if(potentialRandomZlevels.len)
world << "\red \b Loading away mission..."
var/map = pick(potentialRandomZlevels)
var/file = file(map)
if(isfile(file))
maploader.load_map(file)
for(var/obj/effect/landmark/L in landmarks_list)
if (L.name != "awaystart")
continue
awaydestinations.Add(L)
world << "\red \b Away mission loaded."
else
world << "\red \b No away missions found."
return