Skip to content

Commit

Permalink
Changes to bone repairing (#5280)
Browse files Browse the repository at this point in the history
# About the pull request

Bone glue is limited, with 5% glue used per repair
Repairing bones with a screwdriver costs 2 metal sheets per repair
Adds a machine to the USS Almayer that allows you to refill bone glue

# Explain why it's good for the game

By limiting bone glue, you will limit the amount of surgery that happens
groundside without sacrificing other resources that have important use,
or by having additional supplies delivered.
If there is a limit to how much surgery can be done, it will force the
groundside surgeon to prioritize and consider the severity of the
injuries, instead of fully repairing every bone.
This will increase the consequences from getting injured and having
broken bones, by requiring you to either work with the downside via
splints, or to return shipside.
There should be no changes to shipside surgery, as the machine should be
close enough to replenish without having any problems.

# Changelog

:cl:
balance: Repairing bones with bone glue costs a portion of the bone
glue's resources
balance: Repairing bones with a screwdriver costs metal
del: Removed bone glue from the medilathe
spellcheck: New description for bone glue
/:cl:
  • Loading branch information
BeagleGaming1 committed Jan 23, 2024
1 parent 4f5713d commit c7b4d6b
Show file tree
Hide file tree
Showing 9 changed files with 544 additions and 283 deletions.
4 changes: 0 additions & 4 deletions code/game/machinery/autolathe_datums.dm
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,6 @@
name = "bonesetter"
path = /obj/item/tool/surgery/bonesetter

/datum/autolathe/recipe/medilathe/bonegel
name = "bone gel"
path = /obj/item/tool/surgery/bonegel

/datum/autolathe/recipe/medilathe/fixovein
name = "FixOVein"
path = /obj/item/tool/surgery/FixOVein
Expand Down
12 changes: 12 additions & 0 deletions code/game/machinery/medical_pod/bone_gel_refill.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/obj/structure/machinery/gel_refiller
name = "osteomimetic lattice fabricator"
desc = "Often called the bone gel refiller by those unable to pronounce its full name, this machine synthesizes and stores bone gel for later use. A slot in the front allows you to insert a bone gel bottle to refill it."
desc_lore = "In an attempt to prevent counterfeit bottles of bone gel not created by Weyland-Yutani, also known as a regular bottle, from being refilled, there is a chip reader in the fabricator and a chip in each bottle to make sure it is genuine. However, due to a combination of quality issues and being unmaintainable from proprietary parts, the machine often has problems. One such problem is in the chip reader, resulting in the fabricator being unable to detect a bottle directly on it, and such fails to activate, resulting in a person having to stand there and manually hold a bottle at the correct height to fill it."
icon_state = "bone_gel_vendor"
density = TRUE

/obj/structure/machinery/gel_refiller/attackby(obj/item/attacking_item, mob/user)
if(!istype(attacking_item, /obj/item/tool/surgery/bonegel))
return ..()
var/obj/item/tool/surgery/bonegel/gel = attacking_item
gel.refill_gel(src, user)
68 changes: 65 additions & 3 deletions code/game/objects/items/tools/surgery_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,78 @@
*/

/obj/item/tool/surgery/bonegel
name = "bone gel"
name = "bottle of bone gel"
desc = "A container for bone gel that often needs to be refilled from a specialized machine."
desc_lore = "Bone gel is a biological synthetic bone-analogue with the consistency of clay. It is capable of fixing hairline fractures and complex fractures alike. Bone gel should not be used to fix missing bone, as it does not replace the body's bone marrow. Overuse in a short period may cause acute immunodeficiency or anemia."
icon_state = "bone-gel"
force = 0
throwforce = 1
w_class = SIZE_SMALL
matter = list("plastic" = 7500)
///percent of gel remaining in container
var/remaining_gel = 100
///If gel is used when doing bone surgery
var/unlimited_gel = FALSE
///Time it takes per 10% of gel refilled
var/time_per_refill = 1 SECONDS
///if the bone gel is actively being refilled
var/refilling = FALSE

///How much bone gel is needed to fix a fracture
var/fracture_fix_cost = 5
///How much bone gel is needed to mend bones
var/mend_bones_fix_cost = 5

/obj/item/tool/surgery/bonegel/get_examine_text(mob/user)
. = ..()
if(unlimited_gel) //Only show how much gel is left if it actually uses bone gel
return
. += "A volume reader on the side tells you there is still [remaining_gel]% of [src] is remaining."
. += "[src] can be refilled from a osteomimetic lattice fabricator."

if(!skillcheck(user, SKILL_MEDICAL, SKILL_MEDICAL_DOCTOR)) //Know how much you will be using if you can use it
return
. += SPAN_NOTICE("You would need to use [fracture_fix_cost]% of the bone gel to repair a fracture.")
. += SPAN_NOTICE("You would need to use [mend_bones_fix_cost]% of the bone gel to mend bones.")

/obj/item/tool/surgery/bonegel/proc/refill_gel(obj/refilling_obj, mob/user)
if(unlimited_gel)
to_chat(user, SPAN_NOTICE("[refilling_obj] refuses to fill [src]."))
return
if(remaining_gel >= 100)
to_chat(user, SPAN_NOTICE("[src] cannot be filled with any more bone gel."))
return

if(refilling)
to_chat(user, SPAN_NOTICE("You are already refilling [src] from [refilling_obj]."))
return
refilling = TRUE

while(remaining_gel < 100)
if(!do_after(user, time_per_refill, INTERRUPT_ALL, BUSY_ICON_FRIENDLY, refilling_obj))
break
remaining_gel = clamp(remaining_gel + 10, 0, 100)
to_chat(user, SPAN_NOTICE("[refilling_obj] chimes, and displays \"[remaining_gel]% filled\"."))

refilling = FALSE
playsound(refilling_obj, "sound/machines/ping.ogg", 10)
to_chat(user, SPAN_NOTICE("You remove [src] from [refilling_obj]."))

/obj/item/tool/surgery/bonegel/proc/use_gel(gel_cost)
if(unlimited_gel)
return TRUE

if(remaining_gel < gel_cost)
return FALSE
remaining_gel -= gel_cost
return TRUE

/obj/item/tool/surgery/bonegel/empty
remaining_gel = 0

/obj/item/tool/surgery/bonegel/predatorbonegel
name = "gel gun"
desc = "Inside is a liquid that is similar in effect to bone gel, but requires much smaller quantities, allowing near infinite use from a single capsule."
icon_state = "predator_bone-gel"
unlimited_gel = TRUE

/*
* Fix-o-Vein
Expand Down
25 changes: 25 additions & 0 deletions code/modules/surgery/bones.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@
success_sound = 'sound/handling/bandage.ogg'
failure_sound = 'sound/surgery/organ2.ogg'

//Use materials to repair bones, same as /datum/surgery_step/mend_encased
/datum/surgery_step/mend_bones/extra_checks(mob/living/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, repeating, skipped)
. = ..()
if(istype(tool, /obj/item/tool/surgery/bonegel)) //If bone gel, use some of the gel
var/obj/item/tool/surgery/bonegel/gel = tool
if(!gel.use_gel(gel.fracture_fix_cost))
to_chat(user, SPAN_BOLDWARNING("[gel] is empty!"))
return FALSE

else //Otherwise, use metal rods
var/obj/item/stack/rods/rods = user.get_inactive_hand()
if(!istype(rods))
to_chat(user, SPAN_BOLDWARNING("You need metal rods in your offhand to repair [target]'s [surgery.affected_limb.display_name] with [tool]."))
return FALSE
if(!rods.use(2)) //Refunded on failure
to_chat(user, SPAN_BOLDWARNING("You need more metal rods to mend [target]'s [surgery.affected_limb.display_name] with [tool]."))
return FALSE

/datum/surgery_step/mend_bones/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, tool_type, datum/surgery/bone_repair/surgery)
if(surgery.affected_bone)
if(tool_type == /obj/item/tool/surgery/bonegel)
Expand Down Expand Up @@ -118,6 +136,13 @@

target.apply_damage(10, BRUTE, target_zone)
log_interact(user, target, "[key_name(user)] failed to begin repairing bones in [key_name(target)]'s [surgery.affected_limb.display_name] with \the [tool], aborting [surgery].")

if(tool_type != /obj/item/tool/surgery/bonegel)
to_chat(user, SPAN_NOTICE("The metal rods used on [target]'s [surgery.affected_limb.display_name] fall loose from their [surgery.affected_limb]."))
var/obj/item/stack/rods/rods = new /obj/item/stack/rods(get_turf(target))
rods.amount = 2 //Refund 2 rods on failure
rods.update_icon()

return FALSE

//------------------------------------
Expand Down
23 changes: 23 additions & 0 deletions code/modules/surgery/generic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,24 @@
success_sound = 'sound/handling/bandage.ogg'
failure_sound = 'sound/surgery/organ2.ogg'

//Use materials to mend bones, same as /datum/surgery_step/mend_bones
/datum/surgery_step/mend_encased/extra_checks(mob/living/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, repeating, skipped)
. = ..()
if(istype(tool, /obj/item/tool/surgery/bonegel)) //If bone gel, use some of the gel
var/obj/item/tool/surgery/bonegel/gel = tool
if(!gel.use_gel(gel.mend_bones_fix_cost))
to_chat(user, SPAN_BOLDWARNING("[gel] is empty!"))
return FALSE

else //Otherwise, use metal rods
var/obj/item/stack/rods/rods = user.get_inactive_hand()
if(!istype(rods))
to_chat(user, SPAN_BOLDWARNING("You need metal rods in your offhand to mend [target]'s [surgery.affected_limb.display_name] with [tool]."))
return FALSE
if(!rods.use(2)) //Refunded on failure
to_chat(user, SPAN_BOLDWARNING("You need more metal rods to mend [target]'s [surgery.affected_limb.display_name] with [tool]."))
return FALSE

/datum/surgery_step/mend_encased/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, tool_type, datum/surgery/surgery)
if(tool_type == /obj/item/tool/surgery/bonegel)
user.affected_message(target,
Expand Down Expand Up @@ -626,6 +644,11 @@
target.apply_damage(10, BRUTE, target_zone)
log_interact(user, target, "[key_name(user)] failed to mend [key_name(target)]'s [surgery.affected_limb.encased].")

if(tool_type != /obj/item/tool/surgery/bonegel)
to_chat(user, SPAN_NOTICE("The metal rods used on [target]'s [surgery.affected_limb.display_name] fall loose from their [surgery.affected_limb]."))
var/obj/item/stack/rods/rods = new /obj/item/stack/rods(get_turf(target))
rods.amount = 2 //Refund 2 rods on failure
rods.update_icon()

/*Proof of concept. Functions but does nothing useful.
If fiddling with, uncomment /mob/living/attackby surgery code also. It's pointless processing to have live without any surgeries for it to use.*/
Expand Down
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,7 @@
#include "code\game\machinery\kitchen\smartfridge.dm"
#include "code\game\machinery\medical_pod\autodoc.dm"
#include "code\game\machinery\medical_pod\bodyscanner.dm"
#include "code\game\machinery\medical_pod\bone_gel_refill.dm"
#include "code\game\machinery\medical_pod\medical_pod.dm"
#include "code\game\machinery\medical_pod\sleeper.dm"
#include "code\game\machinery\pipe\construction.dm"
Expand Down
Binary file modified icons/obj/structures/props/stationobjs.dmi
Binary file not shown.
Loading

0 comments on commit c7b4d6b

Please sign in to comment.