Skip to content

Commit

Permalink
Sparks ignite flammable things (including people), welding fuel pools…
Browse files Browse the repository at this point in the history
… now ignite in response to more things logically (tgstation#83673)

## About The Pull Request

Currently, sparks only ignite the air in rooms with
plasma/tritium/hydrogen in them. This PR changes sparks to ignite
flammable things they touch, including mobs covered in flammable
liquids. They also marginally heat containers (40K temp increase from a
broken light bulb).

The initial purpose was to make welding fuel pools more responsive to
flaming things being thrown into them. I have also done that. They now
respond to hot objects (including flaming mobs) entering their space or
being thrown onto them. They are also ignited by sparks.

This PR makes sparks a fire hazard. Keep a fire extinguisher handy.

## Why It's Good For The Game

Safety hazards are fun. Sparks should, logically, set flammable things
on fire, including YOU. Welding fuel pools should be more hazardous.

## Changelog

:cl: Bisar
add: Sparks now ignite flammable things. Including you. Keep a fire
extinguisher handy or stop dousing yourself in welding fuel!
fix: Fixed a few oversights with welding fuel pools not igniting when
you throw lit/hot things into them or when you walk into them while on
fire.
/:cl:
  • Loading branch information
Metekillot authored Jun 18, 2024
1 parent 3a8f794 commit d10d790
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 10 deletions.
25 changes: 25 additions & 0 deletions code/game/objects/effects/decals/cleanable/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@
beauty = -50
clean_type = CLEAN_TYPE_BLOOD
mouse_opacity = MOUSE_OPACITY_OPAQUE
resistance_flags = UNACIDABLE | ACID_PROOF | FIRE_PROOF | FLAMMABLE //gross way of doing this but would need to disassemble fire_act call stack otherwise
/// Maximum amount of hotspots this pool can create before deleting itself
var/burn_amount = 3
/// Is this fuel pool currently burning?
Expand All @@ -453,6 +454,10 @@

/obj/effect/decal/cleanable/fuel_pool/Initialize(mapload, burn_stacks)
. = ..()
var/static/list/ignition_trigger_connections = list(
COMSIG_TURF_MOVABLE_THROW_LANDED = PROC_REF(ignition_trigger),
)
AddElement(/datum/element/connect_loc, ignition_trigger_connections)
for(var/obj/effect/decal/cleanable/fuel_pool/pool in get_turf(src)) //Can't use locate because we also belong to that turf
if(pool == src)
continue
Expand Down Expand Up @@ -509,6 +514,26 @@
ignite()
return ..()

/obj/effect/decal/cleanable/fuel_pool/on_entered(datum/source, atom/movable/entered_atom)
. = ..()
if(entered_atom.throwing) // don't light from things being thrown over us, we handle that somewhere else
return
ignition_trigger(source = src, enflammable_atom = entered_atom)

/obj/effect/decal/cleanable/fuel_pool/proc/ignition_trigger(datum/source, atom/movable/enflammable_atom)
SIGNAL_HANDLER

if(isitem(enflammable_atom))
var/obj/item/enflamed_item = enflammable_atom
if(enflamed_item.get_temperature() > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
ignite()
return
else if(isliving(enflammable_atom))
var/mob/living/enflamed_liver = enflammable_atom
if(enflamed_liver.on_fire)
ignite()


/obj/effect/decal/cleanable/fuel_pool/hivis
icon_state = "fuel_pool_hivis"

Expand Down
59 changes: 50 additions & 9 deletions code/game/objects/effects/effect_system/effects_sparks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,65 @@
return INITIALIZE_HINT_LATELOAD

/obj/effect/particle_effect/sparks/LateInitialize()
RegisterSignals(src, list(COMSIG_MOVABLE_CROSS, COMSIG_MOVABLE_CROSS_OVER), PROC_REF(sparks_touched))
flick(icon_state, src)
playsound(src, SFX_SPARKS, 100, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
var/turf/T = loc
if(isturf(T))
T.hotspot_expose(1000,100)
var/turf/location = loc
if(isturf(location))
affect_location(location, just_initialized = TRUE)
QDEL_IN(src, 20)

/obj/effect/particle_effect/sparks/Destroy()
var/turf/T = loc
if(isturf(T))
T.hotspot_expose(1000,100)
var/turf/location = loc
if(isturf(location))
affect_location(location)
return ..()

/obj/effect/particle_effect/sparks/Move()
..()
var/turf/T = loc
if(isturf(T))
T.hotspot_expose(1000,100)
var/turf/location = loc
if(isturf(location))
affect_location(location)

/*
* Apply the effects of this spark to its location.
*
* When the spark is first created, Cross() and Crossed() don't get called,
* so for the first initialization, we make sure to specifically invoke the
* behavior of the spark on all the mobs and objects in the location.
* turf/location - The place the spark is affectiong
* just_initialized - If the spark is just being created, and we need to manually affect everything in the location
*/
/obj/effect/particle_effect/sparks/proc/affect_location(turf/location, just_initialized = FALSE)
location.hotspot_expose(1000,100)
if(just_initialized)
for(var/atom/movable/singed in location)
sparks_touched(src, singed)

/*
* This is called when anything passes through the same tiles as a spark, or when a spark passes through something's tile.
*
* This is invoked by the signals sent by every atom when they're crossed or crossing something. It
* signifies that something has been touched by sparks, and should be affected by possible pyrotechnic affects..
* datum/source - Can either be the spark itself or an object that just walked into it
* mob/living/singed_mob - The mob that was touched by the spark
*/
/obj/effect/particle_effect/sparks/proc/sparks_touched(datum/source, atom/movable/singed)
SIGNAL_HANDLER

if(isobj(singed))
var/obj/singed_obj = singed
if(singed_obj.resistance_flags & FLAMMABLE && !(singed_obj.resistance_flags & ON_FIRE)) //only fire_act flammable objects instead of burning EVERYTHING
singed_obj.fire_act(1,100)
if(singed_obj.reagents)
var/datum/reagents/reagents = singed_obj.reagents
reagents?.expose_temperature(1000)
return
if(isliving(singed))
var/mob/living/singed_living = singed
if(singed_living.fire_stacks)
singed_living.ignite_mob(FALSE) //ignite the mob, silent = FALSE (You're set on fire!)
return

/datum/effect_system/spark_spread
effect_type = /obj/effect/particle_effect/sparks
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/grenades/_grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
flags_1 = PREVENT_CONTENTS_EXPLOSION_1 // We detonate upon being exploded.
obj_flags = CONDUCTS_ELECTRICITY
slot_flags = ITEM_SLOT_BELT
resistance_flags = FLAMMABLE
max_integrity = 40
/// Bitfields which prevent the grenade from detonating if set. Includes ([GRENADE_DUD]|[GRENADE_USED])
var/dud_flags = NONE
Expand Down

0 comments on commit d10d790

Please sign in to comment.