[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

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)

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))

View File

@@ -9,10 +9,13 @@
var/times_spoken_to = 0
var/list/shenanigans = list()
/obj/structure/speaking_tile/New()
var/savefile/S = new /savefile("data/npc_saves/Poly.sav")
S["phrases"] >> shenanigans
..()
/obj/structure/speaking_tile/Initialize()
. = ..()
var/json_file = file("data/npc_saves/Poly.json")
if(!fexists(json_file))
return
var/list/json = json_decode(file2text(json_file))
shenanigans = json["phrases"]
/obj/structure/speaking_tile/interact(mob/user)
if(!isliving(user) || speaking)
@@ -118,4 +121,4 @@
..()
/obj/effect/landmark/error
name = "error"
name = "error"

View File

@@ -87,12 +87,16 @@
/// SNPC voice handling
/mob/living/carbon/human/interactive/proc/loadVoice()
var/json_file = file("data/npc_saves/snpc.json")
if(!fexists(json_file))
return
var/list/json = list()
json = json_decode(file2text(json_file))
knownStrings = json["knownStrings"]
if(fexists("data/npc_saves/snpc.sav"))
var/savefile/S = new /savefile("data/npc_saves/snpc.sav")
S["knownStrings"] >> knownStrings
fdel(S)
else
var/json_file = file("data/npc_saves/snpc.json")
if(!fexists(json_file))
return
var/list/json = json_decode(file2text(json_file))
knownStrings = json["knownStrings"]
if(isnull(knownStrings))
knownStrings = list()
@@ -1618,4 +1622,4 @@
TRAITS |= TRAIT_ROBUST
TRAITS |= TRAIT_SMART
faction += "bot_power"
. = ..()
. = ..()

View File

@@ -5,7 +5,7 @@
var/ancestor_chain = 1
var/relic_hat //Note: these two are paths
var/relic_mask
var/memory_saved = 0
var/memory_saved = FALSE
var/list/pet_monkey_names = list("Pun Pun", "Bubbles", "Mojo", "George", "Darwin", "Aldo", "Caeser", "Kanzi", "Kong", "Terk", "Grodd", "Mala", "Bojangles", "Coco", "Able", "Baker", "Scatter", "Norbit", "Travis")
var/list/rare_pet_monkey_names = list("Professor Bobo", "Deempisi's Revenge", "Furious George", "King Louie", "Dr. Zaius", "Jimmy Rustles", "Dinner", "Lanky")
@@ -32,25 +32,33 @@
equip_to_slot_or_del(new relic_mask, slot_wear_mask)
/mob/living/carbon/monkey/punpun/Life()
if(SSticker.current_state == GAME_STATE_FINISHED && !memory_saved)
Write_Memory(0)
if(!stat && SSticker.current_state == GAME_STATE_FINISHED && !memory_saved)
Write_Memory(FALSE, FALSE)
memory_saved = TRUE
..()
/mob/living/carbon/monkey/punpun/death(gibbed)
if(!memory_saved || gibbed)
Write_Memory(1,gibbed)
if(!memory_saved)
Write_Memory(TRUE, gibbed)
..()
/mob/living/carbon/monkey/punpun/proc/Read_Memory()
var/json_file = file("data/npc_saves/Punpun.json")
if(!fexists(json_file))
return
var/list/json = list()
json = json_decode(file2text(json_file))
ancestor_name = json["ancestor_name"]
ancestor_chain = json["ancestor_chain"]
relic_hat = json["relic_hat"]
relic_mask = json["relic_hat"]
if(fexists("data/npc_saves/Punpun.sav")) //legacy compatability to convert old format to new
var/savefile/S = new /savefile("data/npc_saves/Punpun.sav")
S["ancestor_name"] >> ancestor_name
S["ancestor_chain"] >> ancestor_chain
S["relic_hat"] >> relic_hat
S["relic_mask"] >> relic_mask
fdel("data/npc_saves/Punpun.sav")
else
var/json_file = file("data/npc_saves/Punpun.json")
if(!fexists(json_file))
return
var/list/json = json_decode(file2text(json_file))
ancestor_name = json["ancestor_name"]
ancestor_chain = json["ancestor_chain"]
relic_hat = json["relic_hat"]
relic_mask = json["relic_hat"]
/mob/living/carbon/monkey/punpun/proc/Write_Memory(dead, gibbed)
var/json_file = file("data/npc_saves/Punpun.json")
@@ -60,14 +68,10 @@
file_data["ancestor_chain"] = null
file_data["relic_hat"] = null
file_data["relic_mask"] = null
if(dead)
file_data["ancestor_name"] = ancestor_name
file_data["ancestor_chain"] = ancestor_chain + 1
file_data["relic_hat"] = head ? head.type : null
file_data["relic_mask"] = wear_mask ? wear_mask.type : null
if(!ancestor_name)
file_data["ancestor_name"] = name
else
file_data["ancestor_name"] = ancestor_name ? ancestor_name : name
file_data["ancestor_chain"] = dead ? ancestor_chain + 1 : ancestor_chain
file_data["relic_hat"] = head ? head.type : null
file_data["relic_mask"] = wear_mask ? wear_mask.type : null
fdel(json_file)
WRITE_FILE(json_file, json_encode(file_data))
if(!dead)
memory_saved = 1
WRITE_FILE(json_file, json_encode(file_data))

