mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-31 09:08:30 +01:00
[MIRROR] Adds basic list manipulation and fixes some performance issues with lists in integrated circuits [MDB IGNORE] (#11273)
* Adds basic list manipulation and fixes some performance issues with lists in integrated circuits (#64541) Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com> * Adds basic list manipulation and fixes some performance issues with lists in integrated circuits 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
917f088914
commit
4f58adba08
@@ -13,12 +13,17 @@
|
||||
var/datum/circuit_variable/current_variable
|
||||
circuit_size = 0
|
||||
|
||||
var/should_listen = FALSE
|
||||
|
||||
/obj/item/circuit_component/variable/populate_options()
|
||||
variable_name = add_option_port("Variable", null)
|
||||
|
||||
/obj/item/circuit_component/variable/add_to(obj/item/integrated_circuit/added_to)
|
||||
. = ..()
|
||||
variable_name.possible_options = added_to.circuit_variables
|
||||
variable_name.possible_options = get_variable_list(added_to)
|
||||
|
||||
/obj/item/circuit_component/variable/proc/get_variable_list(obj/item/integrated_circuit/integrated_circuit)
|
||||
return integrated_circuit.circuit_variables
|
||||
|
||||
/obj/item/circuit_component/variable/removed_from(obj/item/integrated_circuit/removed_from)
|
||||
variable_name.possible_options = null
|
||||
@@ -43,7 +48,8 @@
|
||||
/obj/item/circuit_component/variable/proc/remove_current_variable()
|
||||
SIGNAL_HANDLER
|
||||
if(current_variable)
|
||||
current_variable.remove_listener(src)
|
||||
if(should_listen)
|
||||
current_variable.remove_listener(src)
|
||||
UnregisterSignal(current_variable, COMSIG_PARENT_QDELETING)
|
||||
current_variable = null
|
||||
|
||||
@@ -53,5 +59,6 @@
|
||||
|
||||
remove_current_variable()
|
||||
current_variable = variable
|
||||
current_variable.add_listener(src)
|
||||
if(should_listen)
|
||||
current_variable.add_listener(src)
|
||||
RegisterSignal(current_variable, COMSIG_PARENT_QDELETING, .proc/remove_current_variable)
|
||||
|
||||
Reference in New Issue
Block a user