Files
Leland KembleandGitHub b3c74dca2d Moves a plethora of things from attackby() to item_interaction() (#96726)
## About The Pull Request

50 files. Sorry about that, I was faster today. Just merge without
looking, it'll be fine.

This is the end of `/machinery/` & `/stack/` `attackby()`s(that aren't
actually meant for being attacked) when these are all merged.
Like, 200 left? I think? 

Also, this one will make light replacer reloading slightly more
difficult until whichever one converted the light replacer is merged.
If, for some ungodly reason, this one gets merged first.

Changes beyond conversion:

if a `/porta_turret_construct` somehow became anchored out of sync with
its construction steps, it's no longer softlocked
you can no longer place an infinite amount of blackboxes into the
blackbox recorder
a TTV will no longer keep its ghost on your back when you cut its wires
while wearing it
RCLs will properly update their appearance when initially given their
first coil
The creator of `robot_suit/attackby()` has been cursed to spend a
thousand years in the lake of fire

## Why It's Good For The Game

Now that all of these are remade, you can find bugs in them and then get
GBP for fixing them(not that my code would ever have bugs).

## Changelog
🆑

fix: It's no longer possible to softlock building a turret(if it ever
was)
fix: you can no longer stuff the blackbox recorder full with as many
blackboxes as you've somehow collected
fix: TTVs will no longer remain on your back as a ghost when you cut
their wire straps
fix: RCLs will now properly update their appearance when given their
first coil of cleaners
code: 50 files have been converted from attackby() to item_interaction()
/🆑
2026-07-02 06:10:46 +02:00

116 lines
3.9 KiB
Plaintext

/obj/effect/decal/cleanable/fuel_pool
name = "pool of fuel"
desc = "A pool of flammable fuel. Its probably wise to clean this off before something ignites it..."
icon_state = "fuel_pool"
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?
var/burning = FALSE
/// Type of hotspot fuel pool spawns upon being ignited
var/hotspot_type = /obj/effect/hotspot
/obj/effect/decal/cleanable/fuel_pool/Initialize(mapload, burn_stacks)
. = ..()
var/static/list/loc_connections = list(
COMSIG_TURF_MOVABLE_THROW_LANDED = PROC_REF(ignition_trigger),
COMSIG_ATOM_ENTERED = PROC_REF(on_entered)
)
AddElement(/datum/element/connect_loc, loc_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
pool.burn_amount = max(min(pool.burn_amount + burn_stacks, 10), 1)
return INITIALIZE_HINT_QDEL
if(burn_stacks)
burn_amount = max(min(burn_stacks, 10), 1)
return INITIALIZE_HINT_LATELOAD
// Just in case of fires, do this after mapload.
/obj/effect/decal/cleanable/fuel_pool/LateInitialize()
// We don't want to burn down the create_and_destroy test area
#ifndef UNIT_TESTS
RegisterSignal(src, COMSIG_ATOM_TOUCHED_SPARKS, PROC_REF(ignition_trigger))
#endif
/obj/effect/decal/cleanable/fuel_pool/fire_act(exposed_temperature, exposed_volume)
. = ..()
ignite()
/**
* Ignites the fuel pool. This should be the only way to ignite fuel pools.
*/
/obj/effect/decal/cleanable/fuel_pool/proc/ignite()
if(burning)
return
burning = TRUE
burn_process()
/**
* Spends 1 burn_amount and spawns a hotspot. If burn_amount is equal to 0, deletes the fuel pool.
* Else, queues another call of this proc upon hotspot getting deleted and ignites other fuel pools around itself after 0.5 seconds.
* THIS SHOULD NOT BE CALLED DIRECTLY.
*/
/obj/effect/decal/cleanable/fuel_pool/proc/burn_process()
SIGNAL_HANDLER
burn_amount -= 1
var/obj/effect/hotspot/hotspot = new hotspot_type(get_turf(src))
addtimer(CALLBACK(src, PROC_REF(ignite_others)), 0.5 SECONDS)
if(!burn_amount)
qdel(src)
return
RegisterSignal(hotspot, COMSIG_QDELETING, PROC_REF(burn_process))
/**
* Ignites other oil pools around itself.
*/
/obj/effect/decal/cleanable/fuel_pool/proc/ignite_others()
for(var/obj/effect/decal/cleanable/fuel_pool/oil in range(1, get_turf(src)))
oil.ignite()
/obj/effect/decal/cleanable/fuel_pool/bullet_act(obj/projectile/hit_proj)
. = ..()
if(hit_proj.damage > 0)
ignite()
log_combat(hit_proj.firer, src, "used [hit_proj] to ignite")
/obj/effect/decal/cleanable/fuel_pool/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(!tool.ignition_effect(src, user))
return ..()
ignite()
log_combat(user, src, "used [tool] to ignite")
return ITEM_INTERACT_SUCCESS
/obj/effect/decal/cleanable/fuel_pool/proc/on_entered(datum/source, atom/movable/entered_atom)
SIGNAL_HANDLER
if(!entered_atom.throwing) // don't light from things being thrown over us, we handle that somewhere else
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()
else if(istype(enflammable_atom, /obj/effect/particle_effect/sparks))
ignite()
/obj/effect/decal/cleanable/fuel_pool/hivis
icon_state = "fuel_pool_hivis"