View File

@@ -85,7 +85,7 @@
var/list/family = list()//var restored from savefile, has count of each child type
var/list/children = list()//Actual mob instances of children
var/cats_deployed = 0
var/memory_saved = 0
var/memory_saved = FALSE
/mob/living/simple_animal/pet/cat/Runtime/Initialize()
if(prob(5))
@@ -100,6 +100,7 @@
Deploy_The_Cats()
if(!stat && SSticker.current_state == GAME_STATE_FINISHED && !memory_saved)
Write_Memory()
memory_saved = TRUE
..()
/mob/living/simple_animal/pet/cat/Runtime/make_babies()
@@ -110,21 +111,26 @@
/mob/living/simple_animal/pet/cat/Runtime/death()
if(!memory_saved)
Write_Memory(1)
Write_Memory(TRUE)
..()
/mob/living/simple_animal/pet/cat/Runtime/proc/Read_Memory()
var/json_file = file("data/npc_saves/Runtime.json")
if(!fexists(json_file))
return
var/list/json = list()
json = json_decode(file2text(json_file))
family = json["family"]
if(fexists("data/npc_saves/Runtime.sav")) //legacy compatability to convert old format to new
var/savefile/S = new /savefile("data/npc_saves/Runtime.sav")
S["family"] >> family
fdel("data/npc_saves/Runtime.sav")
else
var/json_file = file("data/npc_saves/Runtime.json")
if(!fexists(json_file))
return
var/list/json = json_decode(file2text(json_file))
family = json["family"]
if(isnull(family))
family = list()
/mob/living/simple_animal/pet/cat/Runtime/proc/Write_Memory(dead)
var/json_file = file("data/npc_saves/Runtime.json")
var/list/file_data = list()
family = list()
if(!dead)
for(var/mob/living/simple_animal/pet/cat/kitten/C in children)
@@ -134,9 +140,9 @@
family[C.type] += 1
else
family[C.type] = 1
file_data["family"] = family
fdel(json_file)
WRITE_FILE(json_file, json_encode(family))
memory_saved = 1
WRITE_FILE(json_file, json_encode(file_data))
/mob/living/simple_animal/pet/cat/Runtime/proc/Deploy_The_Cats()
cats_deployed = 1

View File

@@ -292,7 +292,7 @@
gold_core_spawnable = 0
var/age = 0
var/record_age = 1
var/memory_saved = 0
var/memory_saved = FALSE
var/saved_head //path
/mob/living/simple_animal/pet/dog/corgi/Ian/Initialize()
@@ -308,7 +308,7 @@
P.real_name = "Ian"
P.gender = MALE
P.desc = "It's the HoP's beloved corgi puppy."
Write_Memory(0)
Write_Memory(FALSE)
qdel(src)
else if(age == record_age)
icon_state = "old_corgi"
@@ -318,24 +318,31 @@
turns_per_move = 20
/mob/living/simple_animal/pet/dog/corgi/Ian/Life()
if(SSticker.current_state == GAME_STATE_FINISHED && !memory_saved)
Write_Memory(0)
if(!stat && SSticker.current_state == GAME_STATE_FINISHED && !memory_saved)
Write_Memory(FALSE)
memory_saved = TRUE
..()
/mob/living/simple_animal/pet/dog/corgi/Ian/death()
if(!memory_saved)
Write_Memory(1)
Write_Memory(TRUE)
..()
/mob/living/simple_animal/pet/dog/corgi/Ian/proc/Read_Memory()
var/json_file = file("data/npc_saves/Ian.json")
if(!fexists(json_file))
return
var/list/json = list()
json = json_decode(file2text(json_file))
age = json["age"]
record_age = json["record_age"]
saved_head = json["saved_head"]
if(fexists("data/npc_saves/Ian.sav")) //legacy compatability to convert old format to new
var/savefile/S = new /savefile("data/npc_saves/Ian.sav")
S["age"] >> age
S["record_age"] >> record_age
S["saved_head"] >> saved_head
fdel("data/npc_saves/Ian.sav")
else
var/json_file = file("data/npc_saves/Ian.json")
if(!fexists(json_file))
return
var/list/json = json_decode(file2text(json_file))
age = json["age"]
record_age = json["record_age"]
saved_head = json["saved_head"]
if(isnull(age))
age = 0
if(isnull(record_age))
@@ -350,14 +357,18 @@
file_data["age"] = age + 1
if((age + 1) > record_age)
file_data["record_age"] = record_age + 1
else
file_data["record_age"] = record_age
if(inventory_head)
file_data["saved_head"] = inventory_head.type
else
file_data["saved_head"] = null
else
file_data["age"] = 0
file_data["record_age"] = record_age
file_data["saved_head"] = null
fdel(json_file)
WRITE_FILE(json_file, json_encode(file_data))
memory_saved = 1
/mob/living/simple_animal/pet/dog/corgi/Ian/Life()
..()

