Skip to content

Commit

Permalink
Moved various fire procs to /atom level as stubs, consistent name/set…
Browse files Browse the repository at this point in the history
…ter/getter use.
  • Loading branch information
MistakeNot4892 committed Dec 16, 2024
1 parent fbd8205 commit 694628f
Show file tree
Hide file tree
Showing 37 changed files with 268 additions and 240 deletions.
6 changes: 3 additions & 3 deletions code/_helpers/washing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
if(!istype(washing))
return
var/mob/living/L = washing
if(L.on_fire)
if(L.is_on_fire())
L.visible_message("<span class='danger'>A cloud of steam rises up as the water hits \the [L]!</span>")
L.ExtinguishMob()
L.fire_stacks = -20 //Douse ourselves with water to avoid fire more easily
L.extinguish_fire()
L.adjust_fire_intensity(-20) //Douse ourselves with water to avoid fire more easily
washing.clean()
21 changes: 21 additions & 0 deletions code/game/atoms_fires.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Stubs for atom fire system, TODO.
/atom/proc/set_fire_intensity(amount)
return

/atom/proc/get_fire_intensity()
return 0

/atom/proc/adjust_fire_intensity(amount)
return

/atom/proc/can_ignite()
return FALSE

/atom/proc/ignite_fire()
return

/atom/proc/extinguish_fire(mob/user, no_message = FALSE)
return

/atom/proc/is_on_fire()
return FALSE
18 changes: 7 additions & 11 deletions code/game/machinery/igniter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
/obj/machinery/igniter/interface_interact(mob/user)
if(!CanInteract(user, DefaultTopicState()))
return FALSE
ignite()
toggle_igniter()
visible_message(SPAN_NOTICE("\The [user] toggles \the [src]."))
return TRUE

Expand All @@ -51,7 +51,7 @@
location.hotspot_expose(1000,500,1)
return 1

/obj/machinery/igniter/proc/ignite()
/obj/machinery/igniter/proc/toggle_igniter()
use_power_oneoff(2000)
on = !on
if(on)
Expand All @@ -73,7 +73,7 @@
/decl/public_access/public_method/igniter_toggle
name = "igniter toggle"
desc = "Toggle the igniter on or off."
call_proc = TYPE_PROC_REF(/obj/machinery/igniter, ignite)
call_proc = TYPE_PROC_REF(/obj/machinery/igniter, toggle_igniter)

/decl/stock_part_preset/radio/receiver/igniter
frequency = BUTTON_FREQ
Expand Down Expand Up @@ -133,19 +133,15 @@
return ..()

/obj/machinery/sparker/attack_ai()
if (anchored)
return ignite()
else
return
return anchored ? create_sparks() : null

/obj/machinery/sparker/proc/ignite()
/obj/machinery/sparker/proc/create_sparks()
if (stat & NOPOWER)
return

if (disable || (last_spark && world.time < last_spark + 50))
return


flick("[base_state]-spark", src)
spark_at(src, amount=2, cardinal_only = TRUE)
src.last_spark = world.time
Expand All @@ -159,13 +155,13 @@
if(stat & (BROKEN|NOPOWER))
..(severity)
return
ignite()
create_sparks()
..(severity)

/decl/public_access/public_method/sparker_spark
name = "spark"
desc = "Creates sparks to ignite nearby gases."
call_proc = TYPE_PROC_REF(/obj/machinery/sparker, ignite)
call_proc = TYPE_PROC_REF(/obj/machinery/sparker, create_sparks)

/decl/stock_part_preset/radio/receiver/sparker
frequency = BUTTON_FREQ
Expand Down
32 changes: 11 additions & 21 deletions code/game/objects/items/flame/_flame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
loc.update_icon()

/obj/item/flame/Destroy()
extinguish(null, TRUE)
snuff_out(null, TRUE)
return ..()

/obj/item/flame/proc/get_available_scents()
Expand Down Expand Up @@ -115,7 +115,7 @@

return ..()

/obj/item/flame/proc/extinguish(var/mob/user, var/no_message)
/obj/item/flame/proc/snuff_out(mob/user, no_message = FALSE)
if(!lit)
return FALSE
lit = FALSE
Expand Down Expand Up @@ -147,7 +147,7 @@
return TRUE

if(lit && can_manually_extinguish)
extinguish(user)
snuff_out(user)
return TRUE

