Files
Bubberstation/code/modules/wiremod/components/string/contains.dm
SkyratBot c9b268a72a [MIRROR] Integrated the component printer into the integrated circuit UI. You can now link integrated circuits to component printers [MDB IGNORE] (#9107)
* Integrated the component printer into the integrated circuit UI. You can now link integrated circuits to component printers (#62287)

Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com>

* Integrated the component printer into the integrated circuit UI. You can now link integrated circuits to component printers

Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com>
2021-10-28 15:49:34 -04:00

37 lines
864 B
Plaintext

/**
* # String Contains Component
*
* Checks if a string contains a word/letter
*/
/obj/item/circuit_component/compare/contains
display_name = "String Contains"
desc = "Checks if a string contains a word/letter"
category = "String"
input_port_amount = 0
var/datum/port/input/needle
var/datum/port/input/haystack
/obj/item/circuit_component/compare/contains/populate_custom_ports()
needle = add_input_port("Needle", PORT_TYPE_STRING)
haystack = add_input_port("Haystack", PORT_TYPE_STRING)
/obj/item/circuit_component/compare/contains/Destroy()
needle = null
haystack = null
return ..()
/obj/item/circuit_component/compare/contains/do_comparisons(list/ports)
if(length(ports) < input_port_amount)
return
var/to_find = needle.value
var/to_search = haystack.value
if(!to_find || !to_search)
return
return findtext(to_search, to_find)