New fire colors (#27911)

This commit is contained in:
DGamerL
2025-01-15 15:45:23 +01:00
committed by GitHub
parent 39fa268f54
commit f682d8d5bf
5 changed files with 35 additions and 4 deletions
@@ -29,6 +29,8 @@
var/canister_burn_duration = 10 SECONDS
/// How many firestacks will our reagent apply
var/canister_fire_applications = 1
/// Does our chemical have any special color?
var/canister_fire_color
/// How much ammo do we use per tile?
var/ammo_usage = 1
/// Is this a syndicate flamethrower
@@ -90,12 +92,14 @@
canister_burn_temp = null
canister_burn_duration = null
canister_fire_applications = null
canister_fire_color = null
return
var/burn_temp
var/burn_duration
var/fire_applications
var/how_many_canisters = length(canisters)
var/list/colors = list()
for(var/obj/item/chemical_canister/canister as anything in canisters)
if(!canister.ammo)
@@ -103,10 +107,13 @@
burn_temp += canister.chem_burn_temp
burn_duration += canister.chem_burn_duration
fire_applications += canister.fire_applications
colors += canister.chem_color
canister_burn_temp = round(burn_temp / how_many_canisters, 1)
canister_burn_duration = round(burn_duration / how_many_canisters, 1)
canister_fire_applications = round(fire_applications / how_many_canisters, 1)
if(length(colors))
canister_fire_color = pick(colors)
update_icon(UPDATE_OVERLAYS)
/obj/item/chemical_flamethrower/afterattack__legacy__attackchain(atom/target, mob/user, flag)
@@ -159,7 +166,8 @@
previousturf = T
/obj/item/chemical_flamethrower/proc/make_flame(turf/spawn_turf)
new /obj/effect/fire(spawn_turf, canister_burn_temp, (canister_burn_duration + rand(1, 3) SECONDS), canister_fire_applications) // For that spicy randomness (and to save your ears from all fires extinguishing at the same time)
// For that spicy randomness (and to save your ears from all fires extinguishing at the same time)
new /obj/effect/fire(spawn_turf, canister_burn_temp, (canister_burn_duration + rand(1, 3) SECONDS), canister_fire_applications, canister_fire_color)
/*
* Uses `amount` ammo from the flamethrower.
@@ -232,6 +240,8 @@
var/first_time_silent = FALSE // The reason for this is so we can have canisters that spawn with reagents but don't announce it on `Initialize()`
/// What chemical do we have? This will be the chemical ID, so a string
var/stored_chemical
/// What color will our fire burn
var/chem_color
/obj/item/chemical_canister/Initialize(mapload)
. = ..()
@@ -273,6 +283,8 @@
chem_burn_duration = reagent_to_burn.burn_duration
chem_burn_temp = reagent_to_burn.burn_temperature
fire_applications = reagent_to_burn.fire_stack_applications
if(reagent_to_burn.burn_color)
chem_color = reagent_to_burn.burn_color
ammo = initial(ammo)
has_filled_reagent = TRUE
reagents.clear_reagents()
@@ -5,8 +5,8 @@ GLOBAL_LIST_EMPTY(flame_effects)
name = "fire"
desc = "You don't think you should touch this."
icon = 'icons/effects/chemical_fire.dmi'
icon_state = "fire1"
icon_state = "red_small"
base_icon_state = "red"
/// How hot is our fire?
var/temperature
/// How long will our fire last
@@ -14,7 +14,7 @@ GLOBAL_LIST_EMPTY(flame_effects)
/// How many firestacks does the fire give to mobs
var/application_stacks = 1
/obj/effect/fire/Initialize(mapload, reagent_temperature, reagent_duration, fire_applications)
/obj/effect/fire/Initialize(mapload, reagent_temperature, reagent_duration, fire_applications, color)
. = ..()
if(reagent_duration < 0 || reagent_temperature <= 0) // There is no reason for this thing to exist
@@ -24,6 +24,9 @@ GLOBAL_LIST_EMPTY(flame_effects)
duration = reagent_duration
temperature = reagent_temperature
application_stacks = max(application_stacks, fire_applications)
if(color)
base_icon_state = color
update_icon()
for(var/obj/effect/fire/flame in get_turf(src))
if(!istype(flame) || flame == src)
@@ -48,6 +51,7 @@ GLOBAL_LIST_EMPTY(flame_effects)
fizzle()
return
duration -= 2 SECONDS
update_icon(UPDATE_ICON_STATE)
for(var/atom/movable/thing_to_burn in get_turf(src))
if(isliving(thing_to_burn))
@@ -68,6 +72,14 @@ GLOBAL_LIST_EMPTY(flame_effects)
var/datum/milla_safe/fire_heat_air/milla = new()
milla.invoke_async(src, location)
/obj/effect/fire/update_icon_state()
var/suffix = "small"
if(duration >= 30 SECONDS)
suffix = "big"
else if(duration >= 10 SECONDS)
suffix = "medium"
icon_state = "[base_icon_state]_[suffix]"
/datum/milla_safe/fire_heat_air
/datum/milla_safe/fire_heat_air/on_run(obj/effect/fire/fire, turf/T)
@@ -79,6 +91,7 @@ GLOBAL_LIST_EMPTY(flame_effects)
duration -= 10 SECONDS
if(duration <= 0)
fizzle()
update_icon(UPDATE_ICON_STATE)
/obj/effect/fire/proc/on_atom_entered(datum/source, atom/movable/entered, old_loc)
SIGNAL_HANDLER // COMSIG_ATOM_ENTERED