mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 14:39:58 +01:00
Fixed being able to insert infinitely many components into a shell. Fixes being able to view the shell's circuit in a locked shell. (#59962)
This commit is contained in:
@@ -101,12 +101,12 @@
|
||||
return
|
||||
|
||||
if(attached_circuit?.owner_id && item == attached_circuit.owner_id.resolve())
|
||||
locked = !locked
|
||||
set_locked(!locked)
|
||||
source.balloon_alert(attacker, "[locked? "locked" : "unlocked"] [source]")
|
||||
return COMPONENT_NO_AFTERATTACK
|
||||
|
||||
if(attached_circuit && istype(item, /obj/item/circuit_component))
|
||||
attached_circuit.add_component(item, attacker)
|
||||
attached_circuit.add_component_manually(item, attacker)
|
||||
return
|
||||
|
||||
if(!istype(item, /obj/item/integrated_circuit))
|
||||
@@ -128,6 +128,12 @@
|
||||
logic_board.inserter_mind = WEAKREF(attacker.mind)
|
||||
attach_circuit(logic_board, attacker)
|
||||
|
||||
/// Sets whether the shell is locked or not
|
||||
/datum/component/shell/proc/set_locked(new_value)
|
||||
locked = new_value
|
||||
attached_circuit?.locked = locked
|
||||
|
||||
|
||||
/datum/component/shell/proc/on_multitool_act(atom/source, mob/user, obj/item/tool)
|
||||
SIGNAL_HANDLER
|
||||
if(!attached_circuit)
|
||||
@@ -201,6 +207,7 @@
|
||||
attached_circuit.add_component(to_add)
|
||||
RegisterSignal(circuitboard, COMSIG_CIRCUIT_ADD_COMPONENT_MANUALLY, .proc/on_circuit_add_component_manually)
|
||||
attached_circuit.set_shell(parent)
|
||||
attached_circuit.locked = FALSE
|
||||
|
||||
if(shell_flags & SHELL_FLAG_REQUIRE_ANCHOR)
|
||||
var/atom/movable/parent_atom = parent
|
||||
@@ -224,6 +231,7 @@
|
||||
for(var/obj/item/circuit_component/to_remove as anything in unremovable_circuit_components)
|
||||
attached_circuit.remove_component(to_remove)
|
||||
to_remove.moveToNullspace()
|
||||
attached_circuit.locked = FALSE
|
||||
attached_circuit = null
|
||||
|
||||
/datum/component/shell/proc/on_atom_usb_cable_try_attach(atom/source, obj/item/usb_cable/usb_cable, mob/user)
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
/// Whether the integrated circuit is on or not. Handled by the shell.
|
||||
var/on = FALSE
|
||||
|
||||
/// Whether the integrated circuit is locked or not. Handled by the shell.
|
||||
var/locked = FALSE
|
||||
|
||||
/// The ID that is authorized to unlock/lock the shell so that the circuit can/cannot be removed.
|
||||
var/datum/weakref/owner_id
|
||||
|
||||
@@ -262,6 +265,11 @@
|
||||
return shell
|
||||
return ..()
|
||||
|
||||
/obj/item/integrated_circuit/can_interact(mob/user)
|
||||
if(locked)
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/obj/item/integrated_circuit/ui_state(mob/user)
|
||||
if(!shell)
|
||||
return GLOB.hands_state
|
||||
|
||||
Reference in New Issue
Block a user