Skip to content

Fire rework [test required] #7329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cev_eris.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2439,6 +2439,7 @@
#include "code\modules\projectiles\guns\launcher.dm"
#include "code\modules\projectiles\guns\matter.dm"
#include "code\modules\projectiles\guns\projectile.dm"
#include "code\modules\projectiles\guns\reagent.dm"
#include "code\modules\projectiles\guns\energy\charge.dm"
#include "code\modules\projectiles\guns\energy\crossbow.dm"
#include "code\modules\projectiles\guns\energy\decloner.dm"
Expand Down
7 changes: 3 additions & 4 deletions code/__DEFINES/damage_organs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#define HALLOSS "halloss"
#define BLAST "blast"
#define PSY "psy"
#define HEAT "heat"
#define COLD "cold"

#define CUT "cut"
#define BRUISE "bruise"
Expand All @@ -22,9 +24,6 @@
#define EYE_BLUR "eye_blur"
#define DROWSY "drowsy"

#define FIRE_DAMAGE_MODIFIER 0.0215 // Higher values result in more external fire damage to the skin. (default 0.0215)
#define AIR_DAMAGE_MODIFIER 2.025 // More means less damage from hot air scalding lungs, less = more damage. (default 2.025)

//Armor defines

#define ARMOR_MELEE "melee"
Expand Down Expand Up @@ -148,4 +147,4 @@
#define INFECTION_LEVEL_TWO 500
#define INFECTION_LEVEL_THREE 1000

#define ORGAN_RECOVERY_THRESHOLD (5 MINUTES)
#define ORGAN_RECOVERY_THRESHOLD (5 MINUTES)
13 changes: 8 additions & 5 deletions code/__DEFINES/items_clothing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,16 @@
#define WARNING_LOW_PRESSURE 50 // This is when the gray low pressure icon is displayed. (it is 2.5 * HAZARD_LOW_PRESSURE)
#define HAZARD_LOW_PRESSURE 20 // This is when the black ultra-low pressure icon is displayed. (This one is set as a constant)

#define TEMPERATURE_DAMAGE_COEFFICIENT 1.5 // This is used in handle_temperature_damage() for humans, and in reagents that affect body temperature. Temperature damage is multiplied by this amount.
#define TEMPERATURE_DAMAGE_DIVISOR 16 // This is used in reagents that affect body temperature. Temperature damage is divided by this amount.
#define BODYTEMP_AUTORECOVERY_DIVISOR 12 // This is the divisor which handles how much of the temperature difference between the current body temperature and 310.15K (optimal temperature) humans auto-regenerate each tick. The higher the number, the slower the recovery. This is applied each tick, so long as the mob is alive.
#define BODYTEMP_AUTORECOVERY_MINIMUM 1 // Minimum amount of kelvin moved toward 310.15K per tick. So long as abs(310.15 - bodytemp) is more than 50.
#define BODYTEMP_COLD_DIVISOR 6 // Similar to the BODYTEMP_AUTORECOVERY_DIVISOR, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is lower than their body temperature. Make it lower to lose bodytemp faster.
#define BODYTEMP_HEAT_DIVISOR 6 // Similar to the BODYTEMP_AUTORECOVERY_DIVISOR, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is higher than their body temperature. Make it lower to gain bodytemp faster.
#define BODYTEMP_COOLING_MAX -30 // The maximum number of degrees that your body can cool down in 1 tick, when in a cold area.
#define BODYTEMP_HEATING_MAX 30 // The maximum number of degrees that your body can heat up in 1 tick, when in a hot area.
#define BODYTEMP_COLD_DIVISOR 8 // Similar to the BODYTEMP_AUTORECOVERY_DIVISOR, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is lower than their body temperature. Make it lower to lose bodytemp faster.
#define BODYTEMP_HEAT_DIVISOR 8 // Similar to the BODYTEMP_AUTORECOVERY_DIVISOR, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is higher than their body temperature. Make it lower to gain bodytemp faster.
#define BODYTEMP_ROACH_DIVISOR 16 // Both of the above combined for superior animals
#define BODYTEMP_COOLING_MAX -20 // The maximum number of degrees that your body can cool down in 1 tick, when in a cold area.
#define BODYTEMP_HEATING_MAX 25 // The maximum number of degrees that your body can heat up in 1 tick, when in a hot area.

#define TEMP_SHOCK_DAMAGE 40 //Amount of damage temperature shock will cause. No idea why this define works here, but not in life.dm.

#define BODYTEMP_HEAT_DAMAGE_LIMIT 360.15 // The limit the human body can take before it starts taking damage from heat.
#define BODYTEMP_COLD_DAMAGE_LIMIT 260.15 // The limit the human body can take before it starts taking damage from coldness.
Expand Down
4 changes: 4 additions & 0 deletions code/datums/autolathe/containers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
name = "spray bottle"
build_path = /obj/item/reagent_containers/spray

