mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-22 05:25:15 +01:00
[MIRROR] More circuit components. Restructures the circuit components folder to be more organised. (#6142)
* More circuit components. Restructures the circuit components folder to be more organised. * Mirror! Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Funce <funce.973@gmail.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* # String Contains Component
|
||||
*
|
||||
* Checks if a string contains a word/letter
|
||||
*/
|
||||
/obj/item/circuit_component/compare/contains
|
||||
display_name = "String Contains"
|
||||
|
||||
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)
|
||||
Reference in New Issue
Block a user