Merge pull request #2466 from Yoshax/splinting

Splint changes + fixes
This commit is contained in:
Neerti
2016-09-15 16:38:17 -04:00
committed by GitHub
21 changed files with 185 additions and 76 deletions

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,24 @@
/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))
return
if(!istype(user) || user.wear_suit == src)
return
if(user.wear_suit == src)
for(var/obj/item/organ/external/E in user.bad_external_organs)
if(E.is_broken() && 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()
// 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()
/obj/item/clothing/suit/space/proc/handle_fracture(var/mob/living/carbon/human/user, var/obj/item/organ/external/E)
if(!istype(user) || isnull(supporting_limbs))
return
if(E.is_broken() && E.apply_splint(src))
user << "You feel [src] constrict about your [E.name], supporting it."
supporting_limbs |= E

View File

@@ -146,7 +146,7 @@
for(var/datum/playingcard/P in cards)
H.cards += P
H.concealed = src.concealed
user.drop_from_inventory(src,user.loc)
user.drop_from_inventory(src)
qdel(src)
H.update_icon()
return

View File

@@ -50,6 +50,11 @@ var/list/holder_mob_icon_cache = list()
continue
M.forceMove(get_turf(src))
/obj/item/weapon/holder/onDropInto(var/atom/movable/AM)
if(ismob(loc)) // Bypass our holding mob and drop directly to its loc
return loc.loc
return ..()
/obj/item/weapon/holder/GetID()
for(var/mob/M in contents)
var/obj/item/I = M.GetIdCard()

View File

@@ -126,16 +126,12 @@ var/list/slot_equipment_priority = list( \
// Removes an item from inventory and places it in the target atom.
// If canremove or other conditions need to be checked then use unEquip instead.
/mob/proc/drop_from_inventory(var/obj/item/W, var/atom/Target = null)
/mob/proc/drop_from_inventory(var/obj/item/W, var/atom/target = null)
if(W)
if(!Target)
Target = loc
remove_from_mob(W)
if(!(W && W.loc)) return 1 // self destroying objects (tk, grabs)
W.forceMove(Target)
remove_from_mob(W, target)
if(!(W && W.loc))
return 1 // self destroying objects (tk, grabs)
update_icons()
return 1
return 0
@@ -194,7 +190,9 @@ var/list/slot_equipment_priority = list( \
//Attemps to remove an object on a mob.
/mob/proc/remove_from_mob(var/obj/O)
/mob/proc/remove_from_mob(var/obj/O, var/atom/target)
if(!O) // Nothing to remove, so we succeed.
return 1
src.u_equip(O)
if (src.client)
src.client.screen -= O
@@ -202,7 +200,10 @@ var/list/slot_equipment_priority = list( \
O.screen_loc = null
if(istype(O, /obj/item))
var/obj/item/I = O
I.forceMove(src.loc)
if(target)
I.forceMove(target)
else
I.dropInto(loc)
I.dropped(src)
return 1

View File

@@ -251,8 +251,8 @@
//splints
for(var/organ in list(BP_L_LEG, BP_R_LEG, BP_L_ARM, BP_R_ARM))
var/obj/item/organ/external/o = get_organ(organ)
if(o && o.status & ORGAN_SPLINTED)
msg += "<span class='warning'>[T.He] [T.has] a splint on [T.his] [o.name]!</span>\n"
if(o && o.splinted && o.splinted.loc == o)
msg += "<span class='warning'>[T.He] [T.has] \a [o.splinted] on [T.his] [o.name]!</span>\n"
if(suiciding)
msg += "<span class='warning'>[T.He] appears to have commited suicide... there is no hope of recovery.</span>\n"

View File

@@ -1013,7 +1013,7 @@
/mob/living/carbon/human/proc/handle_embedded_objects()
for(var/obj/item/organ/external/organ in src.organs)
if(organ.status & ORGAN_SPLINTED) //Splints prevent movement.
if(organ.splinted) //Splints prevent movement.
continue
for(var/obj/item/O in organ.implants)
if(!istype(O,/obj/item/weapon/implant) && prob(5)) //Moving with things stuck in you could be bad.

View File

@@ -45,7 +45,7 @@
var/obj/item/organ/external/E = get_organ(organ_name)
if(!E || E.is_stump())
tally += 4
if(E.status & ORGAN_SPLINTED)
if(E.splinted)
tally += 0.5
else if(E.status & ORGAN_BROKEN)
tally += 1.5
@@ -57,7 +57,7 @@
var/obj/item/organ/external/E = get_organ(organ_name)
if(!E || E.is_stump())
tally += 4
else if(E.status & ORGAN_SPLINTED)
else if(E.splinted)
tally += 0.5
else if(E.status & ORGAN_BROKEN)
tally += 1.5

View File

@@ -142,10 +142,10 @@
return
for (var/obj/item/organ/external/E in organs)
if(!E || !E.can_grasp || (E.status & ORGAN_SPLINTED))
if(!E || !E.can_grasp)
continue
if(E.is_broken() || E.is_dislocated())
if((E.is_broken() || E.is_dislocated()) && !E.splinted)
switch(E.body_part)
if(HAND_LEFT, ARM_LEFT)
if(!l_hand)

View File

@@ -125,9 +125,13 @@
if(can_reach_splints)
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
if (o && o.splinted)
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_splint())
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

View File

@@ -519,7 +519,7 @@
for(var/name in H.organs_by_name)
var/obj/item/organ/external/e = H.organs_by_name[name]
if(e && H.lying)
if(((e.status & ORGAN_BROKEN && !(e.status & ORGAN_SPLINTED)) || e.status & ORGAN_BLEEDING) && (H.getBruteLoss() + H.getFireLoss() >= 100))
if(((e.status & ORGAN_BROKEN && !(e.splinted)) || e.status & ORGAN_BLEEDING) && (H.getBruteLoss() + H.getFireLoss() >= 100))
return 1
break
return 0

View File

@@ -254,7 +254,6 @@ var/list/organ_cache = list()
robotic = ORGAN_ROBOT
src.status &= ~ORGAN_BROKEN
src.status &= ~ORGAN_BLEEDING
src.status &= ~ORGAN_SPLINTED
src.status &= ~ORGAN_CUT_AWAY
/obj/item/organ/proc/mechassist() //Used to add things like pacemakers, etc

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
@@ -524,11 +529,11 @@ This function completely restores a damaged organ to perfect condition.
//external organs handle brokenness a bit differently when it comes to damage. Instead brute_dam is checked inside process()
//this also ensures that an external organ cannot be "broken" without broken_description being set.
/obj/item/organ/external/is_broken()
return ((status & ORGAN_CUT_AWAY) || ((status & ORGAN_BROKEN) && !(status & ORGAN_SPLINTED)))
return ((status & ORGAN_CUT_AWAY) || ((status & ORGAN_BROKEN) && !(splinted)))
//Determines if we even need to process this organ.
/obj/item/organ/external/proc/need_process()
if(status & (ORGAN_CUT_AWAY|ORGAN_BLEEDING|ORGAN_BROKEN|ORGAN_DESTROYED|ORGAN_SPLINTED|ORGAN_DEAD|ORGAN_MUTATED))
if(status & (ORGAN_CUT_AWAY|ORGAN_BLEEDING|ORGAN_BROKEN|ORGAN_DESTROYED|ORGAN_DEAD|ORGAN_MUTATED))
return 1
if((brute_dam || burn_dam) && (robotic < ORGAN_ROBOT)) //Robot limbs don't autoheal and thus don't need to process when damaged
return 1
@@ -1006,21 +1011,10 @@ 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))
var/mob/living/carbon/human/H = owner
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
if(!(splinted) && owner && istype(owner.wear_suit, /obj/item/clothing/suit/space))
var/obj/item/clothing/suit/space/suit = owner.wear_suit
suit.handle_fracture(owner, src)
/obj/item/organ/external/proc/mend_fracture()
if(robotic >= ORGAN_ROBOT)
@@ -1031,6 +1025,20 @@ Note that amputating the affected organ does in fact remove the infection from t
status &= ~ORGAN_BROKEN
return 1
/obj/item/organ/external/proc/apply_splint(var/atom/movable/splint)
if(!splinted)
splinted = splint
return 1
return 0
/obj/item/organ/external/proc/remove_splint()
if(splinted)
if(splinted.loc == src)
splinted.dropInto(owner? owner.loc : src.loc)
splinted = null
return 1
return 0
/obj/item/organ/external/robotize(var/company, var/skip_prosthetics = 0, var/keep_organs = 0)
if(robotic >= ORGAN_ROBOT)
@@ -1054,6 +1062,7 @@ Note that amputating the affected organ does in fact remove the infection from t
dislocated = -1
cannot_break = 1
remove_splint()
get_icon()
unmutate()

View File

@@ -140,7 +140,6 @@
user.visible_message("\blue [user] has mended the damaged bones in [target]'s [affected.name] with \the [tool]." , \
"\blue You have mended the damaged bones in [target]'s [affected.name] with \the [tool]." )
affected.status &= ~ORGAN_BROKEN
affected.status &= ~ORGAN_SPLINTED
affected.stage = 0
fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)