Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to bone repairing #5280

Merged
merged 19 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
45 changes: 42 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,55 @@
*/

/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 = 2.5 SECONDS

/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
. += "A counter on the side reads \"[remaining_gel]% gel remaining\"."

/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

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

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/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
18 changes: 18 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/attempt_step(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(5))
to_chat(user, SPAN_BOLDWARNING("[gel] is empty!"))
return FALSE

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

/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
18 changes: 18 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 repair bones, same as /datum/surgery_step/mend_bones
/datum/surgery_step/mend_encased/attempt_step(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(5))
to_chat(user, SPAN_BOLDWARNING("[gel] is empty!"))
return FALSE

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

/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
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,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