mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Refactors dislocation, clearer distinction between is_dislocated() and is_usable()
Dislocation no longer relies on adjusting dislocated state of children. Fixes dislocating and relocating parent organs magically fixing children or protecting children from being dislocated. Dislocated limbs no longer count as unusable, since they already count for stance damage and dropping items anyways. In addition, dislocated limbs add to traumatic_shock Also corrects a misusage of traumatic_shock
This commit is contained in:
@@ -194,7 +194,7 @@
|
||||
status += "hurts when touched"
|
||||
if(org.status & ORGAN_DEAD)
|
||||
status += "is bruised and necrotic"
|
||||
if(!org.is_usable())
|
||||
if(!org.is_usable() || org.is_dislocated())
|
||||
status += "dangling uselessly"
|
||||
if(status.len)
|
||||
src.show_message("My [org.name] is <span class='warning'> [english_list(status)].</span>",1)
|
||||
|
||||
@@ -1324,7 +1324,7 @@
|
||||
var/list/limbs = list()
|
||||
for(var/limb in organs_by_name)
|
||||
var/obj/item/organ/external/current_limb = organs_by_name[limb]
|
||||
if(current_limb && current_limb.dislocated == 2)
|
||||
if(current_limb && current_limb.dislocated > 0 && !current_limb.is_parent_dislocated()) //if the parent is also dislocated you will have to relocate that first
|
||||
limbs |= limb
|
||||
var/choice = input(usr,"Which joint do you wish to relocate?") as null|anything in limbs
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@
|
||||
if(!target_zone)
|
||||
return 0
|
||||
var/obj/item/organ/external/organ = get_organ(check_zone(target_zone))
|
||||
if(!organ || organ.is_dislocated() || organ.dislocated == -1)
|
||||
if(!organ || organ.dislocated > 0 || organ.dislocated == -1) //don't use is_dislocated() here, that checks parent
|
||||
return 0
|
||||
|
||||
user.visible_message("<span class='warning'>[user] begins to dislocate [src]'s [organ.joint]!</span>")
|
||||
|
||||
@@ -847,7 +847,10 @@
|
||||
if(!isSynthetic() && (species.flags & IS_PLANT) && (!light_organ || light_organ.is_broken()))
|
||||
if(nutrition < 200)
|
||||
take_overall_damage(2,0)
|
||||
traumatic_shock++
|
||||
|
||||
//traumatic_shock is updated every tick, incrementing that is pointless - shock_stage is the counter.
|
||||
//Not that it matters much for diona, who have NO_PAIN.
|
||||
shock_stage++
|
||||
|
||||
// TODO: stomach and bloodstream organ.
|
||||
if(!isSynthetic())
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
if(istype(src,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/M = src
|
||||
for(var/obj/item/organ/external/organ in M.organs)
|
||||
if(organ && (organ.is_broken() || organ.open))
|
||||
if(organ.is_broken() || organ.open)
|
||||
src.traumatic_shock += 30
|
||||
else if(organ.is_dislocated())
|
||||
src.traumatic_shock += 15
|
||||
|
||||
if(src.traumatic_shock < 0)
|
||||
src.traumatic_shock = 0
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
var/cannot_gib // Impossible to gib, distinct from amputation.
|
||||
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/dislocated = 0 // If you target a joint, you can dislocate the limb, impairing it's usefulness and causing pain
|
||||
var/encased // Needs to be opened with a saw to access the organs.
|
||||
|
||||
// Surgery vars.
|
||||
@@ -156,32 +156,38 @@
|
||||
/obj/item/organ/external/proc/is_dislocated()
|
||||
if(dislocated > 0)
|
||||
return 1
|
||||
if(parent)
|
||||
return parent.is_dislocated()
|
||||
if(is_parent_dislocated())
|
||||
return 1//if any parent is dislocated, we are considered dislocated as well
|
||||
return 0
|
||||
|
||||
/obj/item/organ/external/proc/dislocate(var/primary)
|
||||
if(dislocated != -1)
|
||||
if(primary)
|
||||
dislocated = 2
|
||||
else
|
||||
dislocated = 1
|
||||
owner.verbs |= /mob/living/carbon/human/proc/undislocate
|
||||
if(children && children.len)
|
||||
for(var/obj/item/organ/external/child in children)
|
||||
child.dislocate()
|
||||
/obj/item/organ/external/proc/is_parent_dislocated()
|
||||
var/obj/item/organ/external/O = parent
|
||||
while(O && O.dislocated != -1)
|
||||
if(O.dislocated == 1)
|
||||
return 1
|
||||
O = O.parent
|
||||
return 0
|
||||
|
||||
|
||||
/obj/item/organ/external/proc/dislocate()
|
||||
if(dislocated == -1)
|
||||
return
|
||||
|
||||
dislocated = 1
|
||||
if(owner)
|
||||
owner.verbs |= /mob/living/carbon/human/proc/undislocate
|
||||
|
||||
/obj/item/organ/external/proc/undislocate()
|
||||
if(dislocated != -1)
|
||||
dislocated = 0
|
||||
if(children && children.len)
|
||||
for(var/obj/item/organ/external/child in children)
|
||||
if(child.dislocated == 1)
|
||||
child.undislocate()
|
||||
if(dislocated == -1)
|
||||
return
|
||||
|
||||
dislocated = 0
|
||||
if(owner)
|
||||
owner.shock_stage += 20
|
||||
|
||||
//check to see if we still need the verb
|
||||
for(var/obj/item/organ/external/limb in owner.organs)
|
||||
if(limb.dislocated == 2)
|
||||
if(limb.dislocated == 1)
|
||||
return
|
||||
owner.verbs -= /mob/living/carbon/human/proc/undislocate
|
||||
|
||||
@@ -1085,7 +1091,7 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
return 0
|
||||
|
||||
/obj/item/organ/external/proc/is_usable()
|
||||
return !is_dislocated() && !(status & (ORGAN_MUTATED|ORGAN_DEAD))
|
||||
return !(status & (ORGAN_MUTATED|ORGAN_DEAD))
|
||||
|
||||
/obj/item/organ/external/proc/is_malfunctioning()
|
||||
return ((robotic >= ORGAN_ROBOT) && (brute_dam + burn_dam) >= 10 && prob(brute_dam + burn_dam))
|
||||
|
||||
Reference in New Issue
Block a user