mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Merge pull request #10594 from mwerezak/embed-fix
Embedding and broken limb fixes
This commit is contained in:
@@ -1031,23 +1031,29 @@
|
||||
|
||||
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()
|
||||
|
||||
for(var/obj/item/organ/external/organ in src.organs)
|
||||
if(organ.status & ORGAN_SPLINTED) //Splints prevent movement.
|
||||
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.
|
||||
// All kinds of embedded objects cause bleeding.
|
||||
var/msg = null
|
||||
switch(rand(1,3))
|
||||
if(1)
|
||||
msg ="<span class='warning'>A spike of pain jolts your [organ.name] as you bump [O] inside.</span>"
|
||||
if(2)
|
||||
msg ="<span class='warning'>Your movement jostles [O] in your [organ.name] painfully.</span>"
|
||||
if(3)
|
||||
msg ="<span class='warning'>[O] in your [organ.name] twists painfully as you move.</span>"
|
||||
src << msg
|
||||
if(species.flags & NO_PAIN)
|
||||
src << "<span class='warning'>You feel [O] moving inside your [organ.name].</span>"
|
||||
else
|
||||
var/msg = pick( \
|
||||
"<span class='warning'>A spike of pain jolts your [organ.name] as you bump [O] inside.</span>", \
|
||||
"<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>")
|
||||
src << msg
|
||||
|
||||
organ.take_damage(rand(1,3), 0, 0)
|
||||
if(!(organ.status & ORGAN_ROBOT) && !(species.flags & NO_BLOOD)) //There is no blood in protheses.
|
||||
|
||||
@@ -134,28 +134,29 @@
|
||||
continue
|
||||
|
||||
if(E.is_broken() || E.is_dislocated())
|
||||
if(E.body_part == HAND_LEFT)
|
||||
if(!l_hand)
|
||||
continue
|
||||
drop_from_inventory(l_hand)
|
||||
else
|
||||
if(!r_hand)
|
||||
continue
|
||||
drop_from_inventory(r_hand)
|
||||
switch(E.body_part)
|
||||
if(HAND_LEFT, ARM_LEFT)
|
||||
if(!l_hand)
|
||||
continue
|
||||
drop_from_inventory(l_hand)
|
||||
if(HAND_RIGHT, ARM_RIGHT)
|
||||
if(!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 ")
|
||||
emote("me", 1, "[(species.flags & NO_PAIN) ? "" : emote_scream ]drops what they were holding in their [E.name]!")
|
||||
|
||||
else if(E.is_malfunctioning())
|
||||
|
||||
if(E.body_part == HAND_LEFT)
|
||||
if(!l_hand)
|
||||
continue
|
||||
drop_from_inventory(l_hand)
|
||||
else
|
||||
if(!r_hand)
|
||||
continue
|
||||
drop_from_inventory(r_hand)
|
||||
switch(E.body_part)
|
||||
if(HAND_LEFT, ARM_LEFT)
|
||||
if(!l_hand)
|
||||
continue
|
||||
drop_from_inventory(l_hand)
|
||||
if(HAND_RIGHT, ARM_RIGHT)
|
||||
if(!r_hand)
|
||||
continue
|
||||
drop_from_inventory(r_hand)
|
||||
|
||||
emote("me", 1, "drops what they were holding, their [E.name] malfunctioning!")
|
||||
|
||||
|
||||
@@ -1018,9 +1018,7 @@
|
||||
|
||||
//Periodically double-check embedded_flag
|
||||
if(embedded_flag && !(life_tick % 10))
|
||||
var/list/E
|
||||
E = get_visible_implants(0)
|
||||
if(!E.len)
|
||||
if(!embedded_needs_process())
|
||||
embedded_flag = 0
|
||||
|
||||
//Eyes
|
||||
|
||||
@@ -856,6 +856,9 @@
|
||||
visible_implants += O
|
||||
return visible_implants
|
||||
|
||||
/mob/proc/embedded_needs_process()
|
||||
return (embedded.len > 0)
|
||||
|
||||
mob/proc/yank_out_object()
|
||||
set category = "Object"
|
||||
set name = "Yank out object"
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
var/joint = "joint" // Descriptive string used in dislocation.
|
||||
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/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
|
||||
|
||||
/obj/item/organ/external/Destroy()
|
||||
|
||||
Reference in New Issue
Block a user