Added back json support / restart notice

should fix unnecessary restart after gamemode change before round start
This commit is contained in:
Head
2011-11-29 15:45:01 +01:00
parent 7d5dd0db31
commit 43d71282e0
6 changed files with 108 additions and 4 deletions

View File

@@ -338,6 +338,7 @@
#include "code\game\dna.dm"
#include "code\game\dna_mutations.dm"
#include "code\game\hud.dm"
#include "code\game\json.dm"
#include "code\game\landmarks.dm"
#include "code\game\master_controller.dm"
#include "code\game\prisonshuttle.dm"

View File

@@ -123,7 +123,7 @@
//Crispy fullban
/world/Reboot(var/reason)
spawn(0)
//world << sound(pick('newroundsexy.ogg','apcdestroyed.ogg','bangindonk.ogg')) // random end sounds!! - LastyBatsy No, no random end sounds. - Miniature
//world << sound(pick('newroundsexy.ogg','apcdestroyed.ogg','bangindonk.ogg')) // random end sounds!! - LastyBatsy No, no random end sounds. - Miniature
//if(prob(40))
// for(var/mob/M in world)
// if(M.client)
@@ -132,7 +132,7 @@
// for(var/mob/M in world)
// if(M.client)
// M << sound('apcdestroyed.ogg')
send2irc(world.url,"Server Rebooting!")
for(var/client/C)
if (config.server) //if you set a server location in config.txt, it sends you there instead of trying to reconnect to the same world address. -- NeoFite
C << link("byond://[config.server]")

View File

@@ -173,6 +173,7 @@ var/global/datum/controller/gameticker/ticker
else
feedback_set_details("end_proper","proper completion")
world << "\blue <B>Restarting in [restart_timeout/10] seconds</B>"
// send2irc(world.url,"Server Rebooting!")
feedback_set_details("round_end","[time2text(world.realtime)]")
if(blackbox)

102
code/game/json.dm Normal file
View File

@@ -0,0 +1,102 @@
var/jsonpath = "/home/bay12/public_html"
var/dmepath = "/home/bay12/git/baystation12.dme"
var/makejson = 1 //temp
world/proc/makejson()
if(!makejson)
return
fdel("[jsonpath]/info.json")
//usr << "Error cant delete json"
//else
//usr << "Deleted json in public html"
fdel("info.json")
//usr << "error cant delete local json"
//else
//usr << "Deleted local json"
var/F = file("info.json")
if(!isfile(F))
return
var/mode
if(ticker)
if(ticker.current_state == 1)
mode = "Round Setup"
else if(ticker.hide_mode)
mode = "SECRET"
else
mode = master_mode
var/playerscount = 0
var/players = ""
var/admins = "no"
for(var/client/C)
playerscount++
if(C.holder)
if(!C.stealth)
admins = "yes"
players += "[C.key];"
else
players += "[C.fakekey];"
else
players += "[C.key];"
F << "{\"mode\":\"[mode]\",\"players\" : \"[players]\",\"playercount\" : \"[playerscount]\",\"admin\" : \"[admins]\",\"time\" : \"[time2text(world.realtime,"MM/DD - hh:mm")]\"}"
fcopy("info.json","[jsonpath]/info.json")
/proc/switchmap(newmap,newpath)
var/oldmap
var/obj/mapinfo/M = locate()
if(M)
oldmap = M.mapname
else
message_admins("Did not locate mapinfo object. Go bug the mapper to add a /obj/mapinfo to their map!\n For now, you can probably spawn one manually. If you do, be sure to set it's mapname var correctly, or else you'll just get an error again.")
return
message_admins("Current map: [oldmap]")
var/text = file2text(dmepath)
var/path = "#include \"maps/[oldmap].dmm\""
var/xpath = "#include \"maps/[newpath].dmm\""
var/loc = findtext(text,path,1,0)
if(!loc)
path = "#include \"maps\\[oldmap].dmm\""
xpath = "#include \"maps\\[newpath].dmm\""
loc = findtext(text,path,1,0)
if(!loc)
message_admins("Could not find '#include \"maps\\[oldmap].dmm\"' or '\"maps/[oldmap].dmm\"' in the bs12.dme. The mapinfo probably has an incorrect mapname var. Alternatively, could not find the .dme itself, at [dmepath].")
return
var/rest = copytext(text, loc + length(path))
text = copytext(text,1,loc)
text += "\n[xpath]"
text += rest
/* for(var/A in lines)
if(findtext(A,path,1,0))
lineloc = lines.Find(A,1,0)
lines[lineloc] = xpath
world << "FOUND"*/
fdel(dmepath)
var/file = file(dmepath)
file << text
message_admins("Compiling...")
shell("./recompile")
message_admins("Done")
world.Reboot("Switching to [newmap]")
obj/mapinfo
invisibility = 101
var/mapname = "thismap"
var/decks = 4
proc/GetMapInfo()
var/obj/mapinfo/M = locate()
world << M.name
world << M.mapname
client/proc/ChangeMap(var/X as text)
set name = "Change Map"
set category = "Admin"
switchmap(X,X)
proc/send2irc(msg,msg2)
shell("python26 nudge.py [msg] [msg2]")
proc/send2adminirc(channel,msg)
world << channel << " "<< msg
shell("python26 nudge.py '[channel]' [msg]")
p //test

View File

@@ -74,7 +74,7 @@
world << "Result is change to \red [wintext]"
world.save_mode(winner)
if(ticker)
if(ticker.current_state != 1)
world <<"\red <B>World will reboot in 10 seconds</B>"
feedback_set_details("end_error","mode vote - [winner]")

View File

@@ -2152,7 +2152,7 @@
feedback_set_details("round_end","[time2text(world.realtime)]")
if(blackbox)
blackbox.save_all_data_to_sql()
//send2irc(world.url,"Server Rebooting!")
sleep(50)
world.Reboot()