Merge pull request #10594 from mwerezak/embed-fix

Embedding and broken limb fixes
This commit is contained in:
GinjaNinja32
2015-08-13 04:52:20 +01:00
5 changed files with 39 additions and 31 deletions

View File

@@ -1031,23 +1031,29 @@
return(visible_implants) return(visible_implants)
/mob/living/carbon/human/embedded_needs_process()
for(var/obj/item/organ/external/organ in src.organs)
for(var/obj/item/O in organ.implants)
if(!istype(O, /obj/item/weapon/implant)) //implant type items do not cause embedding effects, see handle_embedded_objects()
return 1
return 0
/mob/living/carbon/human/proc/handle_embedded_objects() /mob/living/carbon/human/proc/handle_embedded_objects()
for(var/obj/item/organ/external/organ in src.organs) for(var/obj/item/organ/external/organ in src.organs)
if(organ.status & ORGAN_SPLINTED) //Splints prevent movement. if(organ.status & ORGAN_SPLINTED) //Splints prevent movement.
continue continue
for(var/obj/item/weapon/O in organ.implants) 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. if(!istype(O,/obj/item/weapon/implant) && prob(5)) //Moving with things stuck in you could be bad.
// All kinds of embedded objects cause bleeding. // All kinds of embedded objects cause bleeding.
var/msg = null if(species.flags & NO_PAIN)
switch(rand(1,3)) src << "<span class='warning'>You feel [O] moving inside your [organ.name].</span>"
if(1) else
msg ="<span class='warning'>A spike of pain jolts your [organ.name] as you bump [O] inside.</span>" var/msg = pick( \
if(2) "<span class='warning'>A spike of pain jolts your [organ.name] as you bump [O] inside.</span>", \
msg ="<span class='warning'>Your movement jostles [O] in your [organ.name] painfully.</span>" "<span class='warning'>Your movement jostles [O] in your [organ.name] painfully.</span>", \
if(3) "<span class='warning'>Your movement jostles [O] in your [organ.name] painfully.</span>")
msg ="<span class='warning'>[O] in your [organ.name] twists painfully as you move.</span>" src << msg
src << msg
organ.take_damage(rand(1,3), 0, 0) organ.take_damage(rand(1,3), 0, 0)
if(!(organ.status & ORGAN_ROBOT) && !(species.flags & NO_BLOOD)) //There is no blood in protheses. if(!(organ.status & ORGAN_ROBOT) && !(species.flags & NO_BLOOD)) //There is no blood in protheses.

View File

@@ -134,28 +134,29 @@
continue continue
if(E.is_broken() || E.is_dislocated()) if(E.is_broken() || E.is_dislocated())
if(E.body_part == HAND_LEFT) switch(E.body_part)
if(!l_hand) if(HAND_LEFT, ARM_LEFT)
continue if(!l_hand)
drop_from_inventory(l_hand) continue
else drop_from_inventory(l_hand)
if(!r_hand) if(HAND_RIGHT, ARM_RIGHT)
continue if(!r_hand)
drop_from_inventory(r_hand) continue
drop_from_inventory(r_hand)
var/emote_scream = pick("screams in pain and ", "lets out a sharp cry and ", "cries out and ") var/emote_scream = pick("screams in pain and ", "lets out a sharp cry and ", "cries out and ")
emote("me", 1, "[(species.flags & NO_PAIN) ? "" : emote_scream ]drops what they were holding in their [E.name]!") emote("me", 1, "[(species.flags & NO_PAIN) ? "" : emote_scream ]drops what they were holding in their [E.name]!")
else if(E.is_malfunctioning()) else if(E.is_malfunctioning())
switch(E.body_part)
if(E.body_part == HAND_LEFT) if(HAND_LEFT, ARM_LEFT)
if(!l_hand) if(!l_hand)
continue continue
drop_from_inventory(l_hand) drop_from_inventory(l_hand)
else if(HAND_RIGHT, ARM_RIGHT)
if(!r_hand) if(!r_hand)
continue continue
drop_from_inventory(r_hand) drop_from_inventory(r_hand)
emote("me", 1, "drops what they were holding, their [E.name] malfunctioning!") emote("me", 1, "drops what they were holding, their [E.name] malfunctioning!")

View File

@@ -1018,9 +1018,7 @@
//Periodically double-check embedded_flag //Periodically double-check embedded_flag
if(embedded_flag && !(life_tick % 10)) if(embedded_flag && !(life_tick % 10))
var/list/E if(!embedded_needs_process())
E = get_visible_implants(0)
if(!E.len)
embedded_flag = 0 embedded_flag = 0
//Eyes //Eyes

View File

@@ -856,6 +856,9 @@
visible_implants += O visible_implants += O
return visible_implants return visible_implants
/mob/proc/embedded_needs_process()
return (embedded.len > 0)
mob/proc/yank_out_object() mob/proc/yank_out_object()
set category = "Object" set category = "Object"
set name = "Yank out object" set name = "Yank out object"

View File

@@ -50,7 +50,7 @@
var/joint = "joint" // Descriptive string used in dislocation. var/joint = "joint" // Descriptive string used in dislocation.
var/amputation_point // Descriptive string used in amputation. var/amputation_point // Descriptive string used in amputation.
var/dislocated = 0 // If you target a joint, you can dislocate the limb, causing temporary damage to the organ. var/dislocated = 0 // If you target a joint, you can dislocate the limb, causing temporary damage to the organ.
var/can_grasp var/can_grasp //It would be more appropriate if these two were named "affects_grasp" and "affects_stand" at this point
var/can_stand var/can_stand
/obj/item/organ/external/Destroy() /obj/item/organ/external/Destroy()