Files
Paradise/code/modules/assembly/igniter.dm
warriorstar-orion 525c68d617 Attack chain, initial setup. (pull *immediately* for *any* TM issues) (#26834)
* refactor: Attack chain, initial setup.

* migrate curtain to make dreamchecker happy

* update thurible

* don't call attacked_by separately for legacy attack chain

* remove duplicate proc

* condense similar code, put allowances for legacy code in new procs

* update docs, include diagram source

* add comment on how to update diagram

* fix admonition

* mindflayer updates

* remove commented out code

* clarify all steps

* after_attack should be overridable

* whoops

* retrofit recent changes

* duh, can't restrict this yet because of tool_acts

* i hate ore bags with the fire of a thousand suns

* return correct value for object attack logic

* Various cleanups.

We don't want to attempt to pull stuff out of `/obj/item/attackby`,
because those pieces are part of the related objects' migrations, not
`/obj/item` itself. Attempting to do this causes knockon effects where
things expected to call e.g. `/obj/item/storage/attackby` in the call
chain were not ferried over to the new item interaction code, because
the related objects hadn't actually been migrated over yet.

I've used refactoring /obj/vehicle as the example for migrating
`attackby` methods instead.

* simplify some argument names

* fuck it

* make it do the thing

* Rename CI module call

* Prove that CI works

* improve test output

* aaand fix it again

* fix curtain tool interactions

* fix compile error

* fix compile error

* Better docs, introduce migration plan tool.
2024-12-02 23:36:36 +00:00

92 lines
3.0 KiB
Plaintext

/obj/item/assembly/igniter
name = "igniter"
desc = "A small electronic device able to ignite combustible substances."
icon_state = "igniter"
materials = list(MAT_METAL=500, MAT_GLASS=50)
origin_tech = "magnets=1"
var/datum/effect_system/spark_spread/sparks
/obj/item/assembly/igniter/Initialize(mapload)
. = ..()
sparks = new /datum/effect_system/spark_spread
sparks.set_up(2, 0, src)
sparks.attach(src)
/obj/item/assembly/igniter/Destroy()
QDEL_NULL(sparks)
return ..()
/obj/item/assembly/igniter/examine(mob/user)
. = ..()
. += "The igniter is [secured ? "secured." : "unsecured."]"
/obj/item/assembly/igniter/activate()
if(!..())
return FALSE //Cooldown check
var/turf/location = get_turf(loc)
if(location)
location.hotspot_expose(1000, 1000)
visible_message(
"<span class='notice'>Sparks shoot out of [src].</span>",
"<span class='warning'>You hear a shower of sparks shooting out from something!</span>"
)
sparks.start()
if(istype(loc, /obj/item/assembly_holder))
var/locloc = loc.loc
if(istype(locloc, /obj/structure/reagent_dispensers/fueltank))
var/obj/structure/reagent_dispensers/fueltank/tank = locloc
if(tank)
tank.boom(TRUE) // this qdel's `src`
if(istype(locloc, /obj/item/onetankbomb))
var/obj/item/onetankbomb/bomb = locloc
if(bomb?.bombtank)
bomb.bombtank.detonate()
else if(istype(locloc, /obj/item/reagent_containers/glass/beaker))
var/obj/item/reagent_containers/glass/beaker/beakerbomb = locloc
if(beakerbomb)
beakerbomb.heat_beaker()
else if(istype(locloc, /obj/item/grenade/chem_grenade))
var/obj/item/grenade/chem_grenade/CG = locloc
CG.prime()
return TRUE
/obj/item/assembly/igniter/attack__legacy__attackchain(mob/living/target, mob/living/user)
if(!cigarette_lighter_act(user, target))
return ..()
/obj/item/assembly/igniter/cigarette_lighter_act(mob/living/user, mob/living/target, obj/item/direct_attackby_item)
var/obj/item/clothing/mask/cigarette/cig = ..()
if(!cig)
return !isnull(cig)
if(target == user)
user.visible_message(
"<span class='notice'>[user] presses [src] against [cig] and activates it, lighting [cig] in a shower of sparks!</span>",
"<span class='notice'>You press [src] against [cig] and activates it, lighting [cig] in a shower of sparks!</span>",
"<span class='warning'>You hear a shower of sparks shooting out from something!</span>"
)
else
user.visible_message(
"<span class='notice'>[user] presses [src] against [cig] and activates it, lighting [cig] for [target] in a shower of sparks!</span>",
"<span class='notice'>You press [src] against [cig] and activate it, lighting [cig] in a shower of sparks!</span>",
"<span class='warning'>You hear a shower of sparks shooting out from something!</span>"
)
sparks.start() // Make sparks fly!
cig.light(user, target)
return TRUE
/obj/item/assembly/igniter/attack_self__legacy__attackchain(mob/user)
if(!istype(loc, /obj/item/assembly_holder))
activate()
add_fingerprint(user)
/obj/item/assembly/igniter/get_heat()
return 2000