mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 21:17:44 +01:00
Input ports now connect to multiple output ports. Remove combiner. (#60494)
* tgui bsod * debug disconnections * prelim * recomment * set_value -> put ._. * DAMN IT * reinsert subsystem * prepare * unditch signals * remove combiner * remove combiner some more * how did router.dm get here? deleting. * These two COMSIGS should be one. * critical typo * inline cast * have your signals * Have your set_input & set_output. * make compile * upgrade save/load to n-to-n-wires * have your documentation * have your unsafe proc * pay no attention to the compile errors * unlist the ref * paste my for block back in ._. * fix manual input * oops pushed too soon * Have your !port.connected_to?.length Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
This commit is contained in:
@@ -77,7 +77,7 @@
|
||||
if(!port_to_update)
|
||||
CRASH("[port.type] doesn't have a linked port in [type]!")
|
||||
|
||||
port_to_update.set_output(port.input_value)
|
||||
port_to_update.set_output(port.value)
|
||||
|
||||
/obj/item/circuit_component/module/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
@@ -87,7 +87,7 @@
|
||||
if(!port_to_update)
|
||||
CRASH("[port.type] doesn't have a linked port in [type]!")
|
||||
|
||||
port_to_update.set_output(port.input_value)
|
||||
port_to_update.set_output(port.value)
|
||||
|
||||
/obj/item/circuit_component/module_output/Destroy()
|
||||
attached_module = null
|
||||
|
||||
@@ -45,11 +45,11 @@
|
||||
|
||||
/obj/item/circuit_component/light/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
brightness.set_input(clamp(brightness.input_value || 0, 0, max_power), FALSE)
|
||||
red.set_input(clamp(red.input_value, 0, 255), FALSE)
|
||||
blue.set_input(clamp(blue.input_value, 0, 255), FALSE)
|
||||
green.set_input(clamp(green.input_value, 0, 255), FALSE)
|
||||
var/list/hsl = rgb2hsl(red.input_value || 0, green.input_value || 0, blue.input_value || 0)
|
||||
brightness.set_input(clamp(brightness.value || 0, 0, max_power))
|
||||
red.set_input(clamp(red.value, 0, 255))
|
||||
blue.set_input(clamp(blue.value, 0, 255))
|
||||
green.set_input(clamp(green.value, 0, 255))
|
||||
var/list/hsl = rgb2hsl(red.value || 0, green.value || 0, blue.value || 0)
|
||||
var/list/light_col = hsl2rgb(hsl[1], hsl[2], max(min_lightness, hsl[3]))
|
||||
shell_light_color = rgb(light_col[1], light_col[2], light_col[3])
|
||||
if(.)
|
||||
@@ -60,9 +60,9 @@
|
||||
|
||||
/obj/item/circuit_component/light/proc/set_atom_light(atom/movable/target_atom)
|
||||
// Clamp anyways just for safety
|
||||
var/bright_val = min(max(brightness.input_value || 0, 0), max_power)
|
||||
var/bright_val = min(max(brightness.value || 0, 0), max_power)
|
||||
|
||||
target_atom.set_light_power(bright_val)
|
||||
target_atom.set_light_range(bright_val)
|
||||
target_atom.set_light_color(shell_light_color)
|
||||
target_atom.set_light_on(!!on.input_value)
|
||||
target_atom.set_light_on(!!on.value)
|
||||
|
||||
@@ -66,10 +66,10 @@
|
||||
if(COMPONENT_TRIGGERED_BY(eject, port))
|
||||
remove_current_brain()
|
||||
if(COMPONENT_TRIGGERED_BY(send, port))
|
||||
if(!message.input_value)
|
||||
if(!message.value)
|
||||
return
|
||||
|
||||
var/msg_str = copytext(html_encode(message.input_value), 1, max_length)
|
||||
var/msg_str = copytext(html_encode(message.value), 1, max_length)
|
||||
|
||||
var/mob/living/target = brain.brainmob
|
||||
if(!target)
|
||||
|
||||
@@ -49,15 +49,15 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/target_X = input_X.input_value
|
||||
var/target_X = input_X.value
|
||||
if(isnull(target_X))
|
||||
return
|
||||
|
||||
var/target_Y = input_Y.input_value
|
||||
var/target_Y = input_Y.value
|
||||
if(isnull(target_Y))
|
||||
return
|
||||
|
||||
var/atom/path_id = id_card.input_value
|
||||
var/atom/path_id = id_card.value
|
||||
if(path_id && !istype(path_id, /obj/item/card/id))
|
||||
path_id = null
|
||||
failed.set_output(COMPONENT_SIGNAL)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/atom/target_atom = target.input_value
|
||||
var/atom/target_atom = target.value
|
||||
if(!target_atom)
|
||||
return
|
||||
|
||||
|
||||
@@ -45,27 +45,27 @@
|
||||
|
||||
/obj/item/circuit_component/radio/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
freq.set_input(sanitize_frequency(freq.input_value, TRUE), FALSE)
|
||||
freq.set_input(sanitize_frequency(freq.value, TRUE))
|
||||
if(.)
|
||||
return
|
||||
var/frequency = freq.input_value
|
||||
var/frequency = freq.value
|
||||
|
||||
SSradio.remove_object(src, current_freq)
|
||||
radio_connection = SSradio.add_object(src, frequency, RADIO_SIGNALER)
|
||||
current_freq = frequency
|
||||
|
||||
if(COMPONENT_TRIGGERED_BY(trigger_input, port))
|
||||
var/datum/signal/signal = new(list("code" = round(code.input_value) || 0, "key" = parent?.owner_id))
|
||||
var/datum/signal/signal = new(list("code" = round(code.value) || 0, "key" = parent?.owner_id))
|
||||
radio_connection.post_signal(src, signal)
|
||||
|
||||
/obj/item/circuit_component/radio/receive_signal(datum/signal/signal)
|
||||
. = FALSE
|
||||
if(!signal)
|
||||
return
|
||||
if(signal.data["code"] != round(code.input_value || 0))
|
||||
if(signal.data["code"] != round(code.value || 0))
|
||||
return
|
||||
|
||||
if(public_options.input_value == COMP_RADIO_PRIVATE && parent?.owner_id != signal.data["key"])
|
||||
if(public_options.value == COMP_RADIO_PRIVATE && parent?.owner_id != signal.data["key"])
|
||||
return
|
||||
|
||||
trigger_output.set_output(COMPONENT_SIGNAL)
|
||||
|
||||
@@ -49,18 +49,18 @@
|
||||
|
||||
/obj/item/circuit_component/soundemitter/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
volume.set_input(clamp(volume.input_value, 0, 100), FALSE)
|
||||
frequency.set_input(clamp(frequency.input_value, -100, 100), FALSE)
|
||||
volume.set_input(clamp(volume.value, 0, 100))
|
||||
frequency.set_input(clamp(frequency.value, -100, 100))
|
||||
if(.)
|
||||
return
|
||||
|
||||
if(TIMER_COOLDOWN_CHECK(parent, COOLDOWN_CIRCUIT_SOUNDEMITTER))
|
||||
return
|
||||
|
||||
var/sound_to_play = options_map[sound_file.input_value]
|
||||
var/sound_to_play = options_map[sound_file.value]
|
||||
if(!sound_to_play)
|
||||
return
|
||||
|
||||
playsound(src, sound_to_play, volume.input_value, frequency != 0, frequency = frequency.input_value)
|
||||
playsound(src, sound_to_play, volume.value, frequency != 0, frequency = frequency.value)
|
||||
|
||||
TIMER_COOLDOWN_START(parent, COOLDOWN_CIRCUIT_SOUNDEMITTER, sound_cooldown)
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
if(TIMER_COOLDOWN_CHECK(parent, COOLDOWN_CIRCUIT_SPEECH))
|
||||
return
|
||||
|
||||
if(message.input_value)
|
||||
if(message.value)
|
||||
var/atom/movable/shell = parent.shell
|
||||
// Prevents appear as the individual component if there is a shell.
|
||||
if(shell)
|
||||
shell.say(message.input_value)
|
||||
shell.say(message.value)
|
||||
else
|
||||
say(message.input_value)
|
||||
say(message.value)
|
||||
TIMER_COOLDOWN_START(parent, COOLDOWN_CIRCUIT_SPEECH, speech_cooldown)
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
var/atom/object = entity.input_value
|
||||
var/var_name = variable_name.input_value
|
||||
var/atom/object = entity.value
|
||||
var/var_name = variable_name.value
|
||||
if(!var_name || !object)
|
||||
output_value.set_output(null)
|
||||
return
|
||||
|
||||
@@ -48,16 +48,16 @@
|
||||
return
|
||||
|
||||
var/called_on
|
||||
if(proccall_options.input_value == COMP_PROC_OBJECT)
|
||||
called_on = entity.input_value
|
||||
if(proccall_options.value == COMP_PROC_OBJECT)
|
||||
called_on = entity.value
|
||||
else
|
||||
called_on = GLOBAL_PROC
|
||||
|
||||
if(!called_on)
|
||||
return
|
||||
|
||||
var/to_invoke = proc_name.input_value
|
||||
var/params = arguments.input_value || list()
|
||||
var/to_invoke = proc_name.value
|
||||
var/params = arguments.value || list()
|
||||
|
||||
if(!to_invoke)
|
||||
return
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/operation = sdql_operation.input_value
|
||||
var/operation = sdql_operation.value
|
||||
|
||||
if(GLOB.AdminProcCaller || !operation)
|
||||
return TRUE
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
var/atom/object = entity.input_value
|
||||
var/var_name = variable_name.input_value
|
||||
var/atom/object = entity.value
|
||||
var/var_name = variable_name.value
|
||||
if(!var_name || !object)
|
||||
return
|
||||
|
||||
object.vv_edit_var(var_name, new_value.input_value)
|
||||
object.vv_edit_var(var_name, new_value.value)
|
||||
|
||||
@@ -33,15 +33,15 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/typepath = input_path.input_value
|
||||
var/typepath = input_path.value
|
||||
|
||||
if(!ispath(typepath, /atom))
|
||||
return
|
||||
|
||||
var/list/params = parameters.input_value
|
||||
var/list/params = parameters.value
|
||||
if(!params)
|
||||
params = list()
|
||||
|
||||
params.Insert(1, spawn_at.input_value)
|
||||
params.Insert(1, spawn_at.value)
|
||||
|
||||
spawned_atom.set_output(new typepath(arglist(params)))
|
||||
|
||||
@@ -24,5 +24,5 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
type_output.set_output(text2path(input_path.input_value))
|
||||
type_output.set_output(text2path(input_path.value))
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/atom/object = input_port.input_value
|
||||
var/atom/object = input_port.value
|
||||
if(!object)
|
||||
return
|
||||
var/turf/location = get_turf(src)
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/mob/living/organism = input_port.input_value
|
||||
var/mob/living/organism = input_port.value
|
||||
var/turf/current_turf = get_turf(src)
|
||||
if(!istype(organism) || get_dist(current_turf, organism) > max_range || current_turf.z != organism.z)
|
||||
brute.set_output(null)
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/mob/living/carbon/human/human = input_port.input_value
|
||||
var/mob/living/carbon/human/human = input_port.value
|
||||
if(!istype(human) || !human.has_dna())
|
||||
output.set_output(null)
|
||||
return
|
||||
|
||||
@@ -33,23 +33,23 @@
|
||||
if(LAZYLEN(active_overlays) >= overlay_limit)
|
||||
return
|
||||
|
||||
var/current_option = bar_overlay_options.input_value
|
||||
var/current_option = bar_overlay_options.value
|
||||
|
||||
if(active_overlays[target_atom])
|
||||
QDEL_NULL(active_overlays[target_atom])
|
||||
|
||||
var/number_clear = clamp(bar_number.input_value, 0, 100)
|
||||
var/number_clear = clamp(bar_number.value, 0, 100)
|
||||
if(current_option == COMP_BAR_OVERLAY_HORIZONTAL)
|
||||
number_clear = round(number_clear / 6.25) * 6.25
|
||||
else if(current_option == COMP_BAR_OVERLAY_VERTICAL)
|
||||
number_clear = round(number_clear / 10) * 10
|
||||
var/image/cool_overlay = image(icon = 'icons/hud/screen_bci.dmi', loc = target_atom, icon_state = "[options_map[current_option]][number_clear]", layer = RIPPLE_LAYER)
|
||||
|
||||
if(image_pixel_x.input_value)
|
||||
cool_overlay.pixel_x = image_pixel_x.input_value
|
||||
if(image_pixel_x.value)
|
||||
cool_overlay.pixel_x = image_pixel_x.value
|
||||
|
||||
if(image_pixel_y.input_value)
|
||||
cool_overlay.pixel_y = image_pixel_y.input_value
|
||||
if(image_pixel_y.value)
|
||||
cool_overlay.pixel_y = image_pixel_y.value
|
||||
|
||||
active_overlays[target_atom] = WEAKREF(target_atom.add_alt_appearance(
|
||||
/datum/atom_hud/alternate_appearance/basic/one_person,
|
||||
|
||||
@@ -60,10 +60,10 @@
|
||||
|
||||
QDEL_NULL(counter_appearance)
|
||||
var/image/counter = image(icon = 'icons/hud/screen_bci.dmi', icon_state = "hud_numbers", loc = owner)
|
||||
if(image_pixel_x.input_value)
|
||||
counter.pixel_x = image_pixel_x.input_value
|
||||
if(image_pixel_y.input_value)
|
||||
counter.pixel_y = image_pixel_y.input_value
|
||||
if(image_pixel_x.value)
|
||||
counter.pixel_x = image_pixel_x.value
|
||||
if(image_pixel_y.value)
|
||||
counter.pixel_y = image_pixel_y.value
|
||||
|
||||
counter_appearance = WEAKREF(owner.add_alt_appearance(
|
||||
/datum/atom_hud/alternate_appearance/basic/one_person,
|
||||
@@ -72,16 +72,16 @@
|
||||
owner,
|
||||
))
|
||||
|
||||
var/cleared_number = clamp(round(counter_number.input_value), 0, 999)
|
||||
var/cleared_number = clamp(round(counter_number.value), 0, 999)
|
||||
|
||||
for(var/i = 1 to 3)
|
||||
var/cur_num = round(cleared_number / (10 ** (3 - i))) % 10
|
||||
var/image/number = image(icon = 'icons/hud/screen_bci.dmi', icon_state = "hud_number_[cur_num]", loc = owner)
|
||||
|
||||
if(image_pixel_x.input_value)
|
||||
number.pixel_x = image_pixel_x.input_value + (i - 1) * 9
|
||||
if(image_pixel_y.input_value)
|
||||
number.pixel_y = image_pixel_y.input_value
|
||||
if(image_pixel_x.value)
|
||||
number.pixel_x = image_pixel_x.value + (i - 1) * 9
|
||||
if(image_pixel_y.value)
|
||||
number.pixel_y = image_pixel_y.value
|
||||
|
||||
numbers.Add(WEAKREF(owner.add_alt_appearance(
|
||||
/datum/atom_hud/alternate_appearance/basic/one_person,
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
return
|
||||
|
||||
var/mob/living/owner = bci.owner
|
||||
var/atom/target_atom = target.input_value
|
||||
var/atom/target_atom = target.value
|
||||
|
||||
if(!owner || !istype(owner) || !owner.client || !target_atom)
|
||||
return
|
||||
@@ -95,13 +95,13 @@
|
||||
if(active_overlays[target_atom])
|
||||
QDEL_NULL(active_overlays[target_atom])
|
||||
|
||||
var/image/cool_overlay = image(icon = 'icons/hud/screen_bci.dmi', loc = target_atom, icon_state = options_map[object_overlay_options.input_value], layer = RIPPLE_LAYER)
|
||||
var/image/cool_overlay = image(icon = 'icons/hud/screen_bci.dmi', loc = target_atom, icon_state = options_map[object_overlay_options.value], layer = RIPPLE_LAYER)
|
||||
|
||||
if(image_pixel_x.input_value)
|
||||
cool_overlay.pixel_x = image_pixel_x.input_value
|
||||
if(image_pixel_x.value)
|
||||
cool_overlay.pixel_x = image_pixel_x.value
|
||||
|
||||
if(image_pixel_y.input_value)
|
||||
cool_overlay.pixel_y = image_pixel_y.input_value
|
||||
if(image_pixel_y.value)
|
||||
cool_overlay.pixel_y = image_pixel_y.value
|
||||
|
||||
var/alt_appearance = WEAKREF(target_atom.add_alt_appearance(
|
||||
/datum/atom_hud/alternate_appearance/basic/one_person,
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/seperator = separator.input_value
|
||||
var/seperator = separator.value
|
||||
if(!seperator)
|
||||
return
|
||||
|
||||
var/list/list_input = list_port.input_value
|
||||
var/list/list_input = list_port.value
|
||||
if(!list_input)
|
||||
return
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/list/input_list = received_table.input_value
|
||||
if(!islist(input_list) || isnum(column_name.input_value))
|
||||
var/list/input_list = received_table.value
|
||||
if(!islist(input_list) || isnum(column_name.value))
|
||||
return
|
||||
|
||||
var/list/new_list = list()
|
||||
for(var/list/entry in input_list)
|
||||
var/anything = entry[column_name.input_value]
|
||||
var/anything = entry[column_name.value]
|
||||
if(islist(anything))
|
||||
continue
|
||||
new_list += anything
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/index = index_port.input_value
|
||||
var/list/list_input = list_port.input_value
|
||||
var/index = index_port.value
|
||||
var/list/list_input = list_port.value
|
||||
|
||||
if(!islist(list_input) || !index)
|
||||
output.set_output(null)
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/list/target_list = received_table.input_value
|
||||
var/list/target_list = received_table.value
|
||||
if(!islist(target_list) || !length(target_list))
|
||||
output_list.set_output(null)
|
||||
return
|
||||
|
||||
var/index = target_index.input_value
|
||||
var/index = target_index.value
|
||||
if(index < 1 || index > length(target_list))
|
||||
output_list.set_output(null)
|
||||
return
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
var/list/new_literal = list()
|
||||
for(var/datum/port/input/entry_port as anything in entry_ports)
|
||||
// Prevents lists from merging together
|
||||
new_literal += list(entry_port.input_value)
|
||||
new_literal += list(entry_port.value)
|
||||
|
||||
list_output.set_output(new_literal)
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
/obj/item/circuit_component/select/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
var/current_option = comparison_options.input_value
|
||||
var/current_option = comparison_options.value
|
||||
|
||||
switch(current_option)
|
||||
if(COMP_COMPARISON_EQUAL, COMP_COMPARISON_NOT_EQUAL)
|
||||
@@ -60,14 +60,14 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/list/input_list = received_table.input_value
|
||||
if(!islist(input_list) || isnum(column_name.input_value))
|
||||
var/list/input_list = received_table.value
|
||||
if(!islist(input_list) || isnum(column_name.value))
|
||||
return
|
||||
|
||||
var/comparison_value = comparison_input.input_value
|
||||
var/comparison_value = comparison_input.value
|
||||
var/list/new_list = list()
|
||||
for(var/list/entry in input_list)
|
||||
var/anything = entry[column_name.input_value]
|
||||
var/anything = entry[column_name.value]
|
||||
if(islist(anything))
|
||||
continue
|
||||
if(current_option != COMP_COMPARISON_EQUAL && current_option != COMP_COMPARISON_NOT_EQUAL && !isnum(anything))
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/separator_value = separator.input_value
|
||||
var/separator_value = separator.value
|
||||
if(isnull(separator_value))
|
||||
return
|
||||
|
||||
var/value = input_port.input_value
|
||||
var/value = input_port.value
|
||||
if(isnull(value))
|
||||
return
|
||||
|
||||
|
||||
@@ -53,14 +53,14 @@
|
||||
|
||||
var/list/ports = arithmetic_ports.Copy()
|
||||
var/datum/port/input/first_port = popleft(ports)
|
||||
var/result = first_port.input_value
|
||||
var/result = first_port.value
|
||||
|
||||
for(var/datum/port/input/input_port as anything in ports)
|
||||
var/value = input_port.input_value
|
||||
var/value = input_port.value
|
||||
if(isnull(value))
|
||||
continue
|
||||
|
||||
switch(arithmetic_option.input_value)
|
||||
switch(arithmetic_option.value)
|
||||
if(COMP_ARITHMETIC_ADD)
|
||||
result += value
|
||||
if(COMP_ARITHMETIC_SUBTRACT)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
comparison_option = add_option_port("Comparison Option", component_options)
|
||||
|
||||
/obj/item/circuit_component/compare/comparison/input_received(datum/port/input/port)
|
||||
switch(comparison_option.input_value)
|
||||
switch(comparison_option.value)
|
||||
if(COMP_COMPARISON_EQUAL, COMP_COMPARISON_NOT_EQUAL)
|
||||
if(current_type != PORT_TYPE_ANY)
|
||||
current_type = PORT_TYPE_ANY
|
||||
@@ -43,9 +43,9 @@
|
||||
return FALSE
|
||||
|
||||
// Comparison component only compares the first two ports
|
||||
var/input1 = compare_ports[1].input_value
|
||||
var/input2 = compare_ports[2].input_value
|
||||
var/current_option = comparison_option.input_value
|
||||
var/input1 = compare_ports[1].value
|
||||
var/input2 = compare_ports[2].value
|
||||
var/current_option = comparison_option.value
|
||||
|
||||
switch(current_option)
|
||||
if(COMP_COMPARISON_EQUAL)
|
||||
|
||||
@@ -25,5 +25,5 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
output.set_output(length(input_port.input_value))
|
||||
output.set_output(length(input_port.value))
|
||||
|
||||
|
||||
@@ -23,26 +23,26 @@
|
||||
|
||||
/obj/item/circuit_component/compare/logic/do_comparisons(list/ports)
|
||||
. = FALSE
|
||||
var/current_option = logic_options.input_value
|
||||
var/current_option = logic_options.value
|
||||
|
||||
// Used by XOR
|
||||
var/total_ports = 0
|
||||
var/total_true_ports = 0
|
||||
for(var/datum/port/input/port as anything in ports)
|
||||
if(isnull(port.input_value) && isnull(port.connected_port))
|
||||
if(isnull(port.value) && length(port.connected_ports) == 0)
|
||||
continue
|
||||
|
||||
total_ports += 1
|
||||
switch(current_option)
|
||||
if(COMP_LOGIC_AND)
|
||||
if(!port.input_value)
|
||||
if(!port.value)
|
||||
return FALSE
|
||||
. = TRUE
|
||||
if(COMP_LOGIC_OR)
|
||||
if(port.input_value)
|
||||
if(port.value)
|
||||
return TRUE
|
||||
if(COMP_LOGIC_XOR)
|
||||
if(port.input_value)
|
||||
if(port.value)
|
||||
. = TRUE
|
||||
total_true_ports += 1
|
||||
|
||||
|
||||
@@ -25,5 +25,5 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
result.set_output(!input_port.input_value)
|
||||
result.set_output(!input_port.value)
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/min_val = minimum.input_value || 0
|
||||
var/max_val = maximum.input_value || 0
|
||||
var/min_val = minimum.value || 0
|
||||
var/max_val = maximum.value || 0
|
||||
|
||||
if(max_val < min_val)
|
||||
output.set_output(0)
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
ports -= trigger_input
|
||||
|
||||
for(var/datum/port/input/input_port as anything in ports)
|
||||
var/value = input_port.input_value
|
||||
var/value = input_port.value
|
||||
if(isnull(value))
|
||||
continue
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
if(length(ports) < input_port_amount)
|
||||
return
|
||||
|
||||
var/to_find = needle.input_value
|
||||
var/to_search = haystack.input_value
|
||||
var/to_find = needle.value
|
||||
var/to_search = haystack.value
|
||||
|
||||
if(!to_find || !to_search)
|
||||
return
|
||||
|
||||
@@ -37,12 +37,12 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/value = input_port.input_value
|
||||
var/value = input_port.value
|
||||
if(isnull(value))
|
||||
return
|
||||
|
||||
var/result
|
||||
switch(textcase_options.input_value)
|
||||
switch(textcase_options.value)
|
||||
if(COMP_TEXT_LOWER)
|
||||
result = lowertext(value)
|
||||
if(COMP_TEXT_UPPER)
|
||||
|
||||
@@ -26,4 +26,4 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
output.set_output(text2num(input_port.input_value))
|
||||
output.set_output(text2num(input_port.value))
|
||||
|
||||
@@ -28,13 +28,13 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/input_value = input_port.input_value
|
||||
if(isatom(input_value))
|
||||
var/value = input_port.value
|
||||
if(isatom(value))
|
||||
var/turf/location = get_turf(src)
|
||||
var/atom/object = input_value
|
||||
var/atom/object = value
|
||||
if(object.z != location.z || get_dist(location, object) > max_range)
|
||||
output.set_output(PORT_TYPE_ATOM)
|
||||
return
|
||||
|
||||
output.set_output("[input_value]")
|
||||
output.set_output("[value]")
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
if(on.input_value)
|
||||
if(on.value)
|
||||
start_process()
|
||||
else
|
||||
stop_process()
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/**
|
||||
* # Combiner Component
|
||||
*
|
||||
* Combines multiple inputs into 1 output port.
|
||||
*/
|
||||
/obj/item/circuit_component/combiner
|
||||
display_name = "Combiner"
|
||||
desc = "A component that combines multiple inputs to provide 1 output."
|
||||
|
||||
/// The amount of input ports to have
|
||||
var/input_port_amount = 4
|
||||
var/datum/port/input/option/combiner_options
|
||||
|
||||
var/datum/port/output/output_port
|
||||
|
||||
var/list/combiner_ports = list()
|
||||
var/current_type
|
||||
|
||||
/obj/item/circuit_component/combiner/populate_options()
|
||||
var/static/component_options = list(
|
||||
PORT_TYPE_ANY,
|
||||
PORT_TYPE_STRING,
|
||||
PORT_TYPE_NUMBER,
|
||||
PORT_TYPE_LIST,
|
||||
PORT_TYPE_ATOM,
|
||||
PORT_TYPE_SIGNAL,
|
||||
)
|
||||
combiner_options = add_option_port("Combiner Options", component_options)
|
||||
|
||||
/obj/item/circuit_component/combiner/Initialize()
|
||||
. = ..()
|
||||
current_type = combiner_options.input_value
|
||||
for(var/port_id in 1 to input_port_amount)
|
||||
var/letter = ascii2text(text2ascii("A") + (port_id-1))
|
||||
combiner_ports += add_input_port(letter, current_type)
|
||||
output_port = add_output_port("Output", current_type)
|
||||
|
||||
/obj/item/circuit_component/combiner/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
if(current_type != combiner_options.input_value)
|
||||
current_type = combiner_options.input_value
|
||||
for(var/datum/port/input/input_port as anything in combiner_ports)
|
||||
input_port.set_datatype(current_type)
|
||||
output_port.set_datatype(current_type)
|
||||
|
||||
if(. || !port)
|
||||
return TRUE
|
||||
output_port.set_output(port.input_value)
|
||||
@@ -33,11 +33,11 @@
|
||||
if(!COMPONENT_TRIGGERED_BY(trigger, port))
|
||||
return
|
||||
|
||||
var/delay = delay_amount.input_value
|
||||
var/delay = delay_amount.value
|
||||
if(delay > COMP_DELAY_MIN_VALUE)
|
||||
// Convert delay into deciseconds
|
||||
addtimer(CALLBACK(output, /datum/port/output.proc/set_output, trigger.input_value), delay*10)
|
||||
addtimer(CALLBACK(output, /datum/port/output.proc/set_output, trigger.value), delay*10)
|
||||
else
|
||||
output.set_output(trigger.input_value)
|
||||
output.set_output(trigger.value)
|
||||
|
||||
#undef COMP_DELAY_MIN_VALUE
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
|
||||
/obj/item/circuit_component/ram/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
if(current_type != ram_options.input_value)
|
||||
current_type = ram_options.input_value
|
||||
if(current_type != ram_options.value)
|
||||
current_type = ram_options.value
|
||||
input_port.set_datatype(current_type)
|
||||
output.set_datatype(current_type)
|
||||
|
||||
@@ -67,6 +67,6 @@
|
||||
if(!COMPONENT_TRIGGERED_BY(trigger, port))
|
||||
return TRUE
|
||||
|
||||
var/input_val = input_port.input_value
|
||||
var/input_val = input_port.value
|
||||
|
||||
output.set_output(input_val)
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
/obj/item/circuit_component/router/Initialize()
|
||||
. = ..()
|
||||
current_type = router_options.input_value
|
||||
current_type = router_options.value
|
||||
if(input_port_amount > 1)
|
||||
input_selector = add_input_port("Input Selector", PORT_TYPE_NUMBER, default = 1)
|
||||
if(output_port_amount > 1)
|
||||
@@ -63,7 +63,7 @@
|
||||
#define WRAPACCESS(L, I) L[(((I||1)-1)%length(L)+length(L))%length(L)+1]
|
||||
/obj/item/circuit_component/router/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
var/current_option = router_options.input_value
|
||||
var/current_option = router_options.value
|
||||
if(current_type != current_option)
|
||||
current_type = current_option
|
||||
for(var/datum/port/input/input as anything in ins)
|
||||
@@ -72,9 +72,9 @@
|
||||
output.set_datatype(current_type)
|
||||
if(.)
|
||||
return
|
||||
var/datum/port/input/input = WRAPACCESS(ins, input_selector ? input_selector.input_value : 1)
|
||||
var/datum/port/output/output = WRAPACCESS(outs, output_selector ? output_selector.input_value : 1)
|
||||
output.set_output(input.input_value)
|
||||
var/datum/port/input/input = WRAPACCESS(ins, input_selector ? input_selector.value : 1)
|
||||
var/datum/port/output/output = WRAPACCESS(outs, output_selector ? output_selector.value : 1)
|
||||
output.set_output(input.value)
|
||||
|
||||
/obj/item/circuit_component/router/multiplexer
|
||||
display_name = "Multiplexer"
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
/obj/item/circuit_component/typecast/Initialize()
|
||||
. = ..()
|
||||
current_type = typecast_options.input_value
|
||||
current_type = typecast_options.value
|
||||
input_value = add_input_port("Input", PORT_TYPE_ANY)
|
||||
output_value = add_output_port("Output", current_type)
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
/obj/item/circuit_component/typecast/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
var/current_option = typecast_options.input_value
|
||||
var/current_option = typecast_options.value
|
||||
if(current_type != current_option)
|
||||
current_type = current_option
|
||||
output_value.set_datatype(current_type)
|
||||
@@ -41,7 +41,7 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/value = input_value.input_value
|
||||
var/value = input_value.value
|
||||
var/value_to_set = null
|
||||
switch(current_option)
|
||||
if(PORT_TYPE_STRING)
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
|
||||
// We're only comparing the first port/value. There shouldn't be any more.
|
||||
var/datum/port/input/input_port = ports[1]
|
||||
var/input_val = input_port.input_value
|
||||
switch(typecheck_options.input_value)
|
||||
var/input_val = input_port.value
|
||||
switch(typecheck_options.value)
|
||||
if(PORT_TYPE_STRING)
|
||||
return istext(input_val)
|
||||
if(PORT_TYPE_NUMBER)
|
||||
|
||||
Reference in New Issue
Block a user