View File

@@ -250,7 +250,7 @@ Difficulty: Very Hard
use_power = NO_POWER_USE
var/memory_saved = FALSE
var/list/stored_items = list()
var/static/list/blacklist = typecacheof(list(/obj/item/spellbook))
var/list/blacklist = list()
/obj/machinery/smartfridge/black_box/update_icon()
return
@@ -276,6 +276,7 @@ Difficulty: Very Hard
..()
if(!memory_saved && SSticker.current_state == GAME_STATE_FINISHED)
WriteMemory()
memory_saved = TRUE
/obj/machinery/smartfridge/black_box/proc/WriteMemory()
var/json_file = file("data/npc_saves/Blackbox.json")
@@ -287,15 +288,18 @@ Difficulty: Very Hard
file_data["data"] = stored_items
fdel(json_file)
WRITE_FILE(json_file, json_encode(file_data))
memory_saved = TRUE
/obj/machinery/smartfridge/black_box/proc/ReadMemory()
var/json_file = file("data/npc_saves/Blackbox.json")
if(!fexists(json_file))
return
var/list/json = list()
json = json_decode(file2text(json_file))
stored_items = json["data"]
if(fexists("data/npc_saves/Blackbox.sav")) //legacy compatability to convert old format to new
var/savefile/S = new /savefile("data/npc_saves/Blackbox.sav")
S["stored_items"] >> stored_items
fdel("data/npc_saves/Blackbox.sav")
else
var/json_file = file("data/npc_saves/Blackbox.json")
if(!fexists(json_file))
return
var/list/json = json_decode(file2text(json_file))
stored_items = json["data"]
if(isnull(stored_items))
stored_items = list()
@@ -789,4 +793,4 @@ Difficulty: Very Hard
#undef ACTIVATE_WEAPON
#undef ACTIVATE_MAGIC
#undef MEDAL_PREFIX
#undef MEDAL_PREFIX

View File

