-tg- Life() refactors

This commit does a *lot*
Main points of shit changed:
 - Breathing for carbons is now partially handled at a carbon/Life()
   level; Humans still use their species bullshit and all.
 - Most shit has been pushed up the chain to living/Life().
 - Simple_animals no longer use the fucking stupid Die() proc, they use
   death() like a consistant fucker.
 - Human vision is now handled via species.
 - Lots and lots of robot copypasta cleaned
  - AI is still a terrifying mess, not even -tg- touches it

I have tested this, and everything I thought to test worked:
 - Aliens breathing
 - Humans breathing
 - Human vision
 - Robot HUD
 - human HUD
 - Simple animals automatic systems
 - Simple animals dying properly
 - Robot goggles working
This commit is contained in:
Tigercat2000
2015-11-04 16:32:57 -08:00
parent 7d465ebcb7
commit 67e20ff5d5
60 changed files with 1462 additions and 1317 deletions

View File

@@ -95,7 +95,7 @@
H.loc = src
loc.visible_message("<span class='warning'>The corpse of [H.name] suddenly rises!</span>")
/mob/living/simple_animal/hostile/blob/blobspore/Die()
/mob/living/simple_animal/hostile/blob/blobspore/death()
// On death, create a small smoke of harmful gas (s-Acid)
var/datum/effect/effect/system/chem_smoke_spread/S = new
var/turf/location = get_turf(src)
@@ -172,6 +172,6 @@
/mob/living/simple_animal/hostile/blob/blobbernaut/blob_act()
return
/mob/living/simple_animal/hostile/blob/blobbernaut/Die()
/mob/living/simple_animal/hostile/blob/blobbernaut/death()
..()
flick("blobbernaut_death", src)

View File

@@ -345,7 +345,7 @@
if(child)
child.loc = get_turf(src)
if(kill && istype(child))
child.Die()
child.death()
else
for(var/mob/M in range(1,src))
if(CanHug(M))

View File

@@ -589,7 +589,7 @@
sterile = 1
tint = 3 //Makes it feel more authentic when it latches on
/obj/item/clothing/mask/facehugger/toy/Die()
/obj/item/clothing/mask/facehugger/toy/death()
return
@@ -656,7 +656,7 @@
return
..()
/mob/living/simple_animal/hostile/mining_drone/Die()
/mob/living/simple_animal/hostile/mining_drone/death()
..()
visible_message("<span class='danger'>[src] is destroyed!</span>")
new /obj/effect/decal/cleanable/blood/gibs/robot(src.loc)

View File

@@ -26,10 +26,6 @@
var/heal_rate = 5
var/plasma_rate = 5
var/oxygen_alert = 0
var/toxins_alert = 0
var/fire_alert = 0
var/large = 0
var/heat_protection = 0.5
var/leaping = 0

View File

@@ -315,7 +315,6 @@ In all, this is a lot like the monkey code. /N
return 0
/mob/living/carbon/alien/humanoid/var/co2overloadtime = null
/mob/living/carbon/alien/humanoid/var/temperature_resistance = T0C+75
/mob/living/carbon/alien/humanoid/show_inv(mob/user as mob)

View File

@@ -229,7 +229,6 @@
/mob/living/carbon/alien/larva/restrained()
return 0
/mob/living/carbon/alien/larva/var/co2overloadtime = null
/mob/living/carbon/alien/larva/var/temperature_resistance = T0C+75
// new damage icon system

View File

@@ -1,84 +1,4 @@
/mob/living/carbon/alien/Life()
if(..())
//First, resolve location and get a breath
if(mob_master.current_cycle%4==2)
//Only try to take a breath every 4 seconds, unless suffocating
spawn(0) breathe()
else //Still give containing object the chance to interact
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
return 1
/mob/living/carbon/alien/handle_chemicals_in_body()
if(reagents)
reagents.metabolize(src)
if (drowsyness)
drowsyness--
eye_blurry = max(2, eye_blurry)
if (prob(5))
sleeping += 1
Paralyse(5)
confused = max(0, confused - 1)
// decrement dizziness counter, clamped to 0
if(resting)
dizziness = max(0, dizziness - 5)
jitteriness = max(0, jitteriness - 5)
else
dizziness = max(0, dizziness - 1)
jitteriness = max(0, jitteriness - 1)
updatehealth()
return //TODO: DEFERRED
/mob/living/carbon/alien/proc/breathe()
if(reagents)
if(reagents.has_reagent("lexorin")) return
if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return
var/datum/gas_mixture/environment = loc.return_air()
var/datum/gas_mixture/breath
// HACK NEED CHANGING LATER
if(health <= config.health_threshold_crit)
losebreath++
if(losebreath>0) //Suffocating so do not take a breath
losebreath--
if (prob(75)) //High chance of gasping for air
spawn emote("gasp")
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
else
//First, check for air from internal atmosphere (using an air tank and mask generally)
breath = get_breath_from_internal(BREATH_VOLUME)
//No breath from internal atmosphere so get breath from location
if(!breath)
if(istype(loc, /obj/))
var/obj/location_as_object = loc
breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME)
else if(istype(loc, /turf/))
var/breath_moles = environment.total_moles()*BREATH_PERCENTAGE
breath = loc.remove_air(breath_moles)
else //Still give containing object the chance to interact
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
handle_breath(breath)
if(breath)
loc.assume_air(breath)
/mob/living/carbon/alien/proc/handle_breath(datum/gas_mixture/breath)
/mob/living/carbon/alien/check_breath(datum/gas_mixture/breath)
if(status_flags & GODMODE)
return
@@ -93,7 +13,6 @@
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
if(Toxins_pp) // Detect toxins in air
adjustToxLoss(breath.toxins*250)
toxins_alert = max(toxins_alert, 1)
@@ -106,13 +25,15 @@
breath.toxins -= toxins_used
breath.oxygen += toxins_used
if(breath.temperature > (T0C+66) && !(RESIST_COLD in mutations)) // Hot air hurts :(
//BREATH TEMPERATURE
handle_breath_temperature(breath)
return 1
/mob/living/carbon/alien/handle_breath_temperature(datum/gas_mixture/breath)
if(breath.temperature > (T0C + 66) && !(RESIST_COLD in mutations))
if(prob(20))
src << "<span class='danger'>You feel a searing heat in your lungs!</span>"
fire_alert = max(fire_alert, 1)
else
fire_alert = 0
//Temporary fixes to the alerts.
return 1

View File

@@ -57,17 +57,17 @@ var/const/MAX_ACTIVE_TIME = 400
/obj/item/clothing/mask/facehugger/attackby(var/obj/item/O,var/mob/m, params)
if(O.force)
Die()
death()
return
/obj/item/clothing/mask/facehugger/bullet_act(var/obj/item/projectile/P)
if(P.damage)
Die()
death()
return
/obj/item/clothing/mask/facehugger/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
if(exposed_temperature > 300)
Die()
death()
return
/obj/item/clothing/mask/facehugger/equipped(mob/M)
@@ -125,7 +125,7 @@ var/const/MAX_ACTIVE_TIME = 400
var/mob/living/carbon/human/H = L
if(H.head && H.head.flags & HEADCOVERSMOUTH)
H.visible_message("<span class='userdanger'>[src] smashes against [H]'s [H.head]!</span>")
Die()
death()
return 0
if(iscarbon(M))
@@ -177,7 +177,7 @@ var/const/MAX_ACTIVE_TIME = 400
target.visible_message("<span class='danger'>[src] falls limp after violating [target]'s face!</span>", \
"<span class='userdanger'>[src] falls limp after violating [target]'s face!</span>")
Die()
death()
icon_state = "[initial(icon_state)]_impregnated"
if(!(target.status_flags & XENO_HOST))
@@ -221,7 +221,7 @@ var/const/MAX_ACTIVE_TIME = 400
GoActive()
return
/obj/item/clothing/mask/facehugger/proc/Die()
/obj/item/clothing/mask/facehugger/proc/death()
if(stat == DEAD)
return

View File

