<commit_before>/*
 * Experimental procs by ESwordTheCat.
 */

/*
 * Get index of last char occurence to string.
 *
 * @args
 * A, string to be search
 * B, char used for search
 *
 * @return
 * >0, index of char at string
 *  0, char not found
 * -1, parameter B is not a char
 * -2, parameter A is not a string
 */
/proc/EgijkAeN(const/A, const/B)
	if (istext(A) == 0 || length(A) < 1)
		return -2

	if (istext(B) == 0 || length(B) > 1)
		return -1

	var/i = findtext(A, B)

	if (0 == i)
		return 0

	while (i)
		. = i
		i = findtext(A, B, i + 1)

/obj/machinery/proc/getArea()
	var/area/A = loc.loc

	if (A != myArea)
		myArea = A

	. = myArea

/**
 * Object pooling.
 *
 * If this file is named experimental,
 * well treat this implementation as experimental experimental (redundancy intended).
 *
 * WARNING, only supports /mob and /obj.
 */

#define DEBUG_OBJECT_POOL 1
#define MAINTAINING_OBJECT_POOL_COUNT 20

var/list/masterPool = list()

/*
 * @args
 * A, object type
 * B, location to spawn
 *
 * Example call: getFromPool(/obj/item/weapon/shard, loc)
 */
/proc/getFromPool(const/A, const/B)
	if (isnull(masterPool[A]))
		#if DEBUG_OBJECT_POOL<commit_msg>I always forgot to turn this to 0.<commit_after>/*
 * Experimental procs by ESwordTheCat.
 */

/*
 * Get index of last char occurence to string.
 *
 * @args
 * A, string to be search
 * B, char used for search
 *
 * @return
 * >0, index of char at string
 *  0, char not found
 * -1, parameter B is not a char
 * -2, parameter A is not a string
 */
/proc/EgijkAeN(const/A, const/B)
	if (istext(A) == 0 || length(A) < 1)
		return -2

	if (istext(B) == 0 || length(B) > 1)
		return -1

	var/i = findtext(A, B)

	if (0 == i)
		return 0

	while (i)
		. = i
		i = findtext(A, B, i + 1)

/obj/machinery/proc/getArea()
	var/area/A = loc.loc

	if (A != myArea)
		myArea = A

	. = myArea

/**
 * Object pooling.
 *
 * If this file is named experimental,
 * well treat this implementation as experimental experimental (redundancy intended).
 *
 * WARNING, only supports /mob and /obj.
 */

#define DEBUG_OBJECT_POOL 0
#define MAINTAINING_OBJECT_POOL_COUNT 20

var/list/masterPool = list()

/*
 * @args
 * A, object type
 * B, location to spawn
 *
 * Example call: getFromPool(/obj/item/weapon/shard, loc)
 */
/proc/getFromPool(const/A, const/B)
	if (isnull(masterPool[A]))
		#if DEBUG_OBJECT_POOL
{'fraction_non_alphanumeric': 0.13994045087196938, 'fraction_numerical': 0.014036580178647383, 'mean_word_length': 2.9662731871838113, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '945745', 'n_tokens_mistral': 943, 'n_tokens_neox': 893, 'n_words': 284}