Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * # Split component
- *
- * Splits a string
- */
- /obj/item/circuit_component/split
- display_name = "Split"
- display_desc = "Splits a string by the separator and turns it into a list"
- /// The input port
- var/datum/port/input/input_port
- /// The seperator
- var/datum/port/input/separator
- /// The result from the output
- var/datum/port/output/output
- circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL
- var/max_range = 5
- /obj/item/circuit_component/split/Initialize()
- . = ..()
- input_port = add_input_port("Input", PORT_TYPE_STRING)
- separator = add_input_port("Seperator", PORT_TYPE_STRING)
- output = add_output_port("Output", PORT_TYPE_LIST)
- /obj/item/circuit_component/split/Destroy()
- input_port = null
- separator = null
- output = null
- return ..()
- /obj/item/circuit_component/split/input_received(datum/port/input/port)
- . = ..()
- if(.)
- return
- var/separator = separator.input_value
- if(isnull(separator))
- return
- var/value = input_port.input_value
- if(isnull(value))
- return
- var/list/result = splittext(value,separator)
- output.set_output(result)
- /**
- Using vendored Node v12.20.0
- => Starting 'dm'
- :: Skipping 'yarn' (up to date)
- :: Skipping 'tgui' (up to date)
- :: Skipping 'tgfont' (up to date)
- DM compiler version 514.1557
- loading tgstation.mdme
- loading interface\skin.dmf
- code\modules\wiremod\components\list\split.dm:40:error: separator.input_value: compile failed (possible infinite cross-reference loop)
- code\modules\wiremod\components\list\split.dm:41:error: separator: compile failed (possible infinite cross-reference loop)
- code\modules\wiremod\components\list\split.dm:49:error: separator: compile failed (possible infinite cross-reference loop)
- code\modules\wiremod\components\list\split.dm:51:error: result: compile failed (possible infinite cross-reference loop)
- tgstation.mdme.dmb - 4 errors, 0 warnings (7/1/21 10:40 pm)
- Total time: 0:59
- => Target 'dm' failed in 59.763s, exit code: 4294967295
- => Target 'default' failed
- Press any key to continue . . .
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement