Skip to content

Commit

Permalink
Seal of Solomon (ColonialMarines-Mirror#346)
Browse files Browse the repository at this point in the history
* Begins preparations for the ritual.

* Spreads salt and other ingredients that shall not be named.

* Begins the banishing ritual.

* Chasing a stray imp.
  • Loading branch information
Rohesie authored and ninjanomnom committed Sep 22, 2018
1 parent eab4c9e commit 964cb24
Show file tree
Hide file tree
Showing 23 changed files with 6 additions and 1,611 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "Seal-of-Solomon"]
path = Seal-of-Solomon
url = https://github.com/ColonialMarines-Mirror/Seal-of-Solomon
1 change: 1 addition & 0 deletions Seal-of-Solomon
Submodule Seal-of-Solomon added at 821fb0
156 changes: 0 additions & 156 deletions code/controllers/voting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -325,159 +325,3 @@ datum/controller/vote

if(vote)
src << browse(vote.interface(client),"window=vote;can_close=0")



var/MapDaemon_UID = -1 //-1 by default so we know when to set it
var/force_mapdaemon_vote = 0

//Basically, this completely ignores the voting datum etc in favor of editing a simple a simple list, player_votes
//Upon request by MapDaemon, world/Topic() will it into JSON and send it away, so we do 0 handling in DM
/client/verb/mapVote()
set category = "OOC"
set name = "Map Vote"

if(!ticker.mode || !ticker.mode.round_finished)
to_chat(src, "<span class='notice'>Please wait until the round ends.</span>")
return

var/list/L = list()
L += "Don't care"
L += NEXT_MAP_CANDIDATES.Copy()
var/selection = input("Vote for the next map to play on", "Vote:", "Don't care") as null|anything in L

if(!selection || !src) return

if(selection == "Don't care")
to_chat(src, "<span class='notice'>You have not voted.</span>")
return

to_chat(src, "<span class='notice'>You have voted for [selection].</span>")

player_votes[src.ckey] = selection

/client/proc/forceMDMapVote()
set name = "Map Vote - Force Initiate"
set category = "Server"

force_mapdaemon_vote = !force_mapdaemon_vote
to_chat(src, "<span class='notice'>The server will [force_mapdaemon_vote ? "now" : "no longer"] tell Mapdaemon to start a vote the next time possible.</span>")

message_admins("[src] is attempting to force a MapDaemon vote.")
log_admin("[src] is attempting to force a MapDaemon vote.")

//Uses an invalid ckey to rig the votes
//Special case for }}} handled in World/Topic()
//Set up so admins can fight over what the map will be, hurray
/client/proc/forceNextMap()
set name = "Map Vote - Force"
set category = "Server"

if(alert("Are you sure you want to force the next map?",, "Yes", "No") == "No") return

var/selection = input("Vote for the next map to play on", "Vote:", "LV-624") as null|anything in NEXT_MAP_CANDIDATES

if(!selection || !src) return

to_chat(src, "<span class='notice'>You have forced the next map to be [selection]</span>")

log_admin("[src] just forced the next map to be [selection].")
message_admins("[src] just forced the next map to be [selection].")

player_votes["}}}"] = selection //}}} is an invalid ckey so we won't be in risk of someone using this cheekily


var/enable_map_vote = 1
/client/proc/cancelMapVote()
set name = "Map Vote - Toggle"
set category = "Server"

if(alert("Are you sure you want to turn the map vote [!enable_map_vote ? "on" : "off"]?",, "Yes", "No") == "No") return

enable_map_vote = !enable_map_vote

to_chat(world, "<span class='notice'>[src] has toggled the map vote [enable_map_vote ? "on" : "off"]</span>")
to_chat(src, "<span class='notice'>You have toggled the map vote [enable_map_vote ? "on" : "off"]</span>")

log_admin("[src] just toggled the map vote [enable_map_vote ? "on" : "off"].")
message_admins("[src] just toggled the map vote [enable_map_vote ? "on" : "off"].")

/client/proc/showVotableMaps()
set name = "Map Vote - List Maps"
set category = "Server"

to_chat(src, "Next map candidates:")
var/i
for(i in NEXT_MAP_CANDIDATES)
to_chat(src, i)

/client/proc/editVotableMaps()
set name = "Map Vote - Edit Maps"
set category = "Server"

if(alert("Are you sure you want to edit the map voting candidates?",, "Yes", "No") == "No") return