@@ -297,7 +297,7 @@
else
parrot_state |= PARROT_FLEE //Otherwise, fly like a bat out of hell!
drop_held_item(0)
if(!stat && M.a_intent == INTENT_HELP)
if(stat != DEAD && M.a_intent == INTENT_HELP)
handle_automated_speech(1) //assured speak/emote
return
@@ -873,7 +873,7 @@
speak = list("Poly wanna cracker!", ":e Check the crystal, you chucklefucks!",":e Wire the solars, you lazy bums!",":e WHO TOOK THE DAMN HARDSUITS?",":e OH GOD ITS ABOUT TO DELAMINATE CALL THE SHUTTLE")
gold_core_spawnable = 0
speak_chance = 3
var/memory_saved = 0
var/memory_saved = FALSE
var/rounds_survived = 0
var/longest_survival = 0
var/longest_deathstreak = 0
@@ -904,50 +904,62 @@
rounds_survived = max(++rounds_survived,1)
if(rounds_survived > longest_survival)
longest_survival = rounds_survived
Write_Memory()
Write_Memory(FALSE)
memory_saved = TRUE
..()
/mob/living/simple_animal/parrot/Poly/death(gibbed)
if(!memory_saved)
var/go_ghost = 0
if(rounds_survived == longest_survival || rounds_survived == longest_deathstreak || prob(0.666))
go_ghost = 1
rounds_survived = min(--rounds_survived,0)
if(rounds_survived < longest_deathstreak)
longest_deathstreak = rounds_survived
Write_Memory()
if(go_ghost)
var/mob/living/simple_animal/parrot/Poly/ghost/G = new(loc)
if(mind)
mind.transfer_to(G)
else
G.key = key
Write_Memory(TRUE)
if(rounds_survived == longest_survival || rounds_survived == longest_deathstreak || prob(0.666))
var/mob/living/simple_animal/parrot/Poly/ghost/G = new(loc)
if(mind)
mind.transfer_to(G)
else
G.key = key
..(gibbed)
/mob/living/simple_animal/parrot/Poly/proc/Read_Memory()
var/json_file = file("data/npc_saves/Poly.json")
if(!fexists(json_file))
return
var/list/json = list()
json = json_decode(file2text(json_file))
speech_buffer = json["phrases"]
rounds_survived = json["roundssurvived"]
longest_survival = json["longestsurvival"]
longest_deathstreak = json["longestdeathstreak"]
if(fexists("data/npc_saves/Poly.sav")) //legacy compatability to convert old format to new
var/savefile/S = new /savefile("data/npc_saves/Poly.sav")
S["phrases"] >> speech_buffer
S["roundssurvived"] >> rounds_survived
S["longestsurvival"] >> longest_survival
S["longestdeathstreak"] >> longest_deathstreak
fdel("data/npc_saves/Poly.sav")
else
var/json_file = file("data/npc_saves/Poly.json")
if(!fexists(json_file))
return
var/list/json = json_decode(file2text(json_file))
speech_buffer = json["phrases"]
rounds_survived = json["roundssurvived"]
longest_survival = json["longestsurvival"]
longest_deathstreak = json["longestdeathstreak"]
if(!islist(speech_buffer))
speech_buffer = list()
/mob/living/simple_animal/parrot/Poly/proc/Write_Memory()
/mob/living/simple_animal/parrot/Poly/proc/Write_Memory(dead)
var/json_file = file("data/npc_saves/Poly.json")
var/list/file_data = list()
if(islist(speech_buffer))
file_data["phrases"] = speech_buffer
file_data["roundssurvived"] = rounds_survived
file_data["longestsurvival"] = longest_survival
file_data["longestdeathstreak"] = longest_deathstreak
if(dead)
file_data["roundssurvived"] = min(rounds_survived - 1, 0)
file_data["longestsurvival"] = longest_survival
if(rounds_survived - 1 < longest_deathstreak)
file_data["longestdeathstreak"] = rounds_survived - 1
else
file_data["longestdeathstreak"] = longest_deathstreak
else
file_data["roundssurvived"] = rounds_survived + 1
if(rounds_survived + 1 > longest_survival)
file_data["longestsurvival"] = rounds_survived + 1
else
file_data["longestsurvival"] = longest_survival
file_data["longestdeathstreak"] = longest_deathstreak
fdel(json_file)
WRITE_FILE(json_file, json_encode(file_data))
memory_saved = 1
/mob/living/simple_animal/parrot/Poly/ghost
name = "The Ghost of Poly"
@@ -959,7 +971,7 @@
butcher_results = list(/obj/item/ectoplasm = 1)
/mob/living/simple_animal/parrot/Poly/ghost/Initialize()
memory_saved = 1 //At this point nothing is saved
memory_saved = TRUE //At this point nothing is saved
..()
/mob/living/simple_animal/parrot/Poly/ghost/handle_automated_speech()
@@ -984,4 +996,4 @@
loc = H
H.ContractDisease(P)
parrot_interest = null
H.visible_message("<span class='danger'>[src] dive bombs into [H]'s chest and vanishes!</span>", "<span class='userdanger'>[src] dive bombs into your chest, vanishing! This can't be good!</span>")
H.visible_message("<span class='danger'>[src] dive bombs into [H]'s chest and vanishes!</span>", "<span class='userdanger'>[src] dive bombs into your chest, vanishing! This can't be good!</span>")

View File

@@ -98,6 +98,9 @@ PROBABILITY DEVIL_AGENTS 0
## You probably want to keep sandbox off by default for secret and random.
PROBABILITY SANDBOX 0
## Percent weight reductions for three of the most recent modes
REPEATED_MODE_ADJUST 45 30 10
## Toggles for continuous modes.
## Modes that aren't continuous will end the instant all antagonists are dead.