Files
Bubberstation/code/modules/surgery/operations/operation_replace_limb.dm
SmArtKar a4f0dcb76f Adds flaying, human butchering and limb surgeries (#94612)
## About The Pull Request

Merry Christmas!

This PR expands on the more gruesome areas of chef content, such as
cannibalism.
Human limbs can now be individually butchered for their meat and skin
with a knife or another butchering implement once the skin has been cut
and retracted (forks now can be used as bootleg retractors). If the limb
contains organs, those will need to be removed first, which also can be
quickly performed with a butchering tool at the cost of damaging the
inhards (head and chest will require the bone to be cut first, which can
be done with a butcher's cleaver if you don't have a saw)
You can also butcher humans whole by right clicking them with a
butchering implement on combat mode, which will attempt to gut/cut apart
the selected limb. Obviously this requires the limb to be prepped first,
so meat hooks/kitchenspikes now allow mobs strung on them to be operated
on without needing drapes. Its a pretty bad spot to be performing
surgeries at though, so beware! Torsos can only be butchered after all
other limbs have been. The gutting/butchering delay is based off the
owner's stat, halving if the limb is detached and doubling if the owner
is still alive and kicking.

<img width="392" height="265" alt="dreamseeker_D7QWbWKStd"
src="https://github.com/user-attachments/assets/050d7c25-3572-4b02-ae93-d8efefe54885"
/>

(The video is too large for github)
https://streamable.com/459a0y

After being butchered, most limbs will leave behind a nonfunctional
skeletal limb (with exceptions like jelly limbs with no skeleton inside)
which is always disabled. Skeleton chests husk their owner, so you'll
need to replace it first.
Gibbers now source their meat from the victim's limbs (and not their
species) at an RNG-based percentage based on the matter bin's tier.

As to allow individual limbs to be butchered, you can now perform (some)
surgeries on individual limbs. There are some obvious restrictions like
zombification or bioware surgeries, but most of the ones that make sense
can be performed on someone's chopped off head as long as you've got the
tools.
Wounds also contribute to surgeries now, major slash wounds count as
cut/open skin (and sealing the vessels would reduce their bleed rate),
and critical blunt wounds count as sawed bones.

I've refactored gibbers, butchering and meat spike code as well as fixed
some backend bugs while I was at it.

## Why It's Good For The Game

While rather gruesome, I feel like the freedom which these mechanics
provide fits us pretty well. We already have plenty of nasty stuff and
this doesn't really go that much further, and a chef serving their own
leg in their dish is pretty funny. (Also you can scrape plasma off
plasmamen bones)
2025-12-31 12:55:39 -06:00

99 lines
4.0 KiB
Plaintext

/datum/surgery_operation/limb/replace_limb
name = "augment limb"
rnd_name = "Augmentation"
desc = "Replace a patient's limb with a robotic or prosthetic one."
operation_flags = OPERATION_NOTABLE
implements = list(
/obj/item/bodypart = 1,
)
time = 3.2 SECONDS
all_surgery_states_required = SURGERY_SKIN_OPEN
/// Radial slice datums for every augment type
VAR_PRIVATE/list/cached_augment_options
/datum/surgery_operation/limb/replace_limb/get_recommended_tool()
return "cybernetic limb"
/datum/surgery_operation/limb/replace_limb/get_default_radial_image()
return image(/obj/item/bodypart/chest/robot)
/datum/surgery_operation/limb/replace_limb/get_radial_options(obj/item/bodypart/limb, obj/item/tool, operating_zone)
var/datum/radial_menu_choice/option = LAZYACCESS(cached_augment_options, tool.type)
if(!option)
option = new()
option.name = "augment with [initial(tool.name)]"
option.info = "Replace the patient's [initial(limb.name)] with [initial(tool.name)]."
option.image = image(tool.type)
LAZYSET(cached_augment_options, tool.type, option)
return option
/datum/surgery_operation/limb/replace_limb/snowflake_check_availability(obj/item/bodypart/limb, mob/living/surgeon, obj/item/bodypart/tool, operated_zone)
if(!surgeon.canUnEquip(tool))
return FALSE
if(limb.body_zone != tool.body_zone)
return FALSE
if(!tool.can_attach_limb(limb.owner))
return FALSE
return TRUE
/datum/surgery_operation/limb/replace_limb/state_check(obj/item/bodypart/limb)
return !HAS_TRAIT(limb.owner, TRAIT_NO_AUGMENTS) && !(limb.bodypart_flags & BODYPART_UNREMOVABLE)
/datum/surgery_operation/limb/replace_limb/tool_check(obj/item/bodypart/tool)
if(tool.item_flags & (ABSTRACT|DROPDEL|HAND_ITEM))
return FALSE
if(!isbodypart(tool))
return FALSE
var/obj/item/bodypart/limb = tool
if(!IS_ROBOTIC_LIMB(limb))
return FALSE
return TRUE
/datum/surgery_operation/limb/replace_limb/pre_preop(atom/movable/operating_on, mob/living/surgeon, obj/item/bodypart/tool, list/operation_args)
if(!length(tool.contents))
return TRUE
// Prevents quickly filling someone with high-tier organs by augmenting them with a pre-stuffed limb
to_chat(surgeon, span_warning("[tool] needs to be empty in order to be attached!"))
return FALSE
/datum/surgery_operation/limb/replace_limb/on_preop(obj/item/bodypart/limb, mob/living/surgeon, obj/item/bodypart/tool, list/operation_args)
// purposefully doesn't use plaintext zone for more context on what is being replaced with what
display_results(
surgeon,
limb.owner,
span_notice("You begin to augment [limb.owner]'s [limb.name] with [tool]..."),
span_notice("[surgeon] begins to augment [limb.owner]'s [limb.name] with [tool]."),
span_notice("[surgeon] begins to augment [limb.owner]'s [limb.name]."),
)
display_pain(limb.owner, "You feel a horrible pain in your [limb.plaintext_zone]!")
/datum/surgery_operation/limb/replace_limb/on_success(obj/item/bodypart/limb, mob/living/surgeon, obj/item/bodypart/tool, list/operation_args)
if(!surgeon.temporarilyRemoveItemFromInventory(tool))
return // should never happen
var/mob/living/patient = limb.owner // owner's about to be nulled
if(!tool.replace_limb(patient))
display_results(
surgeon,
patient,
span_warning("You can't seem to fit [tool] onto [patient]'s body!"),
span_warning("[surgeon] can't seem to fit [tool] onto [patient]'s body!"),
span_warning("[surgeon] can't seem to fit [tool] onto [patient]'s body!"),
)
tool.forceMove(patient.drop_location())
return // could possibly happen
if(tool.check_for_frankenstein(patient))
tool.bodypart_flags |= BODYPART_IMPLANTED
display_results(
surgeon,
patient,
span_notice("You successfully augment [patient]'s [limb.plaintext_zone] with [tool]!"),
span_notice("[surgeon] successfully augments [patient]'s [limb.plaintext_zone] with [tool]!"),
span_notice("[surgeon] finishes augmenting [patient]'s [limb.plaintext_zone]."),
)
display_pain(patient, "Your [limb.plaintext_zone] comes awash with synthetic sensation!", TRUE)
log_combat(surgeon, patient, "augmented", addition = "by giving him new [tool]")