Borer ability code fixes and improvements (#28917)

* oh god well I guess we're reworking this instead

* boring update

* more fixes

* Even more fixes

* woops

* there, last runtime fixed
This commit is contained in:
Waterpig
2024-07-20 21:38:10 +05:30
committed by GitHub
parent 89674b5d62
commit e95fcec1fc
8 changed files with 206 additions and 193 deletions
@@ -4,9 +4,10 @@
#define BLOOD_CHEM_OBJECTIVE 3
// Parent of all borer actions
/datum/action/cooldown/borer
/datum/action/cooldown/mob_cooldown/borer
button_icon = 'modular_skyrat/modules/cortical_borer/icons/actions.dmi'
cooldown_time = 0
shared_cooldown = NONE
/// How many chemicals this costs
var/chemical_cost = 0
/// How many chem evo points are needed to use this ability
@@ -14,7 +15,7 @@
/// How many stat evo points are needed to use this ability
var/stat_evo_points = 0
/datum/action/cooldown/borer/New(Target, original)
/datum/action/cooldown/mob_cooldown/borer/New(Target, original)
. = ..()
var/compiled_string = ""
if(chemical_cost)
@@ -25,7 +26,7 @@
compiled_string += " ([stat_evo_points] stat point[stat_evo_points == 1 ? "" : "s"])"
name = "[initial(name)][compiled_string]"
/datum/action/cooldown/borer/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/Trigger(trigger_flags, atom/target)
. = ..()
if(!iscorticalborer(owner))
to_chat(owner, span_warning("You must be a cortical borer to use this action!"))
@@ -46,11 +47,12 @@
return . == FALSE ? FALSE : TRUE //. can be null, true, or false. There's a difference between null and false here
//inject chemicals into your host
/datum/action/cooldown/borer/inject_chemical
/datum/action/cooldown/mob_cooldown/borer/inject_chemical
name = "Open Chemical Injector"
button_icon_state = "chemical"
click_to_activate = FALSE
/datum/action/cooldown/borer/inject_chemical/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/inject_chemical/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
@@ -63,13 +65,13 @@
return
ui_interact(owner)
/datum/action/cooldown/borer/inject_chemical/ui_interact(mob/user, datum/tgui/ui)
/datum/action/cooldown/mob_cooldown/borer/inject_chemical/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "BorerChem", name)
ui.open()
/datum/action/cooldown/borer/inject_chemical/ui_data(mob/user)
/datum/action/cooldown/mob_cooldown/borer/inject_chemical/ui_data(mob/user)
var/list/data = list()
var/mob/living/basic/cortical_borer/cortical_owner = owner
data["amount"] = cortical_owner.injection_rate_current
@@ -89,7 +91,7 @@
return data
/datum/action/cooldown/borer/inject_chemical/ui_act(action, params)
/datum/action/cooldown/mob_cooldown/borer/inject_chemical/ui_act(action, params)
. = ..()
if(.)
return
@@ -124,10 +126,10 @@
cortical_owner.human_host.log_message(logging_text, LOG_GAME)
. = TRUE
/datum/action/cooldown/borer/inject_chemical/ui_state(mob/user)
/datum/action/cooldown/mob_cooldown/borer/inject_chemical/ui_state(mob/user)
return GLOB.always_state
/datum/action/cooldown/borer/inject_chemical/ui_status(mob/user, datum/ui_state/state)
/datum/action/cooldown/mob_cooldown/borer/inject_chemical/ui_status(mob/user, datum/ui_state/state)
if(!iscorticalborer(user))
return UI_CLOSE
@@ -137,23 +139,24 @@
return UI_CLOSE
return ..()
/datum/action/cooldown/borer/evolution_tree
/datum/action/cooldown/mob_cooldown/borer/evolution_tree
name = "Open Evolution Tree"
button_icon_state = "newability"
click_to_activate = FALSE
/datum/action/cooldown/borer/evolution_tree/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/evolution_tree/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
ui_interact(owner)
/datum/action/cooldown/borer/evolution_tree/ui_interact(mob/user, datum/tgui/ui)
/datum/action/cooldown/mob_cooldown/borer/evolution_tree/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "BorerEvolution", name)
ui.open()
/datum/action/cooldown/borer/evolution_tree/ui_data(mob/user)
/datum/action/cooldown/mob_cooldown/borer/evolution_tree/ui_data(mob/user)
var/list/data = list()
var/static/list/path_to_color = list(
@@ -201,7 +204,7 @@
data["learnedEvolution"] += list(evo_data)
return data
/datum/action/cooldown/borer/evolution_tree/ui_act(action, params)
/datum/action/cooldown/mob_cooldown/borer/evolution_tree/ui_act(action, params)
. = ..()
if(.)
return
@@ -223,14 +226,15 @@
cortical_owner.stat_evolution -= initial(to_evolve_path.evo_cost)
return TRUE
/datum/action/cooldown/borer/evolution_tree/ui_state(mob/user)
/datum/action/cooldown/mob_cooldown/borer/evolution_tree/ui_state(mob/user)
return GLOB.always_state
/datum/action/cooldown/borer/learn_focus
/datum/action/cooldown/mob_cooldown/borer/learn_focus
name = "Learn Focus"
button_icon_state = "getfocus"
click_to_activate = FALSE
/datum/action/cooldown/borer/learn_focus/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/learn_focus/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
@@ -263,12 +267,13 @@
owner.balloon_alert(owner, "focus learned successfully")
StartCooldown()
/datum/action/cooldown/borer/learn_bloodchemical
/datum/action/cooldown/mob_cooldown/borer/learn_bloodchemical
name = "Learn Chemical from Blood"
button_icon_state = "bloodchem"
chemical_evo_points = 5
click_to_activate = FALSE
/datum/action/cooldown/borer/learn_bloodchemical/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/learn_bloodchemical/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
@@ -309,12 +314,13 @@
StartCooldown()
//become stronger by learning new chemicals
/datum/action/cooldown/borer/upgrade_chemical
/datum/action/cooldown/mob_cooldown/borer/upgrade_chemical
name = "Learn New Chemical"
button_icon_state = "bloodlevel"
chemical_evo_points = 1
click_to_activate = FALSE
/datum/action/cooldown/borer/upgrade_chemical/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/upgrade_chemical/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
@@ -344,12 +350,13 @@
StartCooldown()
//become stronger by affecting the stats
/datum/action/cooldown/borer/upgrade_stat
/datum/action/cooldown/mob_cooldown/borer/upgrade_stat
name = "Become Stronger"
button_icon_state = "level"
stat_evo_points = 1
click_to_activate = FALSE
/datum/action/cooldown/borer/upgrade_stat/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/upgrade_stat/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
@@ -375,11 +382,12 @@
StartCooldown()
//go between either hiding behind tables or behind mobs
/datum/action/cooldown/borer/toggle_hiding
/datum/action/cooldown/mob_cooldown/borer/toggle_hiding
name = "Toggle Hiding"
button_icon_state = "hide"
click_to_activate = FALSE
/datum/action/cooldown/borer/toggle_hiding/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/toggle_hiding/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
@@ -396,12 +404,12 @@
StartCooldown()
//to paralyze people
/datum/action/cooldown/borer/fear_human
/datum/action/cooldown/mob_cooldown/borer/fear_human
name = "Incite Fear"
cooldown_time = 12 SECONDS
button_icon_state = "fear"
/datum/action/cooldown/borer/fear_human/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/fear_human/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
@@ -435,7 +443,7 @@
incite_fear(choose_fear)
StartCooldown()
/datum/action/cooldown/borer/fear_human/proc/incite_fear(mob/living/carbon/human/singular_fear)
/datum/action/cooldown/mob_cooldown/borer/fear_human/proc/incite_fear(mob/living/carbon/human/singular_fear)
var/mob/living/basic/cortical_borer/cortical_owner = owner
to_chat(singular_fear, span_warning("Something glares menacingly at you!"))
singular_fear.Paralyze(7 SECONDS)
@@ -446,7 +454,7 @@
cortical_owner.log_message(logging_text, LOG_GAME)
singular_fear.log_message(logging_text, LOG_GAME)
/datum/action/cooldown/borer/fear_human/proc/incite_internal_fear()
/datum/action/cooldown/mob_cooldown/borer/fear_human/proc/incite_internal_fear()
var/mob/living/basic/cortical_borer/cortical_owner = owner
owner.balloon_alert(owner, "fear incited into host")
cortical_owner.human_host.Paralyze(10 SECONDS)
@@ -459,12 +467,13 @@
cortical_owner.human_host.log_message(logging_text, LOG_GAME)
//to check the health of the human
/datum/action/cooldown/borer/check_blood
/datum/action/cooldown/mob_cooldown/borer/check_blood
name = "Check Blood"
cooldown_time = 5 SECONDS
button_icon_state = "blood"
click_to_activate = FALSE
/datum/action/cooldown/borer/check_blood/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/check_blood/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
@@ -479,121 +488,14 @@
chemscan(owner, cortical_owner.human_host)
StartCooldown()
//to either get inside, or out, of a host
/datum/action/cooldown/borer/choosing_host
name = "Inhabit/Uninhabit Host"
cooldown_time = 10 SECONDS
button_icon_state = "host"
/datum/action/cooldown/borer/choosing_host/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
var/mob/living/basic/cortical_borer/cortical_owner = owner
//having a host means we need to leave them then
if(cortical_owner.human_host)
if(cortical_owner.host_sugar())
owner.balloon_alert(owner, "cannot function with sugar in host")
return
owner.balloon_alert(owner, "detached from host")
if(!(cortical_owner.upgrade_flags & BORER_STEALTH_MODE))
to_chat(cortical_owner.human_host, span_notice("Something carefully tickles your inner ear..."))
var/obj/item/organ/internal/borer_body/borer_organ = locate() in cortical_owner.human_host.organs
//log the interaction
var/turf/human_turfone = get_turf(cortical_owner.human_host)
var/logging_text = "[key_name(cortical_owner)] left [key_name(cortical_owner.human_host)] at [loc_name(human_turfone)]"
cortical_owner.log_message(logging_text, LOG_GAME)
cortical_owner.human_host.log_message(logging_text, LOG_GAME)
if(borer_organ)
borer_organ.Remove(cortical_owner.human_host)
cortical_owner.forceMove(human_turfone)
cortical_owner.human_host = null
REMOVE_TRAIT(cortical_owner, TRAIT_WEATHER_IMMUNE, "borer_in_host")
StartCooldown()
return
//we dont have a host so lets inhabit one
var/list/usable_hosts = list()
for(var/mob/living/carbon/human/listed_human in range(1, cortical_owner))
// no non-human hosts
if(!ishuman(listed_human) || ismonkey(listed_human))
continue
// cannot have multiple borers (for now)
if(listed_human.has_borer())
continue
// hosts need to be organic
if(!(listed_human.dna.species.inherent_biotypes & MOB_ORGANIC) && cortical_owner.organic_restricted)
continue
// hosts need to be organic
if(!(listed_human.mob_biotypes & MOB_ORGANIC) && cortical_owner.organic_restricted)
continue
//hosts cannot be changelings
if(IS_CHANGELING(listed_human) && cortical_owner.changeling_restricted)
continue
usable_hosts += listed_human
//if the list of possible hosts is one, just go straight in, no choosing
if(length(usable_hosts) == 1)
enter_host(usable_hosts[1])
return
//if the list of possible host is more than one, allow choosing a host
var/choose_host = tgui_input_list(cortical_owner, "Choose your host!", "Host Choice", usable_hosts)
if(!choose_host)
owner.balloon_alert(owner, "no target selected")
return
enter_host(choose_host)
/datum/action/cooldown/borer/choosing_host/proc/enter_host(mob/living/carbon/human/singular_host)
var/mob/living/basic/cortical_borer/cortical_owner = owner
if(check_for_bio_protection(singular_host))
owner.balloon_alert(owner, "target head too protected!")
return
if(singular_host.has_borer())
owner.balloon_alert(owner, "target already occupied")
return
if(!do_after(cortical_owner, (((cortical_owner.upgrade_flags & BORER_FAST_BORING) && !(cortical_owner.upgrade_flags & BORER_HIDING)) ? 3 SECONDS : 6 SECONDS), target = singular_host))
owner.balloon_alert(owner, "you and target must be still")
return
if(get_dist(singular_host, cortical_owner) > 1)
owner.balloon_alert(owner, "target too far away")
return
cortical_owner.human_host = singular_host
cortical_owner.forceMove(cortical_owner.human_host)
if(!(cortical_owner.upgrade_flags & BORER_STEALTH_MODE))
to_chat(cortical_owner.human_host, span_notice("A chilling sensation goes down your spine..."))
cortical_owner.copy_languages(cortical_owner.human_host)
var/obj/item/organ/internal/borer_body/borer_organ = new(cortical_owner.human_host)
borer_organ.borer = owner
borer_organ.Insert(cortical_owner.human_host)
var/turf/human_turftwo = get_turf(cortical_owner.human_host)
var/logging_text = "[key_name(cortical_owner)] went into [key_name(cortical_owner.human_host)] at [loc_name(human_turftwo)]"
cortical_owner.log_message(logging_text, LOG_GAME)
cortical_owner.human_host.log_message(logging_text, LOG_GAME)
ADD_TRAIT(cortical_owner, TRAIT_WEATHER_IMMUNE, "borer_in_host")
StartCooldown()
/// Checks if the target's head is bio protected, returns true if this is the case
/datum/action/cooldown/borer/choosing_host/proc/check_for_bio_protection(mob/living/carbon/human/target)
if(isobj(target.head))
if(target.head.get_armor_rating(BIO) >= 100)
return TRUE
if(isobj(target.wear_mask))
if(target.wear_mask.get_armor_rating(BIO) >= 100)
return TRUE
if(isobj(target.wear_neck))
if(target.wear_neck.get_armor_rating(BIO) >= 100)
return TRUE
return FALSE
//you can force your host to speak... dont abuse this
/datum/action/cooldown/borer/force_speak
/datum/action/cooldown/mob_cooldown/borer/force_speak
name = "Force Host Speak"
cooldown_time = 30 SECONDS
button_icon_state = "speak"
click_to_activate = FALSE
/datum/action/cooldown/borer/force_speak/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/force_speak/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
@@ -622,13 +524,14 @@
StartCooldown()
//we need a way to produce offspring
/datum/action/cooldown/borer/produce_offspring
/datum/action/cooldown/mob_cooldown/borer/produce_offspring
name = "Produce Offspring"
cooldown_time = 1 MINUTES
button_icon_state = "reproduce"
chemical_cost = 100
click_to_activate = FALSE
/datum/action/cooldown/borer/produce_offspring/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/produce_offspring/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
@@ -665,7 +568,7 @@
owner.balloon_alert(owner, "egg laid")
StartCooldown()
/datum/action/cooldown/borer/produce_offspring/proc/no_host_egg()
/datum/action/cooldown/mob_cooldown/borer/produce_offspring/proc/no_host_egg()
var/mob/living/basic/cortical_borer/cortical_owner = owner
cortical_owner.health = max(cortical_owner.health, 1, cortical_owner.health -= OUT_OF_HOST_EGG_COST)
produce_egg()
@@ -676,7 +579,7 @@
cortical_owner.log_message(logging_text, LOG_GAME)
owner.balloon_alert(owner, "egg laid")
/datum/action/cooldown/borer/produce_offspring/proc/produce_egg()
/datum/action/cooldown/mob_cooldown/borer/produce_offspring/proc/produce_egg()
var/mob/living/basic/cortical_borer/cortical_owner = owner
var/turf/borer_turf = get_turf(cortical_owner)
var/obj/effect/mob_spawn/ghost_role/borer_egg/spawned_egg = new /obj/effect/mob_spawn/ghost_role/borer_egg(borer_turf)
@@ -686,13 +589,14 @@
GLOB.successful_egg_number += 1
//revive your host
/datum/action/cooldown/borer/revive_host
/datum/action/cooldown/mob_cooldown/borer/revive_host
name = "Revive Host"
cooldown_time = 2 MINUTES
button_icon_state = "revive"
chemical_cost = 200
click_to_activate = FALSE
/datum/action/cooldown/borer/revive_host/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/revive_host/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
@@ -726,13 +630,14 @@
StartCooldown()
//to ask if a host is willing
/datum/action/cooldown/borer/willing_host
/datum/action/cooldown/mob_cooldown/borer/willing_host
name = "Willing Host"
cooldown_time = 2 MINUTES
button_icon_state = "willing"
chemical_cost = 150
click_to_activate = FALSE
/datum/action/cooldown/borer/willing_host/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/willing_host/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
@@ -759,13 +664,14 @@
GLOB.willing_hosts += cortical_owner.human_host.ckey
StartCooldown()
/datum/action/cooldown/borer/stealth_mode
/datum/action/cooldown/mob_cooldown/borer/stealth_mode
name = "Stealth Mode"
cooldown_time = 2 MINUTES
button_icon_state = "hiding"
chemical_cost = 100
click_to_activate = FALSE
/datum/action/cooldown/borer/stealth_mode/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/stealth_mode/Trigger(trigger_flags, atom/target)
var/mob/living/basic/cortical_borer/cortical_owner = owner
var/in_stealth = (cortical_owner.upgrade_flags & BORER_STEALTH_MODE)
if(in_stealth)
@@ -788,13 +694,14 @@
StartCooldown()
/datum/action/cooldown/borer/empowered_offspring
/datum/action/cooldown/mob_cooldown/borer/empowered_offspring
name = "Produce Empowered Offspring"
cooldown_time = 1 MINUTES
button_icon_state = "reproduce"
chemical_cost = 150
click_to_activate = FALSE
/datum/action/cooldown/borer/empowered_offspring/Trigger(trigger_flags, atom/target)
/datum/action/cooldown/mob_cooldown/borer/empowered_offspring/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
@@ -0,0 +1,31 @@
//to either get inside, or out, of a host
/datum/action/cooldown/mob_cooldown/borer/choosing_host
name = "Inhabit/Uninhabit Host"
cooldown_time = 10 SECONDS
button_icon_state = "host"
click_to_activate = TRUE
/datum/action/cooldown/mob_cooldown/borer/choosing_host/Activate(atom/target)
if(get_dist(owner, target) > 1)
owner.balloon_alert(owner, "too far")
return
if(!ishuman(target))
owner.balloon_alert(owner, "not human")
return
var/mob/living/basic/cortical_borer/cortical_owner = owner
if(!cortical_owner.try_enter_host(target))
return
. = ..()
return TRUE
/datum/action/cooldown/mob_cooldown/borer/choosing_host/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
return FALSE
// Check if we already have a human_host
var/mob/living/basic/cortical_borer/cortical_owner = owner
if(!cortical_owner.human_host)
return
if(cortical_owner.try_leave_host())
StartCooldown()
return .
@@ -31,13 +31,6 @@ GLOBAL_LIST_EMPTY(cortical_borers)
return check_content
return FALSE
//so if a person is debrained, the borer is removed
/obj/item/organ/internal/brain/Remove(mob/living/carbon/target, special = 0, movement_flags)
. = ..()
var/mob/living/basic/cortical_borer/cb_inside = target.has_borer()
if(cb_inside)
cb_inside.leave_host()
//borers also create an organ, so you dont need to debrain someone
/obj/item/organ/internal/borer_body
name = "engorged cortical borer"
@@ -50,14 +43,14 @@ GLOBAL_LIST_EMPTY(cortical_borers)
borer = null
return ..()
/obj/item/organ/internal/borer_body/Insert(mob/living/carbon/carbon_target, special, movement_flags)
/obj/item/organ/internal/borer_body/on_mob_insert(mob/living/carbon/carbon_target, special, movement_flags)
. = ..()
for(var/datum/borer_focus/body_focus as anything in borer.body_focuses)
body_focus.on_add()
carbon_target.apply_status_effect(/datum/status_effect/grouped/screwy_hud/fake_healthy, type)
//on removal, force the borer out
/obj/item/organ/internal/borer_body/Remove(mob/living/carbon/carbon_target, special)
/obj/item/organ/internal/borer_body/on_mob_remove(mob/living/carbon/carbon_target, special)
. = ..()
var/mob/living/basic/cortical_borer/cb_inside = carbon_target.has_borer()
for(var/datum/borer_focus/body_focus as anything in cb_inside.body_focuses)
@@ -141,19 +134,21 @@ GLOBAL_LIST_EMPTY(cortical_borers)
/// How many times you've levelled up over all
var/level = 0
///the list of actions that the borer has
var/list/known_abilities = list(/datum/action/cooldown/borer/toggle_hiding,
/datum/action/cooldown/borer/choosing_host,
/datum/action/cooldown/borer/evolution_tree,
/datum/action/cooldown/borer/inject_chemical,
/datum/action/cooldown/borer/upgrade_chemical,
/datum/action/cooldown/borer/learn_focus,
/datum/action/cooldown/borer/upgrade_stat,
/datum/action/cooldown/borer/force_speak,
/datum/action/cooldown/borer/fear_human,
/datum/action/cooldown/borer/check_blood,
var/list/known_abilities = list(/datum/action/cooldown/mob_cooldown/borer/toggle_hiding,
/datum/action/cooldown/mob_cooldown/borer/choosing_host,
/datum/action/cooldown/mob_cooldown/borer/evolution_tree,
/datum/action/cooldown/mob_cooldown/borer/inject_chemical,
/datum/action/cooldown/mob_cooldown/borer/upgrade_chemical,
/datum/action/cooldown/mob_cooldown/borer/learn_focus,
/datum/action/cooldown/mob_cooldown/borer/upgrade_stat,
/datum/action/cooldown/mob_cooldown/borer/force_speak,
/datum/action/cooldown/mob_cooldown/borer/fear_human,
/datum/action/cooldown/mob_cooldown/borer/check_blood,
)
///the host
/// The human we are hosted in
var/mob/living/carbon/human/human_host
/// The brain we are currently hooked to
var/obj/item/organ/internal/brain/brain_host
//what the host gains or loses with the borer
var/list/hosts_abilities = list()
//just a little "timer" to compare to world.time
@@ -245,7 +240,8 @@ GLOBAL_LIST_EMPTY(cortical_borers)
do_evolution(/datum/borer_evolution/base)
/mob/living/basic/cortical_borer/Destroy()
human_host = null
if(human_host)
leave_host_clean()
GLOB.cortical_borers -= src
QDEL_NULL(reagent_holder)
return ..()
@@ -364,17 +360,6 @@ GLOBAL_LIST_EMPTY(cortical_borers)
else // this is a hot place
adjust_bodytemperature(min(min(temp_delta / BODYTEMP_DIVISOR, BODYTEMP_HEATING_MAX) * seconds_per_tick, temp_delta))
//leave the host, forced or not
/mob/living/basic/cortical_borer/proc/leave_host()
if(!human_host)
return
var/obj/item/organ/internal/borer_body/borer_organ = locate() in human_host.organs
if(borer_organ)
borer_organ.Remove(human_host)
var/turf/human_turf = get_turf(human_host)
forceMove(human_turf)
human_host = null
//borers shouldnt be able to whisper...
/mob/living/basic/cortical_borer/whisper(message, bubble_type, list/spans = list(), sanitize = TRUE, datum/language/language, ignore_spam = FALSE, forced, filterproof)
to_chat(src, span_warning("You are not able to whisper!"))
@@ -0,0 +1,88 @@
/// Checks if the target's head is bio protected, returns true if this is the case
/mob/living/basic/cortical_borer/proc/check_for_target_bio_protection(mob/living/carbon/human/target)
if(isobj(target.head))
if(target.head.get_armor_rating(BIO) >= 100)
return TRUE
if(isobj(target.wear_mask))
if(target.wear_mask.get_armor_rating(BIO) >= 100)
return TRUE
if(isobj(target.wear_neck))
if(target.wear_neck.get_armor_rating(BIO) >= 100)
return TRUE
return FALSE
/mob/living/basic/cortical_borer/proc/try_enter_host(mob/living/carbon/human/victim)
if(check_for_target_bio_protection(victim))
balloon_alert(src, "head too protected!")
return FALSE
if(victim.has_borer())
balloon_alert(src, "already occupied")
return FALSE
if(!do_after(src, (((upgrade_flags & BORER_FAST_BORING) && !(upgrade_flags & BORER_HIDING)) ? 3 SECONDS : 6 SECONDS), target = victim))
balloon_alert(src, "keep still")
return FALSE
if(get_dist(victim, src) > 1)
balloon_alert(src, "too far")
return FALSE
var/obj/item/organ/internal/brain/brain = victim.get_organ_slot(ORGAN_SLOT_BRAIN)
if(!istype(brain))
balloon_alert(src, "no brain")
return FALSE
return enter_host(victim, brain)
/mob/living/basic/cortical_borer/proc/enter_host(mob/living/carbon/human/victim, obj/item/organ/internal/brain/brain)
human_host = victim
forceMove(human_host)
if(!(upgrade_flags & BORER_STEALTH_MODE))
to_chat(human_host, span_notice("A chilling sensation goes down your spine..."))
copy_languages(human_host)
var/obj/item/organ/internal/borer_body/borer_organ = new()
borer_organ.borer = src
borer_organ.Insert(human_host)
log_message("[key_name(src)] went into [key_name(human_host)] at [loc_name(get_turf(human_host))]", LOG_GAME)
ADD_TRAIT(src, TRAIT_WEATHER_IMMUNE, "borer_in_host")
RegisterSignal(brain, COMSIG_ORGAN_REMOVED, PROC_REF(on_brain_removed))
brain_host = brain
return TRUE
/mob/living/basic/cortical_borer/proc/try_leave_host()
if(host_sugar())
balloon_alert(src, "cannot function with sugar in host")
return TRUE // We force a cooldown over sugar
balloon_alert(src, "left host")
if(!(upgrade_flags & BORER_STEALTH_MODE))
to_chat(human_host, span_notice("Something carefully tickles your inner ear..."))
return leave_host()
/mob/living/basic/cortical_borer/proc/leave_host()
var/turf/dropoff_turf = get_turf(human_host)
log_message("[key_name(src)] left [key_name(human_host)] at [loc_name(dropoff_turf)]", LOG_GAME)
leave_host_clean()
forceMove(dropoff_turf)
REMOVE_TRAIT(src, TRAIT_WEATHER_IMMUNE, "borer_in_host")
return TRUE
///This is the version for correctly cleaning up the borer when qdeling/moving out. Don't call this directly
/mob/living/basic/cortical_borer/proc/leave_host_clean()
var/obj/item/organ/internal/borer_body/borer_organ = locate() in human_host.organs
if(borer_organ)
borer_organ.Remove(human_host)
if(brain_host)
UnregisterSignal(brain_host, COMSIG_ORGAN_REMOVED)
human_host = null
brain_host = null
///If a person is debrained, the borer is removed with this
/mob/living/basic/cortical_borer/proc/on_brain_removed(atom/source, mob/living/carbon/target)
SIGNAL_HANDLER
leave_host()
@@ -107,5 +107,5 @@
/datum/borer_evolution/diveworm/empowered_offspring/on_evolve(mob/living/basic/cortical_borer/cortical_owner)
. = ..()
var/datum/action/cooldown/borer/empowered_offspring/attack_action = new(cortical_owner)
var/datum/action/cooldown/mob_cooldown/borer/empowered_offspring/attack_action = new(cortical_owner)
attack_action.Grant(cortical_owner)
@@ -12,7 +12,7 @@
/datum/borer_evolution/hivelord/produce_offspring/on_evolve(mob/living/basic/cortical_borer/cortical_owner)
. = ..()
var/datum/action/cooldown/borer/produce_offspring/attack_action = new(cortical_owner)
var/datum/action/cooldown/mob_cooldown/borer/produce_offspring/attack_action = new(cortical_owner)
attack_action.Grant(cortical_owner)
// T2
@@ -25,7 +25,7 @@
/datum/borer_evolution/hivelord/blood_chemical/on_evolve(mob/living/basic/cortical_borer/cortical_owner)
. = ..()
var/datum/action/cooldown/borer/learn_bloodchemical/attack_action = new(cortical_owner)
var/datum/action/cooldown/mob_cooldown/borer/learn_bloodchemical/attack_action = new(cortical_owner)
attack_action.Grant(cortical_owner)
// T3
@@ -51,7 +51,7 @@
/datum/borer_evolution/hivelord/stealth_mode/on_evolve(mob/living/basic/cortical_borer/cortical_owner)
. = ..()
var/datum/action/cooldown/borer/stealth_mode/attack_action = new(cortical_owner)
var/datum/action/cooldown/mob_cooldown/borer/stealth_mode/attack_action = new(cortical_owner)
attack_action.Grant(cortical_owner)
// T5
@@ -12,7 +12,7 @@
/datum/borer_evolution/symbiote/willing_host/on_evolve(mob/living/basic/cortical_borer/cortical_owner)
. = ..()
var/datum/action/cooldown/borer/willing_host/attack_action = new(cortical_owner)
var/datum/action/cooldown/mob_cooldown/borer/willing_host/attack_action = new(cortical_owner)
attack_action.Grant(cortical_owner)
// T2
@@ -107,6 +107,6 @@
/datum/borer_evolution/symbiote/revive_host/on_evolve(mob/living/basic/cortical_borer/cortical_owner)
. = ..()
var/datum/action/cooldown/borer/revive_host/attack_action = new(cortical_owner)
var/datum/action/cooldown/mob_cooldown/borer/revive_host/attack_action = new(cortical_owner)
attack_action.Grant(cortical_owner)
+3 -1
View File
@@ -7279,13 +7279,15 @@
#include "modular_skyrat\modules\contractor\code\objects\supplypod.dm"
#include "modular_skyrat\modules\conveyor_sorter\code\conveyor_sorter.dm"
#include "modular_skyrat\modules\cortical_borer\code\cortical_borer.dm"
#include "modular_skyrat\modules\cortical_borer\code\cortical_borer_abilities.dm"
#include "modular_skyrat\modules\cortical_borer\code\cortical_borer_antag.dm"
#include "modular_skyrat\modules\cortical_borer\code\cortical_borer_chems.dm"
#include "modular_skyrat\modules\cortical_borer\code\cortical_borer_egg.dm"
#include "modular_skyrat\modules\cortical_borer\code\cortical_borer_items.dm"
#include "modular_skyrat\modules\cortical_borer\code\cortical_borer_movement.dm"
#include "modular_skyrat\modules\cortical_borer\code\focus_datum.dm"
#include "modular_skyrat\modules\cortical_borer\code\status_effects.dm"
#include "modular_skyrat\modules\cortical_borer\code\abilities\_borer_abilities.dm"
#include "modular_skyrat\modules\cortical_borer\code\abilities\host_movement.dm"
#include "modular_skyrat\modules\cortical_borer\code\evolution\borer_evolution.dm"
#include "modular_skyrat\modules\cortical_borer\code\evolution\evolution_datum.dm"
#include "modular_skyrat\modules\cortical_borer\code\evolution\evolution_diveworm.dm"