From 608737376bfa894aaf316d624f8eacc333e6990d Mon Sep 17 00:00:00 2001 From: ktccd Date: Tue, 1 Aug 2017 06:45:32 +0200 Subject: [PATCH] Borer admin refactor (#2209) * Refactors and clarifications Refactors borers to use objective datums instead of relying entirely on hardcoded snowflake bullshit. Also adds some FEEDBACK to the punishments, so the host isn't completely confused why they suddenly keep getting stunlocked and blinded. Also refactors syndi-borers to display their objectives along the other borers instead of as an antag, since they TECHNICALLY count as a borer for their escape objective, enabling them to cooperate. Refactors borers weakness-chemical to be a variable instead of hardcoded, allowing admin var-editing to work. Borers now inherit the objectives of their parent-borer. Normally makes no difference, but if admins were to give custom objectives to one borer, then all its children will injerit it. * Removed a line Removed a piece of text that was redundant at best and incorrect at worst. Syndicate borers makes it show up as the default 10 needed when no other borers existed and normal borers already state their own objective individually. --- code/game/gamemodes/antag_spawner_cit.dm | 1 - code/game/gamemodes/cit_objectives.dm | 21 +++++++++ code/game/gamemodes/game_mode.dm | 26 +++++----- code/game/gamemodes/miniantags/borer/borer.dm | 47 +++++++++++++------ 4 files changed, 65 insertions(+), 30 deletions(-) diff --git a/code/game/gamemodes/antag_spawner_cit.dm b/code/game/gamemodes/antag_spawner_cit.dm index a7923be45e..c65ac11c6b 100644 --- a/code/game/gamemodes/antag_spawner_cit.dm +++ b/code/game/gamemodes/antag_spawner_cit.dm @@ -16,7 +16,6 @@ obj/item/weapon/antag_spawner/syndi_borer/spawn_antag(client/C, turf/T, mob/owne B.mind.assigned_role = B.name B.mind.special_role = B.name - SSticker.mode.traitors += B.mind var/datum/objective/syndi_borer/new_objective new_objective = new /datum/objective/syndi_borer new_objective.owner = B.mind diff --git a/code/game/gamemodes/cit_objectives.dm b/code/game/gamemodes/cit_objectives.dm index 3874ea95db..faa376571c 100644 --- a/code/game/gamemodes/cit_objectives.dm +++ b/code/game/gamemodes/cit_objectives.dm @@ -83,3 +83,24 @@ explanation_text = "Assassinate [target.name], the [!target_role_type ? target.assigned_role : target.special_role]." else explanation_text = "Stay alive until your target arrives on the station, you will be notified when the target has been identified." + + + +//BORER STUFF +//Because borers didn't use to have objectives +/datum/objective/normal_borer //Default objective, should technically never be used unmodified but CAN work unmodified. + explanation_text = "You must escape with at least one borer with host on the shuttle." + target_amount = 1 + martyr_compatible = 0 + +/datum/objective/normal_borer/check_completion() + var/total_borer_hosts = 0 + for(var/mob/living/carbon/C in GLOB.mob_list) + var/mob/living/simple_animal/borer/D = C.has_brain_worms() + var/turf/location = get_turf(C) + if(location.z == ZLEVEL_CENTCOM && D && D.stat != DEAD) + total_borer_hosts++ + if(target_amount <= total_borer_hosts) + return TRUE + else + return FALSE \ No newline at end of file diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 39a71f85c5..742ed08cf4 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -271,17 +271,19 @@ if(GLOB.borers.len) - var/borerwin = FALSE var/borertext = "
The borers were:" for(var/mob/living/simple_animal/borer/B in GLOB.borers) if((B.key || B.controlling) && B.stat != DEAD) - borertext += "
[B.controlling ? B.victim.key : B.key] was [B.truename] (" - var/turf/location = get_turf(B) - if(location.z == ZLEVEL_CENTCOM && B.victim) - borertext += "escaped with host" - else - borertext += "failed" - borertext += ")" + borertext += "
[B.controlling ? B.victim.key : B.key] was [B.truename]" + var/count = 1 + for(var/datum/objective/objective in B.mind.objectives) + if(objective.check_completion()) + borertext += "
Objective #[count]: [objective.explanation_text] Success!" + else + borertext += "
Objective #[count]: [objective.explanation_text] Fail." + count++ + + to_chat(world, borertext) var/total_borers = 0 @@ -295,14 +297,8 @@ var/turf/location = get_turf(C) if(location.z == ZLEVEL_CENTCOM && D && D.stat != DEAD) total_borer_hosts++ - if(GLOB.total_borer_hosts_needed <= total_borer_hosts) - borerwin = TRUE to_chat(world, "There were [total_borers] borers alive at round end!") - to_chat(world, "A total of [total_borer_hosts] borers with hosts escaped on the shuttle alive. The borers needed [GLOB.total_borer_hosts_needed] hosts to escape.") - if(borerwin) - to_chat(world, "The borers were successful!") - else - to_chat(world, "The borers have failed!") + to_chat(world, "A total of [total_borer_hosts] borers with hosts escaped on the shuttle alive.") CHECK_TICK return 0 diff --git a/code/game/gamemodes/miniantags/borer/borer.dm b/code/game/gamemodes/miniantags/borer/borer.dm index 656dec9341..2b83017d1d 100644 --- a/code/game/gamemodes/miniantags/borer/borer.dm +++ b/code/game/gamemodes/miniantags/borer/borer.dm @@ -97,6 +97,9 @@ GLOBAL_VAR_INIT(total_borer_hosts_needed, 10) var/hiding = FALSE var/waketimerid = null + var/docile_chem = "sugar" + var/list/wakeup_objectives = list() //Used to store objectives until the borer wakes up + var/datum/action/innate/borer/talk_to_host/talk_to_host_action = new var/datum/action/innate/borer/infest_host/infest_host_action = new var/datum/action/innate/borer/toggle_hide/toggle_hide_action = new @@ -136,8 +139,7 @@ GLOBAL_VAR_INIT(total_borer_hosts_needed, 10) borer_chems += /datum/borer_chem/crocin borer_chems += /datum/borer_chem/camphor - if(is_team_borer) - GLOB.borers += src + GLOB.borers += src GrantBorerActions() @@ -285,12 +287,12 @@ GLOBAL_VAR_INIT(total_borer_hosts_needed, 10) if(stat != DEAD && victim.stat != DEAD) - if(victim.reagents.has_reagent("sugar")) + if(victim.reagents.has_reagent(docile_chem)) if(!docile || waketimerid) if(controlling) - to_chat(victim, "You feel the soporific flow of sugar in your host's blood, lulling you into docility.") + to_chat(victim, "You feel the soporific flow of [docile_chem] in your host's blood, lulling you into docility.") else - to_chat(src, "You feel the soporific flow of sugar in your host's blood, lulling you into docility.") + to_chat(src, "You feel the soporific flow of [docile_chem] in your host's blood, lulling you into docility.") if(waketimerid) deltimer(waketimerid) waketimerid = null @@ -298,9 +300,9 @@ GLOBAL_VAR_INIT(total_borer_hosts_needed, 10) else if(docile && !waketimerid) if(controlling) - to_chat(victim, "You start shaking off your lethargy as the sugar leaves your host's blood. This will take about 10 seconds...") + to_chat(victim, "You start shaking off your lethargy as the [docile_chem] leaves your host's blood. This will take about 10 seconds...") else - to_chat(src, "You start shaking off your lethargy as the sugar leaves your host's blood. This will take about 10 seconds...") + to_chat(src, "You start shaking off your lethargy as the [docile_chem] leaves your host's blood. This will take about 10 seconds...") waketimerid = addtimer(CALLBACK(src, "wakeup"), 10, TIMER_STOPPABLE) if(controlling) @@ -775,10 +777,13 @@ GLOBAL_VAR_INIT(total_borer_hosts_needed, 10) switch(punishment) //Hardcoding this stuff. if("Blindness") victim.blind_eyes(4) + to_chat(victim, "Your vision fades away suddenly, as your borer robs you of your sight.") if("Deafness") victim.minimumDeafTicks(40) + to_chat(victim, "Your hearing fades away suddenly, as your borer robs you of your hearing.") if("Stun") victim.Knockdown(100) + to_chat(victim, "You are wracked with unbearable pain, as your borer takes control of your pain-center!") log_game("[src]/([src.ckey]) punished [victim]/([victim.ckey] with [punishment]") @@ -825,7 +830,10 @@ GLOBAL_VAR_INIT(total_borer_hosts_needed, 10) new /obj/effect/decal/cleanable/vomit(get_turf(src)) playsound(loc, 'sound/effects/splat.ogg', 50, 1) - new /mob/living/simple_animal/borer(get_turf(src), B.generation + 1) + var/mob/living/simple_animal/borer/Baby = new /mob/living/simple_animal/borer(get_turf(src), B.generation + 1) + + Baby.wakeup_objectives = src.mind.objectives //Save them for later, since we lack a mind for them right now + log_game("[src]/([src.ckey]) has spawned a new borer via reproducing.") else to_chat(src, "You need 200 chemicals stored to reproduce.") @@ -843,15 +851,26 @@ GLOBAL_VAR_INIT(total_borer_hosts_needed, 10) candidate.mob = src ckey = candidate.ckey - if(mind) - mind.store_memory("You must escape with at least [GLOB.total_borer_hosts_needed] borers with hosts on the shuttle.") - SSticker.mode.update_borer_icons_added(mind) - to_chat(src, "You are a cortical borer!") to_chat(src, "You are a brain slug that worms its way into the head of its victim. Use stealth, persuasion and your powers of mind control to keep you, your host and your eventual spawn safe and warm.") - to_chat(src, "Sugar nullifies your abilities, avoid it at all costs!") + to_chat(src, "[docile_chem] nullifies your abilities, avoid it at all costs!") to_chat(src, "You can speak to your fellow borers by prefixing your messages with ';'. Check out your Borer tab to see your abilities.") - to_chat(src, "You must escape with at least [GLOB.total_borer_hosts_needed] borers with hosts on the shuttle. To reproduce you must have 100 chemicals and be controlling a host.") + + if(mind) + if(!(wakeup_objectives.len)) //No objectives, use default? + var/datum/objective/normal_borer/new_objective + new_objective = new /datum/objective/normal_borer + new_objective.owner = mind + new_objective.target_amount = GLOB.total_borer_hosts_needed + new_objective.explanation_text = "You must escape with at least [GLOB.total_borer_hosts_needed] borer[new_objective.target_amount > 1 ? "s" : ""] with host[new_objective.target_amount > 1 ? "s" : ""] on the shuttle." + mind.objectives += new_objective + to_chat(src, "Objective #1: [new_objective.explanation_text]") + else + mind.objectives += wakeup_objectives + var/count = 1 + for(var/datum/objective/O in mind.objectives) + to_chat(src, "Objective #[count]: [O.explanation_text]") + count++ /mob/living/simple_animal/borer/proc/detatch() if(!victim || !controlling)