Reintegrate mob fire

I took out the entire on_fire system to work on LINDA. This commit readds
it.
This commit is contained in:
Tigercat2000
2015-04-28 13:57:58 -07:00
parent 9b7b4ae656
commit 62657448d4
36 changed files with 407 additions and 106 deletions
+23 -11
View File
@@ -87,13 +87,14 @@
// Aliens are now weak to fire.
//After then, it reacts to the surrounding atmosphere based on your thermal protection
if(loc_temp > bodytemperature)
//Place is hotter than we are
var/thermal_protection = heat_protection //This returns a 0 - 1 value, which corresponds to the percentage of protection based on what you're wearing and what you're exposed to.
if(thermal_protection < 1)
bodytemperature += (1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR)
else
bodytemperature += 1 * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR)
if(!on_fire) // If you're on fire, ignore local air temperature
if(loc_temp > bodytemperature)
//Place is hotter than we are
var/thermal_protection = heat_protection //This returns a 0 - 1 value, which corresponds to the percentage of protection based on what you're wearing and what you're exposed to.
if(thermal_protection < 1)
bodytemperature += (1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR)
else
bodytemperature += 1 * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR)
// bodytemperature -= max((loc_temp - bodytemperature / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM)
// +/- 50 degrees from 310.15K is the 'safe' zone, where no damage is dealt.
@@ -104,12 +105,16 @@
if(360 to 400)
apply_damage(HEAT_DAMAGE_LEVEL_1, BURN)
fire_alert = max(fire_alert, 2)
if(400 to 1000)
if(400 to 460)
apply_damage(HEAT_DAMAGE_LEVEL_2, BURN)
fire_alert = max(fire_alert, 2)
if(1000 to INFINITY)
apply_damage(HEAT_DAMAGE_LEVEL_3, BURN)
fire_alert = max(fire_alert, 2)
if(460 to INFINITY)
if(on_fire)
apply_damage(HEAT_DAMAGE_LEVEL_3, BURN)
fire_alert = max(fire_alert, 2)
else
apply_damage(HEAT_DAMAGE_LEVEL_2, BURN)
fire_alert = max(fire_alert, 2)
return
/mob/living/carbon/alien/proc/handle_mutations_and_radiation()
@@ -141,6 +146,13 @@
radiation -= 3
adjustToxLoss(3)
/mob/living/carbon/alien/handle_fire()//Aliens on fire code
if(..())
return
bodytemperature += BODYTEMP_HEATING_MAX //If you're on fire, you heat up!
return
/mob/living/carbon/alien/IsAdvancedToolUser()
return has_fine_manipulation
@@ -50,6 +50,9 @@
//stuff in the stomach
handle_stomach()
//Handle being on fire
handle_fire()
//Status updates, death etc.
handle_regular_status_updates()
update_canmove()
@@ -62,6 +62,7 @@
update_inv_pockets(0)
update_hud()
update_icons()
update_fire()
@@ -72,6 +73,21 @@
// else client.screen -= hud_used.other //Not used
client.screen |= contents
/mob/living/carbon/alien/humanoid/update_fire()
overlays -= overlays_lying[X_FIRE_LAYER]
overlays -= overlays_standing[X_FIRE_LAYER]
if(on_fire)
overlays_lying[X_FIRE_LAYER] = image("icon"='icons/mob/OnFire.dmi', "icon_state"="Lying", "layer"= -X_FIRE_LAYER)
overlays_standing[X_FIRE_LAYER] = image("icon"='icons/mob/OnFire.dmi', "icon_state"="Standing", "layer"= -X_FIRE_LAYER)
if(src.lying)
overlays += overlays_lying[X_FIRE_LAYER]
else
overlays += overlays_standing[X_FIRE_LAYER]
return
else
overlays_lying[X_FIRE_LAYER] = null
overlays_standing[X_FIRE_LAYER] = null
/mob/living/carbon/alien/humanoid/update_inv_wear_suit(var/update_icons=1)
if(wear_suit)
var/t_state = wear_suit.item_state
+1
View File
@@ -442,6 +442,7 @@ mob/living
/mob/living/carbon/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
..()
src.IgniteMob()
bodytemperature = max(bodytemperature, BODYTEMP_HEAT_DAMAGE_LIMIT+10)
/mob/living/carbon/can_use_hands()
@@ -226,6 +226,11 @@
usr << "<span class='deadsay'>[t_He] has a pulse!</span>"
msg += "<span class='warning'>"
if(fire_stacks > 0)
msg += "[t_He] [t_is] covered in something flammable.\n"
if(fire_stacks < 0)
msg += "[t_He] looks a little soaked.\n"
if(nutrition < 100)
msg += "[t_He] [t_is] severely malnourished.\n"
else if(nutrition >= 500)
@@ -80,4 +80,7 @@
var/lastFart = 0 // Toxic fart cooldown.
var/frozen = 0 //used for preventing attacks on admin-frozen people
var/frozen = 0 //used for preventing attacks on admin-frozen people
var/fire_dmi = 'icons/mob/OnFire.dmi'
var/fire_sprite = "Standing"
+54 -12
View File
@@ -105,6 +105,9 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
handle_virus_updates()
//Check if we're on fire
handle_fire()
//stuff in the stomach
handle_stomach()
@@ -379,6 +382,17 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
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()
if(breath)
loc.assume_air(breath)
@@ -436,16 +450,17 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
stabilize_temperature_from_calories()
//After then, it reacts to the surrounding atmosphere based on your thermal protection
if(loc_temp < bodytemperature)
//Place is colder than we are
var/thermal_protection = get_cold_protection(loc_temp) //This returns a 0 - 1 value, which corresponds to the percentage of protection based on what you're wearing and what you're exposed to.
if(thermal_protection < 1)
bodytemperature += min((1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_COLD_DIVISOR), BODYTEMP_COOLING_MAX)
else
//Place is hotter than we are
var/thermal_protection = get_heat_protection(loc_temp) //This returns a 0 - 1 value, which corresponds to the percentage of protection based on what you're wearing and what you're exposed to.
if(thermal_protection < 1)
bodytemperature += min((1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR), BODYTEMP_HEATING_MAX)
if(!on_fire) //If you're on fire, you do not heat up or cool down based on surrounding gases
if(loc_temp < bodytemperature)
//Place is colder than we are
var/thermal_protection = get_cold_protection(loc_temp) //This returns a 0 - 1 value, which corresponds to the percentage of protection based on what you're wearing and what you're exposed to.
if(thermal_protection < 1)
bodytemperature += min((1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_COLD_DIVISOR), BODYTEMP_COOLING_MAX)
else
//Place is hotter than we are
var/thermal_protection = get_heat_protection(loc_temp) //This returns a 0 - 1 value, which corresponds to the percentage of protection based on what you're wearing and what you're exposed to.
if(thermal_protection < 1)
bodytemperature += min((1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR), BODYTEMP_HEATING_MAX)
// +/- 50 degrees from 310.15K is the 'safe' zone, where no damage is dealt.
if(bodytemperature > species.heat_level_1)
@@ -460,8 +475,12 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
take_overall_damage(burn=HEAT_DAMAGE_LEVEL_2, used_weapon = "High Body Temperature")
fire_alert = max(fire_alert, 2)
if(bodytemperature > species.heat_level_3 && bodytemperature < INFINITY)
take_overall_damage(burn=HEAT_DAMAGE_LEVEL_3, used_weapon = "Fire")
fire_alert = max(fire_alert, 2)
if(on_fire)
take_overall_damage(burn=HEAT_DAMAGE_LEVEL_3, used_weapon = "Fire")
fire_alert = max(fire_alert, 2)
else
take_overall_damage(burn=HEAT_DAMAGE_LEVEL_2, used_weapon = "High Body Temperature")
fire_alert = max(fire_alert, 2)
else if(bodytemperature < species.cold_level_1)
fire_alert = max(fire_alert, 1)
@@ -506,6 +525,29 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
return
///FIRE CODE
handle_fire()
if(..())
return
var/thermal_protection = 0 //Simple check to estimate how protected we are against multiple temperatures
if(wear_suit)
if(wear_suit.max_heat_protection_temperature >= FIRESUIT_MAX_HEAT_PROTECTION_TEMPERATURE)
thermal_protection += (wear_suit.max_heat_protection_temperature*0.7)
if(head)
if(head.max_heat_protection_temperature >= FIRE_HELMET_MAX_HEAT_PROTECTION_TEMPERATURE)
thermal_protection += (head.max_heat_protection_temperature*THERMAL_PROTECTION_HEAD)
thermal_protection = round(thermal_protection)
if(thermal_protection >= FIRE_IMMUNITY_SUIT_MAX_TEMP_PROTECT)
return
if(thermal_protection >= FIRESUIT_MAX_HEAT_PROTECTION_TEMPERATURE)
bodytemperature += 11
return
else
bodytemperature += BODYTEMP_HEATING_MAX
return
//END FIRE CODE
/*
proc/adjust_body_temperature(current, loc_temp, boost)
var/temperature = current
@@ -21,6 +21,8 @@
return message
/datum/species/plasmaman/equip(var/mob/living/carbon/human/H)
H.fire_sprite = "Plasmaman"
// Unequip existing suits and hats.
H.unEquip(H.wear_suit)
H.unEquip(H.head)
@@ -459,6 +459,13 @@ proc/get_damage_icon_part(damage_state, body_part)
overlays_standing[TARGETED_LAYER] = null
if(update_icons) update_icons()
/mob/living/carbon/human/update_fire()
remove_overlay(FIRE_LAYER)
if(on_fire)
overlays_standing[FIRE_LAYER] = image("icon"=fire_dmi, "icon_state"=fire_sprite, "layer"=-FIRE_LAYER)
else
overlays_standing[FIRE_LAYER] = null
apply_overlay(FIRE_LAYER)
/* --------------------------------------- */
//For legacy support.
@@ -489,6 +496,7 @@ proc/get_damage_icon_part(damage_state, body_part)
update_icons()
//Hud Stuff
update_hud()
update_fire()
/* --------------------------------------- */
//vvvvvv UPDATE_INV PROCS vvvvvv
@@ -32,6 +32,10 @@
msg += "It has minor burns.\n"
else
msg += "<B>It has severe burns!</B>\n"
if (src.fire_stacks > 0)
msg += "It's covered in something flammable.\n"
if (src.fire_stacks < 0)
msg += "It's soaked in water.\n"
if (src.stat == UNCONSCIOUS)
msg += "It isn't responding to anything around it; it seems to be asleep.\n"
msg += "</span>"
+16 -4
View File
@@ -59,6 +59,9 @@
if(environment) // More error checking -- TLE
handle_environment(environment)
//Check if we're on fire
handle_fire()
//Status updates, death etc.
handle_regular_status_updates()
update_canmove()
@@ -385,10 +388,11 @@
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
if(!on_fire)
if((environment.temperature > (T0C + 50)) || (environment.temperature < (T0C + 10)))
var/transfer_coefficient = 1
handle_temperature_damage(HEAD, environment.temperature, environment_heat_capacity*transfer_coefficient)
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)
@@ -648,4 +652,12 @@
proc/handle_changeling()
if(mind && mind.changeling)
mind.changeling.regenerate()
mind.changeling.regenerate()
///FIRE CODE
handle_fire()
if(..())
return
adjustFireLoss(6)
return
//END FIRE CODE
@@ -20,6 +20,7 @@
update_inv_r_hand(0)
update_inv_l_hand(0)
update_inv_handcuffed(0)
update_fire()
update_icons()
//Hud Stuff
update_hud()
@@ -112,6 +113,15 @@
overlays_standing[TARGETED_LAYER] = null
if(update_icons) update_icons()
/mob/living/carbon/monkey/update_fire()
overlays -= overlays_standing[M_FIRE_LAYER]
if(on_fire)
overlays_standing[M_FIRE_LAYER] = image("icon"='icons/mob/OnFire.dmi', "icon_state"="Standing", "layer"= -M_FIRE_LAYER)
overlays += overlays_standing[M_FIRE_LAYER]
return
else
overlays_standing[M_FIRE_LAYER] = null
//Monkey Overlays Indexes////////
#undef M_MASK_LAYER
#undef M_BACK_LAYER
+18 -1
View File
@@ -328,6 +328,8 @@
ear_deaf = 0
ear_damage = 0
heal_overall_damage(1000, 1000)
fire_stacks = 0
on_fire = 0
suiciding = 0
buckled = initial(src.buckled)
@@ -350,6 +352,7 @@
timeofdeath = 0
stat = CONSCIOUS
update_fire()
regenerate_icons()
hud_updateflag |= 1 << HEALTH_HUD
hud_updateflag |= 1 << STATUS_HUD
@@ -541,7 +544,6 @@
for(var/mob/O in viewers(usr, null))
O.show_message(text("\red <B>[] resists!</B>", L), 1)
//unbuckling yourself
if(L.buckled && (L.last_special <= world.time) )
if(iscarbon(L))
@@ -635,6 +637,21 @@
//breaking out of handcuffs
else if(iscarbon(L))
var/mob/living/carbon/CM = L
if(CM.on_fire && CM.canmove)
CM.fire_stacks -= 5
CM.weakened = max(CM.weakened, 3)//We dont check for CANWEAKEN, I don't care how immune to weakening you are, if you're rolling on the ground, you're busy.
CM.update_canmove()
CM.spin(32,2)
CM.visible_message("<span class='danger'>[CM] rolls on the floor, trying to put themselves out!</span>", \
"<span class='notice'>You stop, drop, and roll!</span>")
sleep(30)
if(fire_stacks <= 0)
CM.visible_message("<span class='danger'>[CM] has successfully extinguished themselves!</span>", \
"<span class='notice'>You extinguish yourself.</span>")
ExtinguishMob()
return
if(CM.handcuffed && CM.canmove && (CM.last_special <= world.time))
CM.changeNext_move(CLICK_CD_BREAKOUT)
CM.last_special = world.time + CLICK_CD_BREAKOUT
+39
View File
@@ -199,6 +199,45 @@
return
//Mobs on Fire
/mob/living/proc/IgniteMob()
if(fire_stacks > 0 && !on_fire)
on_fire = 1
src.AddLuminosity(3)
update_fire()
/mob/living/proc/ExtinguishMob()
if(on_fire)
on_fire = 0
fire_stacks = 0
src.AddLuminosity(-3)
update_fire()
/mob/living/proc/update_fire()
return
/mob/living/proc/adjust_fire_stacks(add_fire_stacks) //Adjusting the amount of fire_stacks we have on person
fire_stacks = Clamp(fire_stacks + add_fire_stacks, min = -20, max = 20)
/mob/living/proc/handle_fire()
if(fire_stacks < 0)
fire_stacks++ //If we've doused ourselves in water to avoid fire, dry off slowly
fire_stacks = min(0, fire_stacks)//So we dry ourselves back to default, nonflammable.
if(!on_fire)
return 1
var/datum/gas_mixture/G = loc.return_air() // Check if we're standing in an oxygenless environment
if(G.oxygen < 1)
ExtinguishMob() //If there's no oxygen in the tile we're on, put out the fire
return
var/turf/location = get_turf(src)
location.hotspot_expose(700, 50, 1)
/mob/living/fire_act()
adjust_fire_stacks(0.5)
IgniteMob()
//Mobs on Fire end
//This is called when the mob is thrown into a dense turf
/mob/living/proc/turf_collision(var/turf/T, var/speed)
src.take_organ_damage(speed*5)
@@ -36,6 +36,10 @@
var/cameraFollow = null
var/tod = null // Time of death
var/on_fire = 0 //The "Are we on fire?" var
var/fire_stacks = 0 //Tracks how many stacks of fire we have on, max is usually 20
var/update_slimes = 1
var/specialsauce = 0 //Has this person consumed enough special sauce? IF so they're a ticking time bomb of death.
var/implanting = 0 //Used for the mind-slave implant
@@ -61,6 +61,7 @@
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
updateicon()
update_fire()
tod = worldtime2text() //weasellos time of death patch
if(mind) mind.store_memory("Time of death: [tod]", 0)
@@ -21,6 +21,10 @@
msg += "It looks slightly charred.\n"
else
msg += "<B>It looks severely burnt and heat-warped!</B>\n"
if (src.fire_stacks < 0)
msg += "It's covered in water.\n"
if (src.fire_stacks > 0)
msg += "It's coated in something flammable.\n"
msg += "</span>"
if(opened)
@@ -22,6 +22,7 @@
update_gravity(mob_has_gravity())
handle_fire()
/mob/living/silicon/robot/proc/clamp_values()
@@ -340,3 +341,29 @@
if(paralysis || stunned || weakened || buckled || lockcharge) canmove = 0
else canmove = 1
return canmove
//Robots on fire
/mob/living/silicon/robot/handle_fire()
if(..())
return
if(fire_stacks > 0)
fire_stacks--
fire_stacks = max(0, fire_stacks)
else
ExtinguishMob()
//adjustFireLoss(3)
return
/mob/living/silicon/robot/update_fire()
overlays -= image("icon"='icons/mob/OnFire.dmi', "icon_state"="Standing")
if(on_fire)
overlays += image("icon"='icons/mob/OnFire.dmi', "icon_state"="Standing")
update_icons()
return
/mob/living/silicon/robot/fire_act()
if(!on_fire) //Silicons don't gain stacks from hotspots, but hotspots can ignite them
IgniteMob()
//Robots on fire
@@ -510,6 +510,9 @@
return 0
return 1
/mob/living/simple_animal/update_fire()
return
/mob/living/simple_animal/revive()
..()
health = maxHealth