diff --git a/code/__DEFINES/mob.dm b/code/__DEFINES/mob.dm index 5d2b98b683f..5312cba6e14 100644 --- a/code/__DEFINES/mob.dm +++ b/code/__DEFINES/mob.dm @@ -19,6 +19,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 3be1404a030..3ffdfaaf751 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -207,6 +207,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) @@ -221,4 +222,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 512bd475b83..bdb9a359a09 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -1117,4 +1117,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.dm b/code/modules/mob/living/carbon/human/human.dm index 42968e5d63b..651aae8c209 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -62,6 +62,7 @@ /mob/living/carbon/human/Destroy() QDEL_LIST(bodyparts) + splinted_limbs.Cut() return ..() /mob/living/carbon/human/dummy diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 393eae95299..a7fcc6874a2 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -72,3 +72,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_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 3f78bd46e19..fc048ab161a 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -36,40 +36,45 @@ /mob/living/carbon/human/Move(NewLoc, direct) . = ..() if(.) // did we actually move? - if(!lying && !buckled) - var/obj/item/clothing/shoes/S = shoes - if(!has_gravity(loc)) - return - //Bloody footprints - var/turf/T = get_turf(src) - var/obj/item/organ/external/l_foot = get_organ("l_foot") - var/obj/item/organ/external/r_foot = get_organ("r_foot") - var/hasfeet = 1 - if(!l_foot && !r_foot) - hasfeet = 0 + if(!lying && !buckled && !throwing) + for(var/obj/item/organ/external/splinted in splinted_limbs) + splinted.update_splints() + + if(!has_gravity(loc)) + return + + var/obj/item/clothing/shoes/S = shoes + + //Bloody footprints + var/turf/T = get_turf(src) + var/obj/item/organ/external/l_foot = get_organ("l_foot") + var/obj/item/organ/external/r_foot = get_organ("r_foot") + var/hasfeet = TRUE + if(!l_foot && !r_foot) + hasfeet = FALSE - if(shoes) - if(S.bloody_shoes && S.bloody_shoes[S.blood_state]) - var/obj/effect/decal/cleanable/blood/footprints/oldFP = locate(/obj/effect/decal/cleanable/blood/footprints) in T - if(oldFP && oldFP.blood_state == S.blood_state && oldFP.basecolor == S.blood_color) - return - else - //No oldFP or it's a different kind of blood - S.bloody_shoes[S.blood_state] = max(0, S.bloody_shoes[S.blood_state] - BLOOD_LOSS_PER_STEP) - createFootprintsFrom(shoes, dir, T) - update_inv_shoes() - else if(hasfeet) - if(bloody_feet && bloody_feet[blood_state]) - var/obj/effect/decal/cleanable/blood/footprints/oldFP = locate(/obj/effect/decal/cleanable/blood/footprints) in T - if(oldFP && oldFP.blood_state == blood_state && oldFP.basecolor == feet_blood_color) - return - else - bloody_feet[blood_state] = max(0, bloody_feet[blood_state] - BLOOD_LOSS_PER_STEP) - createFootprintsFrom(src, dir, T) - update_inv_shoes() - //End bloody footprints - if(S) - S.step_action(src) + if(shoes) + if(S.bloody_shoes && S.bloody_shoes[S.blood_state]) + var/obj/effect/decal/cleanable/blood/footprints/oldFP = locate(/obj/effect/decal/cleanable/blood/footprints) in T + if(oldFP && oldFP.blood_state == S.blood_state && oldFP.basecolor == S.blood_color) + return + else + //No oldFP or it's a different kind of blood + S.bloody_shoes[S.blood_state] = max(0, S.bloody_shoes[S.blood_state] - BLOOD_LOSS_PER_STEP) + createFootprintsFrom(shoes, dir, T) + update_inv_shoes() + else if(hasfeet) + if(bloody_feet && bloody_feet[blood_state]) + var/obj/effect/decal/cleanable/blood/footprints/oldFP = locate(/obj/effect/decal/cleanable/blood/footprints) in T + if(oldFP && oldFP.blood_state == blood_state && oldFP.basecolor == feet_blood_color) + return + else + bloody_feet[blood_state] = max(0, bloody_feet[blood_state] - BLOOD_LOSS_PER_STEP) + createFootprintsFrom(src, dir, T) + update_inv_shoes() + //End bloody footprints + if(S) + S.step_action(src) /mob/living/carbon/human/handle_footstep(turf/T) if(..()) diff --git a/code/modules/mob/living/carbon/human/human_organs.dm b/code/modules/mob/living/carbon/human/human_organs.dm index 038735f1621..157e95da32d 100644 --- a/code/modules/mob/living/carbon/human/human_organs.dm +++ b/code/modules/mob/living/carbon/human/human_organs.dm @@ -182,3 +182,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 b8f4208df90..eef78948f7a 100644 --- a/code/modules/mob/living/carbon/human/species/skeleton.dm +++ b/code/modules/mob/living/carbon/human/species/skeleton.dm @@ -54,6 +54,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 4a1343ad513..a7aaa538eed 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 cae6a3b1a8b..a623c0a0d0f 100644 --- a/code/modules/surgery/organs/organ_external.dm +++ b/code/modules/surgery/organs/organ_external.dm @@ -58,6 +58,8 @@ var/can_grasp var/can_stand + 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 @@ -84,6 +86,7 @@ if(owner) owner.bodyparts_by_name[limb_name] = null + owner.splinted_limbs -= src QDEL_LIST(children) @@ -196,6 +199,10 @@ if(status & ORGAN_BROKEN && prob(40) && brute) owner.emote("scream") //getting hit on broken hand hurts + if(status & ORGAN_SPLINTED && prob((brute + burn)*4)) //taking damage to splinted limbs removes the splints + status &= ~ORGAN_SPLINTED + owner.visible_message("The splint on [owner]'s left arm unravels from their [name]!","The splint on your [name] unravels!") + owner.handle_splints() if(used_weapon) add_autopsy_data("[used_weapon]", brute + burn) @@ -458,6 +465,18 @@ 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() + if(!(status & ORGAN_SPLINTED)) + owner.splinted_limbs -= src + 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 [name]!","You scream in pain as your splint pops off your [name]!") + owner.emote("scream") + owner.Stun(2) + owner.handle_splints() + + /**************************************************** DISMEMBERMENT ****************************************************/ @@ -648,6 +667,9 @@ Note that amputating the affected organ does in fact remove the infection from t var/is_robotic = status & ORGAN_ROBOT var/mob/living/carbon/human/victim = owner + if(status & ORGAN_SPLINTED) + victim.splinted_limbs -= src + for(var/obj/item/I in embedded_objects) embedded_objects -= I I.forceMove(src) @@ -754,4 +776,4 @@ Note that amputating the affected organ does in fact remove the infection from t for(var/X in bodyparts) var/obj/item/organ/external/L = X for(var/obj/item/I in L.embedded_objects) - return 1 \ No newline at end of file + return 1