mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-15 18:14:22 +01:00
Disables wrenching on money bot and scanner gate shells when they are locked (#61274)
* Tweaks to wrenching * Addresses comments Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
light_on = FALSE
|
||||
|
||||
var/stored_money = 0
|
||||
var/locked = FALSE
|
||||
|
||||
/obj/structure/money_bot/deconstruct(disassembled)
|
||||
new /obj/item/holochip(drop_location(), stored_money)
|
||||
@@ -30,6 +31,8 @@
|
||||
), SHELL_CAPACITY_LARGE)
|
||||
|
||||
/obj/structure/money_bot/wrench_act(mob/living/user, obj/item/tool)
|
||||
if(locked)
|
||||
return
|
||||
set_anchored(!anchored)
|
||||
tool.play_tool_sound(src)
|
||||
balloon_alert(user, "You [anchored?"secure":"unsecure"] [src].")
|
||||
@@ -102,6 +105,8 @@
|
||||
total_money.set_output(attached_bot.stored_money)
|
||||
RegisterSignal(shell, COMSIG_PARENT_ATTACKBY, .proc/handle_money_insert)
|
||||
RegisterSignal(shell, COMSIG_MONEYBOT_ADD_MONEY, .proc/handle_money_update)
|
||||
RegisterSignal(parent, COMSIG_CIRCUIT_SET_LOCKED, .proc/on_set_locked)
|
||||
attached_bot.locked = parent.locked
|
||||
|
||||
/obj/item/circuit_component/money_bot/unregister_shell(atom/movable/shell)
|
||||
UnregisterSignal(shell, list(
|
||||
@@ -109,6 +114,9 @@
|
||||
COMSIG_MONEYBOT_ADD_MONEY,
|
||||
))
|
||||
total_money.set_output(null)
|
||||
if(attached_bot)
|
||||
attached_bot.locked = FALSE
|
||||
UnregisterSignal(parent, COMSIG_CIRCUIT_SET_LOCKED)
|
||||
attached_bot = null
|
||||
return ..()
|
||||
|
||||
@@ -133,3 +141,12 @@
|
||||
SIGNAL_HANDLER
|
||||
if(attached_bot)
|
||||
total_money.set_output(attached_bot.stored_money)
|
||||
|
||||
/**
|
||||
* Locks the attached bot when the circuit is locked.
|
||||
*
|
||||
* Arguments:
|
||||
* * new_value - A boolean that determines if the circuit is locked or not.
|
||||
**/
|
||||
/obj/item/circuit_component/money_bot/proc/on_set_locked(datum/source, new_value)
|
||||
attached_bot.locked = new_value
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
icon_state = "scangate_black"
|
||||
var/scanline_timer
|
||||
|
||||
var/locked = FALSE
|
||||
|
||||
/obj/structure/scanner_gate_shell/Initialize()
|
||||
. = ..()
|
||||
set_scanline("passive")
|
||||
@@ -18,6 +20,8 @@
|
||||
), SHELL_CAPACITY_LARGE, SHELL_FLAG_REQUIRE_ANCHOR)
|
||||
|
||||
/obj/structure/scanner_gate_shell/wrench_act(mob/living/user, obj/item/tool)
|
||||
if(locked)
|
||||
return
|
||||
set_anchored(!anchored)
|
||||
tool.play_tool_sound(src)
|
||||
balloon_alert(user, "You [anchored?"secure":"unsecure"] [src].")
|
||||
@@ -53,9 +57,14 @@
|
||||
if(istype(shell, /obj/structure/scanner_gate_shell))
|
||||
attached_gate = shell
|
||||
RegisterSignal(attached_gate, COMSIG_SCANGATE_SHELL_PASS, .proc/on_trigger)
|
||||
RegisterSignal(parent, COMSIG_CIRCUIT_SET_LOCKED, .proc/on_set_locked)
|
||||
attached_gate.locked = parent.locked
|
||||
|
||||
/obj/item/circuit_component/scanner_gate/unregister_shell(atom/movable/shell)
|
||||
UnregisterSignal(attached_gate, COMSIG_SCANGATE_SHELL_PASS)
|
||||
if(attached_gate)
|
||||
attached_gate.locked = FALSE
|
||||
UnregisterSignal(parent, COMSIG_CIRCUIT_SET_LOCKED)
|
||||
attached_gate = null
|
||||
return ..()
|
||||
|
||||
@@ -63,3 +72,12 @@
|
||||
SIGNAL_HANDLER
|
||||
scanned.set_output(passed)
|
||||
trigger_output.set_output(COMPONENT_SIGNAL)
|
||||
|
||||
/**
|
||||
* Locks the attached bot when the circuit is locked.
|
||||
*
|
||||
* Arguments:
|
||||
* * new_value - A boolean that determines if the circuit is locked or not.
|
||||
**/
|
||||
/obj/item/circuit_component/scanner_gate/proc/on_set_locked(datum/source, new_value)
|
||||
attached_gate.locked = new_value
|
||||
|
||||
Reference in New Issue
Block a user