switch(alert("Do you want to add or remove a map?",, "Add", "Remove", "Cancel"))
if("Cancel")
return
if("Add")
var/selection = ""
switch(alert("Do you want to add one of the default map possibilities?",, "Yes", "No"))
if("Yes")
selection = input("Pick a default map.") as null|anything in DEFAULT_NEXT_MAP_CANDIDATES
if("No")
if(alert("Warning! This is a very dangerous option. If there is a typo in the map name and your choice wins, MapDaemon will crash. Please make sure you enter the exact name of the map. Are you sure you want to continue?", "WARNING", "Yes", "No") == "No") return
selection = input("Enter a map at your own risk.")

if(!selection || !src) return
if(NEXT_MAP_CANDIDATES.Find(selection))
alert("That option was already available.")
return
NEXT_MAP_CANDIDATES.Add(selection)
message_admins("[src] just added [selection] to the map pool.")
log_admin("[src] just added [selection] to the map pool.")
if("Remove")
var/selection = input("Pick a map to remove from the pool") as null|anything in NEXT_MAP_CANDIDATES
if(!selection || !src) return
NEXT_MAP_CANDIDATES.Remove(selection)
message_admins("[src] just removed [selection] from the map pool.")
log_admin("[src] just removed [selection] from the map pool.")

var/kill_map_daemon = 0
/client/proc/killMapDaemon()
set name = "Map Vote - Kill MapDaemon"
set category = "Server"

if(alert("Are you sure you want to kill MapDaemon?",, "Yes", "No") == "No") return

kill_map_daemon = 1

alert("MapDaemon will be killed on next round-end check.")
message_admins("[src] just killed MapDaemon. It may be restarted with \"Map Vote - Revive MapDaemon\".")
log_admin("[src] just killed MapDaemon. It may be restarted with \"Map Vote - Revive MapDaemon\".")

/client/proc/reviveMapDaemon()
set name = "Map Vote - Revive MapDaemon"
set category = "Server"

kill_map_daemon = 0

message_admins("[src] is attempting to restart MapDaemon.")
log_admin("[src] is attempting to restart MapDaemon.")

run_mapdaemon_batch()

//Need to return 1 so that the thing calling hooks wont think that this failed
/hook/roundstart/proc/launchMapDaemon()

run_mapdaemon_batch()

return 1

/proc/run_mapdaemon_batch()

set waitfor = 0

if(world.system_type != MS_WINDOWS) return 0 //Don't know if it'll work for non-Windows, so let's just abort