@@ -1,236 +1,99 @@
/mob/living/carbon/brain/
handle_mutations_and_radiation()
/mob/living/carbon/brain/handle_mutations_and_radiation()
if(radiation)
if(radiation > 100)
radiation -= 3
adjustToxLoss(3)
updatehealth()
if(!container)
src << "<span class='danger'>You feel weak.</span>"
else
src << "<span class='danger'>STATUS: CRITICAL AMOUNTS OF RADIATION DETECTED.</span>"
if (radiation)
if (radiation > 100)
switch(radiation)
if(0 to 49)
radiation--
if(prob(25))
adjustToxLoss(1)
updatehealth()
if(50 to 74)
radiation -= 2
adjustToxLoss(1)
if(prob(5))
radiation -= 5
if(!container)
src << "<span class='danger'>You feel weak.</span>"
else
src << "<span class='danger'>STATUS: DANGEROUS AMOUNTS OF RADIATION DETECTED.</span>"
updatehealth()
if(75 to 100)
radiation -= 3
adjustToxLoss(3)
updatehealth()
if(!container)//If it's not in an MMI
src << "\red You feel weak."
else//Fluff-wise, since the brain can't detect anything itself, the MMI handles thing like that
src << "\red STATUS: CRITICAL AMOUNTS OF RADIATION DETECTED."
switch(radiation)
if(0 to 49)
radiation--
if(prob(25))
adjustToxLoss(1)
updatehealth()
if(50 to 74)
radiation -= 2
adjustToxLoss(1)
if(prob(5))
radiation -= 5
if(!container)
src << "\red You feel weak."
else
src << "\red STATUS: DANGEROUS LEVELS OF RADIATION DETECTED."
updatehealth()
if(75 to 100)
radiation -= 3
adjustToxLoss(3)
updatehealth()
handle_environment(datum/gas_mixture/environment)
if(!environment)
return
var/environment_heat_capacity = environment.heat_capacity()
if(istype(get_turf(src), /turf/space))
var/turf/heat_turf = get_turf(src)
environment_heat_capacity = heat_turf.heat_capacity
if((environment.temperature > (T0C + 50)) || (environment.temperature < (T0C + 10)))
var/transfer_coefficient = 1
handle_temperature_damage(HEAD, environment.temperature, environment_heat_capacity*transfer_coefficient)
if(stat==2)
bodytemperature += 0.1*(environment.temperature - bodytemperature)*environment_heat_capacity/(environment_heat_capacity + 270000)
//Account for massive pressure differences
return //TODO: DEFERRED
proc/handle_temperature_damage(body_part, exposed_temperature, exposed_intensity)
if(status_flags & GODMODE) return
if(exposed_temperature > bodytemperature)
var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0)
//adjustFireLoss(2.5*discomfort)
//adjustFireLoss(5.0*discomfort)
adjustFireLoss(20.0*discomfort)
else
var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0)
//adjustFireLoss(2.5*discomfort)
adjustFireLoss(5.0*discomfort)
handle_chemicals_in_body()
if(reagents) reagents.metabolize(src)
confused = max(0, confused - 1)
// decrement dizziness counter, clamped to 0
if(resting)
dizziness = max(0, dizziness - 5)
else
dizziness = max(0, dizziness - 1)
updatehealth()
return //TODO: DEFERRED
handle_regular_status_updates() //TODO: comment out the unused bits >_>
updatehealth()
if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP
blinded = 1
silent = 0
else //ALIVE. LIGHTS ARE ON
if( !container && (health < config.health_threshold_dead || ((world.time - timeofhostdeath) > config.revival_brain_life)) )
death()
blinded = 1
silent = 0
return 1
//Handling EMP effect in the Life(), it's made VERY simply, and has some additional effects handled elsewhere
if(emp_damage) //This is pretty much a damage type only used by MMIs, dished out by the emp_act
if(!(container && istype(container, /obj/item/device/mmi)))
emp_damage = 0
else
emp_damage = round(emp_damage,1)//Let's have some nice numbers to work with
switch(emp_damage)
if(31 to INFINITY)
emp_damage = 30//Let's not overdo it
if(21 to 30)//High level of EMP damage, unable to see, hear, or speak
eye_blind = 1
blinded = 1
ear_deaf = 1
silent = 1
if(!alert)//Sounds an alarm, but only once per 'level'
emote("alarm")
src << "\red Major electrical distruption detected: System rebooting."
alert = 1
if(prob(75))
emp_damage -= 1
if(20)
alert = 0
blinded = 0
eye_blind = 0
ear_deaf = 0
silent = 0
emp_damage -= 1
if(11 to 19)//Moderate level of EMP damage, resulting in nearsightedness and ear damage
eye_blurry = 1
ear_damage = 1
if(!alert)
emote("alert")
src << "\red Primary systems are now online."
alert = 1
if(prob(50))
emp_damage -= 1
if(10)
alert = 0
eye_blurry = 0
ear_damage = 0
emp_damage -= 1
if(2 to 9)//Low level of EMP damage, has few effects(handled elsewhere)
if(!alert)
emote("notice")
src << "\red System reboot nearly complete."
alert = 1
if(prob(25))
emp_damage -= 1
if(1)
alert = 0
src << "\red All systems restored."
emp_damage -= 1
//Other
handle_statuses()
return 1
handle_regular_hud_updates()
if (stat == 2 || (XRAY in src.mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (stat != 2)
sight &= ~SEE_TURFS
sight &= ~SEE_MOBS
sight &= ~SEE_OBJS
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING
if (healths)
if (stat != 2)
switch(health)
if(100 to INFINITY)
healths.icon_state = "health0"
if(80 to 100)
healths.icon_state = "health1"
if(60 to 80)
healths.icon_state = "health2"
if(40 to 60)
healths.icon_state = "health3"
if(20 to 40)
healths.icon_state = "health4"
if(0 to 20)
healths.icon_state = "health5"
else
healths.icon_state = "health6"
else
healths.icon_state = "health7"
if(pullin) pullin.icon_state = "pull[pulling ? 1 : 0]"
if (client)
client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired)
if ((blind && stat != 2))
if ((blinded))
blind.layer = 18
else
blind.layer = 0
if (disabilities & NEARSIGHTED)
client.screen += global_hud.vimpaired
if (eye_blurry)
client.screen += global_hud.blurry
if (druggy)
client.screen += global_hud.druggy
if (stat != 2)
if (machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(client && !client.adminobs)
reset_view(null)
return 1
/*/mob/living/carbon/brain/emp_act(severity)
if(!(container && istype(container, /obj/item/device/mmi)))
/mob/living/carbon/brain/handle_environment(datum/gas_mixture/environment)
if(!environment)
return
var/environment_heat_capacity = environment.heat_capacity()
if(istype(get_turf(src), /turf/space))
var/turf/heat_turf = get_turf(src)
environment_heat_capacity = heat_turf.heat_capacity
if((environment.temperature > (T0C + 50)) || (environment.temperature < (T0C + 10)))
var/transfer_coefficient = 1
handle_temperature_damage(HEAD, environment.temperature, environment_heat_capacity*transfer_coefficient)
if(stat == DEAD)
bodytemperature += 0.1*(environment.temperature - bodytemperature)*environment_heat_capacity/(environment_heat_capacity + 270000)
/mob/living/carbon/brain/proc/handle_temperature_damage(body_part, exposed_temperature, exposed_intensity)
if(status_flags & GODMODE)
return
if(exposed_temperature > bodytemperature)
var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0)
//adjustFireLoss(2.5*discomfort)
//adjustFireLoss(5.0*discomfort)
adjustFireLoss(20.0*discomfort)
else
switch(severity)
if(1)
emp_damage += rand(20,30)
if(2)
emp_damage += rand(10,20)
if(3)
emp_damage += rand(0,10)
..()*/
var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0)
//adjustFireLoss(2.5*discomfort)
adjustFireLoss(5.0*discomfort)
/mob/living/carbon/brain/handle_regular_status_updates()
updatehealth()
if(stat == DEAD)
blinded = 1
silent = 0
else
if(!container && (health < config.health_threshold_dead || ((world.time - timeofhostdeath) > config.revival_brain_life)))
death()
blinded =1
silent = 0
return 1
handle_statuses()
. = 1
/mob/living/carbon/brain/handle_vision()
..()
if (stat == 2 || (XRAY in src.mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (stat != 2)
sight &= ~SEE_TURFS
sight &= ~SEE_MOBS
sight &= ~SEE_OBJS
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING
handle_hud_icons_health()

View File

@@ -534,36 +534,6 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
legcuffed = null
update_inv_legcuffed()
/mob/living/carbon/proc/get_temperature(var/datum/gas_mixture/environment)
var/loc_temp = T0C
if(istype(loc, /obj/mecha))
var/obj/mecha/M = loc
loc_temp = M.return_temperature()
else if(istype(loc, /obj/spacepod))
var/obj/spacepod/S = loc
loc_temp = S.return_temperature()
else if(istype(loc, /obj/structure/transit_tube_pod))
loc_temp = environment.temperature
else if(istype(get_turf(src), /turf/space))
var/turf/heat_turf = get_turf(src)
loc_temp = heat_turf.temperature
else if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell))
var/obj/machinery/atmospherics/unary/cryo_cell/C = loc
if(C.air_contents.total_moles() < 10)
loc_temp = environment.temperature
else
loc_temp = C.air_contents.temperature
else
loc_temp = environment.temperature
return loc_temp
/mob/living/carbon/show_inv(mob/user)
user.set_machine(src)
var/dat = {"

View File

@@ -26,3 +26,11 @@
var/heart_attack = 0
var/wetlevel = 0 //how wet the mob is
var/oxygen_alert = 0
var/toxins_alert = 0
var/co2_alert = 0
var/fire_alert = 0
var/failed_last_breath = 0 //This is used to determine if the mob failed a breath. If they did fail a brath, they will attempt to breathe each tick, otherwise just once per 4 ticks.
var/co2overloadtime = null

View File

@@ -517,8 +517,6 @@
return 0
/mob/living/carbon/human/var/co2overloadtime = null
/mob/living/carbon/human/var/temperature_resistance = T0C+75

View File

@@ -61,8 +61,6 @@
var/special_voice = "" // For changing our voice. Used by a symptom.
var/said_last_words=0
var/failed_last_breath = 0 //This is used to determine if the mob failed a breath. If they did fail a brath, they will attempt to breathe each tick, otherwise just once per 4 ticks.
var/last_dam = -1 //Used for determining if we need to process all organs or just some or even none.
var/list/bad_external_organs = list()// organs we check until they are good.

View File

@@ -29,10 +29,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
#define TINT_BLIND 3 //Threshold of tint level to obscure vision fully
/mob/living/carbon/human
var/oxygen_alert = 0
var/toxins_alert = 0
var/co2_alert = 0
var/fire_alert = 0
var/pressure_alert = 0
var/prev_gender = null // Debug for plural genders
var/temperature_alert = 0
@@ -60,13 +57,6 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
voice = GetVoice()
if(..() && !in_stasis)
if(mob_master.current_cycle % 4 == 2 || failed_last_breath) //First, resolve location and get a breath
breathe() //Only try to take a breath every 4 ticks, unless suffocating
else //Still give containing object the chance to interact
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
if(check_mutations)
domutcheck(src,null)
@@ -276,91 +266,81 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
var/obj/item/organ/external/O = pick(organs)
if(istype(O)) O.add_autopsy_data("Radiation Poisoning", damage)
/mob/living/carbon/human/proc/breathe()
if(reagents.has_reagent("lexorin")) return
if(NO_BREATH in mutations) return // No breath mutation means no breathing.
if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return
if(species && (species.flags & NO_BREATHE)) return
/mob/living/carbon/human/breathe()
if(reagents.has_reagent("lexorin"))
return
if(NO_BREATH in mutations)
return // No breath mutation means no breathing. //DID YOU REALLY NEED TO FUCKING STATE THIS?
if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell))
return
if(species && (species.flags & NO_BREATHE))
return
var/datum/gas_mixture/environment
if(loc)
environment = loc.return_air()
var/datum/gas_mixture/environment = loc.return_air()
var/datum/gas_mixture/breath
// HACK NEED CHANGING LATER
if(health <= config.health_threshold_crit)
losebreath++
if(losebreath>0) //Suffocating so do not take a breath
if(losebreath > 0)
losebreath--
if (prob(10)) //Gasp per 10 ticks? Sounds about right.
if(prob(10))
spawn emote("gasp")
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
var/obj/loc_as_obj = loc
loc_as_obj.handle_internal_lifeform(src, 0)
else
//First, check for air from internal atmosphere (using an air tank and mask generally)
breath = get_breath_from_internal(BREATH_VOLUME) // Super hacky -- TLE
//breath = get_breath_from_internal(0.5) // Manually setting to old BREATH_VOLUME amount -- TLE
breath = get_breath_from_internal(BREATH_VOLUME)
//No breath from internal atmosphere so get breath from location
if(!breath)
if(isobj(loc))
var/obj/location_as_object = loc
breath = location_as_object.handle_internal_lifeform(src, BREATH_MOLES)
else if(isturf(loc))
if(isobj(loc)) //Breathe from loc as object
var/obj/loc_as_obj = loc
breath = loc_as_obj.handle_internal_lifeform(src, BREATH_MOLES)
else if(isturf(loc)) //Breathe from loc as turf
var/breath_moles = 0
/*if(environment.return_pressure() > ONE_ATMOSPHERE)
// Loads of air around (pressure effect will be handled elsewhere), so lets just take a enough to fill our lungs at normal atmos pressure (using n = Pv/RT)
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
else*/
// Not enough air around, take a percentage of what's there to model this properly
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
if(environment)
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
breath = loc.remove_air(breath_moles)
if(!is_lung_ruptured())
if(!breath || breath.total_moles() < BREATH_MOLES / 5 || breath.total_moles() > BREATH_MOLES * 5)
if(prob(5))
rupture_lung()
if(!is_lung_ruptured()) // THIS FUCKING EXCERPT, THIS LITTLE FUCKING EXCERPT, SNOWFLAKED
if(!breath || breath.total_moles() < BREATH_MOLES / 5 || breath.total_moles() > BREATH_MOLES * 5) // RIGHT IN THE CENTER OF THE FUCKING BREATHE PROC
if(prob(5)) // IT IS THE ONLY FUCKING REASONS HUMAN OVERRIDE breathe()
rupture_lung() // GOD FUCKING DAMNIT
else //Still give containing object the chance to interact
else //Breathe from loc as obj again
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
var/obj/loc_as_obj = loc
loc_as_obj.handle_internal_lifeform(src,0)
handle_breath(breath)
if(species.name=="Plasmaman") //this is stupid as fuck
// Check if we're wearing our biosuit and mask.
if (!istype(wear_suit,/obj/item/clothing/suit/space/eva/plasmaman) || !istype(head,/obj/item/clothing/head/helmet/space/eva/plasmaman))
//testing("Plasmaman [src] leakin'. coverflags=[cover_flags]")
// OH FUCK HE LEAKIN'.
// This was OP.
//environment.adjust(tx = environment.total_moles()*BREATH_PERCENTAGE) // About one breath's worth. (I know we aren't breathing it out, but this should be about the right amount)
src << "<span class='warning'>Your body reacts with the atmosphere and bursts into flame!</span>"
adjust_fire_stacks(0.5)
IgniteMob()
check_breath(breath)
if(breath)
loc.assume_air(breath)
//spread some viruses while we are at it
if (virus2.len > 0)
if (prob(10) && get_infection_chance(src))
// log_debug("[src] : Exhaling some viruses")
//spread virus2
if(virus2.len > 0)
if(prob(10) && get_infection_chance(src))
for(var/mob/living/carbon/M in view(1,src))
src.spread_disease_to(M)
// USED IN DEATHWHISPERS
/mob/living/carbon/human/proc/isInCrit()
// Health is in deep shit and we're not already dead
return health <= 0 && stat != 2
/mob/living/carbon/human/proc/handle_breath(var/datum/gas_mixture/breath)
/mob/living/carbon/human/check_breath(var/datum/gas_mixture/breath)
if(status_flags & GODMODE)
return 0
if(!breath || (breath.total_moles() == 0) || suiciding)
if(reagents.has_reagent("epinephrine"))
return
var/oxyloss = 0
if(suiciding)
oxyloss = 2
@@ -668,11 +648,10 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
return covered
/mob/living/carbon/human/handle_chemicals_in_body()
..()
if(reagents)
reagents.metabolize(src)
if(status_flags & GODMODE) return 0 //godmode
if(status_flags & GODMODE)
return 0 //godmode
if(species.flags & REQUIRE_LIGHT)
var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing
@@ -993,331 +972,46 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
return 1
/mob/living/carbon/human/handle_vision()
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask)
if(machine)
if(!machine.check_eye(src)) reset_view(null)
else
var/isRemoteObserve = 0
if((REMOTE_VIEW in mutations) && remoteview_target)
isRemoteObserve = 1
if(remoteview_target.stat != CONSCIOUS)
src << "<span class='alert'>Your psy-connection grows too faint to maintain!</span>"
isRemoteObserve = 0
if(PSY_RESIST in remoteview_target.mutations)
src << "<span class='alert'>Your mind is shut out!</span>"
isRemoteObserve = 0
// Not on the station or mining?
var/turf/temp_turf = get_turf(remoteview_target)
if(!temp_turf in config.contact_levels)
src << "<span class='alert'>Your psy-connection grows too faint to maintain!</span>"
isRemoteObserve = 0
if(!isRemoteObserve && client && !client.adminobs)
remoteview_target = null
reset_view(null)
species.handle_vision(src)
/mob/living/carbon/human/handle_hud_icons()
species.handle_hud_icons(src)
/mob/living/carbon/human/handle_regular_hud_updates()
if(hud_updateflag)
handle_hud_list()
if(!client) return 0
if(..())
if(hud_updateflag)
handle_hud_list()
if(hud_updateflag)
handle_hud_list()
update_action_buttons()
for(var/image/hud in client.images)
if(copytext(hud.icon_state,1,4) == "hud") //ugly, but icon comparison is worse, I believe
client.images.Remove(hud)
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask,/* global_hud.nvg*/)
if(damageoverlay.overlays)
damageoverlay.overlays = list()
if(stat == UNCONSCIOUS)
//Critical damage passage overlay
if(health <= 0)
//var/image/I
switch(health)
if(-20 to -10)
damageoverlay.overlays += unconscious_overlays["1"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage1")
if(-30 to -20)
damageoverlay.overlays += unconscious_overlays["2"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage2")
if(-40 to -30)
damageoverlay.overlays += unconscious_overlays["3"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage3")
if(-50 to -40)
damageoverlay.overlays += unconscious_overlays["4"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage4")
if(-60 to -50)
damageoverlay.overlays += unconscious_overlays["5"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage5")
if(-70 to -60)
damageoverlay.overlays += unconscious_overlays["6"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage6")
if(-80 to -70)
damageoverlay.overlays += unconscious_overlays["7"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage7")
if(-90 to -80)
damageoverlay.overlays += unconscious_overlays["8"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage8")
if(-95 to -90)
damageoverlay.overlays += unconscious_overlays["9"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage9")
if(-INFINITY to -95)
damageoverlay.overlays += unconscious_overlays["10"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage10")
//damageoverlay.overlays += I
else
//Oxygen damage overlay
if(oxyloss)
//var/image/I
switch(oxyloss)
if(10 to 20)
damageoverlay.overlays += oxyloss_overlays["1"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay1")
if(20 to 25)
damageoverlay.overlays += oxyloss_overlays["2"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay2")
if(25 to 30)
damageoverlay.overlays += oxyloss_overlays["3"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay3")
if(30 to 35)
damageoverlay.overlays += oxyloss_overlays["4"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay4")
if(35 to 40)
damageoverlay.overlays += oxyloss_overlays["5"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay5")
if(40 to 45)
damageoverlay.overlays += oxyloss_overlays["6"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay6")
if(45 to INFINITY)
damageoverlay.overlays += oxyloss_overlays["7"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay7")
//damageoverlay.overlays += I
//Fire and Brute damage overlay (BSSR)
var/hurtdamage = src.getBruteLoss() + src.getFireLoss() + damageoverlaytemp
damageoverlaytemp = 0 // We do this so we can detect if someone hits us or not.
if(hurtdamage)
//var/image/I
switch(hurtdamage)
if(10 to 25)
damageoverlay.overlays += brutefireloss_overlays["1"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay1")
if(25 to 40)
damageoverlay.overlays += brutefireloss_overlays["2"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay2")
if(40 to 55)
damageoverlay.overlays += brutefireloss_overlays["3"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay3")
if(55 to 70)
damageoverlay.overlays += brutefireloss_overlays["4"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay4")
if(70 to 85)
damageoverlay.overlays += brutefireloss_overlays["5"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay5")
if(85 to INFINITY)
damageoverlay.overlays += brutefireloss_overlays["6"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay6")
//damageoverlay.overlays += I
see_invisible = SEE_INVISIBLE_LIVING
if( stat == DEAD )
sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO
if(healths) healths.icon_state = "health7" //DEAD healthmeter
else
sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS)
if(mind && mind.vampire)
if((VAMP_VISION in mind.vampire.powers) && !(VAMP_FULL in mind.vampire.powers))
sight |= SEE_MOBS
if((VAMP_FULL in mind.vampire.powers))
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
see_in_dark = 8
if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO
if(XRAY in mutations)
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
see_in_dark = 8
if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO
if(seer==1)
var/obj/effect/rune/R = locate() in loc
if(R && R.word1 == cultwords["see"] && R.word2 == cultwords["hell"] && R.word3 == cultwords["join"])
see_invisible = SEE_INVISIBLE_OBSERVER
else
see_invisible = SEE_INVISIBLE_LIVING
seer = 0
if(glasses || head)
if(glasses)
var/obj/item/clothing/glasses/G = glasses
if(istype(G))
see_in_dark = (G.darkness_view ? see_in_dark + G.darkness_view : species.darksight) // Otherwise we keep our darkness view with togglable nightvision.
if(G.vision_flags) // MESONS
sight |= G.vision_flags
if(!druggy)
see_invisible = SEE_INVISIBLE_MINIMUM
if(!G.see_darkness)
see_invisible = SEE_INVISIBLE_MINIMUM
/* HUD shit goes here, as long as it doesn't modify sight flags */
// The purpose of this is to stop xray and w/e from preventing you from using huds -- Love, Doohl
switch(G.HUDType)
if(SECHUD)
process_sec_hud(src,1)
if(MEDHUD)
process_med_hud(src,1)
if(ANTAGHUD)
process_antag_hud(src)
if(head)
var/obj/item/clothing/head/H = head
if(istype(H))
if(H.vision_flags) // MESONS
sight |= H.vision_flags
if(!druggy)
see_invisible = SEE_INVISIBLE_MINIMUM
if(!H.see_darkness)
see_invisible = SEE_INVISIBLE_MINIMUM
/* HUD shit goes here, as long as it doesn't modify sight flags */
// The purpose of this is to stop xray and w/e from preventing you from using huds -- Love, Doohl
switch(H.HUDType)
if(SECHUD)
process_sec_hud(src,1)
if(MEDHUD)
process_med_hud(src,1)
if(ANTAGHUD)
process_antag_hud(src)
else if(!seer)
see_in_dark = species.darksight
see_invisible = SEE_INVISIBLE_LIVING
if(vision_type)
see_in_dark = max(see_in_dark, vision_type.see_in_dark, species.darksight)
see_invisible = vision_type.see_invisible
if(vision_type.light_sensitive)
weakeyes = 1
sight |= vision_type.sight_flags
if(see_override) //Override all
see_invisible = see_override
if(healths)
if (analgesic)
healths.icon_state = "health_health_numb"
else
switch(hal_screwyhud)
if(1) healths.icon_state = "health6"
if(2) healths.icon_state = "health7"
else
//switch(health - halloss)
switch(100 - ((species && species.flags & NO_PAIN) ? 0 : traumatic_shock) - staminaloss)
if(100 to INFINITY) healths.icon_state = "health0"
if(80 to 100) healths.icon_state = "health1"
if(60 to 80) healths.icon_state = "health2"
if(40 to 60) healths.icon_state = "health3"
if(20 to 40) healths.icon_state = "health4"
if(0 to 20) healths.icon_state = "health5"
else healths.icon_state = "health6"
if(healthdoll)
healthdoll.overlays.Cut()
if(stat == DEAD)
healthdoll.icon_state = "healthdoll_DEAD"
else
healthdoll.icon_state = "healthdoll_OVERLAY"
for(var/obj/item/organ/external/O in organs)
var/damage = O.burn_dam + O.brute_dam
var/comparison = (O.max_damage/5)
var/icon_num = 0
if(damage)
icon_num = 1
if(damage > (comparison))
icon_num = 2
if(damage > (comparison*2))
icon_num = 3
if(damage > (comparison*3))
icon_num = 4
if(damage > (comparison*4))
icon_num = 5
if(icon_num)
healthdoll.overlays += image('icons/mob/screen_gen.dmi',"[O.limb_name][icon_num]")
if(nutrition_icon)
switch(nutrition)
if(450 to INFINITY) nutrition_icon.icon_state = "nutrition0"
if(350 to 450) nutrition_icon.icon_state = "nutrition1"
if(250 to 350) nutrition_icon.icon_state = "nutrition2"
if(150 to 250) nutrition_icon.icon_state = "nutrition3"
else nutrition_icon.icon_state = "nutrition4"
if(pressure)
pressure.icon_state = "pressure[pressure_alert]"
if(toxin)
if(hal_screwyhud == 4 || toxins_alert) toxin.icon_state = "tox1"
else toxin.icon_state = "tox0"
if(oxygen)
if(hal_screwyhud == 3 || oxygen_alert) oxygen.icon_state = "oxy1"
else oxygen.icon_state = "oxy0"
if(fire)
if(fire_alert) fire.icon_state = "fire[fire_alert]" //fire_alert is either 0 if no alert, 1 for cold and 2 for heat.
else fire.icon_state = "fire0"
if(bodytemp)
if (!species)
switch(bodytemperature) //310.055 optimal body temp
if(370 to INFINITY) bodytemp.icon_state = "temp4"
if(350 to 370) bodytemp.icon_state = "temp3"
if(335 to 350) bodytemp.icon_state = "temp2"
if(320 to 335) bodytemp.icon_state = "temp1"
if(300 to 320) bodytemp.icon_state = "temp0"
if(295 to 300) bodytemp.icon_state = "temp-1"
if(280 to 295) bodytemp.icon_state = "temp-2"
if(260 to 280) bodytemp.icon_state = "temp-3"
else bodytemp.icon_state = "temp-4"
else
var/temp_step
if (bodytemperature >= species.body_temperature)
temp_step = (species.heat_level_1 - species.body_temperature)/4
if (bodytemperature >= species.heat_level_1)
bodytemp.icon_state = "temp4"
else if (bodytemperature >= species.body_temperature + temp_step*3)
bodytemp.icon_state = "temp3"
else if (bodytemperature >= species.body_temperature + temp_step*2)
bodytemp.icon_state = "temp2"
else if (bodytemperature >= species.body_temperature + temp_step*1)
bodytemp.icon_state = "temp1"
else
bodytemp.icon_state = "temp0"
else if (bodytemperature < species.body_temperature)
temp_step = (species.body_temperature - species.cold_level_1)/4
if (bodytemperature <= species.cold_level_1)
bodytemp.icon_state = "temp-4"
else if (bodytemperature <= species.body_temperature - temp_step*3)
bodytemp.icon_state = "temp-3"
else if (bodytemperature <= species.body_temperature - temp_step*2)
bodytemp.icon_state = "temp-2"
else if (bodytemperature <= species.body_temperature - temp_step*1)
bodytemp.icon_state = "temp-1"
else
bodytemp.icon_state = "temp0"
// This checks how much the mob's eyewear impairs their vision
if(tinttotal >= TINT_IMPAIR)
if(tinted_weldhelh)
if(tinttotal >= TINT_BLIND)
blinded = 1 // You get the sudden urge to learn to play keyboard
client.screen += global_hud.darkMask
else
client.screen += global_hud.darkMask
if(blind)
if(blinded) blind.layer = 18
else blind.layer = 0
if(disabilities & NEARSIGHTED) //this looks meh but saves a lot of memory by not requiring to add var/prescription
if(glasses) //to every /obj/item
var/obj/item/clothing/glasses/G = glasses
if(!G.prescription)
client.screen += global_hud.vimpaired
else
client.screen += global_hud.vimpaired
if(eye_blurry) client.screen += global_hud.blurry
if(druggy) client.screen += global_hud.druggy
if(machine)
if(!machine.check_eye(src)) reset_view(null)
else
var/isRemoteObserve = 0
if((REMOTE_VIEW in mutations) && remoteview_target)
isRemoteObserve = 1
// Is he unconscious or dead?
if(remoteview_target.stat!=CONSCIOUS)
src << "<span class='alert'>Your psy-connection grows too faint to maintain!</span>"
isRemoteObserve = 0
// Does he have psy resist?
if(PSY_RESIST in remoteview_target.mutations)
src << "<span class='alert'>Your mind is shut out!</span>"
isRemoteObserve = 0
// Not on the station or mining?
var/turf/temp_turf = get_turf(remoteview_target)
if((!(temp_turf.z in config.contact_levels)) || remoteview_target.stat!=CONSCIOUS)
src << "<span class='alert'>Your psy-connection grows too faint to maintain!</span>"
isRemoteObserve = 0
if(!isRemoteObserve && client && !client.adminobs)
remoteview_target = null
reset_view(null)
return 1
/mob/living/carbon/human/handle_random_events()
// Puke if toxloss is too high

View File

@@ -216,4 +216,10 @@
if(heat_level_3 to INFINITY)
H.apply_damage(HEAT_GAS_DAMAGE_LEVEL_3, BURN, "head", used_weapon = "Excessive Heat")
H.fire_alert = max(H.fire_alert, 2)
if(!istype(H.wear_suit, /obj/item/clothing/suit/space/eva/plasmaman) || !istype(H.head, /obj/item/clothing/head/helmet/space/eva/plasmaman))
H << "<span class='warning'>Your body reacts with the atmosphere and bursts into flame!</span>"
H.adjust_fire_stacks(0.5)
H.IgniteMob()
return 1

View File

@@ -367,3 +367,195 @@
/datum/species/proc/handle_can_equip(obj/item/I, slot, disable_warning = 0, mob/living/carbon/human/user)
return 0
/datum/species/proc/handle_vision(mob/living/carbon/human/H)
if( H.stat == DEAD )
H.sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS)
H.see_in_dark = 8
if(!H.druggy) H.see_invisible = SEE_INVISIBLE_LEVEL_TWO
else
H.sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS)
if(H.mind && H.mind.vampire)
if(VAMP_VISION in H.mind.vampire.powers && !(VAMP_FULL in H.mind.vampire.powers))
H.sight |= SEE_MOBS
else if(VAMP_FULL in H.mind.vampire.powers)
H.sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
H.see_in_dark = 8
if(!H.druggy) H.see_invisible = SEE_INVISIBLE_LEVEL_TWO
if(XRAY in H.mutations)
H.sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
H.see_in_dark = 8
if(!H.druggy) H.see_invisible = SEE_INVISIBLE_LEVEL_TWO
if(H.seer == 1)
var/obj/effect/rune/R = locate() in H.loc
if(R && R.word1 == cultwords["see"] && R.word2 == cultwords["hell"] && R.word3 == cultwords["join"])
H.see_invisible = SEE_INVISIBLE_OBSERVER
else
H.see_invisible = SEE_INVISIBLE_LIVING
H.seer = 0
else if(!H.seer)
H.see_in_dark = darksight
H.see_invisible = SEE_INVISIBLE_LIVING
// This checks how much the mob's eyewear impairs their vision
if(H.tinttotal >= TINT_IMPAIR)
if(tinted_weldhelh)
if(H.tinttotal >= TINT_BLIND)
H.eye_blind = max(H.eye_blind, 1)
if(H.client)
H.client.screen += global_hud.darkMask
if(H.glasses)
if(istype(H.glasses, /obj/item/clothing/glasses))
var/obj/item/clothing/glasses/G = H.glasses
H.sight |= G.vision_flags
H.see_in_dark = G.darkness_view
if(!G.see_darkness)
H.see_invisible = SEE_INVISIBLE_MINIMUM
switch(G.HUDType)
if(SECHUD)
process_sec_hud(H,1)
if(MEDHUD)
process_med_hud(H,1)
if(ANTAGHUD)
process_antag_hud(H)
if(H.head)
if(istype(H.head, /obj/item/clothing/head))
var/obj/item/clothing/head/hat = H.head
H.sight |= hat.vision_flags
if(!hat.see_darkness)
H.see_invisible = SEE_INVISIBLE_MINIMUM
switch(hat.HUDType)
if(SECHUD)
process_sec_hud(H,1)
if(MEDHUD)
process_med_hud(H,1)
if(ANTAGHUD)
process_antag_hud(H)
if(H.see_override) //Override all
H.see_invisible = H.see_override
if(H.blind)
if(H.blinded) H.blind.layer = 18
else H.blind.layer = 0
if(H.disabilities & NEARSIGHTED) //this looks meh but saves a lot of memory by not requiring to add var/prescription
if(H.glasses) //to every /obj/item
var/obj/item/clothing/glasses/G = H.glasses
if(!G.prescription)
H.client.screen += global_hud.vimpaired
else
H.client.screen += global_hud.vimpaired
if(H.eye_blurry) H.client.screen += global_hud.blurry
if(H.druggy) H.client.screen += global_hud.druggy
/datum/species/proc/handle_hud_icons(mob/living/carbon/human/H)
if(H.healths)
if(H.analgesic)
H.healths.icon_state = "health_health_numb"
else
if(H.stat == DEAD)
H.healths.icon_state = "health7"
else
switch(H.hal_screwyhud)
if(1) H.healths.icon_state = "health6"
if(2) H.healths.icon_state = "health7"
if(5) H.healths.icon_state = "health0"
else
switch(H.health - ((flags & NO_PAIN) ? 0 : H.traumatic_shock) - H.staminaloss)
if(100 to INFINITY) H.healths.icon_state = "health0"
if(80 to 100) H.healths.icon_state = "health1"
if(60 to 80) H.healths.icon_state = "health2"
if(40 to 60) H.healths.icon_state = "health3"
if(20 to 40) H.healths.icon_state = "health4"
if(0 to 20) H.healths.icon_state = "health5"
else H.healths.icon_state = "health6"
if(H.healthdoll)
H.healthdoll.overlays.Cut()
if(H.stat == DEAD)
H.healthdoll.icon_state = "healthdoll_DEAD"
else
H.healthdoll.icon_state = "healthdoll_OVERLAY"
for(var/obj/item/organ/external/O in H.organs)
var/damage = O.burn_dam + O.brute_dam
var/comparison = (O.max_damage/5)
var/icon_num = 0
if(damage)
icon_num = 1
if(damage > (comparison))
icon_num = 2
if(damage > (comparison*2))
icon_num = 3
if(damage > (comparison*3))
icon_num = 4
if(damage > (comparison*4))
icon_num = 5
if(icon_num)
H.healthdoll.overlays += image('icons/mob/screen_gen.dmi',"[O.limb_name][icon_num]")
if(H.nutrition_icon)
switch(H.nutrition)
if(450 to INFINITY) H.nutrition_icon.icon_state = "nutrition0"
if(350 to 450) H.nutrition_icon.icon_state = "nutrition1"
if(250 to 350) H.nutrition_icon.icon_state = "nutrition2"
if(150 to 250) H.nutrition_icon.icon_state = "nutrition3"
else H.nutrition_icon.icon_state = "nutrition4"
// BAY SHIT
if(H.pressure)
H.pressure.icon_state = "pressure[H.pressure_alert]"
if(H.toxin)
if(H.hal_screwyhud == 4 || H.toxins_alert) H.toxin.icon_state = "tox1"
else H.toxin.icon_state = "tox0"
if(H.oxygen)
if(H.hal_screwyhud == 3 || H.oxygen_alert) H.oxygen.icon_state = "oxy1"
else H.oxygen.icon_state = "oxy0"
if(H.fire)
if(H.fire_alert) H.fire.icon_state = "fire[H.fire_alert]" //fire_alert is either 0 if no alert, 1 for cold and 2 for heat.
else H.fire.icon_state = "fire0"
if(H.bodytemp)
var/temp_step
if(H.bodytemperature >= body_temperature)
temp_step = (heat_level_1 - body_temperature)/4
if(H.bodytemperature >= heat_level_1)
H.bodytemp.icon_state = "temp4"
else if(H.bodytemperature >= body_temperature + temp_step*3)
H.bodytemp.icon_state = "temp3"
else if(H.bodytemperature >= body_temperature + temp_step*2)
H.bodytemp.icon_state = "temp2"
else if(H.bodytemperature >= body_temperature + temp_step*1)
H.bodytemp.icon_state = "temp1"
else
H.bodytemp.icon_state = "temp0"
else if(H.bodytemperature < body_temperature)
temp_step = (body_temperature - cold_level_1)/4
if(H.bodytemperature <= cold_level_1)
H.bodytemp.icon_state = "temp-4"
else if(H.bodytemperature <= body_temperature - temp_step*3)
H.bodytemp.icon_state = "temp-3"
else if(H.bodytemperature <= body_temperature - temp_step*2)
H.bodytemp.icon_state = "temp-2"
else if(H.bodytemperature <= body_temperature - temp_step*1)
H.bodytemp.icon_state = "temp-1"
else
H.bodytemp.icon_state = "temp0"
return 1

View File

@@ -1,3 +1,188 @@
/mob/living/carbon/Life()
set invisibility = 0
set background = BACKGROUND_ENABLED
if(notransform)
return
if(!loc)
return
if(..())
. = 1
handle_changeling()
handle_wetness()
///////////////
// BREATHING //
///////////////
//Start of a breath chain, calls breathe()
/mob/living/carbon/handle_breathing()
if(mob_master.current_cycle%4==2 || failed_last_breath)
breathe() //Breathe per 4 ticks, unless suffocating
else
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src,0)
//Second link in a breath chain, calls check_breath()
/mob/living/carbon/proc/breathe()
if(reagents.has_reagent("lexorin"))
return
if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell))
return
if(NO_BREATH in mutations)
return // No breath mutation means no breathing.
var/datum/gas_mixture/environment
if(loc)
environment = loc.return_air()
var/datum/gas_mixture/breath
if(health <= config.health_threshold_crit)
losebreath++
if(losebreath > 0)
losebreath--
if(prob(10))
spawn emote("gasp")
if(istype(loc, /obj/))
var/obj/loc_as_obj = loc
loc_as_obj.handle_internal_lifeform(src, 0)
else
//Breathe from internal
breath = get_breath_from_internal(BREATH_VOLUME)
if(!breath)
if(isobj(loc)) //Breathe from loc as object
var/obj/loc_as_obj = loc
breath = loc_as_obj.handle_internal_lifeform(src, BREATH_MOLES)
else if(isturf(loc)) //Breathe from loc as turf
var/breath_moles = 0
if(environment)
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
breath = loc.remove_air(breath_moles)
else //Breathe from loc as obj again
if(istype(loc, /obj/))
var/obj/loc_as_obj = loc
loc_as_obj.handle_internal_lifeform(src,0)
check_breath(breath)
if(breath)
loc.assume_air(breath)
//spread virus2
if(virus2.len > 0)
if(prob(10) && get_infection_chance(src))
for(var/mob/living/carbon/M in view(1,src))
src.spread_disease_to(M)
//Third link in a breath chain, calls handle_breath_temperature()
/mob/living/carbon/proc/check_breath(datum/gas_mixture/breath)
if(status_flags & GODMODE)
return 0
//CRIT
if(!breath || (breath.total_moles() == 0))
if(reagents.has_reagent("epinephrine"))
return
adjustOxyLoss(1)
failed_last_breath = 1
oxygen_alert = max(oxygen_alert, 1)
return 0
var/safe_oxy_min = 16
var/safe_co2_max = 10
var/safe_tox_max = 0.05
var/SA_para_min = 1
var/SA_sleep_min = 1
var/oxygen_used = 0
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
var/O2_partialpressure = (breath.oxygen/breath.total_moles())*breath_pressure
var/Toxins_partialpressure = (breath.toxins/breath.total_moles())*breath_pressure
var/CO2_partialpressure = (breath.carbon_dioxide/breath.total_moles())*breath_pressure
//OXYGEN
if(O2_partialpressure < safe_oxy_min) //Not enough oxygen
if(prob(20))
spawn(0)
emote("gasp")
if(O2_partialpressure > 0)
var/ratio = safe_oxy_min/O2_partialpressure
adjustOxyLoss(min(5*ratio, 3))
failed_last_breath = 1
oxygen_used = breath.oxygen*ratio/6
else
adjustOxyLoss(3)
failed_last_breath = 1
oxygen_alert = max(oxygen_alert, 1)
else //Enough oxygen
failed_last_breath = 0
adjustOxyLoss(-5)
oxygen_used = breath.oxygen/6
oxygen_alert = 0
breath.oxygen -= oxygen_used
breath.carbon_dioxide += oxygen_used
//CARBON DIOXIDE
if(CO2_partialpressure > safe_co2_max)
if(!co2overloadtime)
co2overloadtime = world.time
else if(world.time - co2overloadtime > 120)
Paralyse(3)
adjustOxyLoss(3)
if(world.time - co2overloadtime > 300)
adjustOxyLoss(8)
if(prob(20))
spawn(0) emote("cough")
co2_alert = max(co2_alert, 1)
else
co2_alert = 0
co2overloadtime = 0
//TOXINS/PLASMA
if(Toxins_partialpressure > safe_tox_max)
var/ratio = (breath.toxins/safe_tox_max) * 10
if(reagents)
reagents.add_reagent("plasma", Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE))
toxins_alert = max(toxins_alert, 1)
else
toxins_alert = 0
//TRACE GASES
if(breath.trace_gases.len)
for(var/datum/gas/sleeping_agent/SA in breath.trace_gases)
var/SA_partialpressure = (SA.moles/breath.total_moles())*breath_pressure
if(SA_partialpressure > SA_para_min)
Paralyse(3)
if(SA_partialpressure > SA_sleep_min)
sleeping = max(sleeping+2, 10)
else if(SA_partialpressure > 0.01)
if(prob(20))
spawn(0) emote(pick("giggle","laugh"))
//BREATH TEMPERATURE
handle_breath_temperature(breath)
return 1
//Fourth and final link in a breath chain
/mob/living/carbon/proc/handle_breath_temperature(datum/gas_mixture/breath)
return
/mob/living/carbon/proc/get_breath_from_internal(volume_needed)
if(internal)
if (!contents.Find(internal))
@@ -13,98 +198,46 @@
internals.icon_state = "internal0"
return
/mob/living/carbon/Life()
set invisibility = 0
set background = BACKGROUND_ENABLED
if(notransform)
return
if(!loc)
return
var/datum/gas_mixture/environment = loc.return_air()
//Handle temperature/pressure differences between body and environment
handle_environment(environment)
//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
handle_regular_status_updates() // Status updates, death etc.
if(stat != DEAD)
//Updates the number of stored chemicals for powers
handle_changeling()
//Mutations and radiation
handle_mutations_and_radiation()
//Chemicals in the body
handle_chemicals_in_body()
//Disabilities
handle_disabilities()
//Random events (vomiting etc)
handle_random_events()
. = 1
handle_fire()
//Decrease wetness over time
handle_wetness()
//stuff in the stomach
handle_stomach()
update_canmove()
update_gravity(mob_has_gravity())
for(var/obj/item/weapon/grab/G in src)
G.process()
handle_actions()
if(client)
handle_regular_hud_updates()
return .
//remember to remove the "proc" of the child procs of these.
/mob/living/carbon/proc/handle_changeling()
return
/mob/living/carbon/proc/handle_mutations_and_radiation()
return
/mob/living/carbon/handle_mutations_and_radiation()
if(radiation)
/mob/living/carbon/proc/handle_chemicals_in_body()
return
switch(radiation)
if(0 to 50)
radiation--
if(prob(25))
adjustToxLoss(1)
updatehealth()
/mob/living/carbon/proc/handle_disabilities()
return
if(50 to 75)
radiation -= 2
adjustToxLoss(1)
if(prob(5))
radiation -= 5
updatehealth()
/mob/living/carbon/proc/handle_random_events()
return
if(75 to 100)
radiation -= 3
adjustToxLoss(3)
updatehealth()
/mob/living/carbon/proc/handle_environment(var/datum/gas_mixture/environment)
return
radiation = Clamp(radiation, 0, 100)
/mob/living/carbon/handle_chemicals_in_body()
if(reagents)
reagents.metabolize(src)
/mob/living/carbon/proc/handle_regular_status_updates()
return
/mob/living/carbon/proc/handle_wetness()
if(mob_master.current_cycle%20==2) //dry off a bit once every 20 ticks or so
wetlevel = max(wetlevel - 1,0)
/mob/living/carbon/proc/handle_stomach()
/mob/living/carbon/handle_stomach()
spawn(0)
for(var/mob/living/M in stomach_contents)
if(M.loc != src)
@@ -121,5 +254,245 @@
M.adjustBruteLoss(5)
nutrition += 10
/mob/living/carbon/proc/handle_regular_hud_updates()
//This updates the health and status of the mob (conscious, unconscious, dead)
/mob/living/carbon/handle_regular_status_updates()
if(..()) //alive
if(health <= config.health_threshold_dead)
death()
return
if(getOxyLoss() > 50 || health <= config.health_threshold_crit)
Paralyse(3)
stat = UNCONSCIOUS
if(sleeping)
stat = UNCONSCIOUS
return 1
/mob/living/carbon/proc/CheckStamina()
if(staminaloss)
var/total_health = (health - staminaloss)
if(total_health <= config.health_threshold_crit && !stat)
src << "<span class='notice'>You're too exhausted to keep going...</span>"
Weaken(5)
setStaminaLoss(health - 2)
return
setStaminaLoss(max((staminaloss - 2), 0))
//this updates all special effects: stunned, sleeping, weakened, druggy, stuttering, etc..
/mob/living/carbon/handle_status_effects()
..()
CheckStamina()
if(sleeping)
handle_dreams()
adjustStaminaLoss(-10)
sleeping = max(sleeping-1, 0)
if( prob(10) && health && !hal_crit )
spawn(0)
emote("snore")
var/restingpwr = 1 + 4 * resting
//Dizziness
if(dizziness)
var/client/C = client
var/pixel_x_diff = 0
var/pixel_y_diff = 0
var/temp
var/saved_dizz = dizziness
if(C)
var/oldsrc = src
var/amplitude = dizziness*(sin(dizziness * 0.044 * world.time) + 1) / 70 // This shit is annoying at high strength
src = null
spawn(0)
if(C)
temp = amplitude * sin(0.008 * saved_dizz * world.time)
pixel_x_diff += temp
C.pixel_x += temp
temp = amplitude * cos(0.008 * saved_dizz * world.time)
pixel_y_diff += temp
C.pixel_y += temp
sleep(3)
if(C)
temp = amplitude * sin(0.008 * saved_dizz * world.time)
pixel_x_diff += temp
C.pixel_x += temp
temp = amplitude * cos(0.008 * saved_dizz * world.time)
pixel_y_diff += temp
C.pixel_y += temp
sleep(3)
if(C)
C.pixel_x -= pixel_x_diff
C.pixel_y -= pixel_y_diff
src = oldsrc
dizziness = max(dizziness - restingpwr, 0)
if(drowsyness)
drowsyness = max(drowsyness - restingpwr, 0)
eye_blurry = max(2, eye_blurry)
if(prob(5))
sleeping += 1
Paralyse(5)
if(confused)
confused = max(0, confused - 1)
//Jitteryness
if(jitteriness)
do_jitter_animation(jitteriness)
jitteriness = max(jitteriness - restingpwr, 0)
if(stuttering)
stuttering = max(stuttering-1, 0)
if(slurring)
slurring = max(slurring-1,0)
if(silent)
silent = max(silent-1, 0)
if(druggy)
druggy = max(druggy-1, 0)
if(hallucination)
spawn handle_hallucinations()
if(hallucination<=2)
hallucination = 0
else
hallucination -= 2
//this handles hud updates. Calls update_vision() and handle_hud_icons()
/mob/living/carbon/handle_regular_hud_updates()
if(!client) return 0
if(damageoverlay)
if(damageoverlay.overlays)
damageoverlay.overlays = list()
if(stat == UNCONSCIOUS)
//Critical damage passage overlay
if(health <= config.health_threshold_crit)
var/image/I = image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage0")
I.blend_mode = BLEND_OVERLAY //damageoverlay is BLEND_MULTIPLY
switch(health)
if(-20 to -10)
I.icon_state = "passage1"
if(-30 to -20)
I.icon_state = "passage2"
if(-40 to -30)
I.icon_state = "passage3"
if(-50 to -40)
I.icon_state = "passage4"
if(-60 to -50)
I.icon_state = "passage5"
if(-70 to -60)
I.icon_state = "passage6"
if(-80 to -70)
I.icon_state = "passage7"
if(-90 to -80)
I.icon_state = "passage8"
if(-95 to -90)
I.icon_state = "passage9"
if(-INFINITY to -95)
I.icon_state = "passage10"
damageoverlay.overlays += I
else
//Oxygen damage overlay
if(oxyloss)
var/image/I = image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay0")
switch(oxyloss)
if(10 to 20)
I.icon_state = "oxydamageoverlay1"
if(20 to 25)
I.icon_state = "oxydamageoverlay2"
if(25 to 30)
I.icon_state = "oxydamageoverlay3"
if(30 to 35)
I.icon_state = "oxydamageoverlay4"
if(35 to 40)
I.icon_state = "oxydamageoverlay5"
if(40 to 45)
I.icon_state = "oxydamageoverlay6"
if(45 to INFINITY)
I.icon_state = "oxydamageoverlay7"
damageoverlay.overlays += I
//Fire and Brute damage overlay (BSSR)
var/hurtdamage = src.getBruteLoss() + src.getFireLoss() + damageoverlaytemp
damageoverlaytemp = 0 // We do this so we can detect if someone hits us or not.
if(hurtdamage)
var/image/I = image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay0")
I.blend_mode = BLEND_ADD
switch(hurtdamage)
if(5 to 15)
I.icon_state = "brutedamageoverlay1"
if(15 to 30)
I.icon_state = "brutedamageoverlay2"
if(30 to 45)
I.icon_state = "brutedamageoverlay3"
if(45 to 70)
I.icon_state = "brutedamageoverlay4"
if(70 to 85)
I.icon_state = "brutedamageoverlay5"
if(85 to INFINITY)
I.icon_state = "brutedamageoverlay6"
var/image/black = image(I.icon, I.icon_state) //BLEND_ADD doesn't let us darken, so this is just to blacken the edge of the screen
black.color = "#170000"
damageoverlay.overlays += I
damageoverlay.overlays += black
..()
return 1
/mob/living/carbon/update_sight()
if(stat == DEAD)
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else
sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS)
if(XRAY in mutations)
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING
if(see_override)
see_invisible = see_override
/mob/living/carbon/handle_hud_icons()
return
/mob/living/carbon/handle_hud_icons_health()
if(healths)
if (stat != DEAD)
switch(health)
if(100 to INFINITY)
healths.icon_state = "health0"
if(80 to 100)
healths.icon_state = "health1"
if(60 to 80)
healths.icon_state = "health2"
if(40 to 60)
healths.icon_state = "health3"
if(20 to 40)
healths.icon_state = "health4"
if(0 to 20)
healths.icon_state = "health5"
else
healths.icon_state = "health6"
else
healths.icon_state = "health7"

View File

@@ -554,7 +554,6 @@
/mob/living/carbon/slime/restrained()
return 0
mob/living/carbon/slime/var/co2overloadtime = null
mob/living/carbon/slime/var/temperature_resistance = T0C+75
/mob/living/carbon/slime/show_inv(mob/user)

View File

@@ -0,0 +1,265 @@
/mob/living/Life()
set invisibility = 0
set background = BACKGROUND_ENABLED
if(notransform)
return
if(!loc)
return
var/datum/gas_mixture/environment = loc.return_air()
//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
if(stat != DEAD)
//Breathing, if applicable
handle_breathing()
//Mutations and radiation
handle_mutations_and_radiation()
//Chemicals in the body
handle_chemicals_in_body()
//Random events (vomiting etc)
handle_random_events()
. = 1
//Handle temperature/pressure differences between body and environment
if(environment)
handle_environment(environment)
handle_fire()
//stuff in the stomach
handle_stomach()
update_gravity(mob_has_gravity())
update_pulling()
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
handle_actions()
update_canmove()
if(client)
handle_regular_hud_updates()
/mob/living/proc/handle_breathing()
return
/mob/living/proc/handle_mutations_and_radiation()
radiation = 0 //so radiation don't accumulate in simple animals
return
/mob/living/proc/handle_chemicals_in_body()
return
/mob/living/proc/handle_random_events()
return
/mob/living/proc/handle_environment(datum/gas_mixture/environment)
return
/mob/living/proc/handle_stomach()
return
/mob/living/proc/update_pulling()
if(pulling)
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
handle_vision()
handle_hud_icons()
update_action_buttons()
return 1
/mob/living/proc/handle_vision()
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask)
update_sight()
if(stat != DEAD)
if(blind)
if(eye_blind)
blind.layer = 18
else
blind.layer = 0
if (disabilities & NEARSIGHTED)
client.screen += global_hud.vimpaired
if (eye_blurry)
client.screen += global_hud.blurry
if (druggy)
client.screen += global_hud.druggy
if(machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(!client.adminobs)
reset_view(null)
/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
/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)
if(A.CheckRemoval(src))
A.Remove(src)
for(var/obj/item/I in src)
if(istype(I,/obj/item/clothing/under))
var/obj/item/clothing/under/U = I
for(var/obj/item/IU in U)
if(istype(IU, /obj/item/clothing/accessory))
var/obj/item/clothing/accessory/A = IU
if(A.action_button_name)
if(!A.action)
if(A.action_button_is_hands_free)
A.action = new/datum/action/item_action/hands_free
else
A.action = new/datum/action/item_action
A.action.name = A.action_button_name
A.action.target = A
A.action.check_flags &= ~AB_CHECK_INSIDE
A.action.Grant(src)
if(I.action_button_name)
if(!I.action)
if(I.action_button_is_hands_free)
I.action = new/datum/action/item_action/hands_free
else
I.action = new/datum/action/item_action
I.action.name = I.action_button_name
I.action.target = I
I.action.Grant(src)
return
/mob/living/update_action_buttons()
if(!hud_used) return
if(!client) return
if(hud_used.hud_shown != 1) //Hud toggled to minimal
return
client.screen -= hud_used.hide_actions_toggle
for(var/datum/action/A in actions)
if(A.button)
client.screen -= A.button
if(hud_used.action_buttons_hidden)
if(!hud_used.hide_actions_toggle)
hud_used.hide_actions_toggle = new(hud_used)
hud_used.hide_actions_toggle.UpdateIcon()
if(!hud_used.hide_actions_toggle.moved)
hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(1)
//hud_used.SetButtonCoords(hud_used.hide_actions_toggle,1)
client.screen += hud_used.hide_actions_toggle
return
var/button_number = 0
for(var/datum/action/A in actions)
button_number++
if(A.button == null)
var/obj/screen/movable/action_button/N = new(hud_used)
N.owner = A
A.button = N
var/obj/screen/movable/action_button/B = A.button
B.UpdateIcon()
B.name = A.UpdateName()
client.screen += B
if(!B.moved)
B.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number)
//hud_used.SetButtonCoords(B,button_number)
if(button_number > 0)
if(!hud_used.hide_actions_toggle)
hud_used.hide_actions_toggle = new(hud_used)
hud_used.hide_actions_toggle.InitialiseIcon(src)
if(!hud_used.hide_actions_toggle.moved)
hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number+1)
//hud_used.SetButtonCoords(hud_used.hide_actions_toggle,button_number+1)
client.screen += hud_used.hide_actions_toggle

View File

@@ -3,29 +3,6 @@
..()
return QDEL_HINT_HARDDEL_NOW
/mob/living/Life()
..()
if (notransform) return
if(!loc) return // Fixing a null error that occurs when the mob isn't found in the world -- TLE
if(mind)
if(mind in ticker.mode.implanted)
if(implanting) return
//world << "[src.name]"
var/datum/mind/head = ticker.mode.implanted[mind]
//var/list/removal
if(!(locate(/obj/item/weapon/implant/traitor) in src.contents))
//world << "doesn't have an implant"
ticker.mode.remove_traitor_mind(mind, head)
/*
if((head in ticker.mode.implanters))
ticker.mode.implanter[head] -= src.mind
ticker.mode.implanted -= src.mind
if(src.mind in ticker.mode.traitors)
ticker.mode.traitors -= src.mind
special_role = null
current << "\red <FONT size = 3><B>The fog clouding your mind clears. You remember nothing from the moment you were implanted until now..(You don't remember who enslaved you)</B></FONT>"
*/
//mob verbs are a lot faster than object verbs
//for more info on why this is not atom/pull, see examinate() in mob.dm
/mob/living/verb/pulled(atom/movable/AM as mob|obj in oview(1))
@@ -279,6 +256,18 @@
return def_zone
//damage/heal the mob ears and adjust the deaf amount
/mob/living/adjustEarDamage(damage, 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(damage, deaf)
if(damage >= 0)
ear_damage = damage
if(deaf >= 0)
ear_deaf = deaf
// heal ONE external organ, organ gets randomly selected from damaged ones.
/mob/living/proc/heal_organ_damage(var/brute, var/burn)
adjustBruteLoss(-brute)
@@ -869,15 +858,6 @@
spintime -= speed
return
/mob/living/proc/CheckStamina()
if(staminaloss)
var/total_health = (health - staminaloss)
if(total_health <= config.health_threshold_softcrit && !stat)
Exhaust()
setStaminaLoss(health - 2)
return
setStaminaLoss(max((staminaloss - 2), 0))
/mob/living/proc/Exhaust()
src << "<span class='notice'>You're too exhausted to keep going...</span>"
Weaken(5)
@@ -1006,6 +986,33 @@
animate(pixel_x = initial(pixel_x) , pixel_y = initial(pixel_y) , time = 2)
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.
/mob/living/proc/get_temperature(datum/gas_mixture/environment)
var/loc_temp = T0C
if(istype(loc, /obj/mecha))
var/obj/mecha/M = loc
loc_temp = M.return_temperature()
else if(istype(loc, /obj/structure/transit_tube_pod))
loc_temp = environment.temperature
else if(istype(get_turf(src), /turf/space))
var/turf/heat_turf = get_turf(src)
loc_temp = heat_turf.temperature
else if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell))
var/obj/machinery/atmospherics/unary/cryo_cell/C = loc
if(C.air_contents.total_moles() < 10)
loc_temp = environment.temperature
else
loc_temp = C.air_contents.temperature
else
loc_temp = environment.temperature
return loc_temp
/mob/living/proc/get_standard_pixel_x_offset(lying = 0)
return initial(pixel_x)

View File

@@ -213,94 +213,7 @@
if(volume >= 20) fire_stacks -= 0.5
if(volume >= 50) fire_stacks -= 1
/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)
if(A.CheckRemoval(src))
A.Remove(src)
for(var/obj/item/I in src)
if(istype(I,/obj/item/clothing/under))
var/obj/item/clothing/under/U = I
for(var/obj/item/IU in U)
if(istype(IU, /obj/item/clothing/accessory))
var/obj/item/clothing/accessory/A = IU
if(A.action_button_name)
if(!A.action)
if(A.action_button_is_hands_free)
A.action = new/datum/action/item_action/hands_free
else
A.action = new/datum/action/item_action
A.action.name = A.action_button_name
A.action.target = A
A.action.check_flags &= ~AB_CHECK_INSIDE
A.action.Grant(src)
if(I.action_button_name)
if(!I.action)
if(I.action_button_is_hands_free)
I.action = new/datum/action/item_action/hands_free
else
I.action = new/datum/action/item_action
I.action.name = I.action_button_name
I.action.target = I
I.action.Grant(src)
return
/mob/living/update_action_buttons()
if(!hud_used) return
if(!client) return
if(hud_used.hud_shown != 1) //Hud toggled to minimal
return
client.screen -= hud_used.hide_actions_toggle
for(var/datum/action/A in actions)
if(A.button)
client.screen -= A.button
if(hud_used.action_buttons_hidden)
if(!hud_used.hide_actions_toggle)
hud_used.hide_actions_toggle = new(hud_used)
hud_used.hide_actions_toggle.UpdateIcon()
if(!hud_used.hide_actions_toggle.moved)
hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(1)
//hud_used.SetButtonCoords(hud_used.hide_actions_toggle,1)
client.screen += hud_used.hide_actions_toggle
return
var/button_number = 0
for(var/datum/action/A in actions)
button_number++
if(A.button == null)
var/obj/screen/movable/action_button/N = new(hud_used)
N.owner = A
A.button = N
var/obj/screen/movable/action_button/B = A.button
B.UpdateIcon()
B.name = A.UpdateName()
client.screen += B
if(!B.moved)
B.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number)
//hud_used.SetButtonCoords(B,button_number)
if(button_number > 0)
if(!hud_used.hide_actions_toggle)
hud_used.hide_actions_toggle = new(hud_used)
hud_used.hide_actions_toggle.InitialiseIcon(src)
if(!hud_used.hide_actions_toggle.moved)
hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number+1)
//hud_used.SetButtonCoords(hud_used.hide_actions_toggle,button_number+1)
client.screen += hud_used.hide_actions_toggle
//This is called when the mob is thrown into a dense turf
/mob/living/proc/turf_collision(var/turf/T, var/speed)

View File

@@ -1,44 +1,26 @@
/mob/living/silicon/pai/Life()
if (src.stat == 2)
return
if(src.cable)
if(get_dist(src, src.cable) > 1)
var/turf/T = get_turf_or_move(src.loc)
for (var/mob/M in viewers(T))
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)
sleeping = 0
ear_deaf = 0
. = ..()
if(.)
regular_hud_updates()
if (src.paralysis || src.stunned || src.weakened) //Stunned etc.
src.stat = 1
if (src.stunned > 0)
AdjustStunned(-1)
if (src.weakened > 0)
AdjustWeakened(-1)
if (src.paralysis > 0)
AdjustParalysis(-1)
src.eye_blind = max(eye_blind, 1)
else
src.eye_blind = 0
if(src.secHUD == 1)
process_sec_hud(src, 1)
if(src.medHUD == 1)
process_med_hud(src, 1)
if(silence_time)
if(world.timeofday >= silence_time)
silence_time = null
src << "<font color=green>Communication circuit reinitialized. Speech and messaging functionality restored.</font>"
else //Not stunned.
src.stat = 0
if(cable)
if(get_dist(src, cable) > 1)
var/turf/T = get_turf_or_move(loc)
for (var/mob/M in viewers(T))
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)
if(paralysis || stunned || weakened || buckled || resting || src.loc == card) canmove = 0
else canmove = 1
handle_statuses()
regular_hud_updates()
if(src.secHUD == 1)
process_sec_hud(src, 1)
if(src.medHUD == 1)
process_med_hud(src, 1)
if(silence_time)
if(world.timeofday >= silence_time)
silence_time = null
src << "<font color=green>Communication circuit reinitialized. Speech and messaging functionality restored.</font>"
handle_statuses()
handle_actions()
/mob/living/silicon/pai/updatehealth()
if(status_flags & GODMODE)

View File

@@ -1,34 +1,20 @@
/mob/living/silicon/robot/Life()
set invisibility = 0
//set background = 1
set background = BACKGROUND_ENABLED
if (src.notransform)
return
src.blinded = null
//Status updates, death etc.
clamp_values()
handle_regular_status_updates()
handle_actions()
if(client)
handle_regular_hud_updates()
update_items()
if (src.stat != DEAD) //still using power
if(..())
use_power()
process_locks()
process_queued_alarms()
update_canmove()
update_gravity(mob_has_gravity())
handle_fire()
/mob/living/silicon/robot/proc/clamp_values()
SetStunned(min(stunned, 30))
SetParalysis(min(paralysis, 30))
SetWeakened(min(weakened, 20))
@@ -80,7 +66,7 @@
update_headlamp(1)
Paralyse(3)
/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.IsCameraCut())
@@ -170,7 +156,7 @@
return 1
/mob/living/silicon/robot/proc/handle_regular_hud_updates()
/mob/living/silicon/robot/update_sight()
if (src.stat == 2 || src.sight_mode & BORGXRAY)
src.sight |= SEE_TURFS
@@ -199,124 +185,92 @@
if(see_override)
see_invisible = see_override
/mob/living/silicon/robot/handle_hud_icons()
update_items()
update_cell()
..()
/mob/living/silicon/robot/handle_hud_icons_health()
if(healths)
if(stat != DEAD)
if(health >= maxHealth)
healths.icon_state = "health0"
else if(health > maxHealth*0.5)
healths.icon_state = "health2"
else if(health > 0)
healths.icon_state = "health3"
else if(health > -maxHealth*0.5)
healths.icon_state = "health4"
else if(health > -maxHealth)
healths.icon_state = "health5"
else
healths.icon_state = "health6"
else
healths.icon_state = "health7"
if(bodytemp)
switch(bodytemperature) //310.055 optimal body temp
if(335 to INFINITY)
bodytemp.icon_state = "temp2"
if(320 to 335)
bodytemp.icon_state = "temp1"
if(300 to 320)
bodytemp.icon_state = "temp0"
if(260 to 300)
bodytemp.icon_state = "temp-1"
else
bodytemp.icon_state = "temp-2"
/mob/living/silicon/robot/proc/update_cell()
if(cells)
if(cell)
var/cellcharge = cell.charge/cell.maxcharge
switch(cellcharge)
if(0.75 to INFINITY)
cells.icon_state = "charge4"
if(0.5 to 0.75)
cells.icon_state = "charge3"
if(0.25 to 0.5)
cells.icon_state = "charge2"
if(0 to 0.25)
cells.icon_state = "charge1"
else
cells.icon_state = "charge0"
else
cells.icon_state = "charge-empty"
/mob/living/silicon/robot/handle_regular_hud_updates()
if(!client)
return
regular_hud_updates()
switch(src.sensor_mode)
if (SEC_HUD)
switch(sensor_mode)
if(SEC_HUD)
process_sec_hud(src,1)
if (MED_HUD)
if(MED_HUD)
process_med_hud(src,1)
if (src.healths)
if (src.stat != 2)
if(istype(src,/mob/living/silicon/robot/drone))
switch(health)
if(35 to INFINITY)
src.healths.icon_state = "health0"
if(25 to 34)
src.healths.icon_state = "health1"
if(15 to 24)
src.healths.icon_state = "health2"
if(5 to 14)
src.healths.icon_state = "health3"
if(0 to 4)
src.healths.icon_state = "health4"
if(-35 to 0)
src.healths.icon_state = "health5"
else
src.healths.icon_state = "health6"
else
switch(health)
if(100 to INFINITY)
src.healths.icon_state = "health0"
if(50 to 100)
src.healths.icon_state = "health2"
if(0 to 50)
src.healths.icon_state = "health3"
if(-50 to 0)
src.healths.icon_state = "health4"
if(config.health_threshold_dead to -50)
src.healths.icon_state = "health5"
else
src.healths.icon_state = "health6"
else
src.healths.icon_state = "health7"
if (src.syndicate && src.client)
if(syndicate)
if(ticker.mode.name == "traitor")
for(var/datum/mind/tra in ticker.mode.traitors)
if(tra.current)
var/I = image('icons/mob/mob.dmi', loc = tra.current, icon_state = "traitor")
src.client.images += I
if(src.connected_ai)
src.connected_ai.connected_robots -= src
src.connected_ai = null
if(src.mind)
if(!src.mind.special_role)
src.mind.special_role = "traitor"
if(connected_ai)
connected_ai.connected_robots -= src
connected_ai = null
if(mind)
if(!mind.special_role)
mind.special_role = "traitor"
ticker.mode.traitors += src.mind
if (src.cells)
if (src.cell)
var/cellcharge = src.cell.charge/src.cell.maxcharge
switch(cellcharge)
if(0.75 to INFINITY)
src.cells.icon_state = "charge4"
if(0.5 to 0.75)
src.cells.icon_state = "charge3"
if(0.25 to 0.5)
src.cells.icon_state = "charge2"
if(0 to 0.25)
src.cells.icon_state = "charge1"
else
src.cells.icon_state = "charge0"
else
src.cells.icon_state = "charge-empty"
if(bodytemp)
switch(src.bodytemperature) //310.055 optimal body temp
if(335 to INFINITY)
src.bodytemp.icon_state = "temp2"
if(320 to 335)
src.bodytemp.icon_state = "temp1"
if(300 to 320)
src.bodytemp.icon_state = "temp0"
if(260 to 300)
src.bodytemp.icon_state = "temp-1"
else
src.bodytemp.icon_state = "temp-2"
//Oxygen and fire does nothing yet!!
// if (src.oxygen) src.oxygen.icon_state = "oxy[src.oxygen_alert ? 1 : 0]"
// if (src.fire) src.fire.icon_state = "fire[src.fire_alert ? 1 : 0]"
client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired)
if ((src.blind && src.stat != 2))
if(src.blinded)
src.blind.layer = 18
else
src.blind.layer = 0
if (src.disabilities & NEARSIGHTED)
src.client.screen += global_hud.vimpaired
if (src.eye_blurry)
src.client.screen += global_hud.blurry
if (src.druggy)
src.client.screen += global_hud.druggy
if (src.stat != 2)
if (src.machine)
if (!( src.machine.check_eye(src) ))
src.reset_view(null)
else
if(client && !client.adminobs)
reset_view(null)
..()
return 1
/mob/living/silicon/robot/proc/update_items()
if (src.client)
src.client.screen -= src.contents
@@ -342,8 +296,11 @@
weaponlock_time = 120
/mob/living/silicon/robot/update_canmove()
if(paralysis || stunned || weakened || buckled || lockcharge) canmove = 0
else canmove = 1
if(paralysis || stunned || weakened || buckled || lockcharge)
canmove = 0
else
canmove = 1
update_transform()
return canmove
//Robots on fire

View File

@@ -94,7 +94,7 @@
if(statpanel("Status"))
stat("Resources:",resources)
/mob/living/simple_animal/hostile/swarmer/Die()
/mob/living/simple_animal/hostile/swarmer/death()
..()
new /obj/effect/decal/cleanable/blood/gibs/robot(src.loc)
ghostize()
@@ -105,7 +105,7 @@
health = 1
return
else
Die()
death()
/mob/living/simple_animal/hostile/swarmer/CanPass(atom/movable/O)
if(istype(O, /obj/item/projectile/beam/disabler))//Allows for swarmers to fight as a group without wasting their shots hitting each other

View File

@@ -36,7 +36,7 @@
AddSpell(new spell(src))
updateglow()
/mob/living/simple_animal/construct/Die()
/mob/living/simple_animal/construct/death()
..()
new /obj/item/weapon/reagent_containers/food/snacks/ectoplasm (src.loc)
for(var/mob/M in viewers(src, null))

View File

@@ -33,10 +33,12 @@
var/turns_since_scan = 0
var/mob/living/simple_animal/mouse/movement_target
/mob/living/simple_animal/pet/cat/Runtime/Life()
/mob/living/simple_animal/pet/cat/Runtime/handle_automated_action()
..()
//MICE!
if((src.loc) && isturf(src.loc))
if(!stat && !resting && !buckled)
if(loc && isturf(loc))
if(!incapacitated())
for(var/mob/living/simple_animal/mouse/M in view(1,src))
if(!M.stat && Adjacent(M))
custom_emote(1, "splats \the [M]!")
@@ -45,11 +47,12 @@
stop_automated_movement = 0
break
..()
//attempt to mate
make_babies()
if(!stat && !resting && !buckled)
/mob/living/simple_animal/pet/cat/Runtime/handle_automated_movement()
..()
if(!incapacitated())
turns_since_scan++
if(turns_since_scan > 5)
walk_to(src,0)

View File

@@ -32,20 +32,21 @@
..()
regenerate_icons()
/mob/living/simple_animal/pet/corgi/Life()
. = ..()
if(.)
if(fire)
if(fire_alert) fire.icon_state = "fire[fire_alert]" //fire_alert is either 0 if no alert, 1 for heat and 2 for cold.
else fire.icon_state = "fire0"
if(oxygen)
if(oxygen_alert) oxygen.icon_state = "oxy1"
else oxygen.icon_state = "oxy0"
if(toxin)
if(toxins_alert) toxin.icon_state = "tox1"
else toxin.icon_state = "tox0"
/mob/living/simple_animal/pet/corgi/handle_hud_icons()
..()
if(fire)
if(fire_alert) fire.icon_state = "fire[fire_alert]" //fire_alert is either 0 if no alert, 1 for heat and 2 for cold.
else fire.icon_state = "fire0"
if(oxygen)
if(oxygen_alert) oxygen.icon_state = "oxy1"
else oxygen.icon_state = "oxy0"
if(toxin)
if(toxins_alert) toxin.icon_state = "tox1"
else toxin.icon_state = "tox0"
if (healths)
/mob/living/simple_animal/pet/corgi/handle_hud_icons_health()
..()
if(healths)
switch(health)
if(30 to INFINITY) healths.icon_state = "health0"
if(26 to 29) healths.icon_state = "health1"
@@ -55,9 +56,12 @@
if(6 to 10) healths.icon_state = "health5"
if(1 to 5) healths.icon_state = "health6"
if(0) healths.icon_state = "health7"
/mob/living/simple_animal/pet/corgi/Life()
. = ..()
regenerate_icons()
/mob/living/simple_animal/pet/corgi/Die()
/mob/living/simple_animal/pet/corgi/death()
..()
regenerate_icons()
@@ -638,7 +642,7 @@
M.show_message("\red [src] makes an odd whining noise.")
sleep(10)
explosion(get_turf(src), 0, 1, 4, 7)
Die()
death()
/mob/living/simple_animal/pet/corgi/Ian/borgi/proc/shootAt(var/atom/movable/target)
var/turf/T = get_turf(src)
@@ -669,7 +673,7 @@
s.set_up(3, 1, src)
s.start()
/mob/living/simple_animal/pet/corgi/Ian/borgi/Die()
/mob/living/simple_animal/pet/corgi/Ian/borgi/death()
..()
visible_message("<b>[src]</b> blows apart!")
new /obj/effect/decal/cleanable/blood/gibs/robot(src.loc)

View File

@@ -23,10 +23,9 @@
var/obj/item/inventory_mask
can_hide = 1
/mob/living/simple_animal/crab/Life()
..()
/mob/living/simple_animal/crab/handle_automated_movement()
//CRAB movement
if(!ckey && !stat)
if(!stat)
if(isturf(src.loc) && !resting && !buckled) //This is so it only moves if it's not inside a closet, gentics machine, etc.
turns_since_move++
if(turns_since_move >= turns_per_move)
@@ -34,6 +33,9 @@
if(Process_Spacemove(east_vs_west))
Move(get_step(src, east_vs_west), east_vs_west)
turns_since_move = 0
/mob/living/simple_animal/crab/Life()
. = ..()
regenerate_icons()
//COFFEE! SQUEEEEEEEEE!
@@ -51,7 +53,7 @@
if(prob(50))
user << "\red \b This kills the crab."
health -= 20
Die()
death()
else
GetMad()
get

View File

@@ -27,36 +27,36 @@
stop_automated_movement_when_pulled = 1
var/milk_content = 0
/mob/living/simple_animal/hostile/retaliate/goat/New()
/mob/living/simple_animal/hostile/retaliate/goat/handle_automated_movement()
..()
if(!pulledby)
for(var/direction in shuffle(list(1,2,4,8,5,6,9,10)))
var/step = get_step(src, direction)
if(step)
if(locate(/obj/effect/plant) in step)
Move(step, get_dir(src, step))
/mob/living/simple_animal/hostile/retaliate/goat/handle_automated_action()
//chance to go crazy and start wacking stuff
if(!enemies.len && prob(1))
Retaliate()
if(enemies.len && prob(10))
enemies = list()
LoseTarget()
src.visible_message("\blue [src] calms down.")
if(locate(/obj/effect/plant) in loc)
var/obj/effect/plant/SV = locate(/obj/effect/plant) in loc
qdel(SV)
if(prob(10))
say("Nom")
/mob/living/simple_animal/hostile/retaliate/goat/Life()
. = ..()
if(.)
//chance to go crazy and start wacking stuff
if(!enemies.len && prob(1))
Retaliate()
if(stat == CONSCIOUS && prob(5))
milk_content = min(50, milk_content+rand(5, 10))
if(enemies.len && prob(10))
enemies = list()
LoseTarget()
src.visible_message("\blue [src] calms down.")
if(stat == CONSCIOUS && prob(5))
milk_content = min(50, milk_content+rand(5, 10))
if(locate(/obj/effect/plant) in loc)
var/obj/effect/plant/SV = locate(/obj/effect/plant) in loc
qdel(SV)
if(prob(10))
say("Nom")
if(!pulledby)
for(var/direction in shuffle(list(1,2,4,8,5,6,9,10)))
var/step = get_step(src, direction)
if(step)
if(locate(/obj/effect/plant) in step)
Move(step, get_dir(src, step))
/mob/living/simple_animal/hostile/retaliate/goat/Retaliate()
..()
@@ -186,9 +186,7 @@
/mob/living/simple_animal/chick/Life()
. =..()
if(!.)
return
if(!stat)
if(.)
amount_grown += rand(1,2)
if(amount_grown >= 100)
new /mob/living/simple_animal/chicken(src.loc)
@@ -234,7 +232,7 @@ var/global/chicken_count = 0
pixel_y = rand(0, 10)
chicken_count += 1
/mob/living/simple_animal/chicken/Die()
/mob/living/simple_animal/chicken/death()
..()
chicken_count -= 1
@@ -256,10 +254,8 @@ var/global/chicken_count = 0
..()
/mob/living/simple_animal/chicken/Life()
. =..()
if(!.)
return
if(!stat && prob(3) && eggsleft > 0)
. = ..()
if(. && prob(3) && eggsleft > 0)
visible_message("[src] [pick("lays an egg.","squats down and croons.","begins making a huge racket.","begins clucking raucously.")]")
eggsleft--
var/obj/item/weapon/reagent_containers/food/snacks/egg/E = new(get_turf(src))

View File

@@ -31,12 +31,15 @@
universal_speak = 0
can_hide = 1
/mob/living/simple_animal/mouse/Life()
/mob/living/simple_animal/mouse/handle_automated_speech()
..()
if(!stat && prob(speak_chance))
if(prob(speak_chance))
for(var/mob/M in view())
M << 'sound/effects/mousesqueek.ogg'
/mob/living/simple_animal/mouse/Life()
. = ..()
if(!ckey && stat == CONSCIOUS && prob(0.5))
stat = UNCONSCIOUS
icon_state = "mouse_[mouse_color]_sleep"
@@ -105,7 +108,7 @@
M << 'sound/effects/mousesqueek.ogg'
..()
/mob/living/simple_animal/mouse/Die()
/mob/living/simple_animal/mouse/death()
layer = MOB_LAYER
if(client)
client.time_died_as_mouse = world.time

View File

@@ -37,7 +37,7 @@
..()
regenerate_icons()
/mob/living/simple_animal/pet/Die()
/mob/living/simple_animal/pet/death()
..()
regenerate_icons()

View File

@@ -70,7 +70,7 @@
overlays += "aslime-:33"
/mob/living/simple_animal/slime/adult/Die()
/mob/living/simple_animal/slime/adult/death()
var/mob/living/simple_animal/slime/S1 = new /mob/living/simple_animal/slime (src.loc)
S1.icon_state = "[src.colour] baby slime"
S1.icon_living = "[src.colour] baby slime"

View File

@@ -166,7 +166,7 @@
M.show_message("\red [src] makes an odd warbling noise, fizzles, and explodes.")
explosion(get_turf(loc), -1, -1, 3, 5)
eject_brain()
Die()
death()
/mob/living/simple_animal/spiderbot/proc/update_icon()
if(mmi)
@@ -204,7 +204,7 @@
..()
/mob/living/simple_animal/spiderbot/Die()
/mob/living/simple_animal/spiderbot/death()
living_mob_list -= src
dead_mob_list += src

View File

@@ -41,7 +41,7 @@
density = 1
return
else if(health < 1)
Die()
death()
else if(health > maxHealth)
health = maxHealth
for(var/mob/A in viewers(world.view,src))

View File

@@ -139,7 +139,7 @@
damage = 30
icon_state = "toxin"
/mob/living/simple_animal/hostile/alien/Die()
/mob/living/simple_animal/hostile/alien/death()
..()
if(dead == 0)
dead = 1

View File

@@ -57,7 +57,7 @@
icon_state = "bearfloor"
/mob/living/simple_animal/hostile/bear/Life()
. =..()
. = ..()
if(!.)
return

View File

@@ -62,7 +62,7 @@
icon_living = "holocarp"
maxbodytemp = INFINITY
/mob/living/simple_animal/hostile/carp/holocarp/Die()
/mob/living/simple_animal/hostile/carp/holocarp/death()
..()
ghostize()
qdel(src)

View File

@@ -81,9 +81,8 @@
poison_per_bite = 5
move_to_delay = 5
/mob/living/simple_animal/hostile/poison/giant_spider/Life()
..()
if(!stat && !ckey)
/mob/living/simple_animal/hostile/poison/giant_spider/hunter/handle_automated_action()
if(!stat)
if(stance == HOSTILE_STANCE_IDLE)
//1% chance to skitter madly away
if(!busy && prob(1))
@@ -117,8 +116,7 @@
busy = 0
stop_automated_movement = 0
/mob/living/simple_animal/hostile/poison/giant_spider/nurse/Life()
..()
/mob/living/simple_animal/hostile/poison/giant_spider/nurse/handle_automated_action()
if(!stat && !ckey)
if(stance == HOSTILE_STANCE_IDLE)
var/list/can_see = view(src, 10)

View File

@@ -48,7 +48,7 @@
health = 80
ranged = 1
/mob/living/simple_animal/hostile/hivebot/Die()
/mob/living/simple_animal/hostile/hivebot/death()
..()
visible_message("<b>[src]</b> blows apart!")
new /obj/effect/decal/cleanable/blood/gibs/robot(src.loc)

View File

@@ -242,7 +242,7 @@
//////////////END HOSTILE MOB TARGETTING AND AGGRESSION////////////
/mob/living/simple_animal/hostile/Die()
/mob/living/simple_animal/hostile/death()
LoseAggro()
mouse_opacity = 1
..()

View File

@@ -43,7 +43,7 @@
if(.)
custom_emote(1, "growls at [.]")
/mob/living/simple_animal/hostile/mimic/Die()
/mob/living/simple_animal/hostile/mimic/death()
..()
visible_message("\red <b>[src]</b> stops moving!")
ghostize()
@@ -53,7 +53,7 @@
if(is_electronic)
switch(severity)
if(1)
Die()
death()
if(2)
adjustBruteLoss(50)
..(severity)
@@ -117,7 +117,7 @@
..()
icon_state = initial(icon_state)
/mob/living/simple_animal/hostile/mimic/crate/Die()
/mob/living/simple_animal/hostile/mimic/crate/death()
var/obj/structure/closet/crate/C = new(get_turf(src))
// Put loot in crate
@@ -154,9 +154,9 @@ var/global/list/protected_objects = list(/obj/structure/table, /obj/structure/ca
/mob/living/simple_animal/hostile/mimic/copy/Life()
..()
for(var/mob/living/M in contents) //a fix for animated statues from the flesh to stone spell
Die()
death()
/mob/living/simple_animal/hostile/mimic/copy/Die()
/mob/living/simple_animal/hostile/mimic/copy/death()
for(var/atom/movable/M in src)
M.loc = get_turf(src)

View File

@@ -111,7 +111,7 @@
if(3.0)
adjustBruteLoss(110)
/mob/living/simple_animal/hostile/asteroid/basilisk/Die()
/mob/living/simple_animal/hostile/asteroid/basilisk/death()
if(stat != DEAD)
var/counter
for(counter=0, counter<2, counter++)
@@ -210,7 +210,7 @@
visible_message("<span class='danger'>The [P.name] was repelled by [src.name]'s girth!</span>")
return
/mob/living/simple_animal/hostile/asteroid/goldgrub/Die()
/mob/living/simple_animal/hostile/asteroid/goldgrub/death()
alerted = 0
Reward()
..()
@@ -261,7 +261,7 @@
/mob/living/simple_animal/hostile/asteroid/hivelord/AttackingTarget()
OpenFire()
/mob/living/simple_animal/hostile/asteroid/hivelord/Die()
/mob/living/simple_animal/hostile/asteroid/hivelord/death()
if(stat != DEAD)
new /obj/item/asteroid/hivelord_core(src.loc)
..()
@@ -328,7 +328,7 @@
spawn(100)
qdel(src)
/mob/living/simple_animal/hostile/asteroid/hivelordbrood/Die()
/mob/living/simple_animal/hostile/asteroid/hivelordbrood/death()
qdel(src)
/mob/living/simple_animal/hostile/asteroid/goliath
@@ -378,7 +378,7 @@
anchored = 1
..()
/mob/living/simple_animal/hostile/asteroid/goliath/Die()
/mob/living/simple_animal/hostile/asteroid/goliath/death()
anchored = 0
if(stat != DEAD)
var/obj/item/asteroid/goliath_hide/G = new /obj/item/asteroid/goliath_hide(src.loc)

View File

@@ -88,7 +88,7 @@
icon_state = "mushroom_color"
UpdateMushroomCap()
/mob/living/simple_animal/hostile/mushroom/Die()
/mob/living/simple_animal/hostile/mushroom/death()
visible_message("<span class='notice'>[src] fainted.</span>")
..()
UpdateMushroomCap()

View File

@@ -49,7 +49,7 @@
weapon1 = /obj/item/weapon/gun/energy/laser
/mob/living/simple_animal/hostile/pirate/Die()
/mob/living/simple_animal/hostile/pirate/death()
..()
if(corpse)
new corpse (src.loc)

View File

@@ -45,16 +45,16 @@
//update_bees()
/mob/living/simple_animal/hostile/poison/bees/Die()
/mob/living/simple_animal/hostile/poison/bees/death()
..()
ghostize()
qdel(src)
return
/mob/living/simple_animal/hostile/poison/bees/Life()
/*/mob/living/simple_animal/hostile/poison/bees/Life()
..()
/* update_bees()
update_bees()
/mob/living/simple_animal/hostile/poison/bees/proc/update_bees()
while(overlays.len != health-1) //how many bees do we have in the swarm?

View File

@@ -156,7 +156,7 @@
hostile_drone = 0
walk(src,0)
/mob/living/simple_animal/hostile/retaliate/malf_drone/Die()
/mob/living/simple_animal/hostile/retaliate/malf_drone/death()
src.visible_message("\blue \icon[src] [src] suddenly breaks apart.")
..()
qdel(src)

View File

@@ -67,7 +67,7 @@
else
invisibility = pick(0,60,60,invisibility)
..()
/mob/living/simple_animal/hostile/retaliate/ghost/Die()
/mob/living/simple_animal/hostile/retaliate/ghost/death()
new /obj/item/weapon/reagent_containers/food/snacks/ectoplasm(loc)
qdel(src)
return
@@ -105,7 +105,7 @@
faction = list("undead")
/mob/living/simple_animal/hostile/retaliate/skeleton/Die()
/mob/living/simple_animal/hostile/retaliate/skeleton/death()
new /obj/effect/decal/remains/human(loc)
qdel(src)
return
@@ -143,7 +143,7 @@
faction = list("undead")
/mob/living/simple_animal/hostile/retaliate/zombie/Die()
/mob/living/simple_animal/hostile/retaliate/zombie/death()
new /obj/effect/decal/cleanable/blood/gibs(loc)
qdel(src)
return

View File

@@ -51,7 +51,7 @@
weapon1 = /obj/item/weapon/gun/projectile/shotgun/boltaction
casingtype = /obj/item/ammo_casing/a762
/mob/living/simple_animal/hostile/russian/Die()
/mob/living/simple_animal/hostile/russian/death()
..()
if(corpse)
new corpse (src.loc)

View File

@@ -186,11 +186,11 @@
//Harder to kill the head, but it can kill off the whole worm
/mob/living/simple_animal/hostile/spaceWorm/wormHead/Die()
/mob/living/simple_animal/hostile/spaceWorm/wormHead/death()
..()
if(prob(catastrophicDeathProb))
for(var/mob/living/simple_animal/hostile/spaceWorm/SW in totalWormSegments)
SW.Die()
SW.death()
/mob/living/simple_animal/hostile/spaceWorm/Life()
@@ -291,12 +291,12 @@
myHead.totalWormSegments -= src
if(die)
newHead.Die()
newHead.death()
qdel(src)
/mob/living/simple_animal/hostile/spaceWorm/Die()
/mob/living/simple_animal/hostile/spaceWorm/death()
..()
if(myHead)
myHead.totalWormSegments -= src

View File

@@ -180,7 +180,7 @@
dust(animation)
/mob/living/simple_animal/hostile/statue/Die()
/mob/living/simple_animal/hostile/statue/death()
living_mob_list -= src
dead_mob_list += src
if(key)

View File

@@ -34,7 +34,7 @@
faction = list("syndicate")
status_flags = CANPUSH
/mob/living/simple_animal/hostile/syndicate/Die()
/mob/living/simple_animal/hostile/syndicate/death()
..()
if(corpse)
new corpse (src.loc)
@@ -162,7 +162,7 @@
minbodytemp = 0
flying = 1
/mob/living/simple_animal/hostile/viscerator/Die()
/mob/living/simple_animal/hostile/viscerator/death()
..()
visible_message("\red <b>[src]</b> is smashed into pieces!")
qdel(src)

View File

@@ -50,7 +50,7 @@
L.Weaken(3)
L.visible_message("<span class='danger'>\the [src] knocks down \the [L]!</span>")
/mob/living/simple_animal/hostile/tree/Die()
/mob/living/simple_animal/hostile/tree/death()
..()
visible_message("\red <b>[src]</b> is hacked into pieces!")
new /obj/item/stack/sheet/wood(loc)

View File

@@ -194,7 +194,7 @@
return 1
return 0
/mob/living/simple_animal/revenant/Die()
/mob/living/simple_animal/revenant/death()
..()
src << "<span class='userdanger'><b>NO! No... it's too late, you can feel yourself fading...</b></span>"
notransform = 1

View File

@@ -28,17 +28,14 @@
status_flags = CANPUSH
Life()
death()
..()
if(stat == 2)
new /obj/item/weapon/reagent_containers/food/snacks/ectoplasm (src.loc)
for(var/mob/M in viewers(src, null))
if((M.client && !( M.blinded )))
M.show_message("\red [src] lets out a contented sigh as their form unwinds. ")
ghostize()
qdel(src)
return
new /obj/item/weapon/reagent_containers/food/snacks/ectoplasm (src.loc)
for(var/mob/M in viewers(src, null))
if((M.client && !( M.blinded )))
M.show_message("\red [src] lets out a contented sigh as their form unwinds. ")
ghostize()
qdel(src)
attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri
if(istype(O, /obj/item/device/soulstone))

View File

@@ -90,43 +90,34 @@
..()
health = Clamp(health, 0, maxHealth)
/mob/living/simple_animal/Life()
updatehealth()
update_gravity(mob_has_gravity())
update_canmove()
//Health
if(stat == DEAD)
if(health > 0)
icon_state = icon_living
dead_mob_list -= src
living_mob_list += src
stat = CONSCIOUS
density = 1
return 0
if(health < 1)
Die()
if(..())
world << "Animal [src] Life() passed ..()"
if(!ckey)
handle_automated_movement()
handle_automated_action()
handle_automated_speech()
. = 1
if(resting && icon_resting && stat != DEAD)
icon_state = icon_resting
else if(icon_resting && stat != DEAD)
else if(stat != DEAD)
icon_state = icon_living
if(sleeping)
sleeping = max(sleeping-1, 0)
if(ear_deaf)
ear_deaf = max(ear_deaf-1, 0)
/mob/living/simple_animal/handle_regular_status_updates()
if(..()) //alive
if(health < 1)
death()
return 0
return 1
handle_stunned()
handle_weakened()
handle_paralysed()
/mob/living/simple_animal/proc/handle_automated_action()
return
handle_actions()
//Movement
if(!client && !stop_automated_movement && wander && (ckey == null))
/mob/living/simple_animal/proc/handle_automated_movement()
if(!stop_automated_movement && wander)
if(isturf(src.loc) && !resting && !buckled && canmove) //This is so it only moves if it's not inside a closet, gentics machine, etc.
turns_since_move++
if(turns_since_move >= turns_per_move)
@@ -135,9 +126,10 @@
if(Process_Spacemove(anydir))
Move(get_step(src,anydir), anydir)
turns_since_move = 0
return
//Speaking
if(!client && speak_chance && (ckey == null))
/mob/living/simple_animal/proc/handle_automated_speech()
if(speak_chance)
if(rand(0,200) < speak_chance)
if(speak && speak.len)
if((emote_hear && emote_hear.len) || (emote_see && emote_see.len))
@@ -171,67 +163,69 @@
custom_emote(2,pick(emote_hear))
//Atmos
/mob/living/simple_animal/handle_environment(datum/gas_mixture/environment)
var/atmos_suitable = 1
var/atom/A = src.loc
if(istype(A,/turf))
if(isturf(A))
var/turf/T = A
var/areatemp = get_temperature(environment)
var/datum/gas_mixture/Environment = T.return_air()
if( abs(areatemp - bodytemperature) > 40 && !(flags & NO_BREATHE))
var/diff = areatemp - bodytemperature
diff = diff / 5
bodytemperature += diff
if(Environment)
if(istype(T, /turf/simulated))
var/turf/simulated/ST = T
if(ST.air)
var/tox = ST.air.toxins
var/oxy = ST.air.oxygen
var/n2 = ST.air.nitrogen
var/co2 = ST.air.carbon_dioxide
if( abs(Environment.temperature - bodytemperature) > 40 && !(flags & NO_BREATHE))
bodytemperature += ((Environment.temperature - bodytemperature) / 5)
if(min_oxy)
if(Environment.oxygen < min_oxy)
if(min_oxy && oxy < min_oxy)
atmos_suitable = 0
oxygen_alert = 1
else if(max_oxy && oxy > max_oxy)
atmos_suitable = 0
oxygen_alert = 1
else
oxygen_alert = 0
if(max_oxy)
if(Environment.oxygen > max_oxy)
if(min_tox && tox < min_tox)
atmos_suitable = 0
if(min_tox)
if(Environment.toxins < min_tox)
atmos_suitable = 0
if(max_tox)
if(Environment.toxins > max_tox)
toxins_alert = 1
else if(max_tox && tox > max_tox)
atmos_suitable = 0
toxins_alert = 1
else
toxins_alert = 0
if(min_n2)
if(Environment.nitrogen < min_n2)
atmos_suitable = 0
if(max_n2)
if(Environment.nitrogen > max_n2)
atmos_suitable = 0
if(min_co2)
if(Environment.carbon_dioxide < min_co2)
atmos_suitable = 0
if(max_co2)
if(Environment.carbon_dioxide > max_co2)
atmos_suitable = 0
if(flags & NO_BREATHE)
atmos_suitable = 1
//Atmos effect
if(min_n2 && n2 < min_n2)
atmos_suitable = 0
else if(max_n2 && n2 > max_n2)
atmos_suitable = 0
if(min_co2 && co2 < min_co2)
atmos_suitable = 0
else if(max_co2 && co2 > max_co2)
atmos_suitable = 0
if(!atmos_suitable)
adjustBruteLoss(unsuitable_atmos_damage)
else
if(min_oxy || min_tox || min_n2 || min_co2)
adjustBruteLoss(unsuitable_atmos_damage)
handle_temperature_damage()
/mob/living/simple_animal/proc/handle_temperature_damage()
if(bodytemperature < minbodytemp)
fire_alert = 2
adjustBruteLoss(cold_damage_per_tick)
adjustBruteLoss(2)
else if(bodytemperature > maxbodytemp)
fire_alert = 1
adjustBruteLoss(heat_damage_per_tick)
else
fire_alert = 0
if(!atmos_suitable)
adjustBruteLoss(unsuitable_atmos_damage)
return 1
adjustBruteLoss(3)
/mob/living/simple_animal/Bumped(AM as mob|obj)
if(!AM) return
@@ -450,15 +444,14 @@
statpanel("Status")
stat(null, "Health: [round((health / maxHealth) * 100)]%")
/mob/living/simple_animal/proc/Die()
living_mob_list -= src
dead_mob_list += src
if(key)
respawnable_list += src
/mob/living/simple_animal/death(gibbed)
health = 0
icon_state = icon_dead
stat = DEAD
density = 0
return
if(!gibbed)
visible_message("<span class='danger'>\The [src] stops moving...</span>")
..()
/mob/living/simple_animal/ex_act(severity)
..()

View File

@@ -83,7 +83,7 @@
else
speed = 0
/mob/living/simple_animal/slaughter/Die()
/mob/living/simple_animal/slaughter/death()
..()
var/obj/effect/decal/cleanable/blood/innards = new (get_turf(src))
innards.icon = 'icons/obj/surgery.dmi'

View File

@@ -80,7 +80,7 @@ var/global/totaltribbles = 0 //global variable so it updates for all tribbles,
src.procreate()
/mob/living/simple_animal/tribble/Die() // Gotta make sure to remove tribbles from the list on death
/mob/living/simple_animal/tribble/death() // Gotta make sure to remove tribbles from the list on death
..()
totaltribbles -= 1

View File

@@ -22,7 +22,7 @@
var/amp = null
var/quills = 3
/mob/living/simple_animal/vox/armalis/Die()
/mob/living/simple_animal/vox/armalis/death()
living_mob_list -= src
dead_mob_list += src

View File

@@ -1401,6 +1401,14 @@ mob/proc/yank_out_object()
location.add_poop_floor()
playsound(location, 'sound/effects/splat.ogg', 50, 1)
/mob/proc/adjustEarDamage()
return
/mob/proc/setEarDamage()
return
/mob/proc/AddSpell(var/obj/effect/proc_holder/spell/spell)
spell_list += spell
if(!spell.action)

View File

@@ -1277,6 +1277,7 @@
#include "code\modules\mob\living\bloodcrawl.dm"
#include "code\modules\mob\living\damage_procs.dm"
#include "code\modules\mob\living\default_language.dm"
#include "code\modules\mob\living\life.dm"
#include "code\modules\mob\living\living.dm"
#include "code\modules\mob\living\living_defense.dm"
#include "code\modules\mob\living\living_defines.dm"