diff --git a/code/datums/configuration.dm b/code/datums/configuration.dm index 1c7fce71887..b4e05b500dd 100644 --- a/code/datums/configuration.dm +++ b/code/datums/configuration.dm @@ -41,6 +41,15 @@ var/server var/banappeals + //game_options.txt configs + + var/health_threshold_crit = 0 + var/health_threshold_dead = 0 + + var/revival_pod_plants = 1 + var/revival_cloning = 1 + var/revival_brain_life = -1 + /datum/configuration/New() var/list/L = typesof(/datum/game_mode) - /datum/game_mode for (var/T in L) @@ -59,11 +68,11 @@ del(M) src.votable_modes += "secret" -/datum/configuration/proc/load(filename) +/datum/configuration/proc/load(filename, type = "config") //the type can also be game_options, in which case it uses a different switch. not making it separate to not copypaste code - Urist var/text = file2text(filename) if (!text) - diary << "No config.txt file found, setting defaults" + diary << "No [filename] file found, setting defaults" src = new /datum/configuration() return @@ -94,118 +103,140 @@ if (!name) continue - switch (name) - if ("log_ooc") - config.log_ooc = 1 + if(type == "config") + switch (name) + if ("log_ooc") + config.log_ooc = 1 - if ("log_access") - config.log_access = 1 + if ("log_access") + config.log_access = 1 - if ("sql_enabled") - config.sql_enabled = text2num(value) + if ("sql_enabled") + config.sql_enabled = text2num(value) - if ("log_say") - config.log_say = 1 + if ("log_say") + config.log_say = 1 - if ("log_admin") - config.log_admin = 1 + if ("log_admin") + config.log_admin = 1 - if ("log_game") - config.log_game = 1 + if ("log_game") + config.log_game = 1 - if ("log_vote") - config.log_vote = 1 + if ("log_vote") + config.log_vote = 1 - if ("log_whisper") - config.log_whisper = 1 + if ("log_whisper") + config.log_whisper = 1 - if ("allow_vote_restart") - config.allow_vote_restart = 1 + if ("allow_vote_restart") + config.allow_vote_restart = 1 - if ("allow_vote_mode") - config.allow_vote_mode = 1 + if ("allow_vote_mode") + config.allow_vote_mode = 1 - if ("allow_admin_jump") - config.allow_admin_jump = 1 + if ("allow_admin_jump") + config.allow_admin_jump = 1 - if("allow_admin_rev") - config.allow_admin_rev = 1 + if("allow_admin_rev") + config.allow_admin_rev = 1 - if ("allow_admin_spawning") - config.allow_admin_spawning = 1 + if ("allow_admin_spawning") + config.allow_admin_spawning = 1 - if ("no_dead_vote") - config.vote_no_dead = 1 + if ("no_dead_vote") + config.vote_no_dead = 1 - if ("default_no_vote") - config.vote_no_default = 1 + if ("default_no_vote") + config.vote_no_default = 1 - if ("vote_delay") - config.vote_delay = text2num(value) + if ("vote_delay") + config.vote_delay = text2num(value) - if ("vote_period") - config.vote_period = text2num(value) + if ("vote_period") + config.vote_period = text2num(value) - if ("allow_ai") - config.allow_ai = 1 + if ("allow_ai") + config.allow_ai = 1 - if ("authentication") - config.enable_authentication = 1 + if ("authentication") + config.enable_authentication = 1 - if ("norespawn") - config.respawn = 0 + if ("norespawn") + config.respawn = 0 - if ("servername") - config.server_name = value + if ("servername") + config.server_name = value - if ("serversuffix") - config.server_suffix = 1 + if ("serversuffix") + config.server_suffix = 1 - if ("medalhub") - config.medal_hub = value + if ("medalhub") + config.medal_hub = value - if ("medalpass") - config.medal_password = value + if ("medalpass") + config.medal_password = value - if ("hostedby") - config.hostedby = value + if ("hostedby") + config.hostedby = value - if ("server") - config.server = value + if ("server") + config.server = value - if ("banappeals") - config.banappeals = value + if ("banappeals") + config.banappeals = value - if ("guest_jobban") - config.guest_jobban = text2num(value) + if ("guest_jobban") + config.guest_jobban = text2num(value) - if ("usewhitelist") - config.usewhitelist = 1 + if ("usewhitelist") + config.usewhitelist = 1 - if ("feature_object_spell_system") - config.feature_object_spell_system = 1 + if ("feature_object_spell_system") + config.feature_object_spell_system = 1 - if ("traitor_scaling") - config.traitor_scaling = 1 + if ("traitor_scaling") + config.traitor_scaling = 1 - if ("probability") - var/prob_pos = findtext(value, " ") - var/prob_name = null - var/prob_value = null + if ("probability") + var/prob_pos = findtext(value, " ") + var/prob_name = null + var/prob_value = null - if (prob_pos) - prob_name = lowertext(copytext(value, 1, prob_pos)) - prob_value = copytext(value, prob_pos + 1) - if (prob_name in config.modes) - config.probabilities[prob_name] = text2num(prob_value) + if (prob_pos) + prob_name = lowertext(copytext(value, 1, prob_pos)) + prob_value = copytext(value, prob_pos + 1) + if (prob_name in config.modes) + config.probabilities[prob_name] = text2num(prob_value) + else + diary << "Unknown game mode probability configuration definition: [prob_name]." else - diary << "Unknown game mode probability configuration definition: [prob_name]." + diary << "Incorrect probability configuration definition: [prob_name] [prob_value]." + + if ("kick_inactive") + config.kick_inactive = text2num(value) + else - diary << "Incorrect probability configuration definition: [prob_name] [prob_value]." - if ("kick_inactive") - config.kick_inactive = text2num(value) - else - diary << "Unknown setting in configuration: '[name]'" + diary << "Unknown setting in configuration: '[name]'" + + else if(type == "game_options") + if(!value) + diary << "Unknown value for setting [name] in [filename]." + value = text2num(value) + + switch(name) + if("health_threshold_crit") + config.health_threshold_crit = value + if("health_threshold_dead") + config.health_threshold_dead = value + if("revival_pod_plants") + config.revival_pod_plants = value + if("revival_cloning") + config.revival_cloning = value + if("revival_brain_life") + config.revival_brain_life = value + else + diary << "Unknown setting in configuration: '[name]'" /datum/configuration/proc/loadsql(filename) // -- TLE var/text = file2text(filename) diff --git a/code/defines/obj.dm b/code/defines/obj.dm index 0bd140df58a..66aac71bf7a 100644 --- a/code/defines/obj.dm +++ b/code/defines/obj.dm @@ -844,7 +844,7 @@ //Shifting the brain "mob" over to the brain object so it's easier to keep track of. --NEO //WASSSSSUUUPPPP /N spawn(5) - if(brainmob&&brainmob.client) + if(brainmob && brainmob.client) brainmob.client.screen.len = null //clear the hud proc @@ -854,6 +854,7 @@ brainmob.name = H.real_name brainmob.real_name = H.real_name brainmob.dna = H.dna + brainmob.timeofhostdeath = H.timeofdeath if(H.mind) H.mind.transfer_to(brainmob) brainmob << "\blue You might feel slightly disoriented. That's normal when your brain gets cut out." diff --git a/code/game/cellautomata.dm b/code/game/cellautomata.dm index 65f06e4d127..dacbdf2ebb3 100644 --- a/code/game/cellautomata.dm +++ b/code/game/cellautomata.dm @@ -64,6 +64,7 @@ /world/proc/load_configuration() config = new /datum/configuration() config.load("config/config.txt") + config.load("config/game_options.txt","game_options") config.loadsql("config/dbconfig.txt") config.loadforumsql("config/forumdbconfig.txt") // apply some settings from config.. diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 7706476c044..633929245bd 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -280,7 +280,7 @@ var/mob/selected = find_dead_player("[C.fields["ckey"]]") //Can't clone without someone to clone. Or a pod. Or if the pod is busy. Or full of gibs. - if ((!selected) || (!src.pod1) || (src.pod1.occupant) || (src.pod1.mess)) + if ((!selected) || (!src.pod1) || (src.pod1.occupant) || (src.pod1.mess) || !config.revival_cloning) src.temp = "Unable to initiate cloning cycle." // most helpful error message in THE HISTORY OF THE WORLD else if (src.pod1.growclone(selected, C.fields["name"], C.fields["UI"], C.fields["SE"], C.fields["mind"], C.fields["mrace"], C.fields["interface"],C.fields["changeling"])) src.temp = "Cloning cycle activated." diff --git a/code/game/machinery/hydroponics.dm b/code/game/machinery/hydroponics.dm index 116b07a95d2..f51643099f6 100644 --- a/code/game/machinery/hydroponics.dm +++ b/code/game/machinery/hydroponics.dm @@ -835,7 +835,7 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) /obj/item/seeds/replicapod/harvest(mob/user = usr) //now that one is fun -- Urist var/obj/machinery/hydroponics/parent = loc - if(ckey) //if there's human data stored in it, make a human + if(ckey && config.revival_pod_plants) //if there's human data stored in it, make a human var/mob/ghost = find_dead_player("[ckey]") var/mob/living/carbon/human/podman = new /mob/living/carbon/human(parent.loc) diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm index 4801edaf0d6..d923826f30b 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm @@ -88,9 +88,9 @@ if(src.resting) src.weakened = max(src.weakened, 5) - if(health < -100 || src.brain_op_stage == 4.0) + if(health < config.health_threshold_dead || src.brain_op_stage == 4.0) death() - else if(src.health < 0) + else if(src.health < config.health_threshold_crit) if(src.health <= 20 && prob(1)) spawn(0) emote("gasp") //if(!src.rejuv) src.oxyloss++ diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm index d17d3a9241d..25447e6aea7 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm @@ -89,9 +89,9 @@ if(src.resting) src.weakened = max(src.weakened, 5) - if(health < -100 || src.brain_op_stage == 4.0) + if(health < config.health_threshold_dead || src.brain_op_stage == 4.0) death() - else if(src.health < 0) + else if(src.health < config.health_threshold_crit) if(src.health <= 20 && prob(1)) spawn(0) emote("gasp") //if(!src.rejuv) src.oxyloss++ diff --git a/code/modules/mob/living/carbon/alien/humanoid/life.dm b/code/modules/mob/living/carbon/alien/humanoid/life.dm index bc0bed6d3ee..549a120761c 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/life.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/life.dm @@ -408,9 +408,9 @@ if(src.resting) src.weakened = max(src.weakened, 5) - if(health < -100 || src.brain_op_stage == 4.0) + if(health < config.health_threshold_dead || src.brain_op_stage == 4.0) death() - else if(src.health < 0) + else if(src.health < config.health_threshold_crit) if(src.health <= 20 && prob(1)) spawn(0) emote("gasp") //if(!src.rejuv) src.oxyloss++ diff --git a/code/modules/mob/living/carbon/alien/humanoid/queen.dm b/code/modules/mob/living/carbon/alien/humanoid/queen.dm index 3d3adde9e13..cb06de3116a 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/queen.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/queen.dm @@ -90,9 +90,9 @@ if(src.resting) src.weakened = max(src.weakened, 5) - if(health < -100 || src.brain_op_stage == 4.0) + if(health < config.health_threshold_dead || src.brain_op_stage == 4.0) death() - else if(src.health < 0) + else if(src.health < config.health_threshold_crit) if(src.health <= 20 && prob(1)) spawn(0) emote("gasp") //if(!src.rejuv) src.oxyloss++ diff --git a/code/modules/mob/living/carbon/alien/larva/life.dm b/code/modules/mob/living/carbon/alien/larva/life.dm index f2535086aaf..329814ea894 100644 --- a/code/modules/mob/living/carbon/alien/larva/life.dm +++ b/code/modules/mob/living/carbon/alien/larva/life.dm @@ -335,9 +335,9 @@ if(resting) weakened = max(weakened, 5) - if(health < -100 || brain_op_stage == 4.0) + if(health < config.health_threshold_dead || brain_op_stage == 4.0) death() - else if(health < 0) + else if(health < config.health_threshold_crit) if(health <= 20 && prob(1)) spawn(0) emote("gasp") //if(!rejuv) oxyloss++ diff --git a/code/modules/mob/living/carbon/brain/brain.dm b/code/modules/mob/living/carbon/brain/brain.dm index 2642edc7914..140e40742d5 100644 --- a/code/modules/mob/living/carbon/brain/brain.dm +++ b/code/modules/mob/living/carbon/brain/brain.dm @@ -1,6 +1,7 @@ /mob/living/carbon/brain var obj/item/device/mmi/container = null + timeofhostdeath = 0 New() var/datum/reagents/R = new/datum/reagents(1000) diff --git a/code/modules/mob/living/carbon/brain/death.dm b/code/modules/mob/living/carbon/brain/death.dm index d9fd40e4432..289ef7e46ab 100644 --- a/code/modules/mob/living/carbon/brain/death.dm +++ b/code/modules/mob/living/carbon/brain/death.dm @@ -1,5 +1,5 @@ /mob/living/carbon/brain/death(gibbed) - if(!gibbed&&container)//If not gibbed but in a container. + if(!gibbed && container)//If not gibbed but in a container. for(var/mob/O in viewers(container, null)) O.show_message(text("\red []'s MMI flatlines!", src), 1, "\red You hear something flatline.", 2) container.icon_state = "mmi_dead" diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index bb67918fdcd..f7bd8377f7b 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -155,9 +155,9 @@ if(resting) weakened = max(weakened, 5) - if(health < -100 && stat != 2) + if(stat != 2 && (!container && (health < config.health_threshold_dead || (config.revival_brain_life >= 0 && ((world.time - timeofhostdeath) > config.revival_brain_life ))))) death() - else if(health < 0) + else if(health < config.health_threshold_crit) if(health <= 20 && prob(1)) spawn(0) emote("gasp") //if(!rejuv) oxyloss++ diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 3f4fa44ed33..1aee515904a 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -663,9 +663,9 @@ if(resting) weakened = max(weakened, 3) - if(health < -100 || brain_op_stage == 4.0) + if(health < config.health_threshold_dead || brain_op_stage == 4.0) death() - else if(health < 0) + else if(health < config.health_threshold_crit) if(health <= 20 && prob(1)) spawn(0) emote("gasp") //if(!rejuv) oxyloss++ diff --git a/code/modules/mob/living/carbon/metroid/life.dm b/code/modules/mob/living/carbon/metroid/life.dm index 88fac4623c4..717f3ecf7ac 100644 --- a/code/modules/mob/living/carbon/metroid/life.dm +++ b/code/modules/mob/living/carbon/metroid/life.dm @@ -403,11 +403,11 @@ - if(health < -100) + if(health < config.health_threshold_dead && stat != 2) death() return - else if(src.health < -50) + else if(src.health < config.health_threshold_crit) // if(src.health <= 20 && prob(1)) spawn(0) emote("gasp") //if(!src.rejuv) src.oxyloss++ diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index 5225b5d926c..f7cf893ea12 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -408,9 +408,9 @@ if(src.resting) src.weakened = max(src.weakened, 5) - if(health < -100) + if(health < config.health_threshold_dead && stat != 2) death() - else if(src.health < 0) + else if(src.health < config.health_threshold_crit) if(src.health <= 20 && prob(1)) spawn(0) emote("gasp") //if(!src.rejuv) src.oxyloss++ diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 84513c7a512..50fb4043d09 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -36,10 +36,10 @@ - if (src.health <= -100.0) + if (src.health <= config.health_threshold_dead) death() return -// else if (src.health < 0 && !istype(src.loc, /obj/machinery/computer/aifixer)) //Removing this for now, as it's bloody annoying. We'll see how it works -- Urist +// else if (src.health < config.health_threshold_crit && !istype(src.loc, /obj/machinery/computer/aifixer)) //Removing this for now, as it's bloody annoying. We'll see how it works -- Urist // src.oxyloss++ if (src.machine) diff --git a/code/modules/mob/living/silicon/decoy/life.dm b/code/modules/mob/living/silicon/decoy/life.dm index b396b892844..0a486b9e822 100644 --- a/code/modules/mob/living/silicon/decoy/life.dm +++ b/code/modules/mob/living/silicon/decoy/life.dm @@ -2,7 +2,7 @@ if (src.stat == 2) return else - if (src.health <= -100.0 && src.stat != 2) + if (src.health <= config.health_threshold_dead && src.stat != 2) death() return diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index c0388e01ecb..b621e79a464 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -87,7 +87,7 @@ if(src.stat) src.camera.status = 0 - health = 300 - (oxyloss + fireloss + bruteloss) + health = 200 - (oxyloss + fireloss + bruteloss) if(oxyloss > 50) paralysis = max(paralysis, 3) @@ -98,7 +98,7 @@ if(src.resting) src.weakened = max(src.weakened, 5) - if(health < 0 && src.stat != 2) //die only once + if(health < config.health_threshold_dead && src.stat != 2) //die only once death() if (src.stat != 2) //Alive. diff --git a/config/game_options.txt b/config/game_options.txt new file mode 100644 index 00000000000..6521afe1867 --- /dev/null +++ b/config/game_options.txt @@ -0,0 +1,18 @@ +### HEALTH ### + +## level of health at which a mob becomes unconscious (crit) +HEALTH_THRESHOLD_CRIT 0 + +## level of health at which a mob becomes dead +HEALTH_THRESHOLD_DEAD -100 + +### REVIVAL ### + +## whether pod plants work or not +REVIVAL_POD_PLANTS 1 + +## whether cloning tubes work or not +REVIVAL_CLONING 1 + +## amount of time (in hundredths of seconds) for which a brain retains the "spark of life" after the person's death (set to -1 for infinite) +REVIVAL_BRAIN_LIFE -1 \ No newline at end of file