shell("run_mapdaemon.bat")
11 changes: 2 additions & 9 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,7 @@ var/list/admin_verbs_server = list(
/client/proc/cmd_debug_del_all,
/datum/admins/proc/adrev,
/datum/admins/proc/adspawn,
/datum/admins/proc/adjump,
/client/proc/forceNextMap,
/client/proc/cancelMapVote,
/client/proc/killMapDaemon,
/client/proc/editVotableMaps,
/client/proc/showVotableMaps,
/client/proc/forceMDMapVote,
/client/proc/reviveMapDaemon
/datum/admins/proc/adjump
)
var/list/admin_verbs_debug = list(
/client/proc/cmd_admin_list_open_jobs,
Expand Down Expand Up @@ -264,7 +257,7 @@ var/list/admin_verbs_mod = list(
/client/proc/cmd_admin_subtle_message, /*send an message to somebody as a 'voice in their head'*/
/client/proc/cmd_admin_xeno_report, //Allows creation of IC reports by the Queen Mother
/proc/release,
/datum/admins/proc/viewUnheardAhelps, //Why even have it as a client proc anyway? ¯\_("/)_/¯
/datum/admins/proc/viewUnheardAhelps, //Why even have it as a client proc anyway?
/datum/admins/proc/viewCLFaxes,
/datum/admins/proc/viewUSCMFaxes
)
Expand Down
7 changes: 0 additions & 7 deletions code/modules/client/client procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@
cmd_admin_pm(C,null)
return

//Map voting
if(href_list["vote_for_map"])
mapVote()
return


//Logs all hrefs
if(config && config.log_hrefs)
log_href("[time2text(world.timeofday,"hh:mm")] [src] (usr:[usr]) || [hsrc ? "[hsrc] " : ""][href]")
Expand Down Expand Up @@ -251,7 +245,6 @@
query_accesslog.Execute()


#undef TOPIC_SPAM_DELAY
#undef UPLOAD_LIMIT
#undef MIN_CLIENT_VERSION

Expand Down
134 changes: 0 additions & 134 deletions code/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -195,124 +195,6 @@ var/world_topic_spam_protect_time = world.timeofday
return player_notes_show_irc(input["notes"])


//START: MAPDAEMON PROCESSING
if(addr == "127.0.0.1") //Verify that instructions are coming from the local machine

var/list/md_args = splittext(T,"&")
var/command = md_args[1]
var/MD_UID = md_args[2]

if(command == "mapdaemon_get_round_status")

if(!ticker) return "ERROR" //Yeah yeah wrong data type, but MapDaemon.java can handle it

if(MapDaemon_UID == -1) MapDaemon_UID = MD_UID //If we haven't seen an instance of MD yet, this is ours now

if(kill_map_daemon || MD_UID != MapDaemon_UID) return 2 //The super secret killing code that kills it until it's been killed.

else if(!ticker.mode) return 0 //Before round start

else if(ticker.mode.round_finished || force_mapdaemon_vote) return 1

else return 0 //IDK what would cause this but why not, don't really want runtimes

else if(MD_UID != MapDaemon_UID)
return 2 //kill the imposter, kill it with fire

else if(command == "mapdaemon_delay_round")

if(!ticker) return "ERROR"
spawn(200) //20 seconds

var/text = ""
text += "<hr><br>"
text += "<span class='centerbold'>"
text += "<font color='#00CC00'><b>You have 30 seconds to vote for the next map! Use the \"Map Vote\" verb in the OOC tab or click <a href='?src=\ref[src];vote_for_map=1'>here</a> to select an option.</b></font>"
text += "</span>"
text += "<hr><br>"

to_chat(world, text)
world << 'sound/voice/start_your_voting.ogg'

ticker.delay_end = 1
log_admin("World/Topic() call (likely MapDaemon.exe) has delayed the round end.")
message_admins("World/Topic() call (likely MapDaemon.exe) has delayed the round end.", 1)
return "SUCCESS"

else if(command == "mapdaemon_restart_round")

if(!ticker) return "ERROR"

ticker.delay_end = 0
message_admins("World/Topic() call (likely MapDaemon.exe) has resumed the round end.", 1)

//So admins have a chance to make EORG bans and do whatever
message_staff("NOTICE: Delay round within 30 seconds in order to prevent auto-restart!", 1)

MapDaemonHandleRestart() //Doesn't hold

return "WILL DO" //Yessir!

else if(command == "mapdaemon_receive_votes")

var/list/L = list()

var/i
for(i in NEXT_MAP_CANDIDATES)
L[i] = 0 //Initialize it

var/forced = 0
var/force_result = ""
i = null //Sanitize for safety
var/j
for(i in player_votes)
j = player_votes[i]
if(i == "}}}") //Special invalid ckey for forcing the next map
forced = 1
force_result = j
continue
L[j] = L[j] + 1 //Just number of votes indexed by map name

i = null
var/most_votes = -1
var/next_map = ""
for(i in L)
if(L[i] > most_votes)
most_votes = L[i]
next_map = i

if(!enable_map_vote && ticker && ticker.mode)
next_map = ticker.mode.name
else if(enable_map_vote && forced)
next_map = force_result

var/text = ""
text += "<font color='#00CC00'>"

var/log_text = ""
log_text += "\[[time2text(world.realtime, "DD Month YYYY")]\] Winner: [next_map] ("

text += "The voting results were:<br>"
for(var/name in L)
text += "[name] - [L[name]]<br>"
log_text += "[name] - [L[name]],"

log_text += ")\n"

if(forced) text += "<b>An admin has forced the next map.</b><br>"
else
text2file(log_text, "data/map_votes.txt")

text += "<b>The next map will be on [forced ? force_result : next_map].</b>"

text += "</font>"

to_chat(world, text)

return next_map



/world/Reboot(var/reason)
/*spawn(0)
world << sound(pick('sound/AI/newroundsexy.ogg','sound/misc/apcdestroyed.ogg','sound/misc/bangindonk.ogg')) // random end sounds!! - LastyBatsy
Expand Down Expand Up @@ -482,20 +364,4 @@ proc/establish_old_db_connection()
else
return 1

/proc/MapDaemonHandleRestart()
set waitfor = 0

sleep(300)

if(ticker.delay_end) return

to_chat(world, "\red <b>Restarting world!</b> \blue Initiated by MapDaemon.exe!")
log_admin("World/Topic() call (likely MapDaemon.exe) initiated a reboot.")

if(blackbox)
blackbox.save_all_data_to_sql() //wtf does this even do?

sleep(30)
world.Reboot() //Whatever this is the important part

#undef FAILED_DB_CONNECTION_CUTOFF
38 changes: 0 additions & 38 deletions tools/MapDaemon/MAPDAEMON_README.txt

This file was deleted.

Loading

0 comments on commit 964cb24

Please sign in to comment.