Skip to content

Commit

Permalink
Revert "Changes to bone repairing (cmss13-devs#5280)"
Browse files Browse the repository at this point in the history
This reverts commit c7b4d6b.

A big thanks to Birdtalon for helping me learn how to do this.
  • Loading branch information
AlakRacc committed Feb 3, 2024
1 parent ca5bdc4 commit 4af1abf
Show file tree
Hide file tree
Showing 9 changed files with 169 additions and 347 deletions.
4 changes: 4 additions & 0 deletions code/game/machinery/autolathe_datums.dm
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@
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: 0 additions & 12 deletions code/game/machinery/medical_pod/bone_gel_refill.dm

This file was deleted.

68 changes: 3 additions & 65 deletions code/game/objects/items/tools/surgery_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -195,78 +195,16 @@
*/

/obj/item/tool/surgery/bonegel
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."
name = "bone gel"
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: 0 additions & 25 deletions code/modules/surgery/bones.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,6 @@
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 @@ -136,13 +118,6 @@

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: 0 additions & 23 deletions code/modules/surgery/generic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -573,24 +573,6 @@
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 @@ -644,11 +626,6 @@
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: 0 additions & 1 deletion colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,6 @@
#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 4af1abf

Please sign in to comment.