Lighting nerds on fire part one

FIRE.
This commit is contained in:
Duck-
2014-08-13 19:08:26 -04:00
parent 583f133034
commit 68295719f1
24 changed files with 346 additions and 125 deletions
+15 -8
View File
@@ -86,14 +86,15 @@
// 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)
// bodytemperature -= max((loc_temp - bodytemperature / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM)
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.
if(bodytemperature > 360.15)
@@ -141,6 +142,12 @@
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
@@ -53,6 +53,8 @@
//stuff in the stomach
handle_stomach()
//handle being on fire
handle_fire()
//Status updates, death etc.
handle_regular_status_updates()
@@ -4,7 +4,8 @@
#define X_L_HAND_LAYER 3
#define X_R_HAND_LAYER 4
#define TARGETED_LAYER 5
#define X_TOTAL_LAYERS 5
#define X_FIRE_LAYER 6
#define X_TOTAL_LAYERS 6
/////////////////////////////////
/mob/living/carbon/alien/humanoid
@@ -49,7 +50,7 @@
update_inv_pockets(0)
update_hud()
update_icons()
update_fire()
/mob/living/carbon/alien/humanoid/update_hud()
//TODO
@@ -58,7 +59,20 @@
// 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)
@@ -151,4 +165,5 @@
#undef X_L_HAND_LAYER
#undef X_R_HAND_LAYER
#undef TARGETED_LAYER
#undef X_FIRE_LAYER
#undef X_TOTAL_LAYERS
@@ -227,6 +227,11 @@
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)
+26 -10
View File
@@ -95,6 +95,9 @@
handle_virus_updates()
//check if we're on fire
handle_fire()
//stuff in the stomach
handle_stomach()
@@ -656,16 +659,19 @@
stabilize_temperature_from_calories()
//After then, it reacts to the surrounding atmosphere based on your thermal protection
if(loc_temp < BODYTEMP_COLD_DAMAGE_LIMIT) //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)
var/amt = min((1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_COLD_DIVISOR), BODYTEMP_COOLING_MAX)
bodytemperature += amt
else if (loc_temp > BODYTEMP_HEAT_DAMAGE_LIMIT) //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)
var/amt = min((1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR), BODYTEMP_HEATING_MAX)
bodytemperature += amt
if(!on_fire) //If you're on fire, you do not heat up or cool down based on surrounding gases
if(loc_temp < BODYTEMP_COLD_DAMAGE_LIMIT) //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)
var/amt = min((1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_COLD_DIVISOR), BODYTEMP_COOLING_MAX)
// log_debug("[loc_temp] is Cold. Cooling by [amt]")
bodytemperature += amt
else if (loc_temp > BODYTEMP_HEAT_DAMAGE_LIMIT) //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)
var/amt = min((1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR), BODYTEMP_HEATING_MAX)
// log_debug("[loc_temp] is Heat. Heating up by [amt]")
bodytemperature += amt
// +/- 50 degrees from 310.15K is the 'safe' zone, where no damage is dealt.
if(bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT)
@@ -730,6 +736,16 @@
pl_effects()
return
///FIRE CODE
handle_fire()
if(..())
return
var/thermal_protection = get_heat_protection(30000) //If you don't have fire suit level protection, you get a temperature increase
if((1 - thermal_protection) > 0.0001)
bodytemperature += BODYTEMP_HEATING_MAX
return
//END FIRE CODE
/*
proc/adjust_body_temperature(current, loc_temp, boost)
var/temperature = current
@@ -128,15 +128,31 @@ Please contact me on #coderbus IRC. ~Carn x
#define L_HAND_LAYER 21
#define R_HAND_LAYER 22
#define TARGETED_LAYER 23 //BS12: Layer for the target overlay from weapon targeting system
#define FIRE_LAYER 23 //If you're on fire
#define TOTAL_LAYERS 23
//////////////////////////////////
/mob/living/carbon/human
var/list/overlays_standing[TOTAL_LAYERS]
var/list/overlays_lying[TOTAL_LAYERS]
var/previous_damage_appearance // store what the body last looked like, so we only have to update it if something changed
var/icon/race_icon
var/icon/deform_icon
/mob/living/carbon/human/proc/apply_overlay(cache_index)
var/image/I = lying ? overlays_lying[cache_index] : overlays_standing[cache_index]
if(I)
overlays += I
/mob/living/carbon/human/proc/remove_overlay(cache_index)
if(overlays_lying[cache_index])
overlays -= overlays_lying[cache_index]
overlays_lying[cache_index] = null
if(overlays_standing[cache_index])
overlays -= overlays_standing[cache_index]
overlays_standing[cache_index] = null
//UPDATES OVERLAYS FROM OVERLAYS_LYING/OVERLAYS_STANDING
//this proc is messy as I was forced to include some old laggy cloaking code to it so that I don't break cloakers
//I'll work on removing that stuff by rewriting some of the cloaking stuff at a later date.
@@ -506,6 +522,15 @@ 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_lying[FIRE_LAYER] = image("icon"='icons/mob/OnFire.dmi', "icon_state"="Lying", "layer"=-FIRE_LAYER)
overlays_standing[FIRE_LAYER] = image("icon"='icons/mob/OnFire.dmi', "icon_state"="Standing", "layer"=-FIRE_LAYER)
apply_overlay(FIRE_LAYER)
/* --------------------------------------- */
//For legacy support.
@@ -535,7 +560,7 @@ proc/get_damage_icon_part(damage_state, body_part)
update_icons()
//Hud Stuff
update_hud()
update_fire()
/* --------------------------------------- */
//vvvvvv UPDATE_INV PROCS vvvvvv
@@ -889,4 +914,5 @@ proc/get_damage_icon_part(damage_state, body_part)
#undef L_HAND_LAYER
#undef R_HAND_LAYER
#undef TARGETED_LAYER
#undef FIRE_LAYER
#undef TOTAL_LAYERS
@@ -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>"
+15 -3
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()
@@ -414,10 +417,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)
@@ -688,3 +692,11 @@
proc/handle_changeling()
if(mind && mind.changeling)
mind.changeling.regenerate()
///FIRE CODE
handle_fire()
if(..())
return
adjustFireLoss(6)
return
//END FIRE CODE
@@ -5,7 +5,8 @@
#define M_L_HAND_LAYER 4
#define M_R_HAND_LAYER 5
#define TARGETED_LAYER 6
#define M_TOTAL_LAYERS 6
#define M_FIRE_LAYER 7
#define M_TOTAL_LAYERS 7
/////////////////////////////////
/mob/living/carbon/monkey
@@ -19,9 +20,11 @@
update_inv_r_hand(0)
update_inv_l_hand(0)
update_inv_handcuffed(0)
update_fire()
update_icons()
//Hud Stuff
update_hud()
return
/mob/living/carbon/monkey/update_icons()
@@ -95,6 +98,7 @@
if(update_icons) update_icons()
/mob/living/carbon/monkey/update_hud()
if (client)
client.screen |= contents
@@ -109,6 +113,22 @@
overlays_standing[TARGETED_LAYER] = null
if(update_icons) update_icons()
/mob/living/carbon/monkey/update_fire()
overlays -= overlays_lying[M_FIRE_LAYER]
overlays -= overlays_standing[M_FIRE_LAYER]
if(on_fire)
overlays_lying[M_FIRE_LAYER] = image("icon"='icons/mob/OnFire.dmi', "icon_state"="Lying", "layer"= -M_FIRE_LAYER)
overlays_standing[M_FIRE_LAYER] = image("icon"='icons/mob/OnFire.dmi', "icon_state"="Standing", "layer"= -M_FIRE_LAYER)
if(src.lying)
overlays += overlays_lying[M_FIRE_LAYER]
else
overlays += overlays_standing[M_FIRE_LAYER]
return
else
overlays_lying[M_FIRE_LAYER] = null
overlays_standing[M_FIRE_LAYER] = null
//Monkey Overlays Indexes////////
#undef M_MASK_LAYER
#undef M_BACK_LAYER
@@ -116,5 +136,6 @@
#undef M_L_HAND_LAYER
#undef M_R_HAND_LAYER
#undef TARGETED_LAYER
#undef M_FIRE_LAYER
#undef M_TOTAL_LAYERS
+16 -1
View File
@@ -295,6 +295,8 @@
ear_deaf = 0
ear_damage = 0
heal_overall_damage(getBruteLoss(), getFireLoss())
fire_stacks = 0
on_fire = 0
// restore all of a human's blood
if(ishuman(src))
@@ -313,6 +315,9 @@
// restore us to conciousness
stat = CONSCIOUS
//checks if we are on fire.
update_fire()
// make the icons look correct
regenerate_icons()
@@ -619,9 +624,19 @@
BD.attack_hand(usr)
C.open()
//breaking out of handcuffs
//breaking out of handcuffs and stop, drop, and roll
else if(iscarbon(L))
var/mob/living/carbon/CM = L
if(CM.on_fire && CM.canmove)
CM.fire_stacks -= 5
CM.weakened = 5
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>")
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.next_move = world.time + 100
CM.last_special = world.time + 100
+38
View File
@@ -124,6 +124,44 @@
// End BS12 momentum-transfer code.
//Mobs on Fire
/mob/living/proc/IgniteMob()
if(fire_stacks > 0)
on_fire = 1
update_fire()
/mob/living/proc/ExtinguishMob()
if(on_fire)
on_fire = 0
fire_stacks = 0
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(5)
if(fire_stacks > 9 && !on_fire)
IgniteMob()
//Mobs on Fire end
//Why did I place it here?
//Remind me to place this somewhere else
//I sware this uses less memory
@@ -37,4 +37,6 @@
var/tod = null // Time of death
var/update_slimes = 1
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/silent = null //Can't talk. Value goes down every life proc.
@@ -62,6 +62,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)
@@ -18,6 +18,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)
@@ -19,6 +19,7 @@
process_killswitch()
process_locks()
update_canmove()
handle_fire()
/mob/living/silicon/robot/proc/clamp_values()
@@ -324,3 +325,23 @@
if(paralysis || stunned || weakened || buckled || lockcharge) canmove = 0
else canmove = 1
return canmove
//Robots on fire
/mob/living/silicon/robot/handle_fire()
if(..())
return
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
@@ -1014,6 +1014,9 @@
icon_state = base_icon
return
/mob/living/silicon/robot/proc/updatefire()
return
//Call when target overlay should be added/removed
/mob/living/silicon/robot/update_targeted()
if(!targeted_by && target_locked)
@@ -445,6 +445,9 @@
return (0)
return (1)
/mob/living/simple_animal/update_fire()
return
//Call when target overlay should be added/removed
/mob/living/simple_animal/update_targeted()
if(!targeted_by && target_locked)
+21 -1
View File
@@ -262,6 +262,15 @@ datum
if(!cube.wrapped)
cube.Expand()
return
reaction_mob(var/mob/living/M, var/method=TOUCH, var/volume)//Splashing people with water can help put them out!
if(!istype(M, /mob/living))
return
if(method == TOUCH)
M.adjust_fire_stacks(-(volume / 10))
if(M.fire_stacks <= 0)
M.ExtinguishMob()
return
water/holywater
name = "Holy Water"
@@ -929,7 +938,12 @@ datum
color = "#660000" // rgb: 102, 0, 0
overdose = REAGENTS_OVERDOSE
reaction_mob(var/mob/living/M, var/method=TOUCH, var/volume)//Splashing people with welding fuel to make them easy to ignite!
if(!istype(M, /mob/living))
return
if(method == TOUCH)
M.adjust_fire_stacks(volume / 10)
return
reaction_obj(var/obj/O, var/volume)
var/turf/the_turf = get_turf(O)
if(!the_turf)
@@ -1625,6 +1639,12 @@ datum
napalm.trace_gases += fuel
T.assume_air(napalm)
return
reaction_mob(var/mob/living/M, var/method=TOUCH, var/volume)//Splashing people with plasma is stronger than fuel!
if(!istype(M, /mob/living))
return
if(method == TOUCH)
M.adjust_fire_stacks(volume / 5)
return
toxin/lexorin
name = "Lexorin"