Files
Bubberstation/code/modules/assembly/igniter.dm
SkyratBot c4afb8a473 [MIRROR] Fixes an exploit with stacking igniters. Refactors some assembly flag oddities. Limits assembly holders at 12 assemblies. [MDB IGNORE] (#17689)
* Fixes an exploit with stacking igniters. Refactors some assembly flag oddities. Limits assembly holders at 12 assemblies.  (#71264)

## About The Pull Request

Soft revert of #71224 , Fixes #71222

Fixes an exploit involving attachment of multiple igniters to one
assembly.
- Multiple igniters or condensers can no longer be attached to the same
assembly holder
- Assembly holders have a limit of 12 assemblies maximum
- I'm not sure if this is too low or limited, I picked it arbitrarily.
Please inform me if it could be upped a smidge.
- This lag exploit was born because of limitless assembly holders, which
is a little silly even with the exploit aside. All that uncapped holders
can bring are exploits or bugs, which I feel confident limited can
prevent. What use is there even for having so many?
- Cleans up / refactors some aspects of assemblies and assembly holders.
- Assemblies had a weird wire type flag that was only ever used by
signallers, but also used wrong by signallers. I did some scanning of
the code and realized that ... a lot of this was just straight up
unused, and not even assigned anywhere.
- Now, there is a flag assembly flag var, which everything is read off
of. Tested it and still seemed to all work fine.

## Why It's Good For The Game

Lag exploits are bad.

## Changelog

🆑 Melbert
fix: Fixed an exploit involving igniters attached to themselves.
Assembly holders are now limited to 12 assemblies maximum, and you
cannot attach multiple igniters to the same assembly.
refactor: Refactored some assembly jank, namely in how they pulse and
are pulsed.
/🆑

* Fixes an exploit with stacking igniters. Refactors some assembly flag oddities. Limits assembly holders at 12 assemblies.

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
2022-11-24 14:34:57 -05:00

78 lines
2.2 KiB
Plaintext

#define EXPOSED_VOLUME 1000
#define ROOM_TEMP 293
#define MIN_FREEZE_TEMP 50
#define MAX_FREEZE_TEMP 1000000
/obj/item/assembly/igniter
name = "igniter"
desc = "A small electronic device able to ignite combustible substances."
icon_state = "igniter"
custom_materials = list(/datum/material/iron=500, /datum/material/glass=50)
var/datum/effect_system/spark_spread/sparks
heat = 1000
drop_sound = 'sound/items/handling/component_drop.ogg'
pickup_sound = 'sound/items/handling/component_pickup.ogg'
assembly_flags = ASSEMBLY_NO_DUPLICATES
/obj/item/assembly/igniter/suicide_act(mob/living/carbon/user)
user.visible_message(span_suicide("[user] is trying to ignite [user.p_them()]self with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
user.ignite_mob()
return FIRELOSS
/obj/item/assembly/igniter/Initialize(mapload)
. = ..()
sparks = new
sparks.set_up(2, 0, src)
sparks.attach(src)
/obj/item/assembly/igniter/Destroy()
if(sparks)
qdel(sparks)
sparks = null
. = ..()
/obj/item/assembly/igniter/activate()
if(!..())
return FALSE//Cooldown check
var/turf/location = get_turf(loc)
if(location)
location.hotspot_expose(heat, EXPOSED_VOLUME)
if(holder)
SEND_SIGNAL(holder.loc, COMSIG_IGNITER_ACTIVATE)
if(QDELETED(src))
return TRUE
sparks.start()
return TRUE
/obj/item/assembly/igniter/attack_self(mob/user)
activate()
add_fingerprint(user)
/obj/item/assembly/igniter/ignition_effect(atom/A, mob/user)
. = span_notice("[user] fiddles with [src], and manages to light [A].")
activate()
add_fingerprint(user)
//For the Condenser, which functions like the igniter but makes things colder.
/obj/item/assembly/igniter/condenser
name = "condenser"
desc = "A small electronic device able to chill their surroundings."
icon_state = "freezer"
custom_materials = list(/datum/material/iron=250, /datum/material/glass=300)
heat = 200
/obj/item/assembly/igniter/condenser/activate()
. = ..()
if(!.)
return //Cooldown check
var/turf/location = get_turf(loc)
if(location)
var/datum/gas_mixture/enviro = location.return_air()
enviro.temperature = clamp(min(ROOM_TEMP, enviro.temperature*0.85),MIN_FREEZE_TEMP,MAX_FREEZE_TEMP)
sparks.start()
#undef EXPOSED_VOLUME
#undef ROOM_TEMP
#undef MIN_FREEZE_TEMP
#undef MAX_FREEZE_TEMP