mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-14 03:32:00 +00:00
## 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. /🆑
68 lines
2.3 KiB
Plaintext
68 lines
2.3 KiB
Plaintext
/**
|
|
* # Assembly Shell
|
|
*
|
|
* An assembly that triggers and can be triggered by wires.
|
|
*/
|
|
/obj/item/assembly/wiremod
|
|
name = "circuit assembly"
|
|
desc = "A small electronic device that can house an integrated circuit."
|
|
icon_state = "wiremod"
|
|
attachable = TRUE
|
|
|
|
/obj/item/assembly/wiremod/Initialize(mapload)
|
|
. = ..()
|
|
AddComponent(/datum/component/shell, list(
|
|
new /obj/item/circuit_component/assembly_input(),
|
|
new /obj/item/circuit_component/assembly_output(),
|
|
), SHELL_CAPACITY_SMALL)
|
|
|
|
/obj/item/assembly/wiremod/examine(mob/user)
|
|
. = ..()
|
|
. += span_notice("You can also [secured && "un"]secure [src] by right-clicking it with a screwdriver, even if an integrated circuit is attached.")
|
|
|
|
// This is to bypass removing the circuit with a screwdriver left-click
|
|
/obj/item/assembly/wiremod/screwdriver_act_secondary(mob/living/user, obj/item/tool)
|
|
screwdriver_act(user, tool)
|
|
|
|
/obj/item/circuit_component/assembly_input
|
|
display_name = "Assembly Input"
|
|
desc = "Triggers when pulsed by an attached wire or assembly."
|
|
|
|
var/datum/port/output/signal
|
|
|
|
/obj/item/circuit_component/assembly_input/populate_ports()
|
|
signal = add_output_port("Signal", PORT_TYPE_SIGNAL)
|
|
|
|
/obj/item/circuit_component/assembly_input/register_shell(atom/movable/shell)
|
|
RegisterSignals(shell, list(COMSIG_ASSEMBLY_PULSED, COMSIG_ITEM_ATTACK_SELF), PROC_REF(on_pulsed))
|
|
|
|
/obj/item/circuit_component/assembly_input/unregister_shell(atom/movable/shell)
|
|
UnregisterSignal(shell, list(COMSIG_ASSEMBLY_PULSED, COMSIG_ITEM_ATTACK_SELF))
|
|
|
|
/obj/item/circuit_component/assembly_input/proc/on_pulsed(datum/source, mob/pulser)
|
|
SIGNAL_HANDLER
|
|
signal.set_output(COMPONENT_SIGNAL)
|
|
|
|
/obj/item/circuit_component/assembly_output
|
|
display_name = "Assembly Output"
|
|
desc = "Pulses an attached wire or assembly when triggered."
|
|
|
|
var/obj/item/assembly/attached_assembly
|
|
|
|
var/datum/port/input/signal
|
|
|
|
/obj/item/circuit_component/assembly_output/populate_ports()
|
|
signal = add_input_port("Signal", PORT_TYPE_SIGNAL)
|
|
|
|
/obj/item/circuit_component/assembly_output/register_shell(atom/movable/shell)
|
|
. = ..()
|
|
if(isassembly(shell))
|
|
attached_assembly = shell
|
|
|
|
/obj/item/circuit_component/assembly_output/unregister_shell(atom/movable/shell)
|
|
attached_assembly = null
|
|
return ..()
|
|
|
|
/obj/item/circuit_component/assembly_output/input_received(datum/port/input/port, list/return_values)
|
|
attached_assembly.pulse()
|