[MIRROR] Fixes adjust config (#2723)

* Fixes adjust config

* Update configuration.dm

* Update game_options.txt

* fixes persistance
This commit is contained in:
CitadelStationBot
2017-09-22 23:02:09 -05:00
committed by Poojawa
parent e0b3e861c0
commit 3aafe338af
10 changed files with 192 additions and 112 deletions
+18 -4
View File
@@ -136,7 +136,7 @@ GLOBAL_PROTECT(config_dir)
var/list/probabilities = list() // relative probability of each mode
var/list/min_pop = list() // overrides for acceptible player counts in a mode
var/list/max_pop = list()
var/list/repeated_mode_adjust = list() // weight adjustments for recent modes
var/humans_need_surnames = 0
var/allow_ai = 0 // allow ai job
var/forbid_secborg = 0 // disallow secborg module to be chosen.
@@ -723,7 +723,14 @@ GLOBAL_PROTECT(config_dir)
WRITE_FILE(GLOB.config_error_log, "Unknown game mode probability configuration definition: [prob_name].")
else
WRITE_FILE(GLOB.config_error_log, "Incorrect probability configuration definition: [prob_name] [prob_value].")
if("repeated_mode_adjust")
if(value)
repeated_mode_adjust.Cut()
var/values = splittext(value," ")
for(var/v in values)
repeated_mode_adjust += text2num(v)
else
WRITE_FILE(GLOB.config_error_log, "Incorrect round weight adjustment configuration definition for [value].")
if("protect_roles_from_antagonist")
protect_roles_from_antagonist = 1
if("protect_assistant_from_antagonist")
@@ -976,8 +983,15 @@ GLOBAL_PROTECT(config_dir)
if(max_pop[M.config_tag])
M.maximum_players = max_pop[M.config_tag]
if(M.can_start())
runnable_modes[M] = probabilities[M.config_tag]
//to_chat(world, "DEBUG: runnable_mode\[[runnable_modes.len]\] = [M.config_tag]")
var/final_weight = probabilities[M.config_tag]
if(SSpersistence.saved_modes.len == 3 && repeated_mode_adjust.len == 3)
var/recent_round = min(SSpersistence.saved_modes.Find(M.config_tag),3)
var/adjustment = 0
while(recent_round)
adjustment += repeated_mode_adjust[recent_round]
recent_round = SSpersistence.saved_modes.Find(M.config_tag,recent_round+1,0)
final_weight *= ((100-adjustment)/100)
runnable_modes[M] = final_weight
return runnable_modes
/datum/configuration/proc/get_runnable_midround_modes(crew)
+26 -7
View File
@@ -8,7 +8,7 @@ SUBSYSTEM_DEF(persistence)
var/list/obj/structure/chisel_message/chisel_messages = list()
var/list/saved_messages = list()
var/list/saved_modes = list(1,2,3)
var/list/saved_trophies = list()
/datum/controller/subsystem/persistence/Initialize()
@@ -16,6 +16,7 @@ SUBSYSTEM_DEF(persistence)
LoadPoly()
LoadChiselMessages()
LoadTrophies()
LoadRecentModes()
..()
/datum/controller/subsystem/persistence/proc/LoadSatchels()
@@ -41,8 +42,7 @@ SUBSYSTEM_DEF(persistence)
var/json_file = file("data/npc_saves/SecretSatchels[SSmapping.config.map_name].json")
if(!fexists(json_file))
return
var/list/json = list()
json = json_decode(file2text(json_file))
var/list/json = json_decode(file2text(json_file))
old_secret_satchels = json["data"]
if(old_secret_satchels.len)
if(old_secret_satchels.len >= 20) //guards against low drop pools assuring that one player cannot reliably find his own gear.
@@ -84,8 +84,7 @@ SUBSYSTEM_DEF(persistence)
var/json_file = file("data/npc_saves/ChiselMessages[SSmapping.config.map_name].json")
if(!fexists(json_file))
return
var/list/json
json = json_decode(file2text(json_file))
var/list/json = json_decode(file2text(json_file))
if(!json)
return
@@ -129,13 +128,22 @@ SUBSYSTEM_DEF(persistence)
var/json_file = file("data/npc_saves/TrophyItems.json")
if(!fexists(json_file))
return
var/list/json = list()
json = json_decode(file2text(json_file))
var/list/json = json_decode(file2text(json_file))
if(!json)
return
saved_trophies = json["data"]
SetUpTrophies(saved_trophies.Copy())
/datum/controller/subsystem/persistence/proc/LoadRecentModes()
var/json_file = file("data/RecentModes.json")
if(!fexists(json_file))
return
var/list/json = json_decode(file2text(json_file))
if(!json)
return
saved_modes = json["data"]
/datum/controller/subsystem/persistence/proc/SetUpTrophies(list/trophy_items)
for(var/A in GLOB.trophy_cases)
var/obj/structure/displaycase/trophy/T = A
@@ -165,6 +173,7 @@ SUBSYSTEM_DEF(persistence)
CollectChiselMessages()
CollectSecretSatchels()
CollectTrophies()
CollectRoundtype()
/datum/controller/subsystem/persistence/proc/CollectSecretSatchels()
var/list/satchels = list()
@@ -224,3 +233,13 @@ SUBSYSTEM_DEF(persistence)
data["message"] = T.trophy_message
data["placer_key"] = T.placer_key
saved_trophies += list(data)
/datum/controller/subsystem/persistence/proc/CollectRoundtype()
saved_modes[3] = saved_modes[2]
saved_modes[2] = saved_modes[1]
saved_modes[1] = SSticker.mode.config_tag
var/json_file = file("data/RecentModes.json")
var/list/file_data = list()
file_data["data"] = saved_modes
fdel(json_file)
WRITE_FILE(json_file, json_encode(file_data))