return ..()
Expand Down Expand Up @@ -175,7 +175,7 @@
else
check_depth = FLUID_SHALLOW
if(fluids.total_volume >= check_depth)
extinguish(no_message = TRUE)
snuff_out(no_message = TRUE)

/obj/item/flame/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
. = ..()
Expand Down Expand Up @@ -206,31 +206,21 @@
other.light(user)

/obj/item/flame/attackby(obj/item/used_item, mob/user)

if(!user.check_intent(I_FLAG_HARM) && !can_manually_light && (used_item.isflamesource() || used_item.get_heat() > T100C))
light(user)
return TRUE

return ..()

/obj/item/flame/Process()

if((!waterproof && submerged()) || !expend_fuel(_fuel_spend_amt))
extinguish()
snuff_out()
return PROCESS_KILL

update_icon()
if(istype(loc, /obj/structure/wall_sconce))
loc.update_icon()

// TODO: generalized ignition proc
if(isliving(loc))
var/mob/living/M = loc
M.IgniteMob()

var/turf/location = get_turf(src)
if(location)
location.hotspot_expose(get_heat(), w_class)
if(loc)
loc.ignite_fire()
var/turf/my_turf = get_turf(src)
if(my_turf)
my_turf.hotspot_expose(get_heat(), w_class)

/obj/item/flame/dropped(var/mob/user)
//If dropped, put ourselves out
Expand All @@ -239,7 +229,7 @@
var/turf/location = loc
if(istype(location))
location.hotspot_expose(700, 5)
extinguish()
snuff_out()
return ..()

/obj/item/flame/spark_act(obj/effect/sparks/sparks)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/flame/flame_fuelled_lighter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
user.visible_message(SPAN_NOTICE("After a few attempts, \the [user] manages to light \the [src], burning their finger in the process."))
playsound(src.loc, "light_bic", 100, 1, -4)

/obj/item/flame/fuelled/lighter/extinguish(var/mob/user, var/no_message)
/obj/item/flame/fuelled/lighter/snuff_out(mob/user, no_message = FALSE)
if(!no_message && user)
no_message = TRUE
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/flame/flame_matches.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/obj/item/flame/match/light(mob/user, no_message)
. = !burnt && ..()

/obj/item/flame/match/extinguish(var/mob/user, var/no_message)
/obj/item/flame/match/snuff_out(mob/user, no_message = FALSE)
. = ..()
if(. && !burnt)
_fuel = 0
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/flame/flame_torch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

update_icon()

/obj/item/flame/torch/extinguish(var/mob/user, var/no_message)
/obj/item/flame/torch/snuff_out(mob/user, no_message = FALSE)
. = ..()
if(. && _fuel <= 0 && !burnt)
burnt = TRUE
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/flamethrower.dm
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
target.create_fire(tank.air_contents.temperature * 2 + 400)
target.hotspot_expose(1000, 100)
for(var/mob/living/M in target)
M.IgniteMob(1)
M.ignite_fire()

// slightly weird looking initialize cuz it has to do some stuff first
/obj/item/flamethrower/full/Initialize()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/material/ashtray.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
var/obj/item/clothing/mask/smokable/cigarette/cig = W
if (cig.lit == 1)
visible_message(SPAN_NOTICE("\The [user] crushes \the [cig] in \the [src], putting it out."))
W = cig.extinguish(no_message = 1)
W = cig.extinguish_fire(no_message = TRUE)
else if (cig.lit == 0)
to_chat(user, SPAN_NOTICE("You place \the [cig] in \the [src] without even smoking it. Why would you do that?"))
else
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/weapons/tanks/tanks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ var/global/list/global/tank_gauge_cache = list()
return ..()

/obj/item/tankassemblyproxy/receive_signal() //This is mainly called by the sensor through sense() to the holder, and from the holder to here.
tank.ignite() //boom (or not boom if you made shijwtty mix)
tank.cause_explosion() //boom (or not boom if you made shijwtty mix)

/obj/item/tank/proc/assemble_bomb(W,user) //Bomb assembly proc. This turns assembly+tank into a bomb
var/obj/item/assembly_holder/S = W
Expand All @@ -573,7 +573,7 @@ var/global/list/global/tank_gauge_cache = list()

update_icon(TRUE)

