From 1a7e8976afbb69f410ca5ee140c7a75f7ed8d1af Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Sun, 14 Jun 2015 11:26:52 +0200 Subject: [PATCH] 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 2977b31bf5..27a73c596e 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 165d69bc7b..65cb0aface 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 b4772bf89f..23724cc0d2 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 e0385e7d2b..24ebc4d844 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 58159f3382..bd3e280f68 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 e2ec5059a2..8a58d97112 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