From f5ccbe5ba73d1321881baa0fb7064fa059851fe8 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 12 Nov 2014 13:42:08 -0500 Subject: [PATCH] Cleans up human stance code Merges leg_tally and can_stand, streamlined the stance checks in organ processing. Removes half-implemented has_limbs (assigned to 1 but never updated anywhere). Having only one foot now slows you down. --- .../mob/living/carbon/human/human_movement.dm | 3 ++ code/modules/mob/mob.dm | 27 ++++++++------- code/modules/mob/mob_defines.dm | 5 ++- code/modules/organs/organ.dm | 34 ++++++++----------- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 30c883becbc..c72574495d7 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -55,6 +55,9 @@ if (bodytemperature < 283.222) tally += (283.222 - bodytemperature) / 10 * 1.75 + if(can_stand <= 1) + tally += 5 //hopping around on one foot is slow + if(mRun in mutations) tally = 0 diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 8362e34c89e..9577a476f64 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -847,17 +847,18 @@ note dizziness decrements automatically in the mob's Life() proc. lying = 0 canmove = 1 pixel_y = V.mob_offset_y - else if(buckled && (!buckled.movable)) - anchored = 1 - canmove = 0 - if(istype(buckled,/obj/structure/stool/bed/chair) ) - lying = 0 + else if(buckled) + if (!buckled.movable) + anchored = 1 + canmove = 0 + if(istype(buckled,/obj/structure/stool/bed/chair) ) + lying = 0 + else + lying = 1 else - lying = 1 - else if (buckled && (buckled.movable)) - anchored = 0 - canmove = 1 - lying = 0 + anchored = 0 + canmove = 1 + lying = 0 else if( stat || weakened || paralysis || resting || sleeping || (status_flags & FAKEDEATH)) lying = 1 canmove = 0 @@ -867,9 +868,9 @@ note dizziness decrements automatically in the mob's Life() proc. anchored = 1 canmove = 0 lying = 0 - else if (!buckled) - lying = !can_stand - canmove = has_limbs + else + lying = 0 + canmove = 1 if(lying) density = 0 diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 08e01d2b884..d037b6fd31a 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -213,11 +213,10 @@ var/universal_speak = 0 // Set to 1 to enable the mob to speak to everyone -- TLE var/universal_understand = 0 // Set to 1 to enable the mob to understand everyone, not necessarily speak - var/has_limbs = 1 //Whether this mob have any limbs he can move with - var/can_stand = 1 //Whether this mob have ability to stand + var/can_stand = 2 //Whether this mob have ability to stand var/immune_to_ssd = 0 var/turf/listed_turf = null //the current turf being examined in the stat panel - var/list/active_genes=list() \ No newline at end of file + var/list/active_genes=list() diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm index a69ee36c7d6..72af3d913a9 100644 --- a/code/modules/organs/organ.dm +++ b/code/modules/organs/organ.dm @@ -60,7 +60,6 @@ /mob/living/carbon/human/proc/handle_organs() number_wounds = 0 - var/leg_tally = 2 var/force_process = 0 var/damage_this_tick = getBruteLoss() + getFireLoss() + getToxLoss() if(damage_this_tick > last_dam) @@ -75,6 +74,9 @@ for(var/datum/organ/internal/I in internal_organs) I.process() + //losing a limb stops it from processing, so this has to be done separately + handle_stance() + if(!force_process && !bad_external_organs.len) return @@ -101,23 +103,17 @@ if (W.infection_check()) W.germ_level += 1 - if(E.name in list("l_leg","l_foot","r_leg","r_foot") && !lying) - if (!E.is_usable() || E.is_malfunctioning() || (E.is_broken() && !(E.status & ORGAN_SPLINTED))) - leg_tally-- // let it fail even if just foot&leg +/mob/living/carbon/human/proc/handle_stance() + can_stand = 2 + for (var/organ in list("l_leg","l_foot","r_leg","r_foot")) + var/datum/organ/external/E = organs_by_name[organ] + if ((E.status & ORGAN_DESTROYED) || E.is_malfunctioning() || (E.is_broken() && !(E.status & ORGAN_SPLINTED)) || !E.is_usable()) + can_stand-- // let it fail even if just foot&leg // standing is poor - if(leg_tally <= 0 && !paralysis && !(lying || resting) && prob(5)) - if(species && species.flags & NO_PAIN) - emote("scream") - emote("collapse") - paralysis = 10 - - //Check arms and legs for existence - can_stand = 2 //can stand on both legs - var/datum/organ/external/E = organs_by_name["l_foot"] - if(E.status & ORGAN_DESTROYED) - can_stand-- - - E = organs_by_name["r_foot"] - if(E.status & ORGAN_DESTROYED) - can_stand-- + if(can_stand <= 0) + Weaken(10) + if (!(lying || resting)) + if(species && !(species.flags & NO_PAIN)) + emote("scream") + emote("collapse") \ No newline at end of file