Skip to content

Commit

Permalink
boldannounce (#5408)
Browse files Browse the repository at this point in the history
  • Loading branch information
ROdenFL authored Jul 10, 2024
1 parent a0f82d7 commit dab3a2d
Show file tree
Hide file tree
Showing 82 changed files with 548 additions and 371 deletions.
2 changes: 1 addition & 1 deletion code/__DEFINES/_tgs_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define TGS_DEFINE_AND_SET_GLOBAL(Name, Value) GLOBAL_VAR_INIT(##Name, ##Value); GLOBAL_PROTECT(##Name)
#define TGS_READ_GLOBAL(Name) GLOB.##Name
#define TGS_WRITE_GLOBAL(Name, Value) GLOB.##Name = ##Value
#define TGS_WORLD_ANNOUNCE(message) to_chat(world, "<span class='boldannounce'>[html_encode(##message)]</span>")
#define TGS_WORLD_ANNOUNCE(message) to_chat(world, span_boldannounceooc("[html_encode(##message)]"))
#define TGS_INFO_LOG(message) log_world("\[TGS] Info: [##message]")
#define TGS_WARNING_LOG(message) log_world("\[TGS] Warn: [##message]")
#define TGS_ERROR_LOG(message) log_world("\[TGS] Error: [##message]")
Expand Down
3 changes: 2 additions & 1 deletion code/__DEFINES/span.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
//#define span_blue(str) ("<span class='blue'>" + str + "</span>")
//#define span_blueteamradio(str) ("<span class='blueteamradio'>" + str + "</span>")
//#define span_bold(str) ("<span class='bold'>" + str + "</span>")
#define span_boldannounce(str) ("<span class='boldannounce'>" + str + "</span>")
#define span_boldannounceic(str) ("<span class='boldannounceic'>" + str + "</span>")
#define span_boldannounceooc(str) ("<span class='boldannounceooc'>" + str + "</span>")
#define span_bolddanger(str) ("<span class='bolddanger'>" + str + "</span>")
//#define span_boldnicegreen(str) ("<span class='boldnicegreen'>" + str + "</span>")
#define span_boldnotice(str) ("<span class='boldnotice'>" + str + "</span>")
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/_logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ GLOBAL_PROTECT(log_end)

for(var/client/C in GLOB.admins)
if(check_rights(R_DEBUG|R_VIEWRUNTIMES, 0, C.mob) && (C.prefs.toggles & PREFTOGGLE_CHAT_DEBUGLOGS))
to_chat(C, "DEBUG: [text]")
to_chat(C, "<span class='debug'>DEBUG: [text]</span>", MESSAGE_TYPE_DEBUG, confidential = TRUE)

/proc/log_game(text)
if(CONFIG_GET(flag/log_game))
Expand Down
8 changes: 4 additions & 4 deletions code/__HELPERS/files.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/proc/wrap_file(filepath)
if(IsAdminAdvancedProcCall())
// Admins shouldnt fuck with this
to_chat(usr, "<span class='boldannounce'>File load blocked: Advanced ProcCall detected.</span>")
to_chat(usr, span_boldannounceooc("File load blocked: Advanced ProcCall detected."))
log_and_message_admins("attempted to load files via advanced proc-call")
return

Expand All @@ -11,7 +11,7 @@
/proc/wrap_file2text(filepath)
if(IsAdminAdvancedProcCall())
// Admins shouldnt fuck with this
to_chat(usr, "<span class='boldannounce'>File load blocked: Advanced ProcCall detected.</span>")
to_chat(usr, span_boldannounceooc("File load blocked: Advanced ProcCall detected."))
log_and_message_admins("attempted to load files via advanced proc-call")
return

Expand All @@ -34,7 +34,7 @@
//Sends resource files to client cache
/client/proc/getFiles()
if(IsAdminAdvancedProcCall())
to_chat(usr, "<span class='boldannounce'>Shelleo blocked: Advanced ProcCall detected.</span>")
to_chat(usr, span_boldannounceooc("Shelleo blocked: Advanced ProcCall detected."))
log_and_message_admins("attempted to call Shelleo via advanced proc-call")
return

Expand All @@ -43,7 +43,7 @@

/client/proc/browse_files(root="data/logs/", max_iterations=10, list/valid_extensions=list(".txt",".log",".htm"))
if(IsAdminAdvancedProcCall())
to_chat(usr, "<span class='boldannounce'>Shelleo blocked: Advanced ProcCall detected.</span>")
to_chat(usr, span_boldannounceooc("Shelleo blocked: Advanced ProcCall detected."))
log_and_message_admins("attempted to call Shelleo via advanced proc-call")
return

Expand Down
131 changes: 26 additions & 105 deletions code/__HELPERS/names.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ GLOBAL_VAR(syndicate_name)
GLOBAL_VAR(syndicate_code_phrase) //Code phrase for traitors.
GLOBAL_VAR(syndicate_code_response) //Code response for traitors.

//Cached regex search - for checking if codewords are used.
GLOBAL_DATUM(syndicate_code_phrase_regex, /regex)
GLOBAL_DATUM(syndicate_code_response_regex, /regex)


/*
Should be expanded.
How this works:
Expand All @@ -129,9 +134,12 @@ GLOBAL_VAR(syndicate_code_response) //Code response for traitors.
/N
*/

/proc/generate_code_phrase()//Proc is used for phrase and response in master_controller.dm
/proc/generate_code_phrase(return_list = FALSE) // Proc is used for phrase and response in master_controller.dm

var/code_phrase = ""//What is returned when the proc finishes.
if(!return_list)
. = ""
else
. = list()
var/words = pick(//How many words there will be. Minimum of two. 2, 4 and 5 have a lesser chance of being selected. 3 is the most likely.
50; 2,
200; 3,
Expand Down Expand Up @@ -159,124 +167,37 @@ GLOBAL_VAR(syndicate_code_response) //Code response for traitors.

switch(pick(safety))//Chance based on the safety list.
if(1)//1 and 2 can only be selected once each to prevent more than two specific names/places/etc.
switch(rand(1,2))//Mainly to add more options later.
switch(rand(1, 2)) // Mainly to add more options later.
if(1)
if(names.len)
code_phrase += pick(names)
if(length(names))
. += pick(names)
if(2)
code_phrase += pick(GLOB.jobs)//Returns a job.
. += pick(GLOB.jobs)//Returns a job.
safety -= 1
if(2)
switch(rand(1,2))//Places or things.
switch(rand(1, 2))//Places or things.
if(1)
code_phrase += pick(GLOB.cocktails)
. += pick(GLOB.cocktails)
if(2)
code_phrase += pick(GLOB.locations)
. += pick(GLOB.locations)
safety -= 2
if(3)
switch(rand(1,3))//Nouns, adjectives, verbs. Can be selected more than once.
switch(rand(1, 3))//Nouns, adjectives, verbs. Can be selected more than once.
if(1)
code_phrase += pick(GLOB.nouns)
. += pick(GLOB.nouns)
if(2)
code_phrase += pick(GLOB.adjectives)
. += pick(GLOB.adjectives)
if(3)
code_phrase += pick(GLOB.verbs)
if(words==1)
code_phrase += "."
else
code_phrase += ", "

return code_phrase
. += pick(GLOB.verbs)
if(!return_list)
if(words == 1)
. += "."
else
. += ", "

/proc/GenerateKey()
var/newKey
newKey += pick("the", "if", "of", "as", "in", "a", "you", "from", "to", "an", "too", "little", "snow", "dead", "drunk", "rosebud", "duck", "al", "le")
newKey += pick("diamond", "beer", "mushroom", "civilian", "clown", "captain", "twinkie", "security", "nuke", "small", "big", "escape", "yellow", "gloves", "monkey", "engine", "nuclear", "ai")
newKey += pick("1", "2", "3", "4", "5", "6", "7", "8", "9", "0")
return newKey

/*
//This proc tests the gen above.
/client/verb/test_code_phrase()
set name = "Generate Code Phrase"
set category = "Debug"
to_chat(world, "<span class='warning'>Code Phrase is:</span> [generate_code_phrase()]")
return
This was an earlier attempt at code phrase system, aside from an even earlier attempt (and failure).
This system more or less works as intended--aside from being unfinished--but it's still very predictable.
Particularly, the phrase opening statements are pretty easy to recognize and identify when metagaming.
I think the above-used method solves this issue by using words in a sequence, providing for much greater flexibility.
/N
switch(choice)
if(1)
syndicate_code_phrase += pick("I'm looking for","Have you seen","Maybe you've seen","I'm trying to find","I'm tracking")
syndicate_code_phrase += " "
syndicate_code_phrase += pick(pick(GLOB.first_names_male,GLOB.first_names_female))
syndicate_code_phrase += " "
syndicate_code_phrase += pick(GLOB.last_names)
syndicate_code_phrase += "."
if(2)
syndicate_code_phrase += pick("How do I get to","How do I find","Where is","Where do I find")
syndicate_code_phrase += " "
syndicate_code_phrase += pick("Escape","Engineering","Atmos","the bridge","the brig","Clown Planet","CentComm","the library","the chapel","a bathroom","Med Bay","Tool Storage","the escape shuttle","Robotics","a locker room","the living quarters","the gym","the autolathe","QM","the bar","the theater","the derelict")
syndicate_code_phrase += "?"
if(3)
if(prob(70))
syndicate_code_phrase += pick("Get me","I want","I'd like","Make me")
syndicate_code_phrase += " a "
else
syndicate_code_phrase += pick("One")
syndicate_code_phrase += " "
syndicate_code_phrase += pick("vodka and tonic","gin fizz","bahama mama","manhattan","black Russian","whiskey soda","long island tea","margarita","Irish coffee"," manly dwarf","Irish cream","doctor's delight","Beepksy Smash","tequila sunrise","brave bull","gargle blaster","bloody mary","whiskey cola","white Russian","vodka martini","martini","Cuba libre","kahlua","vodka","wine","moonshine")
syndicate_code_phrase += "."
if(4)
syndicate_code_phrase += pick("I wish I was","My dad was","His mom was","Where do I find","The hero this station needs is","I'd fuck","I wouldn't trust","Someone caught","HoS caught","Someone found","I'd wrestle","I wanna kill")
syndicate_code_phrase += " [pick("a","the")] "
syndicate_code_phrase += pick("wizard","ninja","xeno","lizard","slime","monkey","syndicate","cyborg","clown","space carp","singularity","singulo","mime")
syndicate_code_phrase += "."
if(5)
syndicate_code_phrase += pick("Do we have","Is there","Where is","Where's","Who's")
syndicate_code_phrase += " "
syndicate_code_phrase += "[pick(GLOB.joblist)]"
syndicate_code_phrase += "?"
switch(choice)
if(1)
if(prob(80))
syndicate_code_response += pick("Try looking for them near","I they ran off to","Yes. I saw them near","Nope. I'm heading to","Try searching")
syndicate_code_response += " "
syndicate_code_response += pick("Escape","Engineering","Atmos","the bridge","the brig","Clown Planet","CentComm","the library","the chapel","a bathroom","Med Bay","Tool Storage","the escape shuttle","Robotics","a locker room","the living quarters","the gym","the autolathe","QM","the bar","the theater","the derelict")
syndicate_code_response += "."
else if(prob(60))
syndicate_code_response += pick("No. I'm busy, sorry.","I don't have the time.","Not sure, maybe?","There is no time.")
else
syndicate_code_response += pick("*shrug*","*smile*","*blink*","*sigh*","*laugh*","*nod*","*giggle*")
if(2)
if(prob(80))
syndicate_code_response += pick("Go to","Navigate to","Try","Sure, run to","Try searching","It's near","It's around")
syndicate_code_response += " the "
syndicate_code_response += pick("[pick("south","north","east","west")] maitenance door","nearby maitenance","teleporter","[pick("cold","dead")] space","morgue","vacuum","[pick("south","north","east","west")] hall ","[pick("south","north","east","west")] hallway","[pick("white","black","red","green","blue","pink","purple")] [pick("rabbit","frog","lion","tiger","panther","snake","facehugger")]")
syndicate_code_response += "."
else if(prob(60))
syndicate_code_response += pick("Try asking","Ask","Talk to","Go see","Follow","Hunt down")
syndicate_code_response += " "
if(prob(50))
syndicate_code_response += pick(pick(GLOB.first_names_male,GLOB.first_names_female))
syndicate_code_response += " "
syndicate_code_response += pick(GLOB.last_names)
else
syndicate_code_response += " the "
syndicate_code_response += "[pic(GLOB.joblist)]"
syndicate_code_response += "."
else
syndicate_code_response += pick("*shrug*","*smile*","*blink*","*sigh*","*laugh*","*nod*","*giggle*")
if(3)
if(4)
if(5)
return
*/
2 changes: 1 addition & 1 deletion code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
if(dragged && !modifiers[dragged])
return
if(IsFrozen(A) && !is_admin(usr))
to_chat(usr, "<span class='boldannounce'>Interacting with admin-frozen players is not permitted.</span>")
to_chat(usr, span_boldannounceooc("Interacting with admin-frozen players is not permitted."))
return
if(modifiers["middle"] && modifiers["shift"] && modifiers["ctrl"])
MiddleShiftControlClickOn(A)
Expand Down
18 changes: 9 additions & 9 deletions code/controllers/failsafe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ GLOBAL_REAL(Failsafe, /datum/controller/failsafe)
break
else if(defcon == 1) //Exit Failsafe if we weren't able to recover the MC in the last stage
log_game("FailSafe: Failed to recover MC while in emergency state. Failsafe exiting.")
message_admins("<span class='boldannounce'>Failsafe failed criticaly while trying to recreate broken MC. Please manually fix the MC or reboot the server. Failsafe exiting now.</span>")
message_admins("<span class='boldannounce'>You can try manually calling these two procs:.</span>")
message_admins("<span class='boldannounce'><code>/proc/recover_all_SS_and_recreate_master</code>: Most stuff should still function but expect instability/runtimes/broken stuff.</span>")
message_admins("<span class='boldannounce'><code>/proc/delete_all_SS_and_recreate_master</code>: Most stuff will be broken but basic stuff like movement and chat should still work.</span>")
message_admins(span_boldannounceooc("Failsafe failed criticaly while trying to recreate broken MC. Please manually fix the MC or reboot the server. Failsafe exiting now."))
message_admins(span_boldannounceooc("You can try manually calling these two procs:."))
message_admins(span_boldannounceooc("<code>/proc/recover_all_SS_and_recreate_master</code>: Most stuff should still function but expect instability/runtimes/broken stuff."))
message_admins(span_boldannounceooc("<code>/proc/delete_all_SS_and_recreate_master</code>: Most stuff will be broken but basic stuff like movement and chat should still work."))
else if(recovery_result == -1) //Failed to recreate MC
defcon--
sleep(initial(processing_interval)) //Wait a bit until the next try
Expand Down Expand Up @@ -81,11 +81,11 @@ GLOBAL_REAL(Failsafe, /datum/controller/failsafe)
--defcon

if(2)
to_chat(GLOB.admins, "<span class='boldannounce'>Warning: DEFCON [defcon_pretty()]. The Master Controller has not fired in the last [(5 - defcon) * processing_interval] ticks. Automatic restart in [processing_interval] ticks.</span>")
to_chat(GLOB.admins, span_boldannounceooc("Warning: DEFCON [defcon_pretty()]. The Master Controller has not fired in the last [(5 - defcon) * processing_interval] ticks. Automatic restart in [processing_interval] ticks."))
--defcon

if(1)
to_chat(GLOB.admins, "<span class='boldannounce'>Warning: DEFCON [defcon_pretty()]. The Master Controller has still not fired within the last [(5 - defcon) * processing_interval] ticks. Killing and restarting...</span>")
to_chat(GLOB.admins, span_boldannounceooc("Warning: DEFCON [defcon_pretty()]. The Master Controller has still not fired within the last [(5 - defcon) * processing_interval] ticks. Killing and restarting..."))
--defcon
var/rtn = Recreate_MC()
if(rtn > 0)
Expand All @@ -94,7 +94,7 @@ GLOBAL_REAL(Failsafe, /datum/controller/failsafe)
to_chat(GLOB.admins, "<span class='adminnotice'>MC restarted successfully</span>")
else if(rtn < 0)
log_game("FailSafe: Could not restart MC, runtime encountered. Entering defcon 0")
to_chat(GLOB.admins, "<span class='boldannounce'>ERROR: DEFCON [defcon_pretty()]. Could not restart MC, runtime encountered. I will silently keep retrying.</span>")
to_chat(GLOB.admins, span_boldannounceooc("ERROR: DEFCON [defcon_pretty()]. Could not restart MC, runtime encountered. I will silently keep retrying."))
//if the return number was 0, it just means the mc was restarted too recently, and it just needs some time before we try again
//no need to handle that specially when defcon 0 can handle it

Expand Down Expand Up @@ -136,7 +136,7 @@ GLOBAL_REAL(Failsafe, /datum/controller/failsafe)
to_chat(GLOB.admins, "<span class='adminnotice'>Failsafe recovered MC while in emergency state [defcon_pretty()]</span>")
else
log_game("FailSafe: Failsafe in emergency state and was unable to recreate MC while in defcon state [defcon_pretty()].")
message_admins("<span class='boldannounce'>Failsafe in emergency state and master down, trying to recreate MC while in defcon level [defcon_pretty()] failed.</span>")
message_admins(span_boldannounceooc("Failsafe in emergency state and master down, trying to recreate MC while in defcon level [defcon_pretty()] failed."))


///Recreate all SSs which will still cause data survive due to Recover(), the new Master will then find and take them from global.vars
Expand All @@ -155,7 +155,7 @@ GLOBAL_REAL(Failsafe, /datum/controller/failsafe)
Master.Initialize(10, FALSE, TRUE) //Need to manually start the MC, normally world.new would do this
to_chat(GLOB.admins, "<span class='boldnotice'>MC successfully recreated after recovering all subsystems!</span>")
else
message_admins("<span class='boldannounce'>Failed to create new MC!</span>")
message_admins(span_boldannounceooc("Failed to create new MC!"))


/datum/controller/failsafe/proc/defcon_pretty()
Expand Down
4 changes: 2 additions & 2 deletions code/controllers/master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
msg = "The [BadBoy.name] subsystem seems to be destabilizing the MC and will be offlined. <span class='info'>The following implications are now in effect: [BadBoy.offline_implications]</span>"
BadBoy.flags |= SS_NO_FIRE
if(msg)
to_chat(GLOB.admins, "<span class='boldannounce'>[msg]</span>")
to_chat(GLOB.admins, span_boldannounceooc("[msg]"))
log_world(msg)

if(istype(Master.subsystems))
Expand All @@ -201,7 +201,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
current_runlevel = Master.current_runlevel
StartProcessing(10)
else
to_chat(world, "<span class='boldannounce'>The Master Controller is having some issues, we will need to re-initialize EVERYTHING</span>")
to_chat(world, span_boldannounceooc("The Master Controller is having some issues, we will need to re-initialize EVERYTHING"))
Initialize(20, TRUE)


Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/dbcore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ SUBSYSTEM_DEF(dbcore)
*/
/datum/controller/subsystem/dbcore/proc/NewQuery(sql_query, arguments)
if(IsAdminAdvancedProcCall())
to_chat(usr, "<span class='boldannounce'>DB query blocked: Advanced ProcCall detected.</span>")
to_chat(usr, span_boldannounceooc("DB query blocked: Advanced ProcCall detected."))
message_admins("[key_name(usr)] attempted to create a DB query via advanced proc-call")
log_and_message_admins("attempted to create a DB query via advanced proc-call")
return FALSE
Expand Down
Loading

0 comments on commit dab3a2d

Please sign in to comment.