mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 04:27:35 +01:00
Refactors custom_pain to work on organs instead of on mobs (#23160)
* Wolf request * Update code/modules/mob/living/carbon/human/human_organs.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> --------- Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
@@ -34,6 +34,10 @@
|
||||
///Should this organ be destroyed on removal?
|
||||
var/destroy_on_removal = FALSE
|
||||
|
||||
/// What was the last pain message that was sent?
|
||||
var/last_pain_message
|
||||
/// When can we get the next pain message?
|
||||
var/next_pain_time
|
||||
|
||||
/obj/item/organ/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
@@ -219,7 +223,7 @@
|
||||
if(owner && parent_organ && amount > 0)
|
||||
var/obj/item/organ/external/parent = owner.get_organ(parent_organ)
|
||||
if(parent && !silent)
|
||||
owner.custom_pain("Something inside your [parent.name] hurts a lot.")
|
||||
custom_pain("Something inside your [parent.name] hurts a lot.")
|
||||
|
||||
//check if we've hit max_damage
|
||||
if(damage >= max_damage)
|
||||
@@ -306,3 +310,16 @@ I use this so that this can be made better once the organ overhaul rolls out --
|
||||
robotize()
|
||||
status = data["status"]
|
||||
..()
|
||||
|
||||
// A proc to send a pain message to the owner.
|
||||
/obj/item/organ/proc/custom_pain(message)
|
||||
if(!owner.can_feel_pain() || !message)
|
||||
return
|
||||
|
||||
var/msg = "<span class='userdanger'>[message]</span>"
|
||||
|
||||
// Anti message spam checks
|
||||
if(msg != last_pain_message || world.time >= next_pain_time)
|
||||
last_pain_message = msg
|
||||
to_chat(owner, msg)
|
||||
next_pain_time = world.time + 10 SECONDS
|
||||
|
||||
@@ -716,7 +716,7 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
if(limb_flags & CANNOT_INT_BLEED)
|
||||
return
|
||||
status |= ORGAN_INT_BLEEDING
|
||||
owner.custom_pain("You feel something rip in your [name]!")
|
||||
custom_pain("You feel something rip in your [name]!")
|
||||
|
||||
/obj/item/organ/external/proc/fix_internal_bleeding()
|
||||
if(is_robotic())
|
||||
|
||||
@@ -39,20 +39,6 @@
|
||||
to_chat(src, msg)
|
||||
next_pain_time = world.time + (100 - amount)
|
||||
|
||||
|
||||
// message is the custom message to be displayed
|
||||
/mob/living/carbon/proc/custom_pain(message)
|
||||
if(!can_feel_pain())
|
||||
return
|
||||
|
||||
var/msg = "<span class='userdanger'>[message]</span>"
|
||||
|
||||
// Anti message spam checks
|
||||
if(msg && ((msg != last_pain_message) && (world.time >= next_pain_time)))
|
||||
last_pain_message = msg
|
||||
to_chat(src, msg)
|
||||
next_pain_time = world.time + 10 SECONDS
|
||||
|
||||
/mob/living/carbon/human/proc/handle_pain()
|
||||
// not when sleeping
|
||||
|
||||
@@ -89,4 +75,4 @@
|
||||
intensity = "a sharp"
|
||||
else
|
||||
intensity = "a stabbing"
|
||||
custom_pain("You feel [intensity] pain in your [parent.limb_name]!")
|
||||
I.custom_pain("You feel [intensity] pain in your [parent.limb_name]!")
|
||||
|
||||
Reference in New Issue
Block a user