Refactored fire_act (#19158)

Refactored fire_act() to be in line with TG version, removed useless
parameter, added signal, made non sleepable and forced to call parent.
Added atom_act.dm file for the various *_act procs.
This commit is contained in:
Fluffy
2024-05-26 20:55:36 +00:00
committed by GitHub
parent 263cce7f1e
commit db5b1ee6b2
36 changed files with 171 additions and 46 deletions
+1
View File
@@ -634,6 +634,7 @@
#include "code\game\area\area_power.dm"
#include "code\game\area\areas.dm"
#include "code\game\atom\_atom.dm"
#include "code\game\atom\atom_act.dm"
#include "code\game\atom\atoms_initializing_EXPENSIVE.dm"
#include "code\game\dna\dna2.dm"
#include "code\game\dna\dna2_domutcheck.dm"
+2 -2
View File
@@ -157,9 +157,9 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin
for(var/mob/living/L in loc)
L.FireBurn(firelevel, air_contents.temperature, air_contents.return_pressure()) //Burn the mobs!
loc.fire_act(air_contents, air_contents.temperature, air_contents.volume)
loc.fire_act(air_contents.temperature, air_contents.volume)
for(var/atom/A in loc)
A.fire_act(air_contents, air_contents.temperature, air_contents.volume)
A.fire_act(air_contents.temperature, air_contents.volume)
//spread
for(var/direction in GLOB.cardinal)
@@ -6,3 +6,5 @@
#define COMSIG_ATOM_PRE_EMP_ACT "atom_emp_act"
///from base of atom/emp_act(): (severity, protection)
#define COMSIG_ATOM_EMP_ACT "atom_emp_act"
///from base of atom/fire_act(): (exposed_temperature, exposed_volume)
#define COMSIG_ATOM_FIRE_ACT "atom_fire_act"
+33
View File
@@ -0,0 +1,33 @@
/*
* +++++++++++++++++++++++++++++++++++++++++ ABOUT THIS FILE +++++++++++++++++++++++++++++++++++++++++++++
* Not everything here necessarily has the name pattern of [x]_act()
* This is a file for various atom procs that simply get called when something is happening to that atom.
* If you're adding something here, you likely want a signal and SHOULD_CALL_PARENT(TRUE)
* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
/**
* Respond to fire being used on our atom
*
* Default behaviour is to send [COMSIG_ATOM_FIRE_ACT] and return
*
* * exposed_temperature - The temperature the atom was exposed to, in kelvin
* * exposed_volume - The volume the atom was exposed to, in units
*/
/atom/proc/fire_act(exposed_temperature, exposed_volume)
SHOULD_CALL_PARENT(TRUE)
SHOULD_NOT_SLEEP(TRUE)
SEND_SIGNAL(src, COMSIG_ATOM_FIRE_ACT, exposed_temperature, exposed_volume)
return
/*
THESE ARE LEGACY ONES, NOT UPDATED YET
*/
/atom/proc/ex_act()
set waitfor = FALSE
return
/atom/proc/emag_act(var/remaining_charges, var/mob/user, var/emag_source)
return NO_EMAG_ACT
-10
View File
@@ -355,16 +355,6 @@
L.source_atom.update_light()
GLOB.dir_set_event.raise_event(src, old_dir, dir)
/atom/proc/ex_act()
set waitfor = FALSE
return
/atom/proc/emag_act(var/remaining_charges, var/mob/user, var/emag_source)
return NO_EMAG_ACT
/atom/proc/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
return
/atom/proc/melt()
return
+3 -1
View File
@@ -313,7 +313,9 @@ update_flag
AddOverlays(indicator_overlay)
set_light(1.4, 1, COLOR_BRIGHT_GREEN)
/obj/machinery/portable_atmospherics/canister/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/obj/machinery/portable_atmospherics/canister/fire_act(exposed_temperature, exposed_volume)
. = ..()
if(exposed_temperature > temperature_resistance)
health -= 5
healthcheck()
+3 -1
View File
@@ -780,7 +780,9 @@
door_color = COLOR_VIOLET
mineral = MATERIAL_PHORON
/obj/machinery/door/airlock/phoron/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/obj/machinery/door/airlock/phoron/fire_act(exposed_temperature, exposed_volume)
. = ..()
if(exposed_temperature > 300)
PhoronBurn(exposed_temperature)
+4 -3
View File
@@ -75,11 +75,12 @@
AddOverlays("fire0")
set_light(0)
/obj/machinery/firealarm/fire_act(datum/gas_mixture/air, temperature, volume)
/obj/machinery/firealarm/fire_act(exposed_temperature, exposed_volume)
. = ..()
if(src.detecting)
if(temperature > T0C+200)
if(exposed_temperature > T0C+200)
src.alarm() // added check of detector status here
return
/obj/machinery/firealarm/bullet_act()
return src.alarm()
+3 -1
View File
@@ -69,7 +69,9 @@
for(var/_R in reagents.reagent_volumes)
F.reagents.add_reagent(_R, 1, safety = 1) //added safety check since reagents in the foam have already had a chance to react
/obj/effect/effect/foam/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) // foam disolves when heated, except metal foams
/obj/effect/effect/foam/fire_act(exposed_temperature, exposed_volume) // foam disolves when heated, except metal foams
. = ..()
if(!metal && prob(max(0, exposed_temperature - 475)))
flick("[icon_state]-disolve", src)
+3 -1
View File
@@ -46,7 +46,9 @@
if(health <= 0)
qdel(src)
/obj/effect/spider/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/obj/effect/spider/fire_act(exposed_temperature, exposed_volume)
. = ..()
if(exposed_temperature > 300 + T0C)
health -= 5
healthcheck()
@@ -114,7 +114,7 @@
//Step two - washing..... it's actually in washing machine code.
//Step three - drying
/obj/item/stack/material/animalhide/wetleather/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/obj/item/stack/material/animalhide/wetleather/fire_act(exposed_temperature, exposed_volume)
..()
if(exposed_temperature >= drying_threshold_temperature)
wetness--
+3 -1
View File
@@ -170,7 +170,9 @@
/obj/item/toy/balloon/bullet_act()
burst()
/obj/item/toy/balloon/fire_act(datum/gas_mixture/air, temperature, volume)
/obj/item/toy/balloon/fire_act(temperature, volume)
. = ..()
if(temperature > T0C+100)
burst()
return
@@ -57,6 +57,8 @@
if(!active)
prime()
/obj/item/grenade/dynamite/fire_act()
/obj/item/grenade/dynamite/fire_act(exposed_temperature, exposed_volume)
. = ..()
if(!active)
prime()
+3 -1
View File
@@ -944,7 +944,9 @@
to_chat(user, SPAN_WARNING("The cell isn't charged!"))
return TRUE
/obj/item/steelwool/fire_act()
/obj/item/steelwool/fire_act(exposed_temperature, exposed_volume)
. = ..()
ignite()
/obj/item/steelwool/proc/ignite(var/L, mob/user)
@@ -132,7 +132,9 @@
health -= maxHealth / 5
healthcheck()
/obj/structure/gore/tendrils/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/obj/structure/gore/tendrils/fire_act(exposed_temperature, exposed_volume)
. = ..()
if(exposed_temperature > 300 + T0C)
health -= 5
healthcheck()
+1 -1
View File
@@ -274,7 +274,7 @@
return 0
return 0
/obj/structure/grille/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/obj/structure/grille/fire_act(exposed_temperature, exposed_volume)
if(!destroyed)
if(exposed_temperature > T0C + 1500)
health -= 1
+3 -1
View File
@@ -15,7 +15,9 @@
var/health = 100
var/maxhealth = 100
/obj/structure/simple_door/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/obj/structure/simple_door/fire_act(exposed_temperature, exposed_volume)
. = ..()
TemperatureAct(exposed_temperature)
/obj/structure/simple_door/proc/TemperatureAct(temperature)
@@ -323,7 +323,9 @@
anchored = FALSE
density = FALSE
/obj/structure/flora/log_bench/fire_act()
/obj/structure/flora/log_bench/fire_act(exposed_temperature, exposed_volume)
. = ..()
for(var/obj/structure/bonfire/B in get_turf(src))
if(B.on_fire)
B.fuel = min(B.max_fuel, B.fuel + 300)
+1 -1
View File
@@ -409,7 +409,7 @@
return 1
return 0
/obj/structure/window/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/obj/structure/window/fire_act(exposed_temperature, exposed_volume)
if(exposed_temperature > maximal_heat)
hit(damage_per_fire_tick, 0)
..()
+3 -2
View File
@@ -32,7 +32,8 @@
src.hotspot_expose(1000,CELL_VOLUME)
return
/turf/simulated/floor/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/turf/simulated/floor/fire_act(exposed_temperature, exposed_volume)
. = ..()
var/temp_destroy = get_damage_temperature()
if(!burnt && prob(5))
@@ -51,4 +52,4 @@
for(var/obj/structure/window/W in src)
if(W.dir == dir_to || W.is_fulltile()) //Same direction or diagonal (full tile)
W.fire_act(adj_air, adj_temp, adj_volume)
W.fire_act(adj_temp, adj_volume)
+2 -1
View File
@@ -183,7 +183,8 @@
return
/turf/simulated/wall/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) //Doesn't fucking work because walls don't interact with air :[
/turf/simulated/wall/fire_act(exposed_temperature, exposed_volume) //Doesn't fucking work because walls don't interact with air :[
. = ..()
burn(exposed_temperature)
/turf/simulated/wall/adjacent_fire_act(turf/simulated/floor/adj_turf, datum/gas_mixture/adj_air, adj_temp, adj_volume)
+3 -1
View File
@@ -227,7 +227,9 @@
take_damage(damage)
/obj/effect/blob/fire_act()
/obj/effect/blob/fire_act(exposed_temperature, exposed_volume)
. = ..()
take_damage(rand(5, 20) / fire_resist)
#define CORE_SHIELD_HIGH "high"
+3 -1
View File
@@ -206,7 +206,9 @@
wipe_down(A, user)
return
/obj/item/reagent_containers/glass/rag/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/obj/item/reagent_containers/glass/rag/fire_act(exposed_temperature, exposed_volume)
. = ..()
if(exposed_temperature >= 50 + T0C)
ignite()
if(exposed_temperature >= 900 + T0C)
+1 -1
View File
@@ -335,7 +335,7 @@
// ++++ROCKDTBEN++++ MOB PROCS //END
/mob/living/carbon/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/mob/living/carbon/fire_act(exposed_temperature, exposed_volume)
..()
var/temp_inc = max(min(BODYTEMP_HEATING_MAX*(1-get_heat_protection()), exposed_temperature - bodytemperature), 0)
bodytemperature += temp_inc
+3 -1
View File
@@ -337,7 +337,9 @@
var/turf/location = get_turf(src)
location.hotspot_expose(fire_burn_temperature(), 50, 1)
/mob/living/fire_act()
/mob/living/fire_act(exposed_temperature, exposed_volume)
. = ..()
IgniteMob(2)
/mob/living/proc/get_cold_protection()
@@ -329,6 +329,8 @@
AddOverlays(image("icon" = 'icons/mob/burning/burning_generic.dmi', "icon_state" = "upper"))
AddOverlays(image("icon" = 'icons/mob/burning/burning_generic.dmi', "icon_state" = "lower"))
/mob/living/silicon/robot/fire_act()
/mob/living/silicon/robot/fire_act(exposed_temperature, exposed_volume)
. = ..()
if(!on_fire) // Silicons don't gain stacks from hotspots, but hotspots can ignite them.
IgniteMob()
@@ -24,7 +24,7 @@
death()
return ..()
/obj/structure/flora/pottedplant/fire_act()
/obj/structure/flora/pottedplant/fire_act(exposed_temperature, exposed_volume)
death()
return ..()
@@ -19,7 +19,7 @@
death()
return ..()
/obj/item/flora/pottedplant_small/fire_act()
/obj/item/flora/pottedplant_small/fire_act(exposed_temperature, exposed_volume)
death()
return ..()
@@ -20,7 +20,8 @@
SSicon_smooth.add_to_queue_neighbors(src)
SSicon_smooth.add_to_queue(src)
/turf/simulated/floor/exoplanet/snow/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/turf/simulated/floor/exoplanet/snow/fire_act(exposed_temperature, exposed_volume)
. = ..()
melt()
/turf/simulated/floor/exoplanet/snow/melt()
@@ -105,7 +105,9 @@
if(ammunition_flags & SHIP_AMMO_FLAG_INFLAMMABLE)
cookoff(TRUE)
/obj/item/ship_ammunition/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/obj/item/ship_ammunition/fire_act(exposed_temperature, exposed_volume)
. = ..()
if(ammunition_flags & SHIP_AMMO_FLAG_INFLAMMABLE)
if(exposed_temperature >= T0C+200)
cookoff(TRUE)
@@ -155,7 +155,9 @@
/obj/item/warhead/longbow/ex_act(severity)
cookoff(TRUE)
/obj/item/warhead/longbow/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/obj/item/warhead/longbow/fire_act(exposed_temperature, exposed_volume)
. = ..()
if(exposed_temperature >= T0C+200)
cookoff(TRUE)
+3 -1
View File
@@ -695,7 +695,9 @@
// called when on fire
/obj/machinery/light/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/obj/machinery/light/fire_act(exposed_temperature, exposed_volume)
. = ..()
if(prob(max(0, exposed_temperature - 673))) //0% at <400C, 100% at >500C
broken()
@@ -220,10 +220,10 @@
detonate(TRUE)
. = ..()
/obj/item/reagent_containers/food/drinks/cans/fire_act()
/obj/item/reagent_containers/food/drinks/cans/fire_act(exposed_temperature, exposed_volume)
if(can_light())
fuselit = TRUE
detonate(FALSE)
INVOKE_ASYNC(src, PROC_REF(detonate), FALSE)
visible_message(SPAN_WARNING("<b>\The [name]'s fuse catches on fire!</b>"))
. = ..()
+1 -1
View File
@@ -220,7 +220,7 @@
..()
/obj/structure/reagent_dispensers/fueltank/fire_act(datum/gas_mixture/air, temperature, volume)
/obj/structure/reagent_dispensers/fueltank/fire_act(temperature, volume)
if (is_leaking)
ex_act(2.0)
else if (temperature > T0C+500)
@@ -145,7 +145,9 @@
if(H)
H.apply_damage(Proj.damage, DAMAGE_PAIN)
/obj/item/poppet/fire_act()
/obj/item/poppet/fire_act(exposed_temperature, exposed_volume)
. = ..()
var/mob/living/carbon/human/H = target.resolve()
if(H)
H.adjust_fire_stacks(2)
@@ -0,0 +1,59 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# - (fixes bugs)
# wip
# - (work in progress)
# qol
# - (quality of life)
# soundadd
# - (adds a sound)
# sounddel
# - (removes a sound)
# rscadd
# - (adds a feature)
# rscdel
# - (removes a feature)
# imageadd
# - (adds an image or sprite)
# imagedel
# - (removes an image or sprite)
# spellcheck
# - (fixes spelling or grammar)
# experiment
# - (experimental change)
# balance
# - (balance changes)
# code_imp
# - (misc internal code change)
# refactor
# - (refactors code)
# config
# - (makes a change to the config files)
# admin
# - (makes changes to administrator tools)
# server
# - (miscellaneous changes to server)
#################################
# Your name.
author: FluffyGhost
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit.
# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog.
changes:
- refactor: "Refactored fire_act() to be in line with TG version, removed useless parameter, added signal, made non sleepable and forced to call parent."
- refactor: "Added atom_act.dm file for the various *_act procs."