mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 14:39:58 +01:00
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. /🆑
This commit is contained in:
@@ -1,9 +1,3 @@
|
||||
#define WIRE_RECEIVE (1<<0)
|
||||
#define WIRE_PULSE (1<<1)
|
||||
#define WIRE_PULSE_SPECIAL (1<<2)
|
||||
#define WIRE_RADIO_RECEIVE (1<<3)
|
||||
#define WIRE_RADIO_PULSE (1<<4)
|
||||
#define ASSEMBLY_BEEP_VOLUME 5
|
||||
|
||||
/obj/item/assembly
|
||||
name = "assembly"
|
||||
@@ -24,10 +18,11 @@
|
||||
* This will prevent things such as visible lasers from facing the incorrect direction when transformed by assembly_holder's update_appearance()
|
||||
*/
|
||||
var/is_position_sensitive = FALSE
|
||||
/// Flags related to this assembly. See [assemblies.dm]
|
||||
var/assembly_flags = NONE
|
||||
var/secured = TRUE
|
||||
var/list/attached_overlays = null
|
||||
var/obj/item/assembly_holder/holder = null
|
||||
var/wire_type = WIRE_RECEIVE | WIRE_PULSE
|
||||
var/attachable = FALSE // can this be attached to wires
|
||||
var/datum/wires/connected = null
|
||||
var/next_activate = 0 //When we're next allowed to activate - for spam control
|
||||
@@ -75,24 +70,26 @@
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
///Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs
|
||||
/obj/item/assembly/proc/pulsed(radio = FALSE, mob/pulser)
|
||||
if(wire_type & WIRE_RECEIVE)
|
||||
INVOKE_ASYNC(src, PROC_REF(activate), pulser)
|
||||
if(radio && (wire_type & WIRE_RADIO_RECEIVE))
|
||||
INVOKE_ASYNC(src, PROC_REF(activate), pulser)
|
||||
/**
|
||||
* Pulsed: This device was pulsed by another device
|
||||
*
|
||||
* * pulser: Who triggered the pulse
|
||||
*/
|
||||
/obj/item/assembly/proc/pulsed(mob/pulser)
|
||||
INVOKE_ASYNC(src, PROC_REF(activate), pulser)
|
||||
SEND_SIGNAL(src, COMSIG_ASSEMBLY_PULSED)
|
||||
return TRUE
|
||||
|
||||
///Called when this device attempts to act on another device, var/radio determines if it was sent via radio or direct
|
||||
/obj/item/assembly/proc/pulse(radio = FALSE)
|
||||
if(connected && wire_type)
|
||||
/**
|
||||
* Pulse: This device is emitting a pulse to act on another device
|
||||
*/
|
||||
/obj/item/assembly/proc/pulse()
|
||||
// if we have connected wires and are a pulsing assembly, pulse it
|
||||
if(connected)
|
||||
connected.pulse_assembly(src)
|
||||
return TRUE
|
||||
if(holder && (wire_type & WIRE_PULSE))
|
||||
holder.process_activation(src, 1, 0)
|
||||
if(holder && (wire_type & WIRE_PULSE_SPECIAL))
|
||||
holder.process_activation(src, 0, 1)
|
||||
// otherwise if we're attached to a holder, process the activation of it with our flags
|
||||
else if(holder)
|
||||
holder.process_activation(src)
|
||||
return TRUE
|
||||
|
||||
/// What the device does when turned on
|
||||
@@ -116,21 +113,29 @@
|
||||
return
|
||||
. = ..()
|
||||
|
||||
/obj/item/assembly/attackby(obj/item/W, mob/user, params)
|
||||
if(isassembly(W))
|
||||
var/obj/item/assembly/A = W
|
||||
if((!A.secured) && (!secured))
|
||||
holder = new/obj/item/assembly_holder(get_turf(src))
|
||||
holder.assemble(src,A,user)
|
||||
to_chat(user, span_notice("You attach and secure \the [A] to \the [src]!"))
|
||||
else
|
||||
to_chat(user, span_warning("Both devices must be in attachable mode to be attached together."))
|
||||
/obj/item/assembly/attackby(obj/item/attacking_item, mob/user, params)
|
||||
if(isassembly(attacking_item))
|
||||
var/obj/item/assembly/new_assembly = attacking_item
|
||||
// Check both our's and their's assembly flags to see if either should not duplicate
|
||||
// If so, and we match types, don't create a holder - block it
|
||||
if(((new_assembly.assembly_flags|assembly_flags) & ASSEMBLY_NO_DUPLICATES) && istype(new_assembly, type))
|
||||
balloon_alert(user, "can't attach another of that!")
|
||||
return
|
||||
if(new_assembly.secured || secured)
|
||||
balloon_alert(user, "both devices not attachable!")
|
||||
return
|
||||
|
||||
holder = new /obj/item/assembly_holder(drop_location())
|
||||
holder.assemble(src, new_assembly, user)
|
||||
holder.balloon_alert(user, "parts combined")
|
||||
return
|
||||
if(istype(W, /obj/item/assembly_holder))
|
||||
if(!secured)
|
||||
var/obj/item/assembly_holder/added_to_holder = W
|
||||
added_to_holder.add_assembly(src, user)
|
||||
..()
|
||||
|
||||
if(istype(attacking_item, /obj/item/assembly_holder))
|
||||
var/obj/item/assembly_holder/added_to_holder = attacking_item
|
||||
added_to_holder.try_add_assembly(src, user)
|
||||
return
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/screwdriver_act(mob/living/user, obj/item/I)
|
||||
if(..())
|
||||
|
||||
Reference in New Issue
Block a user