/datum/design/autolathe/container/chemthrower
name = "AG CT \"Chemthrower\""
build_path = /obj/item/gun/reagent

/datum/design/autolathe/container/pill_bottle
name = "pill bottle"
build_path = /obj/item/storage/pill_bottle
Expand Down
9 changes: 9 additions & 0 deletions code/datums/craft/recipes/tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@
list(QUALITY_ADHESIVE, 15, 70)
)

/datum/craft_recipe/tool/ignited_chemthrower
name = "Ignited chemthrower"
result = /obj/item/gun/reagent/flame
steps = list(
list(/obj/item/gun/reagent, 1),
list(/obj/item/device/assembly/igniter, 1),
list(QUALITY_ADHESIVE, 15, 100)
)

/*************************
TOOL MODS
*************************/
Expand Down
47 changes: 31 additions & 16 deletions code/game/objects/heatwave.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,44 @@ proc/heatwave(turf/epicenter, heavy_range, light_range, damage, fire_stacks, pen
light_range = heavy_range

for(var/atom/T in range(light_range, epicenter))
if(fire_stacks)
T.fire_act()

if(istype(T, /mob/living))
var/mob/living/L = T
playsound(L, 'sound/effects/gore/sear.ogg', 40, 1)

var/burn_damage = 0

var/distance = get_dist(epicenter, L)

var/isLight_range = FALSE
if(distance < 0)
distance = 0
if(distance <= heavy_range)
burn_damage = damage
else
burn_damage = damage * 0.5

if(burn_damage && L.stat == CONSCIOUS)
if(!distance <= heavy_range)
isLight_range = TRUE


if(L.stat == CONSCIOUS)
to_chat(L, SPAN_WARNING("You feel your skin boiling!"))

var/organ_hit = BP_CHEST //Chest is hit first
var/loc_damage
while (burn_damage > 0)
burn_damage -= loc_damage = rand(1, burn_damage)
L.damage_through_armor(loc_damage, BURN, organ_hit, ARMOR_ENERGY, penetration)
organ_hit = ran_zone() //We determine next body parts that should be hit
return 1
if(damage[HEAT])
var/heat_damage = isLight_range ? damage[HEAT] / 2 : damage[HEAT]
L.damage_through_armor(heat_damage, HEAT, attack_flag = ARMOR_ENERGY, armor_divisor = penetration)

if(damage[BURN])
var/burn_damage = isLight_range ? damage[BURN] / 2 : damage[BURN]


var/organ_hit = BP_CHEST //Chest is hit first
var/loc_damage
while (burn_damage > 0)
burn_damage -= loc_damage = rand(1, burn_damage)
L.damage_through_armor(loc_damage, BURN, organ_hit, ARMOR_ENERGY, penetration)
organ_hit = ran_zone() //We determine some other body parts that should be hit

if(fire_stacks)
L.adjust_fire_stacks(fire_stacks)
L.IgniteMob()
return TRUE

if(fire_stacks)
T.fire_act()
return TRUE
1 change: 1 addition & 0 deletions code/game/objects/items/weapons/design_disks/asters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
/datum/design/autolathe/device/destTagger,
/datum/design/autolathe/device/export_scanner,
/datum/design/autolathe/device/implanter,
/datum/design/autolathe/container/chemthrower = 2,
/datum/design/autolathe/device/hand_labeler,
/datum/design/research/item/light_replacer,
/datum/design/autolathe/sec/hailer,
Expand Down
13 changes: 7 additions & 6 deletions code/game/objects/items/weapons/grenades/heatwave.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
item_state = "grenade"
matter = list(MATERIAL_STEEL = 3, MATERIAL_PLASMA = 4)

var/heavy_range = 2
var/weak_range = 3
var/heavy_range = 3
var/weak_range = 4
var/flash_range = 10
var/heat_damage = 90
var/fire_stacks = TRUE
var/list/heat_damage = list(BURN = 60, HEAT = 120) // Less firestacks and burn damage, but significantly higher heat and radius
var/fire_stacks = 6
var/penetration = 0


Expand All @@ -34,7 +34,8 @@
icon_state = "frag_nt"
item_state = "fraggrenade_nt"
heavy_range = 2
weak_range = 4
heat_damage = 90
weak_range = 3
heat_damage = list(BURN = 87, HEAT = 60)
fire_stacks = 10
penetration = 25
matter = list(MATERIAL_BIOMATTER = 30, MATERIAL_PLASMA = 5)
4 changes: 2 additions & 2 deletions code/game/objects/items/weapons/tools/_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@
var/obj/item/weldpack/P = O
P.explode()
return
/*

else if(istype(O, /mob/living/carbon/superior_animal/roach/benzin))
var/mob/living/carbon/superior_animal/roach/benzin/B = O
if(B.stat != DEAD)
Expand All @@ -913,7 +913,7 @@
to_chat(user, SPAN_NOTICE("[src] refueled"))
playsound(src.loc, 'sound/effects/refill.ogg', 50, 1, -6)
return
*/

if(switched_on)
var/turf/location = get_turf(user)
if(isliving(O))
Expand Down
4 changes: 4 additions & 0 deletions code/modules/mob/living/carbon/human/human_damage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
heal_overall_damage(0, -amount)
BITSET(hud_updateflag, HEALTH_HUD)

/mob/living/carbon/human/adjustHeat(var/amount)
amount *= species.heat_mod
..(amount)

/mob/living/carbon/human/proc/adjustBruteLossByPart(amount, organ_name, obj/damage_source)
amount = amount*species.brute_mod
if (organ_name in organs_by_name)
Expand Down
72 changes: 40 additions & 32 deletions code/modules/mob/living/carbon/human/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
#define HUMAN_MAX_OXYLOSS 1 //Defines how much oxyloss humans can get per tick. A tile with no air at all (such as space) applies this value, otherwise it's a percentage of it.
#define HUMAN_CRIT_MAX_OXYLOSS ( 2 / 6) //The amount of damage you'll get when in critical condition. We want this to be a 5 minute deal = 300s. There are 50HP to get through, so (1/6)*last_tick_duration per second. Breaths however only happen every 4 ticks. last_tick_duration = ~2.0 on average

#define HEAT_DAMAGE_LEVEL_1 2 //Amount of damage applied when your body temperature just passes the 360.15k safety point
#define HEAT_DAMAGE_LEVEL_2 4 //Amount of damage applied when your body temperature passes the 400K point
#define HEAT_DAMAGE_LEVEL_3 8 //Amount of damage applied when your body temperature passes the 1000K point
#define HEAT_DAMAGE_LEVEL_1 1 //Amount of damage applied when your body temperature just passes the 360.15k safety point
#define HEAT_DAMAGE_LEVEL_2 2 //Amount of damage applied when your body temperature passes the 400K point
#define HEAT_DAMAGE_LEVEL_3 3 //Amount of damage applied when your body temperature passes the 1000K point

#define COLD_DAMAGE_LEVEL_1 0.5 //Amount of damage applied when your body temperature just passes the 260.15k safety point
#define COLD_DAMAGE_LEVEL_2 1.5 //Amount of damage applied when your body temperature passes the 200K point
#define COLD_DAMAGE_LEVEL_3 3 //Amount of damage applied when your body temperature passes the 120K point

//Note that gas heat damage is only applied once every FOUR ticks.
#define HEAT_GAS_DAMAGE_LEVEL_1 2 //Amount of damage applied when the current breath's temperature just passes the 360.15k safety point
#define HEAT_GAS_DAMAGE_LEVEL_2 4 //Amount of damage applied when the current breath's temperature passes the 400K point
#define HEAT_GAS_DAMAGE_LEVEL_3 8 //Amount of damage applied when the current breath's temperature passes the 1000K point
#define HEAT_GAS_DAMAGE_LEVEL_1 1 //Amount of damage applied when the current breath's temperature just passes the 360.15k safety point
#define HEAT_GAS_DAMAGE_LEVEL_2 2 //Amount of damage applied when the current breath's temperature passes the 400K point
#define HEAT_GAS_DAMAGE_LEVEL_3 3 //Amount of damage applied when the current breath's temperature passes the 1000K point

#define COLD_GAS_DAMAGE_LEVEL_1 0.5 //Amount of damage applied when the current breath's temperature just passes the 260.15k safety point
#define COLD_GAS_DAMAGE_LEVEL_2 1.5 //Amount of damage applied when the current breath's temperature passes the 200K point
Expand Down Expand Up @@ -602,13 +602,24 @@
fire_alert = max(fire_alert, FIRE_ALERT_COLD)
if(status_flags & GODMODE) return 1 //godmode
var/burn_dam = 0
switch(bodytemperature)
if(species.heat_level_1 to species.heat_level_2)
burn_dam = HEAT_DAMAGE_LEVEL_1
if(species.heat_level_2 to species.heat_level_3)
burn_dam = HEAT_DAMAGE_LEVEL_2
if(species.heat_level_3 to INFINITY)
burn_dam = HEAT_DAMAGE_LEVEL_3

if(bodytemperature >= species.heat_level_3)
burn_dam = HEAT_DAMAGE_LEVEL_3
fire_stacks += 3

else if(bodytemperature >= species.heat_level_2)
burn_dam = HEAT_DAMAGE_LEVEL_2
fire_stacks++

else
burn_dam = HEAT_DAMAGE_LEVEL_1


IgniteMob() // Ignites oil or other firestacks, damage increased while on fire

if(on_fire)
burn_dam = burn_dam * 2

take_overall_damage(burn=burn_dam, used_weapon = "High Body Temperature")
fire_alert = max(fire_alert, FIRE_ALERT_HOT)

Expand All @@ -618,13 +629,22 @@

if(!istype(loc, /obj/machinery/atmospherics/unary/cryo_cell))
var/burn_dam = 0
switch(bodytemperature)
if(-INFINITY to species.cold_level_3)
burn_dam = COLD_DAMAGE_LEVEL_1
if(species.cold_level_3 to species.cold_level_2)
burn_dam = COLD_DAMAGE_LEVEL_2
if(species.cold_level_2 to species.cold_level_1)
burn_dam = COLD_DAMAGE_LEVEL_3

if(bodytemperature <= species.cold_level_3)
burn_dam = COLD_DAMAGE_LEVEL_3
fire_stacks -= 3

else if(bodytemperature <= species.cold_level_2)
burn_dam = COLD_DAMAGE_LEVEL_2
fire_stacks--

else
burn_dam = COLD_DAMAGE_LEVEL_1

if(on_fire)
burn_dam += TEMP_SHOCK_DAMAGE // Temperature shock
ExtinguishMob()

take_overall_damage(burn=burn_dam, used_weapon = "Low Body Temperature")
fire_alert = max(fire_alert, FIRE_ALERT_COLD)

Expand Down Expand Up @@ -679,8 +699,6 @@

if (abs(body_temperature_difference) < 0.5)
return //fuck this precision
if (on_fire)
return //too busy for pesky metabolic regulation

if(bodytemperature < species.cold_level_1) //260.15 is 310.15 - 50, the temperature where you start to feel effects.
if(nutrition >= 2) //If we are very, very cold we'll use up quite a bit of nutriment to heat us up.
Expand Down Expand Up @@ -1121,16 +1139,6 @@
speech_problem_flag = 1
return stuttering

/mob/living/carbon/human/handle_fire()
if(..())
return

var/burn_temperature = fire_burn_temperature()
var/thermal_protection = get_heat_protection(burn_temperature)

if (thermal_protection < 1 && bodytemperature < burn_temperature)
bodytemperature += round(BODYTEMP_HEATING_MAX*(1-thermal_protection), 1)

/mob/living/carbon/human/rejuvenate()
sanity.setLevel(sanity.max_level)
timeofdeath = 0
Expand Down
15 changes: 8 additions & 7 deletions code/modules/mob/living/carbon/human/species/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
var/toxins_mod = 1 // Toxloss modifier
var/radiation_mod = 1 // Radiation modifier
var/flash_mod = 1 // Stun from blindness modifier.
var/heat_mod = 1 // Heat damage modifier
var/vision_flags = SEE_SELF // Same flags as glasses.

var/list/hair_styles
Expand All @@ -83,12 +84,12 @@
var/breath_type = "oxygen" // Non-oxygen gas breathed, if any.
var/poison_type = "plasma" // Poisonous air.
var/exhale_type = "carbon_dioxide" // Exhaled gas type.
var/cold_level_1 = 260 // Cold damage level 1 below this point.
var/cold_level_2 = 200 // Cold damage level 2 below this point.
var/cold_level_3 = 120 // Cold damage level 3 below this point.
var/heat_level_1 = 360 // Heat damage level 1 above this point.
var/heat_level_2 = 400 // Heat damage level 2 above this point.
var/heat_level_3 = 1000 // Heat damage level 3 above this point.
var/cold_level_1 = 280 // Cold damage level 1 below this point.
var/cold_level_2 = 220 // Cold damage level 2 below this point.
var/cold_level_3 = 160 // Cold damage level 3 below this point.
var/heat_level_1 = 340 // Heat damage level 1 above this point.
var/heat_level_2 = 380 // Heat damage level 2 above this point.
var/heat_level_3 = 480 // Heat damage level 3 above this point.
var/passive_temp_gain = 0 // Species will gain this much temperature every second
var/hazard_high_pressure = HAZARD_HIGH_PRESSURE // Dangerously high pressure.
var/warning_high_pressure = WARNING_HIGH_PRESSURE // High pressure warning.
Expand Down Expand Up @@ -355,7 +356,7 @@
else if((!H.equipment_prescription && (H.sdisabilities & NEARSIGHTED)) || H.equipment_tint_total == TINT_MODERATE)
H.client.screen |= global_hud.vimpaired
else if(H.equipment_tint_total == TINT_LOW)
H.client.screen |= global_hud.lightMask
H.client.screen |= global_hud.lightMask

for(var/overlay in H.equipment_overlays)
H.client.screen |= overlay
Expand Down
Loading