Skip to content

Commit

Permalink
[MIRROR] Makes Bioware into Status Effects because they're just Statu…
Browse files Browse the repository at this point in the history
…s Effects but their own datum (#1597)

* Makes Bioware into Status Effects because they're just Status Effects but their own datum (#81989)

- Refactors `/datum/bioware` -> `/datum/status_effect/bioware`. 
- Literally everything bioware datum does is done by the status effect
API, including handing dupes / unique keys
- Tallies all blackbox surgeries done rather than just nerve splicing

* Makes Bioware into Status Effects because they're just Status Effects but their own datum

---------

Co-authored-by: MrMelbert <[email protected]>
  • Loading branch information
2 people authored and StealsThePRs committed Mar 23, 2024
1 parent 9aba8d1 commit e146fcb
Show file tree
Hide file tree
Showing 19 changed files with 215 additions and 229 deletions.
7 changes: 0 additions & 7 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,6 @@

#define BRAIN_DAMAGE_INTEGRITY_MULTIPLIER 0.5

//Surgery Defines
#define BIOWARE_GENERIC "generic"
#define BIOWARE_NERVES "nerves"
#define BIOWARE_CIRCULATION "circulation"
#define BIOWARE_LIGAMENTS "ligaments"
#define BIOWARE_CORTEX "cortex"

//Health hud screws for carbon mobs
#define SCREWYHUD_NONE 0
#define SCREWYHUD_CRIT 1
Expand Down
28 changes: 28 additions & 0 deletions code/datums/status_effects/buffs/bioware/_bioware.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* ## Bioware status effect
*
* Simple holder status effects that grants the owner mob basic buffs
*/
/datum/status_effect/bioware
id = "bioware"
alert_type = null
duration = -1
tick_interval = -1

/datum/status_effect/bioware/on_apply()
if(!ishuman(owner))
return FALSE

bioware_gained()
return TRUE

/datum/status_effect/bioware/on_remove()
bioware_lost()

/// Called when applying to the mob.
/datum/status_effect/bioware/proc/bioware_gained()
return

/// Called when removing from the mob.
/datum/status_effect/bioware/proc/bioware_lost()
return
23 changes: 23 additions & 0 deletions code/datums/status_effects/buffs/bioware/circulation.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Bioware that affects the heart / circulatory system
/datum/status_effect/bioware/heart
id = "circulation"

/// Muscled veins - Removes the need to have a heart
/datum/status_effect/bioware/heart/muscled_veins

/datum/status_effect/bioware/heart/muscled_veins/bioware_gained()
ADD_TRAIT(owner, TRAIT_STABLEHEART, TRAIT_STATUS_EFFECT(id))

/datum/status_effect/bioware/heart/muscled_veins/bioware_lost()
REMOVE_TRAIT(owner, TRAIT_STABLEHEART, TRAIT_STATUS_EFFECT(id))

/// Threaded veins - Bleed way less
/datum/status_effect/bioware/heart/threaded_veins

/datum/status_effect/bioware/heart/threaded_veins/bioware_gained()
var/mob/living/carbon/human/human_owner = owner
human_owner.physiology.bleed_mod *= 0.25

/datum/status_effect/bioware/heart/threaded_veins/bioware_lost()
var/mob/living/carbon/human/human_owner = owner
human_owner.physiology.bleed_mod *= 4
20 changes: 20 additions & 0 deletions code/datums/status_effects/buffs/bioware/cortex.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Bioware that affects the brain
/datum/status_effect/bioware/cortex
id = "cortex"

// Folded brain - Grants a bonus chance to getting special traumas via lobotomy
/datum/status_effect/bioware/cortex/folded

/datum/status_effect/bioware/cortex/folded/bioware_gained()
ADD_TRAIT(owner, TRAIT_SPECIAL_TRAUMA_BOOST, TRAIT_STATUS_EFFECT(id))

/datum/status_effect/bioware/cortex/folded/bioware_lost()
REMOVE_TRAIT(owner, TRAIT_SPECIAL_TRAUMA_BOOST, TRAIT_STATUS_EFFECT(id))

// Imprinted brain - Cures basic traumas continuously
/datum/status_effect/bioware/cortex/imprinted
tick_interval = 2 SECONDS

/datum/status_effect/bioware/cortex/imprinted/tick(seconds_between_ticks)
var/mob/living/carbon/human/human_owner = owner
human_owner.cure_trauma_type(resilience = TRAUMA_RESILIENCE_BASIC)
21 changes: 21 additions & 0 deletions code/datums/status_effects/buffs/bioware/ligaments.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Bioware that affects the player's limbs
/datum/status_effect/bioware/ligaments
id = "ligaments"

// Hooked ligaments - Easier to dismember, but easier to reattach
/datum/status_effect/bioware/ligaments/hooked

/datum/status_effect/bioware/ligaments/hooked/bioware_gained()
owner.add_traits(list(TRAIT_LIMBATTACHMENT, TRAIT_EASYDISMEMBER), TRAIT_STATUS_EFFECT(id))

/datum/status_effect/bioware/ligaments/hooked/bioware_lost()
owner.remove_traits(list(TRAIT_LIMBATTACHMENT, TRAIT_EASYDISMEMBER), TRAIT_STATUS_EFFECT(id))

// Reinforced ligaments - Easier to break, but cannot be dismembered
/datum/status_effect/bioware/ligaments/reinforced

/datum/status_effect/bioware/ligaments/reinforced/bioware_gained()
owner.add_traits(list(TRAIT_NODISMEMBER, TRAIT_EASILY_WOUNDED), TRAIT_STATUS_EFFECT(id))

/datum/status_effect/bioware/ligaments/reinforced/bioware_lost()
owner.remove_traits(list(TRAIT_NODISMEMBER, TRAIT_EASILY_WOUNDED), TRAIT_STATUS_EFFECT(id))
25 changes: 25 additions & 0 deletions code/datums/status_effects/buffs/bioware/nerves.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Bioware that affects the CNS
/datum/status_effect/bioware/nerves
id = "nerves"

// Grounded Nerves - Immunity to being zapped
/datum/status_effect/bioware/nerves/grounded

/datum/status_effect/bioware/nerves/grounded/bioware_gained()
ADD_TRAIT(owner, TRAIT_SHOCKIMMUNE, TRAIT_STATUS_EFFECT(id))

/datum/status_effect/bioware/nerves/grounded/bioware_lost()
REMOVE_TRAIT(owner, TRAIT_SHOCKIMMUNE, TRAIT_STATUS_EFFECT(id))

// Spliced Nerves - Reduced stun time and stamina damage taken
/datum/status_effect/bioware/nerves/spliced

/datum/status_effect/bioware/nerves/spliced/bioware_gained()
var/mob/living/carbon/human/human_owner = owner
human_owner.physiology.stun_mod *= 0.5
human_owner.physiology.stamina_mod *= 0.8

/datum/status_effect/bioware/nerves/spliced/bioware_lost()
var/mob/living/carbon/human/human_owner = owner
human_owner.physiology.stun_mod *= 2
human_owner.physiology.stamina_mod *= 1.25
2 changes: 0 additions & 2 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@

/mob/living/carbon/human/Destroy()
QDEL_NULL(physiology)
if(biowares)
QDEL_LAZYLIST(biowares)
GLOB.human_list -= src

if (mob_mood)
Expand Down
2 changes: 0 additions & 2 deletions code/modules/mob/living/carbon/human/human_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@

var/datum/physiology/physiology

var/list/datum/bioware/biowares

/// What types of mobs are allowed to ride/buckle to this mob
var/static/list/can_ride_typecache = typecacheof(list(
/mob/living/basic/parrot,
Expand Down
36 changes: 0 additions & 36 deletions code/modules/surgery/advanced/bioware/bioware.dm

This file was deleted.

24 changes: 20 additions & 4 deletions code/modules/surgery/advanced/bioware/bioware_surgery.dm
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
/datum/surgery/advanced/bioware
name = "Enhancement surgery"
var/bioware_target = BIOWARE_GENERIC
/// What status effect is gained when the surgery is successful?
/// Used to check against other bioware types to prevent stacking.
var/status_effect_gained = /datum/status_effect/bioware

/datum/surgery/advanced/bioware/can_start(mob/user, mob/living/carbon/human/target)
if(!..())
return FALSE
if(!istype(target))
return FALSE
for(var/datum/bioware/bioware as anything in target.biowares)
if(bioware.mod_type == bioware_target)
return FALSE
if(target.has_status_effect(status_effect_gained))
return FALSE
return TRUE

/datum/surgery_step/apply_bioware
accept_hand = TRUE
time = 12.5 SECONDS

/datum/surgery_step/apply_bioware/success(mob/user, mob/living/target, target_zone, obj/item/tool, datum/surgery/advanced/bioware/surgery, default_display_results)
. = ..()
if(!.)
return
if(!istype(surgery))
return

target.apply_status_effect(surgery.status_effect_gained)
if(target.ckey)
SSblackbox.record_feedback("tally", "bioware", 1, surgery.type)
33 changes: 10 additions & 23 deletions code/modules/surgery/advanced/bioware/cortex_folding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,22 @@
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/incise,
/datum/surgery_step/incise,
/datum/surgery_step/fold_cortex,
/datum/surgery_step/apply_bioware/fold_cortex,
/datum/surgery_step/close,
)

bioware_target = BIOWARE_CORTEX
status_effect_gained = /datum/status_effect/bioware/cortex/folded

/datum/surgery/advanced/bioware/cortex_folding/can_start(mob/user, mob/living/carbon/target)
var/obj/item/organ/internal/brain/target_brain = target.get_organ_slot(ORGAN_SLOT_BRAIN)
if(!target_brain)
return FALSE
return ..()

/datum/surgery_step/fold_cortex
/datum/surgery_step/apply_bioware/fold_cortex
name = "fold cortex (hand)"
accept_hand = TRUE
time = 125

/datum/surgery_step/fold_cortex/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
/datum/surgery_step/apply_bioware/fold_cortex/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(
user,
target,
Expand All @@ -35,7 +33,11 @@
)
display_pain(target, "Your head throbs with gruesome pain, it's nearly too much to handle!")

/datum/surgery_step/fold_cortex/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
/datum/surgery_step/apply_bioware/fold_cortex/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
. = ..()
if(!.)
return

display_results(
user,
target,
Expand All @@ -44,10 +46,8 @@
span_notice("[user] completes the surgery on [target]'s brain."),
)
display_pain(target, "Your brain feels stronger... more flexible!")
new /datum/bioware/cortex_fold(target)
return ..()

/datum/surgery_step/fold_cortex/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
/datum/surgery_step/apply_bioware/fold_cortex/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(target.get_organ_slot(ORGAN_SLOT_BRAIN))
display_results(
user,
Expand All @@ -62,16 +62,3 @@
else
user.visible_message(span_warning("[user] suddenly notices that the brain [user.p_they()] [user.p_were()] working on is not there anymore."), span_warning("You suddenly notice that the brain you were working on is not there anymore."))
return FALSE

/datum/bioware/cortex_fold
name = "Cortex Fold"
desc = "The cerebral cortex has been folded into a complex fractal pattern, and can support non-standard neural patterns."
mod_type = BIOWARE_CORTEX

/datum/bioware/cortex_fold/on_gain()
. = ..()
ADD_TRAIT(owner, TRAIT_SPECIAL_TRAUMA_BOOST, EXPERIMENTAL_SURGERY_TRAIT)

/datum/bioware/cortex_fold/on_lose()
REMOVE_TRAIT(owner, TRAIT_SPECIAL_TRAUMA_BOOST, EXPERIMENTAL_SURGERY_TRAIT)
return ..()
29 changes: 10 additions & 19 deletions code/modules/surgery/advanced/bioware/cortex_imprint.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,22 @@
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/incise,
/datum/surgery_step/incise,
/datum/surgery_step/imprint_cortex,
/datum/surgery_step/apply_bioware/imprint_cortex,
/datum/surgery_step/close,
)

bioware_target = BIOWARE_CORTEX
status_effect_gained = /datum/status_effect/bioware/cortex/imprinted

/datum/surgery/advanced/bioware/cortex_imprint/can_start(mob/user, mob/living/carbon/target)
var/obj/item/organ/internal/brain/target_brain = target.get_organ_slot(ORGAN_SLOT_BRAIN)
if(!target_brain)
return FALSE
return ..()

/datum/surgery_step/imprint_cortex
/datum/surgery_step/apply_bioware/imprint_cortex
name = "imprint cortex (hand)"
accept_hand = TRUE
time = 125

/datum/surgery_step/imprint_cortex/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
/datum/surgery_step/apply_bioware/imprint_cortex/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(
user,
target,
Expand All @@ -35,7 +33,11 @@
)
display_pain(target, "Your head throbs with gruesome pain, it's nearly too much to handle!")

/datum/surgery_step/imprint_cortex/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
/datum/surgery_step/apply_bioware/imprint_cortex/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
. = ..()
if(!.)
return

display_results(
user,
target,
Expand All @@ -44,10 +46,8 @@
span_notice("[user] completes the surgery on [target]'s brain."),
)
display_pain(target, "Your brain feels stronger... more resillient!")
new /datum/bioware/cortex_imprint(target)
return ..()

/datum/surgery_step/imprint_cortex/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
/datum/surgery_step/apply_bioware/imprint_cortex/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(target.get_organ_slot(ORGAN_SLOT_BRAIN))
display_results(
user,
Expand All @@ -62,12 +62,3 @@
else
user.visible_message(span_warning("[user] suddenly notices that the brain [user.p_they()] [user.p_were()] working on is not there anymore."), span_warning("You suddenly notice that the brain you were working on is not there anymore."))
return FALSE

/datum/bioware/cortex_imprint
name = "Cortex Imprint"
desc = "The cerebral cortex has been reshaped into a redundant neural pattern, making the brain able to bypass impediments caused by minor brain traumas."
mod_type = BIOWARE_CORTEX
can_process = TRUE

/datum/bioware/cortex_imprint/process()
owner.cure_trauma_type(resilience = TRAUMA_RESILIENCE_BASIC)
Loading

0 comments on commit e146fcb

Please sign in to comment.