diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 3e9c9a75242..74c8f006aed 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -275,17 +275,21 @@ user << "You can't apply a splint to the arm you're using!" return user.visible_message("[user] starts to apply \the [src] to their [limb].", "You start to apply \the [src] to your [limb].", "You hear something being wrapped.") - if(do_after(user, 50)) - if (M != user) - user.visible_message("[user] finishes applying \the [src] to [M]'s [limb].", "You finish applying \the [src] to [M]'s [limb].", "You hear something being wrapped.") - else - if(prob(25)) - user.visible_message("[user] successfully applies \the [src] to their [limb].", "You successfully apply \the [src] to your [limb].", "You hear something being wrapped.") - else - user.visible_message("[user] fumbles \the [src].", "You fumble \the [src].", "You hear something being wrapped.") + if(do_after(user, 50, M)) + if(M == user && prob(75)) + user.visible_message("\The [user] fumbles [src].", "You fumble [src].", "You hear something being wrapped.") + return + var/obj/item/stack/medical/splint/S = split(1) + if(S) + if(affecting.apply_splint(S)) + S.forceMove(affecting) + if (M != user) + user.visible_message("\The [user] finishes applying [src] to [M]'s [limb].", "You finish applying \the [src] to [M]'s [limb].", "You hear something being wrapped.") + else + user.visible_message("\The [user] successfully applies [src] to their [limb].", "You successfully apply \the [src] to your [limb].", "You hear something being wrapped.") return - affecting.status |= ORGAN_SPLINTED - use(1) + S.dropInto(src.loc) //didn't get applied, so just drop it + user.visible_message("\The [user] fails to apply [src].", "You fail to apply [src].", "You hear something being wrapped.") return diff --git a/code/modules/clothing/spacesuits/spacesuits.dm b/code/modules/clothing/spacesuits/spacesuits.dm index f06e839ae3a..6582cd4e680 100644 --- a/code/modules/clothing/spacesuits/spacesuits.dm +++ b/code/modules/clothing/spacesuits/spacesuits.dm @@ -63,7 +63,7 @@ var/list/supporting_limbs //If not-null, automatically splints breaks. Checked when removing the suit. /obj/item/clothing/suit/space/equipped(mob/M) - check_limb_support() + check_limb_support(M) ..() /obj/item/clothing/suit/space/dropped(var/mob/user) @@ -77,14 +77,17 @@ /obj/item/clothing/suit/space/proc/check_limb_support(var/mob/living/carbon/human/user) // If this isn't set, then we don't need to care. - if(!supporting_limbs || !supporting_limbs.len) + if(!istype(user) || isnull(supporting_limbs) || !supporting_limbs.len) return - if(!istype(user) || user.wear_suit == src) - return - - // Otherwise, remove the splints. - for(var/obj/item/organ/external/E in supporting_limbs) - E.status &= ~ ORGAN_SPLINTED - user << "The suit stops supporting your [E.name]." - supporting_limbs = list() + if(user.wear_suit == src) + for(var/obj/item/organ/external/E in user.organs) + if(E.apply_splint(src)) + user << "You feel [src] constrict about your [E.name], supporting it." + supporting_limbs |= E + else + // Otherwise, remove the splints. + for(var/obj/item/organ/external/E in supporting_limbs) + if(E.splinted == src && E.remove_splint(src)) + user << "\The [src] stops supporting your [E.name]." + supporting_limbs.Cut() diff --git a/code/modules/mob/living/carbon/human/stripping.dm b/code/modules/mob/living/carbon/human/stripping.dm index 700a0a53086..01088861001 100644 --- a/code/modules/mob/living/carbon/human/stripping.dm +++ b/code/modules/mob/living/carbon/human/stripping.dm @@ -126,8 +126,12 @@ var/removed_splint for(var/obj/item/organ/external/o in organs) if (o && o.status & ORGAN_SPLINTED) - o.status &= ~ORGAN_SPLINTED - removed_splint = 1 + var/obj/item/S = o.splinted + if(istype(S) && S.loc == o) //can only remove splints that are actually worn on the organ (deals with hardsuit splints) + S.add_fingerprint(user) + if(o.remove_splints()) + user.put_in_active_hand(S) + removed_splint = 1 if(removed_splint) visible_message("\The [user] removes \the [src]'s splints!") else diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index 612cda4a985..97fb4bf4292 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -50,6 +50,7 @@ var/list/implants = list() // Currently implanted objects. var/organ_rel_size = 25 // Relative size of the organ. var/base_miss_chance = 20 // Chance of missing. + var/atom/movable/splinted // Joint/state stuff. var/can_grasp // It would be more appropriate if these two were named "affects_grasp" and "affects_stand" at this point @@ -84,6 +85,10 @@ for(var/obj/item/organ/O in internal_organs) qdel(O) + if(splinted && splinted.loc == src) + qdel(splinted) + splinted = null + if(owner) owner.organs -= src owner.organs_by_name[organ_tag] = null @@ -1006,21 +1011,25 @@ Note that amputating the affected organ does in fact remove the infection from t // This is mostly for the ninja suit to stop ninja being so crippled by breaks. // TODO: consider moving this to a suit proc or process() or something during // hardsuit rewrite. - if(owner && !(status & ORGAN_SPLINTED) && istype(owner,/mob/living/carbon/human)) + if(!(status & ORGAN_SPLINTED) && owner && istype(owner.wear_suit, /obj/item/clothing/suit/space)) + var/obj/item/clothing/suit/space/suit = owner.wear_suit + suit.check_limb_support() - var/mob/living/carbon/human/H = owner +/obj/item/organ/external/proc/apply_splint(var/atom/movable/splint) + if(!splinted) + splinted = splint + status |= ORGAN_SPLINTED + return 1 + return 0 - if(H.wear_suit && istype(H.wear_suit,/obj/item/clothing/suit/space)) - - var/obj/item/clothing/suit/space/suit = H.wear_suit - - if(isnull(suit.supporting_limbs)) - return - - owner << "You feel \the [suit] constrict about your [name], supporting it." - status |= ORGAN_SPLINTED - suit.supporting_limbs |= src - return +/obj/item/organ/external/proc/remove_splint() + if(splinted) + if(splinted.loc == src) + splinted.dropInto(owner? owner.loc : src.loc) + splinted = null + status &= ~(ORGAN_SPLINTED) + return 1 + return 0 /obj/item/organ/external/proc/mend_fracture() if(robotic >= ORGAN_ROBOT)