Refactors splinting

This commit is contained in:
Yoshax
2016-09-15 16:53:11 +01:00
parent 33eb7b65bc
commit 795d3dfb7b
4 changed files with 55 additions and 35 deletions
+14 -10
View File
@@ -275,17 +275,21 @@
user << "<span class='danger'>You can't apply a splint to the arm you're using!</span>"
return
user.visible_message("<span class='danger'>[user] starts to apply \the [src] to their [limb].</span>", "<span class='danger'>You start to apply \the [src] to your [limb].</span>", "<span class='danger'>You hear something being wrapped.</span>")
if(do_after(user, 50))
if (M != user)
user.visible_message("<span class='danger'>[user] finishes applying \the [src] to [M]'s [limb].</span>", "<span class='danger'>You finish applying \the [src] to [M]'s [limb].</span>", "<span class='danger'>You hear something being wrapped.</span>")
else
if(prob(25))
user.visible_message("<span class='danger'>[user] successfully applies \the [src] to their [limb].</span>", "<span class='danger'>You successfully apply \the [src] to your [limb].</span>", "<span class='danger'>You hear something being wrapped.</span>")
else
user.visible_message("<span class='danger'>[user] fumbles \the [src].</span>", "<span class='danger'>You fumble \the [src].</span>", "<span class='danger'>You hear something being wrapped.</span>")
if(do_after(user, 50, M))
if(M == user && prob(75))
user.visible_message("<span class='danger'>\The [user] fumbles [src].</span>", "<span class='danger'>You fumble [src].</span>", "<span class='danger'>You hear something being wrapped.</span>")
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("<span class='danger'>\The [user] finishes applying [src] to [M]'s [limb].</span>", "<span class='danger'>You finish applying \the [src] to [M]'s [limb].</span>", "<span class='danger'>You hear something being wrapped.</span>")
else
user.visible_message("<span class='danger'>\The [user] successfully applies [src] to their [limb].</span>", "<span class='danger'>You successfully apply \the [src] to your [limb].</span>", "<span class='danger'>You hear something being wrapped.</span>")
return
affecting.status |= ORGAN_SPLINTED
use(1)
S.dropInto(src.loc) //didn't get applied, so just drop it
user.visible_message("<span class='danger'>\The [user] fails to apply [src].</span>", "<span class='danger'>You fail to apply [src].</span>", "<span class='danger'>You hear something being wrapped.</span>")
return
+13 -10
View File
@@ -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()
@@ -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("<span class='danger'>\The [user] removes \the [src]'s splints!</span>")
else
+22 -13
View File
@@ -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 << "<span class='notice'>You feel \the [suit] constrict about your [name], supporting it.</span>"
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)