Files
Bubberstation/code/modules/wiremod/components/string/contains.dm
SkyratBot 5ab9aba9d4 [MIRROR] Added circuit component UI details, added multiplexer and allowed inserting components directly into shells. (#6479)
* Added circuit component UI details, added multiplexer and allowed inserting components directly into shells. (#59635)

Adds the multiplexer circuit component - en.wikipedia.org/wiki/Multiplexer
Circuit components can now be directly inserted into shells rather than having to take the integrated circuit out.
Special information can be accessed from components now through the "Info" button besides the eject button on a component.

* Added circuit component UI details, added multiplexer and allowed inserting components directly into shells.

Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
2021-06-23 22:50:59 +01:00

36 lines
859 B
Plaintext

/**
* # String Contains Component
*
* Checks if a string contains a word/letter
*/
/obj/item/circuit_component/compare/contains
display_name = "String Contains"
display_desc = "Checks if a string contains a word/letter"
input_port_amount = 0
var/datum/port/input/needle
var/datum/port/input/haystack
/obj/item/circuit_component/compare/contains/load_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.input_value
var/to_search = haystack.input_value
if(!to_find || !to_search)
return
return findtext(to_search, to_find)