diff --git a/code/__DEFINES/mob.dm b/code/__DEFINES/mob.dm index 36fffdd907a..f62db7a3fdc 100644 --- a/code/__DEFINES/mob.dm +++ b/code/__DEFINES/mob.dm @@ -25,6 +25,8 @@ #define LEFT 1 #define RIGHT 2 +#define SPLINT_LIFE 2000 //number of steps splints stay on + //Pulse levels, very simplified #define PULSE_NONE 0 //so !M.pulse checks would be possible diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 82d2ce8c024..8ec4fc87160 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -200,6 +200,7 @@ to_chat(user, "[H]'s [limb] is already splinted!") if(alert(user, "Would you like to remove the splint from [H]'s [limb]?", "Removing.", "Yes", "No") == "Yes") affecting.status &= ~ORGAN_SPLINTED + H.handle_splints() to_chat(user, "You remove the splint from [H]'s [limb].") return if(M == user) @@ -214,4 +215,7 @@ "You hear something being wrapped.") affecting.status |= ORGAN_SPLINTED + affecting.splinted_count = H.step_count + H.handle_splints() + use(1) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 0848a90e8c0..9cdb618b8a4 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -1110,4 +1110,4 @@ so that different stomachs can handle things in different ways VB*/ update_tint() if(I.flags_inv & HIDEMASK || forced) update_inv_wear_mask() - update_inv_head() + update_inv_head() \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 15f9b6d112e..5ea1c9baeb0 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -73,3 +73,5 @@ var/global/default_martial_art = new/datum/martial_art var/datum/body_accessory/body_accessory = null var/tail // Name of tail image in species effects icon file. + + var/list/splinted_limbs = list() //limbs we know are splinted diff --git a/code/modules/mob/living/carbon/human/human_organs.dm b/code/modules/mob/living/carbon/human/human_organs.dm index 24ed336a4a3..733493dc005 100644 --- a/code/modules/mob/living/carbon/human/human_organs.dm +++ b/code/modules/mob/living/carbon/human/human_organs.dm @@ -12,15 +12,25 @@ number_wounds = 0 var/force_process = 0 + var/splint_process = 0 var/damage_this_tick = getBruteLoss() + getFireLoss() + getToxLoss() if(damage_this_tick > last_dam) force_process = 1 + if(splinted_limbs.len) + splint_process = 1 last_dam = damage_this_tick if(force_process) bad_external_organs.Cut() for(var/obj/item/organ/external/Ex in bodyparts) bad_external_organs |= Ex + else if(splint_process) //we don't need to process every organ if it's just one limb splinted + for(var/obj/item/organ/external/splinted in splinted_limbs) + if(!(splinted.status & ORGAN_SPLINTED)) + splinted_limbs -= splinted + continue + bad_external_organs |= splinted + //processing internal organs is pretty cheap, do that first. for(var/obj/item/organ/internal/I in internal_organs) I.process() @@ -210,3 +220,9 @@ I use this to standardize shadowling dethrall code odmg += O.brute_dam odmg += O.burn_dam return (health < (100 - odmg)) + +/mob/living/carbon/human/proc/handle_splints() //proc that rebuilds the list of splints on this person, for ease of processing + splinted_limbs.Cut() + for(var/obj/item/organ/external/limb in bodyparts) + if(limb.status & ORGAN_SPLINTED) + splinted_limbs += limb \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/species/skeleton.dm b/code/modules/mob/living/carbon/human/species/skeleton.dm index 62676144ebd..efb0ca00785 100644 --- a/code/modules/mob/living/carbon/human/species/skeleton.dm +++ b/code/modules/mob/living/carbon/human/species/skeleton.dm @@ -55,6 +55,7 @@ if(L.brute_dam < L.min_broken_damage) L.status &= ~ORGAN_BROKEN L.status &= ~ORGAN_SPLINTED + H.handle_splints() L.perma_injury = 0 break // We're only checking one limb here, bucko if(prob(3)) diff --git a/code/modules/surgery/bones.dm b/code/modules/surgery/bones.dm index db9d5f4821d..74fd2c7c3d4 100644 --- a/code/modules/surgery/bones.dm +++ b/code/modules/surgery/bones.dm @@ -168,7 +168,7 @@ affected.status &= ~ORGAN_BROKEN affected.status &= ~ORGAN_SPLINTED affected.perma_injury = 0 - + target.handle_splints() return 1 /datum/surgery_step/finish_bone/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) diff --git a/code/modules/surgery/organs/organ_external.dm b/code/modules/surgery/organs/organ_external.dm index 151636a9a50..de97dd66baa 100644 --- a/code/modules/surgery/organs/organ_external.dm +++ b/code/modules/surgery/organs/organ_external.dm @@ -68,6 +68,8 @@ var/can_stand var/wound_cleanup_timer + var/splinted_count = 0 //Time when this organ was last splinted + /obj/item/organ/external/necrotize(update_sprite=TRUE) if(status & (ORGAN_ROBOT|ORGAN_DEAD)) return @@ -468,6 +470,8 @@ This function completely restores a damaged organ to perfect condition. //Infections update_germs() + //Splints + update_splints() else ..() @@ -680,6 +684,17 @@ Note that amputating the affected organ does in fact remove the infection from t tbrute = 3 return "[tbrute][tburn]" +/obj/item/organ/external/proc/update_splints() //we're processing splints like this instead of on a per step basis for efficiency + if(!(status & ORGAN_SPLINTED)) + return + if(owner.step_count >= splinted_count + SPLINT_LIFE) + status &= ~ORGAN_SPLINTED //oh no, we actually need surgery now! + owner.visible_message("[owner] screams in pain as their splint pops off their [src.name]!","You scream in pain as your splint pops off your [src.name]!") + owner.emote("scream") + owner.Stun(2) + owner.handle_splints() + + /**************************************************** DISMEMBERMENT ****************************************************/