mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
[MIRROR] Disables wrenching on money bot and scanner gate shells when they are locked (#8048)
* 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> * Disables wrenching on money bot and scanner gate shells when they are locked Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com>
This commit is contained in:
co-authored by
Watermelon914
Watermelon914
parent
b149784aaa
commit
1d86f54aad
@@ -100,10 +100,26 @@ GLOBAL_LIST_EMPTY_TYPED(integrated_circuits, /obj/item/integrated_circuit)
|
||||
else
|
||||
. += span_notice("There is no power cell installed.")
|
||||
|
||||
/**
|
||||
* Sets the cell of the integrated circuit.
|
||||
*
|
||||
* Arguments:
|
||||
* * cell_to_set - The new cell of the circuit. Can be null.
|
||||
**/
|
||||
/obj/item/integrated_circuit/proc/set_cell(obj/item/stock_parts/cell_to_set)
|
||||
SEND_SIGNAL(src, COMSIG_CIRCUIT_SET_CELL, cell_to_set)
|
||||
cell = cell_to_set
|
||||
|
||||
/**
|
||||
* Sets the locked status of the integrated circuit.
|
||||
*
|
||||
* Arguments:
|
||||
* * new_value - A boolean that determines if the circuit is locked or not.
|
||||
**/
|
||||
/obj/item/integrated_circuit/proc/set_locked(new_value)
|
||||
SEND_SIGNAL(src, COMSIG_CIRCUIT_SET_LOCKED, new_value)
|
||||
locked = new_value
|
||||
|
||||
/obj/item/integrated_circuit/attackby(obj/item/I, mob/living/user, params)
|
||||
. = ..()
|
||||
if(istype(I, /obj/item/circuit_component))
|
||||
@@ -170,6 +186,12 @@ GLOBAL_LIST_EMPTY_TYPED(integrated_circuits, /obj/item/integrated_circuit)
|
||||
set_on(FALSE)
|
||||
SEND_SIGNAL(src, COMSIG_CIRCUIT_SHELL_REMOVED)
|
||||
|
||||
/**
|
||||
* Sets the on status of the integrated circuit.
|
||||
*
|
||||
* Arguments:
|
||||
* * new_value - A boolean that determines if the circuit is on or not.
|
||||
**/
|
||||
/obj/item/integrated_circuit/proc/set_on(new_value)
|
||||
SEND_SIGNAL(src, COMSIG_CIRCUIT_SET_ON, new_value)
|
||||
on = new_value
|
||||
|
||||
@@ -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