mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 06:29:23 +01:00
Refactors how components are triggered and refactors how ports are ordered (#60934)
Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
This commit is contained in:
co-authored by
Watermelon914
parent
a9cc1bc816
commit
126411f405
@@ -64,8 +64,7 @@
|
||||
/// Called when the airlock is unbolted
|
||||
var/datum/port/output/unbolted
|
||||
|
||||
/obj/item/circuit_component/airlock/Initialize()
|
||||
. = ..()
|
||||
/obj/item/circuit_component/airlock/populate_ports()
|
||||
// Input Signals
|
||||
bolt = add_input_port("Bolt", PORT_TYPE_SIGNAL)
|
||||
unbolt = add_input_port("Unbolt", PORT_TYPE_SIGNAL)
|
||||
@@ -116,9 +115,6 @@
|
||||
closed.set_output(COMPONENT_SIGNAL)
|
||||
|
||||
/obj/item/circuit_component/airlock/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
if(!attached_airlock)
|
||||
return
|
||||
|
||||
@@ -30,8 +30,7 @@
|
||||
/// The user who used the bot
|
||||
var/datum/port/output/entity
|
||||
|
||||
/obj/item/circuit_component/bot/Initialize()
|
||||
. = ..()
|
||||
/obj/item/circuit_component/bot/populate_ports()
|
||||
entity = add_output_port("User", PORT_TYPE_ATOM)
|
||||
signal = add_output_port("Signal", PORT_TYPE_SIGNAL)
|
||||
|
||||
|
||||
@@ -119,11 +119,6 @@
|
||||
QDEL_NULL(bci_action)
|
||||
|
||||
/obj/item/circuit_component/bci_action/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
|
||||
if (.)
|
||||
return
|
||||
|
||||
if (!isnull(bci_action))
|
||||
update_action()
|
||||
|
||||
@@ -167,8 +162,7 @@
|
||||
|
||||
var/datum/weakref/user
|
||||
|
||||
/obj/item/circuit_component/bci_core/Initialize()
|
||||
. = ..()
|
||||
/obj/item/circuit_component/bci_core/populate_ports()
|
||||
|
||||
message = add_input_port("Message", PORT_TYPE_STRING)
|
||||
send_message_signal = add_input_port("Send Message", PORT_TYPE_SIGNAL)
|
||||
@@ -199,24 +193,24 @@
|
||||
COMSIG_ORGAN_REMOVED,
|
||||
))
|
||||
|
||||
/obj/item/circuit_component/bci_core/should_receive_input(datum/port/input/port)
|
||||
if (!COMPONENT_TRIGGERED_BY(send_message_signal, port))
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/obj/item/circuit_component/bci_core/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
if (.)
|
||||
return .
|
||||
var/sent_message = trim(message.value)
|
||||
if (!sent_message)
|
||||
return
|
||||
|
||||
if (COMPONENT_TRIGGERED_BY(send_message_signal, port))
|
||||
var/sent_message = trim(message.value)
|
||||
if (!sent_message)
|
||||
return
|
||||
var/mob/living/carbon/resolved_owner = user?.resolve()
|
||||
if (isnull(resolved_owner))
|
||||
return
|
||||
|
||||
var/mob/living/carbon/resolved_owner = user?.resolve()
|
||||
if (isnull(resolved_owner))
|
||||
return
|
||||
if (resolved_owner.stat == DEAD)
|
||||
return
|
||||
|
||||
if (resolved_owner.stat == DEAD)
|
||||
return
|
||||
|
||||
to_chat(resolved_owner, "<i>You hear a strange, robotic voice in your head...</i> \"[span_robot("[html_encode(sent_message)]")]\"")
|
||||
to_chat(resolved_owner, "<i>You hear a strange, robotic voice in your head...</i> \"[span_robot("[html_encode(sent_message)]")]\"")
|
||||
|
||||
/obj/item/circuit_component/bci_core/proc/on_organ_implanted(datum/source, mob/living/carbon/owner)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
/// The user who used the bot
|
||||
var/datum/port/output/entity
|
||||
|
||||
/obj/item/circuit_component/compact_remote/Initialize()
|
||||
. = ..()
|
||||
/obj/item/circuit_component/compact_remote/populate_ports()
|
||||
entity = add_output_port("User", PORT_TYPE_ATOM)
|
||||
signal = add_output_port("Signal", PORT_TYPE_SIGNAL)
|
||||
|
||||
|
||||
@@ -33,8 +33,7 @@
|
||||
/// The entity output
|
||||
var/datum/port/output/entity
|
||||
|
||||
/obj/item/circuit_component/controller/Initialize()
|
||||
. = ..()
|
||||
/obj/item/circuit_component/controller/populate_ports()
|
||||
entity = add_output_port("User", PORT_TYPE_ATOM)
|
||||
signal = add_output_port("Signal", PORT_TYPE_SIGNAL)
|
||||
alt = add_output_port("Alternate Signal", PORT_TYPE_SIGNAL)
|
||||
|
||||
@@ -44,17 +44,13 @@
|
||||
/// Delay between each movement
|
||||
var/move_delay = 0.2 SECONDS
|
||||
|
||||
/obj/item/circuit_component/bot_circuit/Initialize()
|
||||
. = ..()
|
||||
/obj/item/circuit_component/bot_circuit/populate_ports()
|
||||
north = add_input_port("Move North", PORT_TYPE_SIGNAL)
|
||||
east = add_input_port("Move East", PORT_TYPE_SIGNAL)
|
||||
south = add_input_port("Move South", PORT_TYPE_SIGNAL)
|
||||
west = add_input_port("Move West", PORT_TYPE_SIGNAL)
|
||||
|
||||
/obj/item/circuit_component/bot_circuit/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/mob/living/shell = parent.shell
|
||||
if(!istype(shell) || shell.stat)
|
||||
|
||||
@@ -49,8 +49,7 @@
|
||||
|
||||
var/obj/structure/money_bot/attached_bot
|
||||
|
||||
/obj/item/circuit_component/money_dispenser/Initialize()
|
||||
. = ..()
|
||||
/obj/item/circuit_component/money_dispenser/populate_ports()
|
||||
dispense_amount = add_input_port("Amount", PORT_TYPE_NUMBER)
|
||||
on_fail = add_output_port("On Failed", PORT_TYPE_SIGNAL)
|
||||
|
||||
@@ -64,9 +63,6 @@
|
||||
return ..()
|
||||
|
||||
/obj/item/circuit_component/money_dispenser/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
if(!attached_bot)
|
||||
return
|
||||
@@ -93,8 +89,7 @@
|
||||
/// The person who input the money
|
||||
var/datum/port/output/entity
|
||||
|
||||
/obj/item/circuit_component/money_bot/Initialize()
|
||||
. = ..()
|
||||
/obj/item/circuit_component/money_bot/populate_ports()
|
||||
total_money = add_output_port("Total Money", PORT_TYPE_NUMBER)
|
||||
money_input = add_output_port("Last Input Money", PORT_TYPE_NUMBER)
|
||||
entity = add_output_port("User", PORT_TYPE_ATOM)
|
||||
|
||||
@@ -35,8 +35,7 @@
|
||||
|
||||
|
||||
|
||||
/obj/item/circuit_component/wiremod_scanner/Initialize()
|
||||
. = ..()
|
||||
/obj/item/circuit_component/wiremod_scanner/populate_ports()
|
||||
attacker = add_output_port("Scanner", PORT_TYPE_ATOM)
|
||||
attacking = add_output_port("Scanned Entity", PORT_TYPE_ATOM)
|
||||
signal = add_output_port("Scanned", PORT_TYPE_SIGNAL)
|
||||
|
||||
@@ -45,8 +45,7 @@
|
||||
|
||||
var/obj/structure/scanner_gate_shell/attached_gate
|
||||
|
||||
/obj/item/circuit_component/scanner_gate/Initialize()
|
||||
. = ..()
|
||||
/obj/item/circuit_component/scanner_gate/populate_ports()
|
||||
scanned = add_output_port("Scanned Object", PORT_TYPE_ATOM)
|
||||
|
||||
/obj/item/circuit_component/scanner_gate/register_shell(atom/movable/shell)
|
||||
|
||||
Reference in New Issue
Block a user