From 240aed884ed6c160888cb4ee8896e5567c2167c6 Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Sun, 14 Jun 2015 11:03:03 +0200 Subject: [PATCH 01/13] mob/living/Life() now handles chemicals in the body. --- code/modules/mob/living/carbon/alien/life.dm | 7 ------- code/modules/mob/living/carbon/brain/life.dm | 6 +----- code/modules/mob/living/carbon/human/life.dm | 8 ++++---- code/modules/mob/living/carbon/metroid/life.dm | 3 +-- code/modules/mob/living/life.dm | 6 ++++++ 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index e13f6b46707..2977b31bf5d 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -10,13 +10,9 @@ ..() if (stat != DEAD) //still breathing - // GROW! update_progression() - // Chemicals in the body - handle_chemicals_in_body() - blinded = null //Status updates, death etc. @@ -27,9 +23,6 @@ if(client) handle_regular_hud_updates() -/mob/living/carbon/alien/proc/handle_chemicals_in_body() - return // Nothing yet. Maybe check it out at a later date. - /mob/living/carbon/alien/handle_mutations_and_radiation() // Currently both Dionaea and larvae like to eat radiation, so I'm defining the diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index 64f45649417..7df46c394d0 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -6,10 +6,6 @@ set background = 1 ..() - if(stat != DEAD) - //Chemicals in the body - handle_chemicals_in_body() - //Apparently, the person who wrote this code designed it so that //blinded get reset each cycle and then get activated later in the //code. Very ugly. I dont care. Moving this stuff here so its easy @@ -91,7 +87,7 @@ adjustFireLoss(5.0*discomfort) -/mob/living/carbon/brain/proc/handle_chemicals_in_body() +/mob/living/carbon/brain/handle_chemicals_in_body() chem_effects.Cut() analgesic = 0 diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 25299f19fa7..bdada0e1ebc 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -66,9 +66,6 @@ //Updates the number of stored chemicals for powers handle_changeling() - //Chemicals in the body - handle_chemicals_in_body() - //Disabilities handle_disabilities() @@ -845,7 +842,10 @@ return min(1,thermal_protection) -/mob/living/carbon/human/proc/handle_chemicals_in_body() +/mob/living/carbon/human/handle_chemicals_in_body() + if(in_stasis) + return + if(reagents) chem_effects.Cut() analgesic = 0 diff --git a/code/modules/mob/living/carbon/metroid/life.dm b/code/modules/mob/living/carbon/metroid/life.dm index 00d28b3a37c..a04db40e073 100644 --- a/code/modules/mob/living/carbon/metroid/life.dm +++ b/code/modules/mob/living/carbon/metroid/life.dm @@ -8,7 +8,6 @@ ..() if(stat != DEAD) - handle_chemicals_in_body() handle_nutrition() if (!client) @@ -74,7 +73,7 @@ temp_change = (temperature - current) return temp_change -/mob/living/carbon/slime/proc/handle_chemicals_in_body() +/mob/living/carbon/slime/handle_chemicals_in_body() chem_effects.Cut() analgesic = 0 diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 751b995c83b..b7d1fa92b8b 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -15,6 +15,9 @@ //Mutations and radiation handle_mutations_and_radiation() + //Chemicals in the body + handle_chemicals_in_body() + . = 1 //Handle temperature/pressure differences between body and environment @@ -27,5 +30,8 @@ /mob/living/proc/handle_mutations_and_radiation() return +/mob/living/proc/handle_chemicals_in_body() + return + /mob/living/proc/handle_environment(var/datum/gas_mixture/environment) return From a14406f83ab6e0d0ed7b4e334b6a2556c6f45289 Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Sun, 14 Jun 2015 11:14:31 +0200 Subject: [PATCH 02/13] mob/living/Life() now handles blood. --- code/modules/mob/living/carbon/human/life.dm | 4 ++-- code/modules/mob/living/life.dm | 6 ++++++ code/modules/organs/blood.dm | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index bdada0e1ebc..aaf61f07c09 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -47,7 +47,6 @@ //to find it. blinded = null fire_alert = 0 //Reset this here, because both breathe() and handle_environment() have a chance to set it. - ..() //TODO: seperate this out // update the current life tick, can be used to e.g. only do something every 4 ticks @@ -56,6 +55,8 @@ in_stasis = istype(loc, /obj/structure/closet/body_bag/cryobag) && loc:opened == 0 if(in_stasis) loc:used++ + ..() + if(life_tick%30==15) hud_updateflag = 1022 @@ -71,7 +72,6 @@ //Organs and blood handle_organs() - handle_blood() stabilize_body_temperature() //Body temperature adjusts itself (self-regulation) //Random events (vomiting etc) diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index b7d1fa92b8b..a0ac76b4527 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -18,6 +18,9 @@ //Chemicals in the body handle_chemicals_in_body() + //Blood + handle_blood() + . = 1 //Handle temperature/pressure differences between body and environment @@ -33,5 +36,8 @@ /mob/living/proc/handle_chemicals_in_body() return +/mob/living/proc/handle_blood() + return + /mob/living/proc/handle_environment(var/datum/gas_mixture/environment) return diff --git a/code/modules/organs/blood.dm b/code/modules/organs/blood.dm index 70c2281bb30..4c756ace0ce 100644 --- a/code/modules/organs/blood.dm +++ b/code/modules/organs/blood.dm @@ -35,7 +35,9 @@ var/const/BLOOD_VOLUME_SURVIVE = 122 B.color = B.data["blood_colour"] // Takes care blood loss and regeneration -/mob/living/carbon/human/proc/handle_blood() +/mob/living/carbon/human/handle_blood() + if(in_stasis) + return if(species && species.flags & NO_BLOOD) return From 03be640d019b2281321675d4dcce7ae1439beae4 Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Sun, 14 Jun 2015 11:17:04 +0200 Subject: [PATCH 03/13] mob/living/Life() now handles random events (vomiting etc). --- code/modules/mob/living/carbon/human/life.dm | 8 ++++---- code/modules/mob/living/life.dm | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index aaf61f07c09..165d69bc7b1 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -74,9 +74,6 @@ handle_organs() stabilize_body_temperature() //Body temperature adjusts itself (self-regulation) - //Random events (vomiting etc) - handle_random_events() - //stuff in the stomach handle_stomach() @@ -1416,7 +1413,10 @@ O.process_hud(src) if(!druggy && !seer) see_invisible = SEE_INVISIBLE_LIVING -/mob/living/carbon/human/proc/handle_random_events() +/mob/living/carbon/human/handle_random_events() + if(in_stasis) + return + // Puke if toxloss is too high if(!stat) if (getToxLoss() >= 45 && nutrition > 20) diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index a0ac76b4527..b4772bf89fe 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -21,6 +21,9 @@ //Blood handle_blood() + //Random events (vomiting etc) + handle_random_events() + . = 1 //Handle temperature/pressure differences between body and environment @@ -39,5 +42,8 @@ /mob/living/proc/handle_blood() return +/mob/living/proc/handle_random_events() + return + /mob/living/proc/handle_environment(var/datum/gas_mixture/environment) return From 1a7e8976afbb69f410ca5ee140c7a75f7ed8d1af Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Sun, 14 Jun 2015 11:26:52 +0200 Subject: [PATCH 04/13] mob/living/Life() now handles fire. Aliens (largery un-used on Bay) and robots now deal with fire differently. --- code/modules/mob/living/carbon/alien/life.dm | 6 +++++ code/modules/mob/living/carbon/human/life.dm | 3 --- code/modules/mob/living/life.dm | 3 +++ code/modules/mob/living/living_defense.dm | 24 +++++++++---------- code/modules/mob/living/silicon/robot/life.dm | 9 +++++++ .../mob/living/simple_animal/simple_animal.dm | 14 +++++++++-- 6 files changed, 42 insertions(+), 17 deletions(-) diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index 2977b31bf5d..27a73c596ed 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -173,3 +173,9 @@ src << "\red You feel a searing heat!" else if (fire) fire.icon_state = "fire0" + +/mob/living/carbon/alien/handle_fire() + if(..()) + return + bodytemperature += BODYTEMP_HEATING_MAX //If you're on fire, you heat up! + return diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 165d69bc7b1..65cb0aface7 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -93,9 +93,6 @@ if(life_tick > 5 && timeofdeath && (timeofdeath < 5 || world.time - timeofdeath > 6000)) //We are long dead, or we're junk mobs spawned like the clowns on the clown shuttle return //We go ahead and process them 5 times for HUD images and other stuff though. - //Check if we're on fire - handle_fire() - //Status updates, death etc. handle_regular_status_updates() //Optimized a bit update_canmove() diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index b4772bf89fe..23724cc0d2c 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -26,6 +26,9 @@ . = 1 + //Check if we're on fire + handle_fire() + //Handle temperature/pressure differences between body and environment if(environment) handle_environment(environment) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index e0385e7d2b7..24ebc4d8442 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -219,7 +219,7 @@ /mob/living/proc/handle_fire() if(fire_stacks < 0) - fire_stacks = max(0, fire_stacks++) //If we've doused ourselves in water to avoid fire, dry off slowly + fire_stacks = min(0, fire_stacks++) //If we've doused ourselves in water to avoid fire, dry off slowly if(!on_fire) return 1 @@ -324,49 +324,49 @@ //If simple_animals are ever moved under carbon, then this can probably be moved to carbon as well /mob/living/proc/attack_throat(obj/item/W, obj/item/weapon/grab/G, mob/user) - + // Knifing if(!W.edge || !W.force || W.damtype != BRUTE) return //unsuitable weapon - + user.visible_message("\The [user] begins to slit [src]'s throat with \the [W]!") - + user.next_move = world.time + 20 //also should prevent user from triggering this repeatedly if(!do_after(user, 20)) return if(!(G && G.assailant == user && G.affecting == src)) //check that we still have a grab return - + var/damage_mod = 1 //presumably, if they are wearing a helmet that stops pressure effects, then it probably covers the throat as well var/obj/item/clothing/head/helmet = get_equipped_item(slot_head) if(istype(helmet) && (helmet.body_parts_covered & HEAD) && (helmet.flags & STOPPRESSUREDAMAGE)) //we don't do an armor_check here because this is not an impact effect like a weapon swung with momentum, that either penetrates or glances off. damage_mod = 1.0 - (helmet.armor["melee"]/100) - + var/total_damage = 0 for(var/i in 1 to 3) var/damage = min(W.force*1.5, 20)*damage_mod apply_damage(damage, W.damtype, "head", 0, sharp=W.sharp, edge=W.edge) total_damage += damage - + var/oxyloss = total_damage if(total_damage >= 40) //threshold to make someone pass out oxyloss = 60 // Brain lacks oxygen immediately, pass out - + adjustOxyLoss(min(oxyloss, 100 - getOxyLoss())) //don't put them over 100 oxyloss - + if(total_damage) if(oxyloss >= 40) user.visible_message("\The [user] slit [src]'s throat open with \the [W]!") else user.visible_message("\The [user] cut [src]'s neck with \the [W]!") - + if(W.hitsound) playsound(loc, W.hitsound, 50, 1, -1) - + G.last_action = world.time flick(G.hud.icon_state, G.hud) - + user.attack_log += "\[[time_stamp()]\] Knifed [name] ([ckey]) with [W.name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(W.damtype)])" src.attack_log += "\[[time_stamp()]\] Got knifed by [user.name] ([user.ckey]) with [W.name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(W.damtype)])" msg_admin_attack("[key_name(user)] knifed [key_name(src)] with [W.name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(W.damtype)])" ) diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 58159f33829..bd3e280f684 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -331,3 +331,12 @@ if(paralysis || stunned || weakened || buckled || lockcharge || !is_component_functioning("actuator")) canmove = 0 else canmove = 1 return canmove + +/mob/living/silicon/robot/update_fire() + overlays -= image("icon"='icons/mob/OnFire.dmi', "icon_state"="Standing") + if(on_fire) + overlays += image("icon"='icons/mob/OnFire.dmi', "icon_state"="Standing") + +/mob/living/silicon/robot/fire_act() + if(!on_fire) //Silicons don't gain stacks from hotspots, but hotspots can ignite them + IgniteMob() diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index e2ec5059a2b..8a58d971124 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -295,7 +295,7 @@ if(!O.force) visible_message("[user] gently taps [src] with \the [O].") return - + if(O.force > resistance) var/damage = O.force if (O.damtype == HALLOSS) @@ -306,7 +306,7 @@ adjustBruteLoss(damage) else usr << "[src] has been attacked with the [O] by [user].") user.do_attack_animation(src) @@ -404,3 +404,13 @@ else user.visible_message("[user] butchers \the [src] messily!") gib() + +/mob/living/simple_animal/handle_fire() + return + +/mob/living/simple_animal/update_fire() + return +/mob/living/simple_animal/IgniteMob() + return +/mob/living/simple_animal/ExtinguishMob() + return From c8b7a773993be6db98d65c38cedb2590babefbda Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Wed, 17 Jun 2015 15:19:41 +0200 Subject: [PATCH 05/13] mob/living/Life() now handles stomach contents. --- code/modules/mob/living/carbon/human/life.dm | 5 +---- code/modules/mob/living/life.dm | 12 +++++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 65cb0aface7..0495bcc32b8 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -74,9 +74,6 @@ handle_organs() stabilize_body_temperature() //Body temperature adjusts itself (self-regulation) - //stuff in the stomach - handle_stomach() - handle_shock() handle_pain() @@ -1426,7 +1423,7 @@ if(L && L.lum_r + L.lum_g + L.lum_b == 0) playsound_local(src,pick(scarySounds),50, 1, -1) -/mob/living/carbon/human/proc/handle_stomach() +/mob/living/carbon/human/handle_stomach() spawn(0) for(var/mob/living/M in stomach_contents) if(M.loc != src) diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 23724cc0d2c..5db47928f53 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -26,13 +26,16 @@ . = 1 - //Check if we're on fire - handle_fire() - //Handle temperature/pressure differences between body and environment if(environment) handle_environment(environment) + //Check if we're on fire + handle_fire() + + //stuff in the stomach + handle_stomach() + /mob/living/proc/handle_breathing() return @@ -50,3 +53,6 @@ /mob/living/proc/handle_environment(var/datum/gas_mixture/environment) return + +/mob/living/proc/handle_stomach() + return From 9887f161351c4a3319ef122f6513561e268d6b40 Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Wed, 17 Jun 2015 15:32:23 +0200 Subject: [PATCH 06/13] mob/living/Life() now has basic gravity handling (no overrides). --- code/game/area/areas.dm | 16 +++++++++++++++- code/modules/mob/living/life.dm | 2 ++ code/modules/mob/mob_movement.dm | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index dccc9e9dbf6..e342ba33292 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -299,4 +299,18 @@ var/list/mob/living/forced_ambiance_list = new for(var/obj/machinery/door/airlock/temp_airlock in src) temp_airlock.prison_open() for(var/obj/machinery/door/window/temp_windoor in src) - temp_windoor.open() \ No newline at end of file + temp_windoor.open() + +/area/proc/has_gravity() + return has_gravity + +/area/space/has_gravity() + return 0 + +/proc/has_gravity(atom/AT, turf/T) + if(!T) + T = get_turf(AT) + var/area/A = get_area(T) + if(A && A.has_gravity()) + return 1 + return 0 diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 5db47928f53..63f0739a3f9 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -36,6 +36,8 @@ //stuff in the stomach handle_stomach() + update_gravity(mob_has_gravity()) + /mob/living/proc/handle_breathing() return diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 7eefc97d688..8ba66ffe317 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -520,3 +520,9 @@ prob_slip = round(prob_slip) return(prob_slip) + +/mob/proc/mob_has_gravity(turf/T) + return has_gravity(src, T) + +/mob/proc/update_gravity() + return From 838739c4edb21ec8645696b1220cb678f3a09702 Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Wed, 17 Jun 2015 15:35:41 +0200 Subject: [PATCH 07/13] mob/living/Life() now handles updating pulling. --- code/modules/mob/living/life.dm | 7 +++++++ code/modules/mob/living/living_defense.dm | 4 ++++ code/modules/mob/mob.dm | 2 ++ 3 files changed, 13 insertions(+) diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 63f0739a3f9..bafdfa4efe8 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -38,6 +38,8 @@ update_gravity(mob_has_gravity()) + update_pulling() + /mob/living/proc/handle_breathing() return @@ -58,3 +60,8 @@ /mob/living/proc/handle_stomach() return + +/mob/living/proc/update_pulling() + if(pulling) + if(incapacitated()) + stop_pulling() diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 24ebc4d8442..a566c3a901d 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -371,3 +371,7 @@ src.attack_log += "\[[time_stamp()]\] Got knifed by [user.name] ([user.ckey]) with [W.name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(W.damtype)])" msg_admin_attack("[key_name(user)] knifed [key_name(src)] with [W.name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(W.damtype)])" ) return + +/mob/living/incapacitated() + if(stat || paralysis || stunned || weakened || restrained()) + return 1 diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 2264f60a54b..6fba60f97ce 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -118,6 +118,8 @@ //handle_typing_indicator() //You said the typing indicator would be fine. The test determined that was a lie. return +/mob/proc/incapacitated() + return /mob/proc/restrained() return From 225ed82c1c075a9dfc4977bca85ed62b9ecd44b7 Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Wed, 17 Jun 2015 15:38:53 +0200 Subject: [PATCH 08/13] mob/living/Life() now handles can move. --- code/modules/mob/living/carbon/alien/life.dm | 1 - code/modules/mob/living/carbon/brain/life.dm | 1 - code/modules/mob/living/carbon/human/life.dm | 1 - code/modules/mob/living/life.dm | 2 ++ 4 files changed, 2 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index 27a73c596ed..6eee1ac7a79 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -17,7 +17,6 @@ //Status updates, death etc. handle_regular_status_updates() - update_canmove() update_icons() if(client) diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index 7df46c394d0..f4758cb335e 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -14,7 +14,6 @@ //Status updates, death etc. handle_regular_status_updates() - update_canmove() if(client) handle_regular_hud_updates() diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 0495bcc32b8..35569e10bef 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -92,7 +92,6 @@ //Status updates, death etc. handle_regular_status_updates() //Optimized a bit - update_canmove() //Update our name based on whether our face is obscured/disfigured name = get_visible_name() diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index bafdfa4efe8..6e27266ce60 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -40,6 +40,8 @@ update_pulling() + update_canmove() + /mob/living/proc/handle_breathing() return From b98d64b66857f4cd63580140157a49debbef5207 Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Wed, 17 Jun 2015 15:41:25 +0200 Subject: [PATCH 09/13] mob/living/Life() now handles processing grabs. --- code/modules/mob/living/carbon/human/life.dm | 4 ---- code/modules/mob/living/life.dm | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 35569e10bef..9b1183e75e7 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -100,10 +100,6 @@ pulse = handle_pulse() - // Grabbing - for(var/obj/item/weapon/grab/G in src) - G.process() - /mob/living/carbon/human/breathe() if(!in_stasis) ..() diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 6e27266ce60..5cd668cc408 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -40,6 +40,9 @@ update_pulling() + for(var/obj/item/weapon/grab/G in src) + G.process() + update_canmove() /mob/living/proc/handle_breathing() From d4b2fb71768d8f9002d7431bb04fd321706e99ab Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Wed, 17 Jun 2015 15:47:24 +0200 Subject: [PATCH 10/13] mob/living/Life() now handles regular hud updates. --- code/modules/mob/living/carbon/alien/life.dm | 5 +--- code/modules/mob/living/carbon/brain/life.dm | 5 +--- code/modules/mob/living/carbon/human/life.dm | 4 +-- code/modules/mob/living/life.dm | 25 +++++++++++++++++++ code/modules/mob/living/silicon/robot/life.dm | 2 +- 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index 6eee1ac7a79..fcd5a372d43 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -19,9 +19,6 @@ handle_regular_status_updates() update_icons() - if(client) - handle_regular_hud_updates() - /mob/living/carbon/alien/handle_mutations_and_radiation() // Currently both Dionaea and larvae like to eat radiation, so I'm defining the @@ -100,7 +97,7 @@ return 1 -/mob/living/carbon/alien/proc/handle_regular_hud_updates() +/mob/living/carbon/alien/handle_regular_hud_updates() if (stat == 2 || (XRAY in src.mutations)) sight |= SEE_TURFS diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index f4758cb335e..ca0d1aa1de5 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -15,9 +15,6 @@ //Status updates, death etc. handle_regular_status_updates() - if(client) - handle_regular_hud_updates() - /mob/living/carbon/brain/handle_mutations_and_radiation() if (radiation) if (radiation > 100) @@ -181,7 +178,7 @@ handle_statuses() return 1 -/mob/living/carbon/brain/proc/handle_regular_hud_updates() +/mob/living/carbon/brain/handle_regular_hud_updates() if (stat == 2 || (XRAY in src.mutations)) sight |= SEE_TURFS sight |= SEE_MOBS diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 9b1183e75e7..e9d55414bd1 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -96,8 +96,6 @@ //Update our name based on whether our face is obscured/disfigured name = get_visible_name() - handle_regular_hud_updates() - pulse = handle_pulse() /mob/living/carbon/human/breathe() @@ -1076,7 +1074,7 @@ return 1 -/mob/living/carbon/human/proc/handle_regular_hud_updates() +/mob/living/carbon/human/handle_regular_hud_updates() if(!overlays_cache) overlays_cache = list() overlays_cache.len = 23 diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 5cd668cc408..7214f2e18f5 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -45,6 +45,9 @@ update_canmove() + if(client) + handle_regular_hud_updates() + /mob/living/proc/handle_breathing() return @@ -70,3 +73,25 @@ if(pulling) if(incapacitated()) stop_pulling() + +//this handles hud updates. Calls update_vision() and handle_hud_icons() +/mob/living/proc/handle_regular_hud_updates() + if(!client) return 0 + + handle_vision() + handle_hud_icons() + + return 1 + +/mob/living/proc/handle_vision() + return + +/mob/living/proc/update_sight() + return + +/mob/living/proc/handle_hud_icons() + handle_hud_icons_health() + return + +/mob/living/proc/handle_hud_icons_health() + return diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index bd3e280f684..6051c9c122e 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -144,7 +144,7 @@ return 1 -/mob/living/silicon/robot/proc/handle_regular_hud_updates() +/mob/living/silicon/robot/handle_regular_hud_updates() if (src.stat == 2 || XRAY in mutations || src.sight_mode & BORGXRAY) src.sight |= SEE_TURFS From 9d38bcc149cac1d10cb7a50a3ce59ad22be11320 Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Wed, 17 Jun 2015 16:01:26 +0200 Subject: [PATCH 11/13] mob/living/Life() now handles regular status updates. --- code/modules/mob/living/carbon/alien/life.dm | 3 +- code/modules/mob/living/carbon/brain/life.dm | 16 +------ code/modules/mob/living/carbon/human/life.dm | 17 ++++--- .../modules/mob/living/carbon/metroid/life.dm | 6 +-- code/modules/mob/living/life.dm | 47 +++++++++++++++++++ code/modules/mob/living/living.dm | 12 +++++ code/modules/mob/living/silicon/robot/life.dm | 2 +- code/modules/mob/living/silicon/silicon.dm | 6 +++ code/modules/mob/mob.dm | 6 +++ 9 files changed, 86 insertions(+), 29 deletions(-) diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index fcd5a372d43..a28afc25dcf 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -16,7 +16,6 @@ blinded = null //Status updates, death etc. - handle_regular_status_updates() update_icons() /mob/living/carbon/alien/handle_mutations_and_radiation() @@ -35,7 +34,7 @@ adjustToxLoss(-(rads)) return -/mob/living/carbon/alien/proc/handle_regular_status_updates() +/mob/living/carbon/alien/handle_regular_status_updates() if(status_flags & GODMODE) return 0 diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index ca0d1aa1de5..40f709efb5e 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -1,20 +1,6 @@ /mob/living/carbon/brain/handle_breathing() return -/mob/living/carbon/brain/Life() - set invisibility = 0 - set background = 1 - ..() - - //Apparently, the person who wrote this code designed it so that - //blinded get reset each cycle and then get activated later in the - //code. Very ugly. I dont care. Moving this stuff here so its easy - //to find it. - blinded = null - - //Status updates, death etc. - handle_regular_status_updates() - /mob/living/carbon/brain/handle_mutations_and_radiation() if (radiation) if (radiation > 100) @@ -108,7 +94,7 @@ return //TODO: DEFERRED -/mob/living/carbon/brain/proc/handle_regular_status_updates() //TODO: comment out the unused bits >_> +/mob/living/carbon/brain/handle_regular_status_updates() //TODO: comment out the unused bits >_> updatehealth() if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index e9d55414bd1..ac76041fb61 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -87,17 +87,19 @@ handle_stasis_bag() - if(life_tick > 5 && timeofdeath && (timeofdeath < 5 || world.time - timeofdeath > 6000)) //We are long dead, or we're junk mobs spawned like the clowns on the clown shuttle + if(!handle_some_updates()) return //We go ahead and process them 5 times for HUD images and other stuff though. - //Status updates, death etc. - handle_regular_status_updates() //Optimized a bit - //Update our name based on whether our face is obscured/disfigured name = get_visible_name() pulse = handle_pulse() +/mob/living/carbon/human/proc/handle_some_updates() + if(life_tick > 5 && timeofdeath && (timeofdeath < 5 || world.time - timeofdeath > 6000)) //We are long dead, or we're junk mobs spawned like the clowns on the clown shuttle + return 0 + return 1 + /mob/living/carbon/human/breathe() if(!in_stasis) ..() @@ -149,7 +151,7 @@ else return ONE_ATMOSPHERE + pressure_difference -/mob/living/carbon/human/proc/handle_disabilities() +/mob/living/carbon/human/handle_disabilities() if (disabilities & EPILEPSY) if ((prob(1) && paralysis < 1)) src << "\red You have a seizure!" @@ -911,7 +913,10 @@ return //TODO: DEFERRED -/mob/living/carbon/human/proc/handle_regular_status_updates() +/mob/living/carbon/human/handle_regular_status_updates() + if(!handle_some_updates()) + return 0 + if(status_flags & GODMODE) return 0 //SSD check, if a logged player is awake put them back to sleep! diff --git a/code/modules/mob/living/carbon/metroid/life.dm b/code/modules/mob/living/carbon/metroid/life.dm index a04db40e073..73f6913361b 100644 --- a/code/modules/mob/living/carbon/metroid/life.dm +++ b/code/modules/mob/living/carbon/metroid/life.dm @@ -17,10 +17,6 @@ handle_AI() handle_speech_and_mood() - regular_hud_updates() - - handle_regular_status_updates() // Status updates, death etc. - /mob/living/carbon/slime/handle_environment(datum/gas_mixture/environment) if(!environment) adjustToxLoss(rand(10,20)) @@ -91,7 +87,7 @@ return //TODO: DEFERRED -/mob/living/carbon/slime/proc/handle_regular_status_updates() +/mob/living/carbon/slime/handle_regular_status_updates() src.blinded = null diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 7214f2e18f5..14bdd03a7ae 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -43,6 +43,10 @@ for(var/obj/item/weapon/grab/G in src) G.process() + if(handle_regular_status_updates()) // Status & health update, are we dead or alive etc. + handle_disabilities() // eye, ear, brain damages + handle_status_effects() //all special effects, stunned, weakened, jitteryness, hallucination, sleeping, etc + update_canmove() if(client) @@ -74,6 +78,49 @@ if(incapacitated()) stop_pulling() +//This updates the health and status of the mob (conscious, unconscious, dead) +/mob/living/proc/handle_regular_status_updates() + updatehealth() + if(stat != DEAD) + if(paralysis) + stat = UNCONSCIOUS + else if (status_flags & FAKEDEATH) + stat = UNCONSCIOUS + else + stat = CONSCIOUS + return 1 + +//this updates all special effects: stunned, sleeping, weakened, druggy, stuttering, etc.. +/mob/living/proc/handle_status_effects() + if(paralysis) + paralysis = max(paralysis-1,0) + if(stunned) + stunned = max(stunned-1,0) + if(!stunned) + update_icons() + + if(weakened) + weakened = max(weakened-1,0) + if(!weakened) + update_icons() + +/mob/living/proc/handle_disabilities() + //Eyes + if(disabilities & BLIND || stat) //blindness from disability or unconsciousness doesn't get better on its own + eye_blind = max(eye_blind, 1) + else if(eye_blind) //blindness, heals slowly over time + eye_blind = max(eye_blind-1,0) + else if(eye_blurry) //blurry eyes heal slowly + eye_blurry = max(eye_blurry-1, 0) + + //Ears + if(disabilities & DEAF) //disabled-deaf, doesn't get better on its own + setEarDamage(-1, max(ear_deaf, 1)) + else + // deafness heals slowly over time, unless ear_damage is over 100 + if(ear_damage < 100) + adjustEarDamage(-0.05,-1) + //this handles hud updates. Calls update_vision() and handle_hud_icons() /mob/living/proc/handle_regular_hud_updates() if(!client) return 0 diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index af99441108d..e24fa8a7827 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -800,3 +800,15 @@ default behaviour is: return ..() + +//damage/heal the mob ears and adjust the deaf amount +/mob/living/adjustEarDamage(var/damage, var/deaf) + ear_damage = max(0, ear_damage + damage) + ear_deaf = max(0, ear_deaf + deaf) + +//pass a negative argument to skip one of the variable +/mob/living/setEarDamage(var/damage, var/deaf) + if(damage >= 0) + ear_damage = damage + if(deaf >= 0) + ear_deaf = deaf diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 6051c9c122e..d86ab2ba2ca 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -61,7 +61,7 @@ lights_on = 0 set_light(0) -/mob/living/silicon/robot/proc/handle_regular_status_updates() +/mob/living/silicon/robot/handle_regular_status_updates() if(src.camera && !scrambledcodes) if(src.stat == 2 || wires.IsIndexCut(BORG_WIRE_CAMERA)) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index de279566784..270f618a852 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -350,3 +350,9 @@ /mob/living/silicon/proc/is_malf_or_traitor() return is_traitor() || is_malf() + +/mob/living/silicon/adjustEarDamage() + return + +/mob/living/silicon/setEarDamage() + return diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 6fba60f97ce..40d39fff322 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1027,3 +1027,9 @@ mob/proc/yank_out_object() /mob/verb/westfaceperm() set hidden = 1 set_face_dir(WEST) + +/mob/proc/adjustEarDamage() + return + +/mob/proc/setEarDamage() + return From 6ed7cee0416259f47041fd88ee056223f7c4e3b9 Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Wed, 17 Jun 2015 16:08:12 +0200 Subject: [PATCH 12/13] mob/living/Life() now handles even more regular hud updates. Relocates action handling. --- code/defines/procs/hud.dm | 2 +- code/modules/mob/living/carbon/metroid/hud.dm | 2 +- code/modules/mob/living/life.dm | 5 ++++- code/modules/mob/living/living.dm | 5 ----- code/modules/mob/living/living_defense.dm | 4 ---- code/modules/mob/living/silicon/ai/life.dm | 2 +- code/modules/mob/living/silicon/pai/life.dm | 2 +- code/modules/mob/living/silicon/robot/life.dm | 2 +- 8 files changed, 9 insertions(+), 15 deletions(-) diff --git a/code/defines/procs/hud.dm b/code/defines/procs/hud.dm index e572176ef9c..5f222b0374a 100644 --- a/code/defines/procs/hud.dm +++ b/code/defines/procs/hud.dm @@ -61,7 +61,7 @@ proc/can_process_hud(var/mob/M) return 1 //Deletes the current HUD images so they can be refreshed with new ones. -mob/proc/regular_hud_updates() //Used in the life.dm of mobs that can use HUDs. +mob/proc/handle_regular_hud_updates() //Used in the life.dm of mobs that can use HUDs. if(client) for(var/image/hud in client.images) if(copytext(hud.icon_state,1,4) == "hud") diff --git a/code/modules/mob/living/carbon/metroid/hud.dm b/code/modules/mob/living/carbon/metroid/hud.dm index c5282b9a839..da6729c3dcf 100644 --- a/code/modules/mob/living/carbon/metroid/hud.dm +++ b/code/modules/mob/living/carbon/metroid/hud.dm @@ -1,2 +1,2 @@ -/mob/living/carbon/slime/regular_hud_updates() +/mob/living/carbon/slime/handle_regular_hud_updates() return \ No newline at end of file diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 14bdd03a7ae..d7f475ec5b2 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -47,6 +47,8 @@ handle_disabilities() // eye, ear, brain damages handle_status_effects() //all special effects, stunned, weakened, jitteryness, hallucination, sleeping, etc + handle_actions() + update_canmove() if(client) @@ -122,8 +124,9 @@ adjustEarDamage(-0.05,-1) //this handles hud updates. Calls update_vision() and handle_hud_icons() -/mob/living/proc/handle_regular_hud_updates() +/mob/living/handle_regular_hud_updates() if(!client) return 0 + ..() handle_vision() handle_hud_icons() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index e24fa8a7827..07b5fb7900e 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1,8 +1,3 @@ -/mob/living/Life() - ..() - if(stat != DEAD) - handle_actions() - //mob verbs are faster than object verbs. See mob/verb/examine. /mob/living/verb/pulled(atom/movable/AM as mob|obj in oview(1)) set name = "Pull" diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index a566c3a901d..28860ba5b4f 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -247,10 +247,6 @@ //Scale quadratically so that single digit numbers of fire stacks don't burn ridiculously hot. return round(FIRESUIT_MAX_HEAT_PROTECTION_TEMPERATURE*(fire_stacks/FIRE_MAX_FIRESUIT_STACKS)**2) -/mob/living/regular_hud_updates() - ..() - update_action_buttons() - /mob/living/proc/handle_actions() //Pretty bad, i'd use picked/dropped instead but the parent calls in these are nonexistent for(var/datum/action/A in actions) diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index a62ce82429c..51f2ffa7823 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -151,7 +151,7 @@ theAPC = null process_queued_alarms() - regular_hud_updates() + handle_regular_hud_updates() switch(src.sensor_mode) if (SEC_HUD) process_sec_hud(src,0,src.eyeobj) diff --git a/code/modules/mob/living/silicon/pai/life.dm b/code/modules/mob/living/silicon/pai/life.dm index fe426c36d0f..a9ad6987540 100644 --- a/code/modules/mob/living/silicon/pai/life.dm +++ b/code/modules/mob/living/silicon/pai/life.dm @@ -10,7 +10,7 @@ M.show_message("\red The data cable rapidly retracts back into its spool.", 3, "\red You hear a click and the sound of wire spooling rapidly.", 2) qdel(src.cable) - regular_hud_updates() + handle_regular_hud_updates() if(src.secHUD == 1) process_sec_hud(src, 1) diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index d86ab2ba2ca..e5a0227020b 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -173,7 +173,7 @@ src.see_invisible = SEE_INVISIBLE_LIVING // This is normal vision (25), setting it lower for normal vision means you don't "see" things like darkness since darkness // has a "invisible" value of 15 - regular_hud_updates() + handle_regular_hud_updates() var/obj/item/borg/sight/hud/hud = (locate(/obj/item/borg/sight/hud) in src) if(hud && hud.hud) From bca222b119555cccb12c87689a335766709655b5 Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Thu, 25 Jun 2015 08:39:33 +0200 Subject: [PATCH 13/13] Some more disability cleanup. --- code/modules/mob/living/carbon/alien/life.dm | 7 ------- code/modules/mob/living/carbon/human/life.dm | 3 --- 2 files changed, 10 deletions(-) diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index a28afc25dcf..642cbfdbded 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -85,13 +85,6 @@ else if(eye_blurry) eye_blurry = max(eye_blurry-1, 0) - //Ears - if(sdisabilities & DEAF) //disabled-deaf, doesn't get better on its own - ear_deaf = max(ear_deaf, 1) - else if(ear_deaf) //deafness, heals slowly over time - ear_deaf = max(ear_deaf-1, 0) - ear_damage = max(ear_damage-0.05, 0) - update_icons() return 1 diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index ac76041fb61..a3028751815 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -67,9 +67,6 @@ //Updates the number of stored chemicals for powers handle_changeling() - //Disabilities - handle_disabilities() - //Organs and blood handle_organs() stabilize_body_temperature() //Body temperature adjusts itself (self-regulation)