From 6f1af6c9be300f3cd42def54aeb0ee4ebb7beff7 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Tue, 15 Jun 2021 21:36:18 +0200 Subject: [PATCH] [MIRROR] Fixed RAM component retaining its type after the input port is cleared (#6328) * Fixed RAM component retaining its type after the input port is cleared (#59592) Allows people to input types, such as strings, entities or numbers with the Stored Value type retaining its last input type, which can result in bugs. * Fixed RAM component retaining its type after the input port is cleared Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> --- code/modules/wiremod/component.dm | 3 +++ code/modules/wiremod/port.dm | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/code/modules/wiremod/component.dm b/code/modules/wiremod/component.dm index 4d3c57c9877..d0446c69323 100644 --- a/code/modules/wiremod/component.dm +++ b/code/modules/wiremod/component.dm @@ -135,6 +135,9 @@ if(connected_port.datatype != output_port.datatype) output_port.set_datatype(connected_port.datatype) return TRUE + else + output_port.set_datatype(output_port.default_datatype) + return TRUE return FALSE diff --git a/code/modules/wiremod/port.dm b/code/modules/wiremod/port.dm index b0df9411b52..84f98d57445 100644 --- a/code/modules/wiremod/port.dm +++ b/code/modules/wiremod/port.dm @@ -15,6 +15,9 @@ /// The port type. Ports can only connect to each other if the type matches var/datatype + /// The default port type. Stores the original datatype of the port set on Initialize. + var/default_datatype + /// The port color. If unset, appears as blue. var/color @@ -28,6 +31,7 @@ src.connected_component = to_connect src.name = name src.datatype = datatype + src.default_datatype = datatype src.color = datatype_to_color()