mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 02:34:00 +00:00
Committing work on away missions.
Standardised cigs_lighters.dm a bit. Removed the SORD, and some unused and shit flasks. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4609 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
91
code/modules/awaymissions/gateway.dm
Normal file
91
code/modules/awaymissions/gateway.dm
Normal file
@@ -0,0 +1,91 @@
|
||||
/obj/machinery/gateway
|
||||
name = "gateway"
|
||||
desc = "It's a Nanotrasen approved one-way experimental teleporter that will take you places. Still has the pricetag on it."
|
||||
icon = 'icons/obj/machines/gateway.dmi'
|
||||
density = 1
|
||||
anchored = 1
|
||||
var/active = 0
|
||||
|
||||
/obj/machinery/gateway/initialize()
|
||||
update_icon()
|
||||
if(dir == 2)
|
||||
density = 0
|
||||
|
||||
/obj/machinery/gateway/update_icon()
|
||||
if(active)
|
||||
icon_state = "on[dir]"
|
||||
return
|
||||
icon_state = "off[dir]"
|
||||
|
||||
/obj/machinery/gateway/attack_hand(mob/user as mob)
|
||||
update_icon()
|
||||
|
||||
|
||||
|
||||
//this is da important part wot makes things go
|
||||
/obj/machinery/gateway/center
|
||||
density = 1
|
||||
dir = 3 //this doesn't work for some reason? see below
|
||||
var/list/linked = list() //a list of the connected gateway chunks
|
||||
var/ready = 0
|
||||
|
||||
/obj/machinery/gateway/center/initialize()
|
||||
dir = 3 //see above
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/gateway/center/proc/detect()
|
||||
linked = list() //clear the list
|
||||
var/turf/T = loc
|
||||
|
||||
for(var/i in alldirs)
|
||||
T = get_step(loc, i)
|
||||
var/obj/machinery/gateway/G = locate(/obj/machinery/gateway) in T
|
||||
if(G)
|
||||
linked.Add(G)
|
||||
continue
|
||||
|
||||
//this is only done if we fail to find a part
|
||||
ready = 0
|
||||
toggleoff()
|
||||
break
|
||||
|
||||
if(linked.len == 8)
|
||||
ready = 1
|
||||
|
||||
/obj/machinery/gateway/center/proc/toggleon()
|
||||
if(!ready) return
|
||||
if(linked.len != 8) return
|
||||
|
||||
for(var/obj/machinery/gateway/G in linked)
|
||||
G.active = 1
|
||||
G.update_icon()
|
||||
active = 1
|
||||
update_icon()
|
||||
density = 0
|
||||
|
||||
/obj/machinery/gateway/center/proc/toggleoff()
|
||||
for(var/obj/machinery/gateway/G in linked)
|
||||
G.active = 0
|
||||
G.update_icon()
|
||||
active = 0
|
||||
update_icon()
|
||||
density = 1
|
||||
|
||||
/obj/machinery/gateway/center/attack_hand(mob/user as mob)
|
||||
if(!ready)
|
||||
detect()
|
||||
return
|
||||
if(!active)
|
||||
toggleon()
|
||||
return
|
||||
toggleoff()
|
||||
|
||||
//okay, here's the good teleporting stuff
|
||||
/obj/machinery/gateway/center/HasEntered(mob/user as mob)
|
||||
if(!ready) return
|
||||
if(!active) return
|
||||
|
||||
var/obj/effect/landmark/dest = pick(awaydestinations)
|
||||
if(dest)
|
||||
user.loc = dest.loc
|
||||
return
|
||||
17
code/modules/awaymissions/loot.dm
Normal file
17
code/modules/awaymissions/loot.dm
Normal file
@@ -0,0 +1,17 @@
|
||||
/obj/effect/spawner/lootdrop
|
||||
icon = 'icons/mob/screen1.dmi'
|
||||
icon_state = "x2"
|
||||
var/lootcount = 1 //how many items will be spawned
|
||||
var/lootdoubles = 0 //if the same item can be spawned twice
|
||||
var/loot = "" //a list of possible items to spawn- a string of paths
|
||||
|
||||
/obj/effect/spawner/lootdrop/initialize()
|
||||
var/list/things = params2list(loot)
|
||||
if(things && things.len)
|
||||
for(var/i = lootcount, i > 0, i--)
|
||||
var/lootspawn = text2path(pick(things))
|
||||
if(!lootdoubles)
|
||||
things.Remove(lootspawn)
|
||||
|
||||
new lootspawn(get_turf(src))
|
||||
del(src)
|
||||
7
code/modules/awaymissions/trigger.dm
Normal file
7
code/modules/awaymissions/trigger.dm
Normal file
@@ -0,0 +1,7 @@
|
||||
/obj/effect/step_trigger/message
|
||||
var/message //the message to give to the mob
|
||||
|
||||
/obj/effect/step_trigger/message/Trigger(mob/M as mob)
|
||||
if(M.client)
|
||||
M << "<span class='info'>[message]</span>"
|
||||
del(src)
|
||||
@@ -7,7 +7,7 @@ proc/createRandomZlevel()
|
||||
if (!text) // No random Z-levels for you.
|
||||
return
|
||||
|
||||
world << "\red \b Reticulating Splines"
|
||||
world << "\red \b Searching for away missions..."
|
||||
|
||||
var/list/CL = dd_text2list(text, "\n")
|
||||
|
||||
@@ -38,10 +38,20 @@ proc/createRandomZlevel()
|
||||
|
||||
|
||||
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 world)
|
||||
if (L.name != "awaystart")
|
||||
continue
|
||||
awaydestinations.Add(L)
|
||||
|
||||
world << "\red \b Away mission loaded."
|
||||
|
||||
else
|
||||
world << "\red \b No away missions found."
|
||||
return
|
||||
@@ -1,237 +0,0 @@
|
||||
/*
|
||||
DMP to swapmap converter
|
||||
version 1.0
|
||||
|
||||
by Lummox JR
|
||||
*/
|
||||
|
||||
mob/verb/Convert(filename as file)
|
||||
dmp2swapmap(filename)
|
||||
|
||||
proc/d2sm_prepmap(filename)
|
||||
var/txt = file2text(filename)
|
||||
if(!txt) return
|
||||
var/i,j
|
||||
i=findText(txt,ascii2text(13)) // eliminate carriage returns
|
||||
while(i)
|
||||
txt=copytext(txt,1,i)+copytext(txt,i+1)
|
||||
i=findText(txt,ascii2text(13),i)
|
||||
i=findText(txt,"\\\n")
|
||||
while(i)
|
||||
for(j=i+2,j<=length(txt),++j) if(text2ascii(txt,j)>32) break
|
||||
txt=copytext(txt,1,i)+copytext(txt,j)
|
||||
i=findText(txt,"\\\n",i)
|
||||
return txt
|
||||
|
||||
proc/dmp2swapmap(filename)
|
||||
//var/txt = file2text(filename)
|
||||
//if(!txt) return
|
||||
var/txt = d2sm_prepmap(filename)
|
||||
var/mapname="[filename]"
|
||||
var/i,j,k
|
||||
i=findtext(mapname,".dmp")
|
||||
while(i && i+4<length(mapname)) i=findtext(mapname,".dmp",i+1)
|
||||
mapname=copytext(mapname,1,i)
|
||||
/* i=findText(txt,ascii2text(13))
|
||||
while(i)
|
||||
txt=copytext(txt,1,i)+copytext(txt,i+1)
|
||||
i=findText(txt,ascii2text(13),i)
|
||||
i=findText(txt,"\\\n")
|
||||
while(i)
|
||||
for(j=i+2,j<=length(txt),++j) if(text2ascii(txt,j)>32) break
|
||||
txt=copytext(txt,1,i)+copytext(txt,j)
|
||||
i=findText(txt,"\\\n",i) */
|
||||
var/list/codes=new
|
||||
var/codelen=1
|
||||
var/list/areas
|
||||
var/mode=34
|
||||
var/z=0
|
||||
var/X=0,Y=0,Z=0
|
||||
while(txt)
|
||||
if(text2ascii(txt)==34)
|
||||
if(mode!=34)
|
||||
world << "Corrupt map file [filename]: Unexpected code found after z-level [z]"
|
||||
return
|
||||
// standard line:
|
||||
// "a" = (/obj, /obj, /turf, /area)
|
||||
i=findtext(txt,"\"",2)
|
||||
var/code=copytext(txt,2,i)
|
||||
codelen=length(code)
|
||||
i=findtext(txt,"(",i)
|
||||
if(!i)
|
||||
world << "Corrupt map file [filename]: No type list follows \"[code]\""
|
||||
return
|
||||
k=findtext(txt,"\n",++i)
|
||||
j=(k || length(txt+1))
|
||||
while(--j>=i && text2ascii(txt,j)!=41)
|
||||
if(j<i)
|
||||
world << "Corrupt map file [filename]: Type list following \"[code]\" is incomplete"
|
||||
return
|
||||
var/list/L = d2sm_ParseCommaList(copytext(txt,i,j))
|
||||
if(istext(L))
|
||||
world << "Corrupt map file [filename]: [L]"
|
||||
return
|
||||
if(L.len<2)
|
||||
world << "Corrupt map file [filename]: Type list following \"[code]\" has only 1 item"
|
||||
return
|
||||
txt=k?copytext(txt,k+1):null
|
||||
if(L[L.len] == "[world.area]") L[L.len]=0
|
||||
else
|
||||
if(!areas) areas=list()
|
||||
i=areas.Find(L[L.len])
|
||||
if(i) L[L.len]=i
|
||||
else
|
||||
areas+=L[L.len]
|
||||
L[L.len]=areas.len
|
||||
var/codetrans=d2sm_ConvertType(L[L.len-1],"\t\t\t\t")
|
||||
if(L[L.len]) codetrans+="\t\t\t\tAREA = [L[L.len]]\n"
|
||||
if(L.len>2) codetrans+=d2sm_Contents(L,L.len-2,"\t\t\t\t")
|
||||
codes[code]=copytext(codetrans,1,length(codetrans))
|
||||
else if(text2ascii(txt)==40)
|
||||
mode=40
|
||||
// standard line (top-down, left-right symbol order):
|
||||
// (1,1,1) = {"
|
||||
// abcde
|
||||
// bcdef
|
||||
// "}
|
||||
i=d2sm_MatchBrace(txt,1,40)
|
||||
if(!i)
|
||||
world << "Corrupt map file [filename]: No matching ) for coordinates: [copytext(txt,1,findtext(txt,"\n"))]"
|
||||
return
|
||||
var/list/coords=d2sm_ParseCommaList(copytext(txt,2,i))
|
||||
if(istext(coords) || coords.len!=3)
|
||||
world << "Corrupt map file [filename]: [istext(coords)?(coords):"[copytext(txt,1,i+1)] is not a valid (x,y,z) coordinate"]"
|
||||
return
|
||||
j=findtext(txt,"{",i+1)
|
||||
if(!j)
|
||||
world << "Corrupt map file [filename]: No braces {} following [copytext(txt,1,i+1)]"
|
||||
return
|
||||
k=d2sm_MatchBrace(txt,j,123)
|
||||
if(!k)
|
||||
world << "Corrupt map file [filename]: No closing brace } following [copytext(txt,1,i+1)]"
|
||||
return
|
||||
var/mtxt=copytext(txt,j+1,k)
|
||||
if(findText(mtxt,"\"\n")!=1 || !findText(mtxt,"\n\"",length(mtxt)-1))
|
||||
world << findText(mtxt,"\"\n")
|
||||
world << findText(mtxt,"\n\"",length(mtxt)-1)
|
||||
world << "Corrupt map file [filename]: No quotes in braces following [copytext(txt,1,i+1)]"
|
||||
return
|
||||
mtxt=copytext(mtxt,2,length(mtxt))
|
||||
var/_x=0,_y=0
|
||||
for(i=1,,++_y)
|
||||
j=findText(mtxt,"\n",i+1)
|
||||
if(!j) break
|
||||
_x=max(_x,(j-i-1)/codelen)
|
||||
i=j
|
||||
X=max(X,_x)
|
||||
Y=max(Y,_y)
|
||||
z=text2num(coords[3])
|
||||
Z=max(Z,z)
|
||||
txt=copytext(txt,k+1)
|
||||
else
|
||||
i=findtext(txt,"\n")
|
||||
txt=i?copytext(txt,i+1):null
|
||||
world << "Map size: [X],[Y],[Z]"
|
||||
//for(var/code in codes)
|
||||
// world << "Code \"[code]\":\n[codes[code]]"
|
||||
fdel("map_[mapname].txt")
|
||||
var/F = file("map_[mapname].txt")
|
||||
F << ". = object(\".0\")\n.0\n\ttype = /swapmap\n\tid = \"[mapname]\"\n\tz = [Z]\n\ty = [Y]\n\tx = [X]"
|
||||
if(areas)
|
||||
txt=""
|
||||
for(i=0,i<areas.len,++i)
|
||||
txt+="[i?", ":""]object(\".[i]\")"
|
||||
F << "\tareas = list([txt])"
|
||||
for(i=0,i<areas.len,++i)
|
||||
F << "\t\t.[i]"
|
||||
txt=d2sm_ConvertType(areas[i+1],"\t\t\t")
|
||||
F << copytext(txt,1,length(txt))
|
||||
|
||||
// 2nd pass
|
||||
txt=d2sm_prepmap(filename)
|
||||
while(txt)
|
||||
// skip all non-data sections
|
||||
if(text2ascii(txt)!=40)
|
||||
i=findText(txt,"\n")
|
||||
if(i) txt=copytext(txt,i+1)
|
||||
else txt=null
|
||||
continue
|
||||
i=d2sm_MatchBrace(txt,1,40)
|
||||
var/list/coords=d2sm_ParseCommaList(copytext(txt,2,i))
|
||||
j=findtext(txt,"{",i+1)
|
||||
k=d2sm_MatchBrace(txt,j,123)
|
||||
var/mtxt=copytext(txt,j+2,k-1)
|
||||
var/_x=0,_y=0
|
||||
for(i=1,,++_y)
|
||||
j=findText(mtxt,"\n",i+1)
|
||||
if(!j) break
|
||||
_x=max(_x,(j-i-1)/codelen)
|
||||
i=j
|
||||
// print out this z-level now
|
||||
F << "\t[coords[3]]"
|
||||
i=1
|
||||
for(var/y=_y,y>0,--y) // map is top-down
|
||||
++i
|
||||
F << "\t\t[y]"
|
||||
for(var/x in 1 to _x)
|
||||
F << "\t\t\t[x]"
|
||||
j=i+codelen
|
||||
F << codes[copytext(mtxt,i,j)]
|
||||
i=j
|
||||
txt=copytext(txt,k+1)
|
||||
/* for(z in 1 to Z)
|
||||
F << "\t[z]"
|
||||
for(var/y in 1 to Y)
|
||||
F << "\t\t[y]"
|
||||
for(var/x in 1 to X)
|
||||
F << "\t\t\t[x]"
|
||||
F << codes[pick(codes)] */
|
||||
|
||||
proc/d2sm_ParseCommaList(txt)
|
||||
var/list/L=new
|
||||
var/i,ch
|
||||
for(i=1,i<=length(txt),++i)
|
||||
if(text2ascii(txt,i)>32) break
|
||||
for(,i<=length(txt),++i)
|
||||
ch=text2ascii(txt,i)
|
||||
if(ch==44)
|
||||
L+=copytext(txt,1,i)
|
||||
for(++i,i<=length(txt),++i) if(text2ascii(txt,i)>32) break
|
||||
txt=copytext(txt,i)
|
||||
i=0;continue
|
||||
if(ch==40 || ch==91 || ch==123)
|
||||
i=d2sm_MatchBrace(txt,i,ch)
|
||||
if(!i) return "No matching brace found for [ascii2text(ch)]"
|
||||
if(i>1) L+=copytext(txt,1,i)
|
||||
return L
|
||||
|
||||
proc/d2sm_MatchBrace(txt, i, which)
|
||||
if(which==40) ++which
|
||||
else which+=2
|
||||
var/j,ch
|
||||
for(j=i+1,j<=length(txt),++j)
|
||||
ch=text2ascii(txt,j)
|
||||
if(ch==which) return j
|
||||
if(ch==40 || ch==91 || ch==123)
|
||||
j=d2sm_MatchBrace(txt,j,ch)
|
||||
if(!j) return 0
|
||||
|
||||
proc/d2sm_ConvertType(tt,tabs="")
|
||||
var/i=findText(tt,"{")
|
||||
if(!i) return "[tabs]type = [tt]\n"
|
||||
.="[tabs]type = [copytext(tt,1,i)]\n"
|
||||
var/list/L=d2sm_ParseCommaList(copytext(tt,i+1,d2sm_MatchBrace(tt,i,123)))
|
||||
if(istext(L)) return
|
||||
for(var/pair in L)
|
||||
.="[.][tabs][pair]\n"
|
||||
|
||||
proc/d2sm_Contents(list/conts,n,tabs="")
|
||||
.="[tabs]contents = list("
|
||||
var/i
|
||||
for(i=0,i<n,++i)
|
||||
.+="[i?", ":""]object(\".[i]\")"
|
||||
.+=")\n"
|
||||
tabs+="\t"
|
||||
for(i=0,i<n,++i)
|
||||
.+="[tabs].[i]\n"
|
||||
.+=d2sm_ConvertType(conts[i+1],tabs+"\t")
|
||||
Reference in New Issue
Block a user