Files
Bubberstation/code/modules/wiremod/components/string/contains.dm
SkyratBot 9e74cd4a03 [MIRROR] Input ports now connect to multiple output ports. Remove combiner. (#7505)
* 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>

* Input ports now connect to multiple output ports. Remove combiner.

Co-authored-by: Gurkenglas <gurkenglas@hotmail.de>
Co-authored-by: Watermelon914 <37270891+Watermelon914@ users.noreply.github.com>
2021-08-11 20:27:29 +01:00

36 lines
839 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"
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.value
var/to_search = haystack.value
if(!to_find || !to_search)
return
return findtext(to_search, to_find)