Files
VOREStation/code/modules/mob/living/living_fire.dm
T
Will 57f85c4af5 prevent shadekin conflagration in phase (#18915)
* prevent shadekin conflagration

* don't do this either
2025-12-18 06:37:01 -08:00

186 lines
6.1 KiB
Plaintext

//Mobs on Fire
//altered this to cap at the temperature of the fire causing it, using the same 1:1500 value as /mob/living/carbon/human/handle_fire() in human/life.dm
/mob/living/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
if(is_incorporeal())
return
if(exposed_temperature)
if(fire_stacks < exposed_temperature/1500) // Subject to balance
adjust_fire_stacks(2)
else
adjust_fire_stacks(2)
ignite_mob()
/// Global list that containes cached fire overlays for mobs
GLOBAL_LIST_EMPTY(fire_appearances)
/mob/living/proc/ignite_mob(silent)
if(fire_stacks <= 0)
return FALSE
var/datum/status_effect/fire_handler/fire_stacks/fire_status = has_status_effect(/datum/status_effect/fire_handler/fire_stacks)
if(!fire_status || fire_status.on_fire)
return FALSE
return fire_status.ignite(silent)
/**
* Extinguish all fire on the mob
*
* This removes all fire stacks, fire effects, alerts, and moods
* Signals the extinguishing.
*/
/mob/living/proc/extinguish_mob()
if(HAS_TRAIT(src, TRAIT_NO_EXTINGUISH)) //The everlasting flames will not be extinguished
return
var/datum/status_effect/fire_handler/fire_stacks/fire_status = has_status_effect(/datum/status_effect/fire_handler/fire_stacks)
if(!fire_status || !fire_status.on_fire)
return
remove_status_effect(/datum/status_effect/fire_handler/fire_stacks)
/mob/living/proc/update_fire()
return
/**
* Adjust the amount of fire stacks on a mob
*
* This modifies the fire stacks on a mob.
*
* Vars:
* * stacks: int The amount to modify the fire stacks
* * fire_type: type Type of fire status effect that we apply, should be subtype of /datum/status_effect/fire_handler/fire_stacks
*/
/mob/living/proc/adjust_fire_stacks(stacks, fire_type = /datum/status_effect/fire_handler/fire_stacks)
if(stacks < 0)
if(HAS_TRAIT(src, TRAIT_NO_EXTINGUISH)) //You can't reduce fire stacks of the everlasting flames
return
stacks = max(-fire_stacks, stacks)
apply_status_effect(fire_type, stacks)
/mob/living/proc/adjust_wet_stacks(stacks, wet_type = /datum/status_effect/fire_handler/wet_stacks)
if(HAS_TRAIT(src, TRAIT_NO_EXTINGUISH)) //The everlasting flames will not be extinguished
return
if(stacks < 0)
stacks = max(fire_stacks, stacks)
apply_status_effect(wet_type, stacks)
/**
* Set the fire stacks on a mob
*
* This sets the fire stacks on a mob, stacks are clamped between -20 and 20.
* If the fire stacks are reduced to 0 then we will extinguish the mob.
*
* Vars:
* * stacks: int The amount to set fire_stacks to
* * fire_type: type Type of fire status effect that we apply, should be subtype of /datum/status_effect/fire_handler/fire_stacks
* * remove_wet_stacks: bool If we remove all wet stacks upon doing this
*/
/mob/living/proc/set_fire_stacks(stacks, fire_type = /datum/status_effect/fire_handler/fire_stacks, remove_wet_stacks = TRUE)
if(stacks < 0) //Shouldn't happen, ever
CRASH("set_fire_stacks received negative [stacks] fire stacks")
if(remove_wet_stacks)
remove_status_effect(/datum/status_effect/fire_handler/wet_stacks)
if(stacks == 0)
remove_status_effect(fire_type)
return
apply_status_effect(fire_type, stacks, TRUE)
/mob/living/proc/set_wet_stacks(stacks, wet_type = /datum/status_effect/fire_handler/wet_stacks, remove_fire_stacks = TRUE)
if(stacks < 0)
CRASH("set_wet_stacks received negative [stacks] wet stacks")
if(remove_fire_stacks)
remove_status_effect(/datum/status_effect/fire_handler/fire_stacks)
if(stacks == 0)
remove_status_effect(wet_type)
return
apply_status_effect(wet_type, stacks, TRUE)
//Share fire evenly between the two mobs
//Called in MobBump() and Crossed()
/mob/living/proc/spreadFire(mob/living/spread_to)
if(!istype(spread_to))
return
// Shadekin checkkkkk~~~
if(is_incorporeal() || spread_to.is_incorporeal())
return
// can't spread fire to mobs that don't catch on fire
if(HAS_TRAIT(spread_to, TRAIT_NOFIRE_SPREAD) || HAS_TRAIT(src, TRAIT_NOFIRE_SPREAD))
return
var/datum/status_effect/fire_handler/fire_stacks/fire_status = has_status_effect(/datum/status_effect/fire_handler/fire_stacks)
var/datum/status_effect/fire_handler/fire_stacks/their_fire_status = spread_to.has_status_effect(/datum/status_effect/fire_handler/fire_stacks)
if(fire_status && fire_status.on_fire)
if(their_fire_status && their_fire_status.on_fire)
var/firesplit = (fire_stacks + spread_to.fire_stacks) / 2
var/fire_type = (spread_to.fire_stacks > fire_stacks) ? their_fire_status.type : fire_status.type
set_fire_stacks(firesplit, fire_type)
spread_to.set_fire_stacks(firesplit, fire_type)
return
adjust_fire_stacks(-fire_stacks / 2, fire_status.type)
spread_to.adjust_fire_stacks(fire_stacks, fire_status.type)
if(spread_to.ignite_mob())
message_admins("[key_name(src)] bumped into [key_name(spread_to)] and set them on fire.")
return
if(!their_fire_status || !their_fire_status.on_fire)
return
spread_to.adjust_fire_stacks(-spread_to.fire_stacks / 2, their_fire_status.type)
adjust_fire_stacks(spread_to.fire_stacks, their_fire_status.type)
ignite_mob()
/**
* Gets the fire overlay to use for this mob
*
* Args:
* * stacks: Current amount of fire_stacks
* * on_fire: If we're lit on fire
*
* Return a mutable appearance, the overlay that will be applied.
*/
// Gets the correct icon_state for being on fire. See OnFire.dmi for the icons.
/mob/living/proc/get_fire_icon_state()
return "generic"
/mob/living/proc/get_fire_overlay(stacks, on_fire)
RETURN_TYPE(/mutable_appearance)
var/fire_icon = get_fire_icon_state()
if(!GLOB.fire_appearances[fire_icon])
var/mutable_appearance/new_fire_overlay = mutable_appearance(
'icons/mob/OnFire.dmi',
fire_icon,
FIRE_LAYER,
appearance_flags = RESET_COLOR|KEEP_APART,
)
GLOB.fire_appearances[fire_icon] = new_fire_overlay
return GLOB.fire_appearances[fire_icon]
/**
* Handles effects happening when mob is on normal fire
*
* Vars:
* * seconds_per_tick
* * times_fired
* * fire_handler: Current fire status effect that called the proc
*/
/mob/living/proc/on_fire_stack(seconds_per_tick, datum/status_effect/fire_handler/fire_stacks/fire_handler)
return
//Mobs on Fire end