Adds a gamemode probability verb (#3320)

Using the show server revision verb will now show the percent chance of each gamemode in the secret and mixed secret rotation. Based off of how TG did it.
This commit is contained in:
Ron
2017-08-26 09:05:20 -04:00
committed by Lohikar
parent 50a2a6c85b
commit ad4fce70c5
4 changed files with 36 additions and 0 deletions

View File

@@ -273,6 +273,8 @@ var/list/gamemode_cache = list()
var/merchant_chance = 20 //Chance, in percentage, of the merchant job slot being open at round start var/merchant_chance = 20 //Chance, in percentage, of the merchant job slot being open at round start
var/show_game_type_odd = 1 // If the check gamemode probability verb is enabled or not
/datum/configuration/New() /datum/configuration/New()
var/list/L = typesof(/datum/game_mode) - /datum/game_mode var/list/L = typesof(/datum/game_mode) - /datum/game_mode
for (var/T in L) for (var/T in L)
@@ -842,6 +844,8 @@ var/list/gamemode_cache = list()
if("merchant_chance") if("merchant_chance")
config.merchant_chance = text2num(value) config.merchant_chance = text2num(value)
if("show_game_type_odd")
config.show_game_type_odd = 1
else else
log_misc("Unknown setting in configuration: '[name]'") log_misc("Unknown setting in configuration: '[name]'")

View File

@@ -615,3 +615,28 @@ proc/get_nt_opposed()
else else
usr << "<i>Shhhh</i>. It's a secret." usr << "<i>Shhhh</i>. It's a secret."
return return
/mob/verb/check_gamemode_probability()
set name = "Check Gamemode Probability"
set category = "OOC"
if(config.show_game_type_odd)
to_chat(src, "<b>Secret Mode Odds:</b>")
var/sum = 0
for(var/config_tag in config.probabilities_secret)
sum += config.probabilities_secret[config_tag]
for(var/config_tag in config.probabilities_secret)
if(config.probabilities_secret[config_tag] > 0)
var/percentage = round(config.probabilities_secret[config_tag] / sum * 100, 0.1)
to_chat(src, "[config_tag] [percentage]%")
to_chat(src, "<b>Mixed Secret Mode Odds:</b>")
sum = 0
for(var/config_tag in config.probabilities_mixed_secret)
sum += config.probabilities_mixed_secret[config_tag]
for(var/config_tag in config.probabilities_mixed_secret)
if(config.probabilities_mixed_secret[config_tag] > 0)
var/percentage = round(config.probabilities_mixed_secret[config_tag] / sum * 100, 0.1)
to_chat(src, "[config_tag] [percentage]%")
else
to_chat(src, "Displaying gamemode odds is disabled in the config.")

View File

@@ -131,6 +131,9 @@ PROBABILITY MS SIEGE 1
PROBABILITY MS TRAITORLING 1 PROBABILITY MS TRAITORLING 1
PROBABILITY MS EXTENDED 1 PROBABILITY MS EXTENDED 1
## If the game type odds are showed in the check gamemode probability verb.
SHOW_GAME_TYPE_ODD
## Hash out to disable random events during the round. ## Hash out to disable random events during the round.
ALLOW_RANDOM_EVENTS ALLOW_RANDOM_EVENTS

View File

@@ -0,0 +1,4 @@
author: Printer16
delete-after: True
changes:
- rscadd: "You can now view the probability of each gamemode using the check gamemode probability verb."