mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 02:34:00 +00:00
Updated the linkage between the NanoTrasen IRC bot and the server.
- Server will now send adminhelps to the admin channel, with information if there is no admins online. - Server will inform the admin channel if the last admin online logs out. - When a round ends, the server will alert the main channel, supplying some statistics. Additionally, laid the groundwork for an external scripts system. This is fully configurable/togglable in the config.txt file. Signed-off-by: Mloc-Argent <colmohici@gmail.com>
This commit is contained in:
@@ -76,7 +76,6 @@
|
||||
var/alert_desc_delta = "The station's self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill."
|
||||
|
||||
var/forbid_singulo_possession = 0
|
||||
var/useircbot = 0
|
||||
|
||||
//game_options.txt configs
|
||||
|
||||
@@ -118,6 +117,11 @@
|
||||
var/gateway_delay = 18000 //How long the gateway takes before it activates. Default is half an hour.
|
||||
var/ghost_interaction = 0
|
||||
|
||||
var/use_irc_bot = 0
|
||||
var/main_irc = ""
|
||||
var/admin_irc = ""
|
||||
var/python_path = "" //Path to the python executable. Defaults to "python" on windows and "/usr/bin/env python2" on unix
|
||||
|
||||
|
||||
/datum/configuration/New()
|
||||
var/list/L = typesof(/datum/game_mode) - /datum/game_mode
|
||||
@@ -359,8 +363,8 @@
|
||||
if("allow_holidays")
|
||||
Holiday = 1
|
||||
|
||||
if("useircbot")
|
||||
useircbot = 1
|
||||
if("use_irc_bot")
|
||||
use_irc_bot = 1
|
||||
|
||||
if("ticklag")
|
||||
Ticklag = text2num(value)
|
||||
@@ -399,6 +403,21 @@
|
||||
if("ghost_interaction")
|
||||
config.ghost_interaction = 1
|
||||
|
||||
if("main_irc")
|
||||
config.main_irc = value
|
||||
|
||||
if("admin_irc")
|
||||
config.admin_irc = value
|
||||
|
||||
if("python_path")
|
||||
if(value)
|
||||
config.python_path = value
|
||||
else
|
||||
if(world.system_type == UNIX)
|
||||
config.python_path = "/usr/bin/env python2"
|
||||
else //probably windows, if not this should work anyway
|
||||
config.python_path = "python"
|
||||
|
||||
else
|
||||
diary << "Unknown setting in configuration: '[name]'"
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ datum/shuttle_controller
|
||||
|
||||
start_location.move_contents_to(end_location)
|
||||
settimeleft(SHUTTLELEAVETIME)
|
||||
send2irc("Server", "The Emergency Shuttle has docked with the station.")
|
||||
//send2irc("Server", "The Emergency Shuttle has docked with the station.")
|
||||
captain_announce("The Emergency Shuttle has docked with the station. You have [round(timeleft()/60,1)] minutes to board the Emergency Shuttle.")
|
||||
world << sound('sound/AI/shuttledock.ogg')
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ Implants;
|
||||
if(escaped_on_pod_5 > 0)
|
||||
feedback_set("escaped_on_pod_5",escaped_on_pod_5)
|
||||
|
||||
send2irc("Server", "Round just ended.")
|
||||
send2mainirc("A round of [src.name] has ended - [surviving_total] survivors, [ghosts] ghosts.")
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ var/global/datum/controller/gameticker/ticker
|
||||
if(C.holder)
|
||||
admins_number++
|
||||
if(admins_number == 0)
|
||||
send2irc("Server", "Round just started with no admins online!")
|
||||
send2adminirc("Round has started with no admins online.")
|
||||
|
||||
supply_shuttle.process() //Start the supply shuttle regenerating points -- TLE
|
||||
master_controller.process() //Start master_controller.process()
|
||||
|
||||
@@ -106,15 +106,10 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","
|
||||
log_admin("HELP: [key_name(src)]: [original_msg] - heard by [admin_number_present] non-AFK admins.")
|
||||
if(admin_number_present <= 0)
|
||||
if(!admin_number_afk)
|
||||
send2irc(ckey, "[original_msg] - No admins online")
|
||||
send2adminirc("ADMINHELP from [key_name(src)]: [original_msg] - !!No admins online!!")
|
||||
else
|
||||
send2irc(ckey, "[original_msg] - All admins AFK ([admin_number_afk])")
|
||||
send2adminirc("ADMINHELP from [key_name(src)]: [original_msg] - !!All admins AFK ([admin_number_afk])!!")
|
||||
else
|
||||
send2irc(ckey, original_msg)
|
||||
send2adminirc("ADMINHELP from [key_name(src)]: [original_msg]")
|
||||
feedback_add_details("admin_verb","AH") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
return
|
||||
|
||||
proc/send2irc(msg,msg2)
|
||||
if(config.useircbot)
|
||||
shell("python [config.nudge_script_path] [msg] [msg2]")
|
||||
return
|
||||
14
code/modules/ext_scripts/irc.dm
Normal file
14
code/modules/ext_scripts/irc.dm
Normal file
@@ -0,0 +1,14 @@
|
||||
/proc/send2irc(var/channel, var/msg)
|
||||
if(config.use_irc_bot)
|
||||
ext_python("ircbot_message.py", "[channel] [msg]")
|
||||
return
|
||||
|
||||
/proc/send2mainirc(var/msg)
|
||||
if(config.use_irc_bot && config.main_irc)
|
||||
ext_python("ircbot_message.py", "[config.main_irc] [msg]")
|
||||
return
|
||||
|
||||
/proc/send2adminirc(var/msg)
|
||||
if(config.use_irc_bot && config.admin_irc)
|
||||
ext_python("ircbot_message.py", "[config.admin_irc] [msg]")
|
||||
return
|
||||
9
code/modules/ext_scripts/python.dm
Normal file
9
code/modules/ext_scripts/python.dm
Normal file
@@ -0,0 +1,9 @@
|
||||
/proc/ext_python(var/script, var/args, var/scriptsprefix = 1)
|
||||
if(scriptsprefix) script = "scripts/" + script
|
||||
|
||||
if(world.system_type == MS_WINDOWS)
|
||||
script = replacetext(script, "/", "\\")
|
||||
|
||||
var/command = config.python_path + " " + script + " " + args
|
||||
|
||||
return shell(command)
|
||||
@@ -7,26 +7,7 @@
|
||||
|
||||
message_admins("Admin logout: [key_name(src)]")
|
||||
if(admins_number == 0) //Apparently the admin logging out is no longer an admin at this point, so we have to check this towards 0 and not towards 1. Awell.
|
||||
var/cheesy_message = pick( list( \
|
||||
"I have no admins online!",\
|
||||
"I'm all alone :(",\
|
||||
"I'm feeling lonely :(",\
|
||||
"I'm so lonely :(",\
|
||||
"Why does nobody love me? :(",\
|
||||
"I want a man :(",\
|
||||
"Where has everyone gone?",\
|
||||
"I need a hug :(",\
|
||||
"Someone come hold me :(",\
|
||||
"I need someone on me :(",\
|
||||
"What happened? Where has everyone gone?",\
|
||||
"Forever alone :("\
|
||||
) )
|
||||
|
||||
if(cheesy_message)
|
||||
cheesy_message += " (No admins online)"
|
||||
|
||||
|
||||
send2irc("Server", "[cheesy_message]")
|
||||
send2adminirc("[key_name(src)] logged out - no more admins online.")
|
||||
..()
|
||||
|
||||
return 1
|
||||
Reference in New Issue
Block a user