Original mirrored too much.

This commit is contained in:
LetterJay
2017-06-05 07:18:29 -05:00
parent b93c49bd1d
commit 60da3ff9b8
12 changed files with 238 additions and 83 deletions
+5
View File
@@ -421,6 +421,8 @@
return
var/list/options = list("Regular Restart", "Hard Restart (No Delay/Feeback Reason)", "Hardest Restart (No actions, just reboot)")
if(world.RunningService())
options += "Service Restart (Force restart DD)";
var result = input(usr, "Select reboot method", "World Reboot", options[1]) as null|anything in options
if(result)
SSblackbox.add_details("admin_verb","Reboot World") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
@@ -433,6 +435,9 @@
if("Hardest Restart (No actions, just reboot)")
world.Reboot(fast_track = TRUE)
if("Service Restart (Force restart DD)")
GLOB.reboot_mode = REBOOT_MODE_HARD
world.ServiceReboot()
/datum/admins/proc/end_round()
set category = "Server"
+8 -7
View File
@@ -183,7 +183,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
to_chat(C, "<span class='adminnotice'>PM to-<b>Admins</b>: [name]</span>")
//send it to irc if nobody is on and tell us how many were on
var/admin_number_present = send2irc_adminless_only(initiator_ckey, name)
var/admin_number_present = send2irc_adminless_only("#[id] [initiator_ckey]", name)
log_admin_private("Ticket #[id]: [key_name(initiator)]: [name] - heard by [admin_number_present] non-AFK admins who have +BAN.")
if(admin_number_present <= 0)
to_chat(C, "<span class='notice'>No active admins are online, your adminhelp was sent to the admin irc.</span>")
@@ -431,9 +431,9 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
/obj/effect/statclick/ahelp
var/datum/admin_help/ahelp_datum
/obj/effect/statclick/ahelp/Initialize(mapload, datum/admin_help/AH)
/obj/effect/statclick/ahelp/Initialize(mapload, datum/admin_help/AH)
ahelp_datum = AH
. = ..()
. = ..()
/obj/effect/statclick/ahelp/update()
return ..(ahelp_datum.name)
@@ -479,7 +479,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
current_ticket.MessageNoRecipient(msg)
current_ticket.TimeoutVerb()
return
else
else
to_chat(usr, "<span class='warning'>Ticket not found, creating new one...</span>")
else
current_ticket.AddInteraction("[key_name_admin(usr)] opened a new ticket.")
@@ -567,9 +567,10 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
/proc/send2irc(msg,msg2)
if(config.useircbot)
if(world.RunningService())
world.ExportService("[SERVICE_REQUEST_IRC_ADMIN_CHANNEL_MESSAGE] [msg] | [msg2]")
else if(config.useircbot)
shell("python nudge.py [msg] [msg2]")
return
/proc/send2otherserver(source,msg,type = "Ahelp")
if(config.cross_allowed)
@@ -591,7 +592,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
admin_keys += "[C][C.holder.fakekey ? "(Stealth)" : ""][C.is_afk() ? "(AFK)" : ""]"
for(var/admin in admin_keys)
if(LAZYLEN(message) > 1)
if(LAZYLEN(message) > 1)
message += ", [admin]"
else
message += "[admin]"
+33 -31
View File
@@ -11,7 +11,7 @@
if( !ismob(M) || !M.client )
return
cmd_admin_pm(M.client,null)
SSblackbox.add_details("admin_verb","Admin PM Mob") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
SSblackbox.add_details("admin_verb","Admin PM Mob") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
//shows a list of clients we could send PMs to, then forwards our choice to cmd_admin_pm
/client/proc/cmd_admin_pm_panel()
@@ -33,7 +33,7 @@
targets["(No Mob) - [T]"] = T
var/target = input(src,"To whom shall we send a message?","Admin PM",null) as null|anything in sortList(targets)
cmd_admin_pm(targets[target],null)
SSblackbox.add_details("admin_verb","Admin PM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
SSblackbox.add_details("admin_verb","Admin PM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/cmd_ahelp_reply(whom)
if(prefs.muted & MUTE_ADMINHELP)
@@ -59,11 +59,11 @@
if (!msg)
message_admins("[key_name_admin(src)] has cancelled their reply to [key_name(C, 0, 0)]'s admin help.")
return
cmd_admin_pm(whom, msg, AH)
cmd_admin_pm(whom, msg)
//takes input from cmd_admin_pm_context, cmd_admin_pm_panel or /client/Topic and sends them a PM.
//Fetching a message if needed. src is the sender and C is the target client
/client/proc/cmd_admin_pm(whom, msg, datum/admin_help/AH)
/client/proc/cmd_admin_pm(whom, msg)
if(prefs.muted & MUTE_ADMINHELP)
to_chat(src, "<font color='red'>Error: Admin-PM: You are unable to use admin PM-s (muted).</font>")
return
@@ -103,7 +103,7 @@
if(!recipient)
if(holder)
to_chat(src, "<font color='red'>Error: Admin-PM: Client not found.</font>")
to_chat(src, msg)
to_chat(src, msg)
else
current_ticket.MessageNoRecipient(msg)
return
@@ -144,9 +144,9 @@
if(irc)
to_chat(src, "<font color='blue'>PM to-<b>Admins</b>: [rawmsg]</font>")
admin_ticket_log(src, "<font color='red'>Reply PM from-<b>[key_name(src, TRUE, TRUE)] to <i>IRC</i>: [keywordparsedmsg]</font>")
var/datum/admin_help/AH = admin_ticket_log(src, "<font color='red'>Reply PM from-<b>[key_name(src, TRUE, TRUE)] to <i>IRC</i>: [keywordparsedmsg]</font>")
ircreplyamount--
send2irc("Reply: [ckey]",rawmsg)
send2irc("[AH ? "#[AH.id] " : ""]Reply: [ckey]", rawmsg)
else
if(recipient.holder)
if(holder) //both are admins
@@ -221,42 +221,44 @@
var/datum/admin_help/ticket = C ? C.current_ticket : GLOB.ahelp_tickets.CKey2ActiveTicket(target)
var/compliant_msg = trim(lowertext(msg))
var/unhandled = FALSE
var/irc_tagged = "[sender](IRC)"
switch(compliant_msg)
if("ticket close")
if(ticket)
ticket.Close(irc_tagged)
return "Ticket #[ticket.id] successfully closed"
if("ticket resolve")
if(ticket)
ticket.Resolve(irc_tagged)
return "Ticket #[ticket.id] successfully resolved"
if("ticket ic")
if(ticket)
ticket.ICIssue(irc_tagged)
return "Ticket #[ticket.id] successfully marked as IC issue"
if("ticket reject")
if(ticket)
ticket.Reject(irc_tagged)
return "Ticket #[ticket.id] successfully rejected"
else
unhandled = TRUE
if(!unhandled)
return "Ticket could not be found"
var/list/splits = splittext(compliant_msg, " ")
if(splits.len && splits[1] == "ticket")
if(splits.len < 2)
return "Usage: ticket <close|resolve|icissue|reject>"
switch(splits[2])
if("close")
if(ticket)
ticket.Close(irc_tagged)
return "Ticket #[ticket.id] successfully closed"
if("resolve")
if(ticket)
ticket.Resolve(irc_tagged)
return "Ticket #[ticket.id] successfully resolved"
if("icissue")
if(ticket)
ticket.ICIssue(irc_tagged)
return "Ticket #[ticket.id] successfully marked as IC issue"
if("reject")
if(ticket)
ticket.Reject(irc_tagged)
return "Ticket #[ticket.id] successfully rejected"
else
return "Usage: ticket <close|resolve|icissue|reject>"
return "Error: Ticket could not be found"
var/static/stealthkey
var/adminname = config.showircname ? irc_tagged : "Administrator"
if(!C)
return "No client"
return "Error: No client"
if(!stealthkey)
stealthkey = GenIrcStealthKey()
msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN))
if(!msg)
return "No message"
return "Error: No message"
message_admins("IRC message from [sender] to [key_name_admin(C)] : [msg]")
log_admin_private("IRC PM: [sender] -> [key_name(C)] : [msg]")
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env python3
import sys
import pickle
import socket
def pack():
data = sys.argv[1]
nudge(str.encode(data))
def nudge(data):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
with open('config/server_to_tool_bridge_port.txt', 'r') as myfile:
portstr=myfile.read().replace('\n', '').strip()
s.connect(("localhost", int(portstr)))
s.send(data)
s.close()
if __name__ == "__main__" and len(sys.argv) > 1:
pack()
+79
View File
@@ -0,0 +1,79 @@
GLOBAL_VAR_INIT(reboot_mode, REBOOT_MODE_NORMAL) //if the world should request the service to kill it at reboot
GLOBAL_PROTECT(reboot_mode)
/world/proc/RunningService()
return params[SERVICE_WORLD_PARAM]
/world/proc/ExportService(command)
return shell("python code/modules/server_tools/nudge.py \"[command]\"") == 0
/world/proc/IRCBroadcast(msg)
ExportService("[SERVICE_REQUEST_IRC_BROADCAST] [msg]")
//called at the exact moment the world is supposed to reboot
/world/proc/ServiceReboot()
switch(GLOB.reboot_mode)
if(REBOOT_MODE_HARD)
to_chat(src, "<span class='boldannounce'>Hard reboot triggered, you will automatically reconnect...</span>")
log_world("Sending shutdown request!");
sleep(1) //flush the buffers
ExportService(SERVICE_REQUEST_KILL_PROCESS)
if(REBOOT_MODE_SHUTDOWN)
to_chat(src, "<span class='boldannounce'>The server is shutting down...</span>")
log_world("Deleting world")
qdel(src)
/world/proc/ServiceCommand(list/params)
var/sCK = RunningService()
var/their_sCK = params[SERVICE_CMD_PARAM_KEY]
if(!their_sCK || their_sCK != sCK)
return "Invalid comms key!";
var/command = params[SERVICE_CMD_PARAM_COMMAND]
if(!command)
return "No command!"
var/static/last_irc_status = 0
switch(command)
if(SERVICE_CMD_HARD_REBOOT)
if(GLOB.reboot_mode != REBOOT_MODE_HARD)
GLOB.reboot_mode = REBOOT_MODE_HARD
log_world("Hard reboot requested by service")
message_admins("The world will hard reboot at the end of the game. Requested by service.")
SSblackbox.set_val("service_hard_restart", TRUE)
if(SERVICE_CMD_GRACEFUL_SHUTDOWN)
if(GLOB.reboot_mode != REBOOT_MODE_SHUTDOWN)
GLOB.reboot_mode = REBOOT_MODE_SHUTDOWN
log_world("Shutdown requested by service")
message_admins("The world will shutdown at the end of the game. Requested by service.")
SSblackbox.set_val("service_shutdown", TRUE)
if(SERVICE_CMD_WORLD_ANNOUNCE)
var/msg = params["message"]
if(!istext(msg) || !msg)
return "No message set!"
to_chat(src, "<span class='boldannounce'>[html_encode(msg)]</span>")
return "SUCCESS"
if(SERVICE_CMD_IRC_STATUS)
var/rtod = REALTIMEOFDAY
if(rtod - last_irc_status < IRC_STATUS_THROTTLE)
return
last_irc_status = rtod
var/list/adm = get_admin_counts()
var/list/allmins = adm["total"]
var/status = "Admins: [allmins.len] (Active: [english_list(adm["present"])] AFK: [english_list(adm["afk"])] Stealth: [english_list(adm["stealth"])] Skipped: [english_list(adm["noflags"])]). "
status += "Players: [GLOB.clients.len] (Active: [get_active_player_count(0,1,0)]). Mode: [SSticker.mode ? SSticker.mode.name : "Not started"]."
return status
if(SERVICE_CMD_ADMIN_MSG)
return IrcPm(params[SERVICE_CMD_PARAM_TARGET], params[SERVICE_CMD_PARAM_MESSAGE], params[SERVICE_CMD_PARAM_SENDER])
if(SERVICE_CMD_NAME_CHECK)
log_admin("IRC Name Check: [params[SERVICE_CMD_PARAM_SENDER]] on [params[SERVICE_CMD_PARAM_TARGET]]")
message_admins("IRC name checking on [params[SERVICE_CMD_PARAM_TARGET]] from [params[SERVICE_CMD_PARAM_SENDER]]")
return keywords_lookup(params[SERVICE_CMD_PARAM_TARGET], 1)
if(SERVICE_CMD_ADMIN_WHO)
return ircadminwho()
else
return "Unknown command: [command]"