From 862898526d92db78d9932f0af8bf7a93d09637c6 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Fri, 27 Apr 2018 14:40:45 +0000 Subject: [PATCH] Gamemode and gamemode vote obfuscation (Plus hub entry rework) (#6276) * adds gamemode/gamemode vote obfuscation, redesigns hub entry * ternaries: the easiest way to obfuscate your code to the point where even you can't read it * FUCK * changes the inaccuracy chance from 1/10 to 1/5 --- code/controllers/subsystem/ticker.dm | 8 +++---- code/controllers/subsystem/vote.dm | 28 ++++++++++++++++-------- code/game/gamemodes/extended/extended.dm | 4 ++++ code/game/gamemodes/game_mode.dm | 14 ++++++++++++ code/game/world.dm | 20 ++++++++++------- code/modules/admin/chat_commands.dm | 4 ++-- code/modules/mob/dead/dead.dm | 4 ++-- 7 files changed, 57 insertions(+), 25 deletions(-) diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 0bc2354032..5fc77669bc 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -272,14 +272,14 @@ SUBSYSTEM_DEF(ticker) message_admins("DEBUG: Bypassing prestart checks...") CHECK_TICK - if(hide_mode) + /*if(hide_mode) CIT CHANGE - comments this section out to obfuscate gamemodes. Quit self-antagging during extended just because "hurrrrr no antaggs!!!!!! i giv sec thing 2 do!!!!!!!!!" it's bullshit and everyone hates it var/list/modes = new for (var/datum/game_mode/M in runnable_modes) modes += M.name modes = sortList(modes) to_chat(world, "The gamemode is: secret!\nPossibilities: [english_list(modes)]") else - mode.announce() + mode.announce()*/ if(!CONFIG_GET(flag/ooc_during_round)) toggle_ooc(FALSE) // Turn it off @@ -477,12 +477,12 @@ SUBSYSTEM_DEF(ticker) /datum/controller/subsystem/ticker/proc/IsRoundInProgress() return current_state == GAME_STATE_PLAYING -/proc/send_gamemode_vote() +/proc/send_gamemode_vote() //CIT CHANGE - adds roundstart gamemode votes if(SSticker.current_state == GAME_STATE_PREGAME) if(SSticker.timeLeft < 900) SSticker.timeLeft = 900 SSticker.modevoted = TRUE - SSvote.initiate_vote("roundtype","server") + SSvote.initiate_vote("roundtype","server",TRUE) /datum/controller/subsystem/ticker/Recover() current_state = SSticker.current_state diff --git a/code/controllers/subsystem/vote.dm b/code/controllers/subsystem/vote.dm index 1a0514b490..8d49c311cc 100644 --- a/code/controllers/subsystem/vote.dm +++ b/code/controllers/subsystem/vote.dm @@ -16,6 +16,8 @@ SUBSYSTEM_DEF(vote) var/list/voting = list() var/list/generated_actions = list() + var/obfuscated = FALSE//CIT CHANGE - adds obfuscated/admin-only votes + /datum/controller/subsystem/vote/fire() //called by master_controller if(mode) time_remaining = round((started_time + CONFIG_GET(number/vote_period) - world.time)/10) @@ -42,6 +44,7 @@ SUBSYSTEM_DEF(vote) choices.Cut() voted.Cut() voting.Cut() + obfuscated = FALSE //CIT CHANGE - obfuscated votes remove_action_buttons() /datum/controller/subsystem/vote/proc/get_result() @@ -91,14 +94,14 @@ SUBSYSTEM_DEF(vote) var/votes = choices[choices[i]] if(!votes) votes = 0 - text += "\n[choices[i]]: [votes]" + text += "\n[choices[i]]: [obfuscated ? "???" : votes]" //CIT CHANGE - adds obfuscated votes if(mode != "custom") - if(winners.len > 1) + if(winners.len > 1 && !obfuscated) //CIT CHANGE - adds obfuscated votes text = "\nVote Tied Between:" for(var/option in winners) text += "\n\t[option]" . = pick(winners) - text += "\nVote Result: [.]" + text += "\nVote Result: [obfuscated ? "???" : .]" //CIT CHANGE - adds obfuscated votes else text += "\nDid not vote: [GLOB.clients.len-voted.len]" else @@ -106,6 +109,12 @@ SUBSYSTEM_DEF(vote) log_vote(text) remove_action_buttons() to_chat(world, "\n[text]") + if(obfuscated) //CIT CHANGE - adds obfuscated votes. this messages admins with the vote's true results + var/admintext = "Obfuscated results" + for(var/i=1,i<=choices.len,i++) + var/votes = choices[choices[i]] + admintext += "\n[choices[i]]: [votes]" + message_admins(admintext) return . /datum/controller/subsystem/vote/proc/result() @@ -113,12 +122,12 @@ SUBSYSTEM_DEF(vote) var/restart = 0 if(.) switch(mode) - if("roundtype") + if("roundtype") //CIT CHANGE - adds the roundstart extended/secret vote if(SSticker.current_state > GAME_STATE_PREGAME)//Don't change the mode if the round already started. return message_admins("A vote has tried to change the gamemode, but the game has already started. Aborting.") GLOB.master_mode = . SSticker.save_mode(.) - to_chat(world, "The mode is now: [GLOB.master_mode]") + message_admins("The gamemode has been voted for, and has been changed to: [GLOB.master_mode]") log_admin("Gamemode has been voted for and switched to: [GLOB.master_mode].") if("restart") if(. == "Restart Round") @@ -155,7 +164,7 @@ SUBSYSTEM_DEF(vote) return vote return 0 -/datum/controller/subsystem/vote/proc/initiate_vote(vote_type, initiator_key) +/datum/controller/subsystem/vote/proc/initiate_vote(vote_type, initiator_key, hideresults)//CIT CHANGE - adds hideresults argument to votes to allow for obfuscated votes if(!mode) if(started_time) var/next_allowed_time = (started_time + CONFIG_GET(number/vote_delay)) @@ -173,12 +182,13 @@ SUBSYSTEM_DEF(vote) return 0 reset() + obfuscated = hideresults //CIT CHANGE - adds obfuscated votes switch(vote_type) if("restart") choices.Add("Restart Round","Continue Playing") if("gamemode") choices.Add(config.votable_modes) - if("roundtype") + if("roundtype") //CIT CHANGE - adds the roundstart secret/extended vote choices.Add("secret", "extended") if("custom") question = stripped_input(usr,"What is the vote for?") @@ -233,7 +243,7 @@ SUBSYSTEM_DEF(vote) var/votes = choices[choices[i]] if(!votes) votes = 0 - . += "
  • [choices[i]] ([votes] votes)
  • " + . += "
  • [choices[i]] ([obfuscated ? (admin ? "??? ([votes])" : "???") : votes] votes)
  • " // CIT CHANGE - adds obfuscated votes . += "
    " if(admin) . += "(Cancel Vote) " @@ -332,4 +342,4 @@ SUBSYSTEM_DEF(vote) else if(owner.ckey) var/datum/player_details/P = GLOB.player_details[owner.ckey] if(P) - P.player_actions -= src \ No newline at end of file + P.player_actions -= src diff --git a/code/game/gamemodes/extended/extended.dm b/code/game/gamemodes/extended/extended.dm index ac55cb526d..c1ae2287ef 100644 --- a/code/game/gamemodes/extended/extended.dm +++ b/code/game/gamemodes/extended/extended.dm @@ -19,10 +19,14 @@ false_report_weight = 0 /datum/game_mode/extended/announced/generate_station_goals() + if(flipseclevel) //CIT CHANGE - allows the sec level to be flipped roundstart + return ..() for(var/T in subtypesof(/datum/station_goal)) var/datum/station_goal/G = new T station_goals += G G.on_report() /datum/game_mode/extended/announced/send_intercept(report = 0) + if(flipseclevel) //CIT CHANGE - allows the sec level to be flipped roundstart + return ..() priority_announce("Thanks to the tireless efforts of our security and intelligence divisions, there are currently no credible threats to [station_name()]. All station construction projects have been authorized. Have a secure shift!", "Security Report", 'sound/ai/commandreport.ogg') diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index c8f5fa6911..fbf62886e3 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -48,6 +48,8 @@ var/gamemode_ready = FALSE //Is the gamemode all set up and ready to start checking for ending conditions. + var/flipseclevel = FALSE //CIT CHANGE - adds a 10% chance for the alert level to be the opposite of what the gamemode is supposed to have + /datum/game_mode/proc/announce() //Shows the gamemode's name and a fast description. to_chat(world, "The gamemode is: [name]!") to_chat(world, "[announce_text]") @@ -82,6 +84,9 @@ report = !CONFIG_GET(flag/no_intercept_report) addtimer(CALLBACK(GLOBAL_PROC, .proc/display_roundstart_logout_report), ROUNDSTART_LOGOUT_REPORT_TIME) + if(prob(20)) //CIT CHANGE - adds a 20% chance for the security level to be the opposite of what it normally is + flipseclevel = TRUE + if(SSdbcore.Connect()) var/sql if(SSticker.mode) @@ -250,6 +255,9 @@ return 0 /datum/game_mode/proc/send_intercept() + if(flipseclevel && !(config_tag == "extended"))//CIT CHANGE - lets the security level be flipped roundstart + priority_announce("Thanks to the tireless efforts of our security and intelligence divisions, there are currently no credible threats to [station_name()]. All station construction projects have been authorized. Have a secure shift!", "Security Report", 'sound/ai/commandreport.ogg') + return var/intercepttext = "Central Command Status Summary
    " intercepttext += "Central Command has intercepted and partially decoded a Syndicate transmission with vital information regarding their movements. The following report outlines the most \ likely threats to appear in your sector." @@ -508,6 +516,12 @@ rev.remove_revolutionary(TRUE) /datum/game_mode/proc/generate_station_goals() + if(flipseclevel && !(config_tag == "extended")) //CIT CHANGE - allows the sec level to be flipped roundstart + for(var/T in subtypesof(/datum/station_goal)) + var/datum/station_goal/G = new T + station_goals += G + G.on_report() + return var/list/possible = list() for(var/T in subtypesof(/datum/station_goal)) var/datum/station_goal/G = T diff --git a/code/game/world.dm b/code/game/world.dm index f6a7a8cae6..cc4246a7c8 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -228,11 +228,11 @@ GLOBAL_PROTECT(security_mode) var/list/features = list() - if(GLOB.master_mode) + /*if(GLOB.master_mode) CIT CHANGE - hides the gamemode from the hub entry, removes some useless info from the hub entry features += GLOB.master_mode if (!GLOB.enter_allowed) - features += "closed" + features += "closed"*/ var/s = "" var/hostedby @@ -240,25 +240,29 @@ GLOBAL_PROTECT(security_mode) var/server_name = CONFIG_GET(string/servername) if (server_name) s += "[server_name] — " - features += "[CONFIG_GET(flag/norespawn) ? "no " : ""]respawn" + /*features += "[CONFIG_GET(flag/norespawn) ? "no " : ""]respawn" CIT CHANGE - removes some useless info from the hub entry if(CONFIG_GET(flag/allow_vote_mode)) features += "vote" if(CONFIG_GET(flag/allow_ai)) - features += "AI allowed" + features += "AI allowed"*/ hostedby = CONFIG_GET(string/hostedby) s += "[station_name()]"; s += " (" - s += "" //Change this to wherever you want the hub to link to. - s += "Default" //Replace this with something else. Or ever better, delete it and uncomment the game version. + s += "" //Change this to wherever you want the hub to link to. CIT CHANGE - links to cit's website on the hub + s += "Citadel" //Replace this with something else. Or ever better, delete it and uncomment the game version. CIT CHANGE - modifies the hub entry link s += "" - s += ")" + s += ")\]" //CIT CHANGE - encloses the server title in brackets to make the hub entry fancier + s += "
    That furry /TG/code server your mother warned you about.
    " //CIT CHANGE - adds a tagline! var/n = 0 for (var/mob/M in GLOB.player_list) if (M.client) n++ + if(get_security_level())//CIT CHANGE - makes the hub entry show the security level + features += "code [get_security_level()]" + if (n > 1) features += "~[n] players" else if (n > 0) @@ -268,7 +272,7 @@ GLOBAL_PROTECT(security_mode) features += "hosted by [hostedby]" if (features) - s += ": [jointext(features, ", ")]" + s += "\[[jointext(features, ", ")]" //CIT CHANGE - replaces the colon here with a left bracket status = s diff --git a/code/modules/admin/chat_commands.dm b/code/modules/admin/chat_commands.dm index bc41b489c0..02402956d9 100644 --- a/code/modules/admin/chat_commands.dm +++ b/code/modules/admin/chat_commands.dm @@ -28,7 +28,7 @@ return last_irc_check = rtod var/server = CONFIG_GET(string/server) - return "[GLOB.round_id ? "Round #[GLOB.round_id]: " : ""][GLOB.clients.len] players on [SSmapping.config.map_name], Mode: [GLOB.master_mode]; Round [SSticker.HasRoundStarted() ? (SSticker.IsRoundInProgress() ? "Active" : "Finishing") : "Starting"] -- [server ? server : "[world.internet_address]:[world.port]"]" + return "[GLOB.round_id ? "Round #[GLOB.round_id]: " : ""][GLOB.clients.len] players on [SSmapping.config.map_name]; Round [SSticker.HasRoundStarted() ? (SSticker.IsRoundInProgress() ? "Active" : "Finishing") : "Starting"] -- [server ? server : "[world.internet_address]:[world.port]"]" //CIT CHANGE - obfuscates the current gamemode from players /datum/server_tools_command/ahelp name = "ahelp" @@ -100,7 +100,7 @@ GLOBAL_LIST(round_end_notifiees) var/list/text_res = results.Copy(1, 3) var/list/refs = results.len > 3 ? results.Copy(4) : null . = "[text_res.Join("\n")][refs ? "\nRefs: [refs.Join(" ")]" : ""]" - + /datum/server_tools_command/reload_admins name = "reload_admins" help_text = "Forces the server to reload admins." diff --git a/code/modules/mob/dead/dead.dm b/code/modules/mob/dead/dead.dm index 59e8911659..3daf9c8fe4 100644 --- a/code/modules/mob/dead/dead.dm +++ b/code/modules/mob/dead/dead.dm @@ -36,7 +36,7 @@ INITIALIZE_IMMEDIATE(/mob/dead) if(!statpanel("Status")) return - stat(null, "Game Mode: [SSticker.hide_mode ? "Secret" : "[GLOB.master_mode]"]") + //stat(null, "Game Mode: [SSticker.hide_mode ? "Secret" : "[GLOB.master_mode]"]") CIT CHANGE - obfuscates gamemode from player view if(SSticker.HasRoundStarted()) return @@ -72,7 +72,7 @@ INITIALIZE_IMMEDIATE(/mob/dead) if(!pick) return - + var/addr = csa[pick] if(alert(src, "Jump to server [pick] ([addr])?", "Server Hop", "Yes", "No") != "Yes")