/obj/item/tank/proc/ignite() //This happens when a bomb is told to explode
/obj/item/tank/proc/cause_explosion() //This happens when a bomb is told to explode
var/obj/item/assembly_holder/assy = proxyassembly.assembly
var/ign = assy.a_right
var/obj/item/other = assy.a_left
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/weapons/tools/weldingtool.dm
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
var/turf/location = get_turf(user)
if(isliving(O))
var/mob/living/L = O
L.IgniteMob()
L.ignite_fire()
else if(isatom(O))
O.handle_external_heating(WELDING_TOOL_HOTSPOT_TEMP_ACTIVE, src, user)
if (isturf(location))
Expand Down Expand Up @@ -243,7 +243,7 @@
var/mob/living/L = loc
if(!(src in L.get_held_items()))
fuel_usage = max(fuel_usage, 2)
L.IgniteMob()
L.ignite_fire()
else if(isturf(loc))
var/turf/location = get_turf(src)
location.hotspot_expose(WELDING_TOOL_HOTSPOT_TEMP_IDLE, 5) //a bit colder when idling
Expand Down
4 changes: 4 additions & 0 deletions code/game/objects/structures/wall_sconce.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
QDEL_NULL(light_source)
return ..()

/obj/structure/wall_sconce/ignite_fire()
. = ..()
update_icon()

/obj/structure/wall_sconce/physically_destroyed()
if(light_source)
light_source.dropInto(loc)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/ZAS/Fire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin
return simulated

/turf/proc/hotspot_expose(exposed_temperature, exposed_volume, soh = 0)
if(locate(/obj/fire) in src)
if((locate(/obj/fire) in src) || !simulated)
return 1

var/datum/gas_mixture/air_contents = return_air()
Expand Down
12 changes: 6 additions & 6 deletions code/modules/clothing/head/misc_special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
icon = 'icons/clothing/head/cakehat.dmi'
body_parts_covered = SLOT_HEAD
item_flags = null
var/is_on_fire = FALSE
VAR_PRIVATE/_on_fire = FALSE

/obj/item/clothing/head/cakehat/equipped(mob/user, slot)
. = ..()
Expand All @@ -217,7 +217,7 @@
/obj/item/clothing/head/cakehat/on_update_icon(mob/user)
. = ..()
z_flags &= ~ZMM_MANGLE_PLANES
if(is_on_fire && check_state_in_icon("[icon_state]-flame", icon))
if(is_on_fire() && check_state_in_icon("[icon_state]-flame", icon))
if(plane == HUD_PLANE)
add_overlay("[icon_state]-flame")
else
Expand All @@ -230,7 +230,7 @@
return emissive_overlay(overlay.icon, "[overlay.icon_state]-flame")

/obj/item/clothing/head/cakehat/apply_additional_mob_overlays(mob/living/user_mob, bodytype, image/overlay, slot, bodypart, use_fallback_if_icon_missing = TRUE)
if(overlay && is_on_fire)
if(overlay && is_on_fire())
var/image/I = get_mob_flame_overlay(overlay, bodytype)
if(I)
overlay.overlays += I
Expand All @@ -241,7 +241,7 @@
return ..()

/obj/item/clothing/head/cakehat/Process()
if(!is_on_fire)
if(!is_on_fire())
STOP_PROCESSING(SSobj, src)
return
var/turf/location = loc
Expand All @@ -255,9 +255,9 @@
/obj/item/clothing/head/cakehat/attack_self(mob/user)
. = ..()
if(!.)
is_on_fire = !is_on_fire
_on_fire = !_on_fire
update_icon()
if(is_on_fire)
if(is_on_fire())
atom_damage_type = BURN
START_PROCESSING(SSobj, src)
else
Expand Down
4 changes: 2 additions & 2 deletions code/modules/clothing/masks/chewable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
/obj/item/clothing/mask/chewable/Process()
chew(1)
if(chewtime < 1)
extinguish()
extinguish_fire()

/obj/item/clothing/mask/chewable/tobacco
name = "wad"
Expand All @@ -72,7 +72,7 @@
desc = "A disgusting spitwad."
icon = 'icons/clothing/mask/chewables/chew_spit.dmi'

/obj/item/clothing/mask/chewable/proc/extinguish(var/mob/user, var/no_message)
/obj/item/clothing/mask/chewable/extinguish_fire(mob/user, no_message = FALSE)
STOP_PROCESSING(SSobj, src)
if(type_butt)
var/obj/item/trash/cigbutt/butt = new type_butt(get_turf(src))
Expand Down
Loading

0 comments on commit 694628f

Please sign in to comment.