<commit_before>/obj/item/suspiciousphone
	name = "suspicious phone"
	desc = "This device raises pink levels to unknown highs."
	icon = 'icons/obj/weapons/items_and_weapons.dmi'
	icon_state = "suspiciousphone"
	w_class = WEIGHT_CLASS_SMALL
	attack_verb_continuous = list("dumps")
	attack_verb_simple = list("dump")
	var/dumped = FALSE

/obj/item/suspiciousphone/attack_self(mob/living/user)
	if(!ISADVANCEDTOOLUSER(user))
		to_chat(user, span_warning("This device is too advanced for you!"))
		return
	if(dumped)
		to_chat(user, span_warning("You already activated Protocol CRAB-17."))
		return FALSE
	if(tgui_alert(user, "Are you sure you want to crash this market with no survivors?", "Protocol CRAB-17", list("Yes", "No")) == "Yes")
		if(dumped || QDELETED(src)) //Prevents fuckers from cheesing alert
			return FALSE
		var/turf/targetturf = get_safe_random_station_turf()
		if (!targetturf)
			return FALSE
		var/list/accounts_to_rob = flatten_list(SSeconomy.bank_accounts_by_id)
		var/mob/living/L
		if(isliving(user))
			L = user
			accounts_to_rob -= L.get_bank_account()
		for(var/i in accounts_to_rob)
			var/datum/bank_account/B = i
			B.being_dumped = TRUE
		new /obj/effect/dumpeet_target(targetturf, L)

		to_chat(user, span_notice("You have activated Protocol CRAB-17."))
		message_admins("[ADMIN_LOOKUPFLW(user)] has activated Protocol CRAB-17.")
		user.log_message("activated Protocol CRAB-17.", LOG_GAME)

		dumped = TRUE

/obj/structure/checkoutmachine
	name = "\improper Nanotrasen Space-Coin Market"
	desc = "This is good for spacecoin because"
	icon = 'icons/obj/money_machine.dmi'
	icon_state = "bogdanoff"
	layer = ABOVE_ALL_MOB_LAYER
	plane = ABOVE_GAME_PLANE
	resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
	density = TRUE
	pixel_z = -8
	max_integrity = 5000
	var/list/accounts_to_rob
	var/mob/living/bogdanoff
	var/canwalk = FALSE

/obj/structure/checkoutmachine/examine(mob/living/user)
	. = ..()
	. += span_info("It has a flashing <b>ID card reader</b> for convenient cashing out.")

/obj/structure/checkoutmachine/proc/check_if_finished()
	for(var/i in accounts_to_rob)
		var/datum/bank_account/B = i
		if (B.being_dumped)
			return FALSE
	return TRUE

/obj/structure/checkoutmachine/attackby(obj/item/attacking_item, mob/user, params)
	if(check_if_finished())
		qdel(src)
		return

	var/obj/item/card/id/card = attacking_item.GetID()
	if(!card)
		balloon_alert(user, "your [attacking_item.name] gets repelled by the id card reader")

		var/throwtarget = get_step(user, get_dir(src, user))
		user.safe_throw_at(throwtarget, 1, 1, force = MOVE_FORCE_EXTREMELY_STRONG)
		playsound(get_turf(src),'sound/magic/repulse.ogg', 100, TRUE)

		return

	if(!card.registered_account)
		to_chat(user, span_warning("This card does not have a registered account!"))
		return

	if(!card.registered_account.being_dumped)
		to_chat(user, span_warning("It appears that your funds are safe from draining!"))
		return

	to_chat(user, span_warning("You quickly cash out your funds to a more secure banking location. Funds are safu.")) // This is a reference and not a typo
	card.registered_account.being_dumped = FALSE

	if(check_if_finished())
		qdel(src)
		return

/obj/structure/checkoutmachine/Initialize(mapload, mob/living/user)
	. = ..()
	if(QDELETED(src))
		return
	bogdanoff = user
	add_overlay("flaps")
	add_overlay("hatch")
	add_overlay("legs_retracted")
	addtimer(CALLBACK(src, .proc/startUp), 50)
	QDEL_IN(src, 8 MINUTES) //Self-destruct after 8 min
	ADD_TRAIT(SSeconomy, TRAIT_MARKET_CRASHING, REF(src))


/obj/structure/checkoutmachine/proc/startUp() //very VERY snowflake code that adds a neat animation when the pod lands.
	start_dumping() //The machine doesnt move during this time, giving people close by a small window to grab their funds before it starts running around
	sleep(10)
	if(QDELETED(src))
		return
	playsound(src, 'sound/machines/click.ogg', 15, TRUE, -3)
	cut_overlay("flaps")
	sleep(10)
	if(QDELETED(src))
		return
	playsound(src, 'sound/machines/click.ogg', 15, TRUE, -3)
	cut_overlay("hatch")
	sleep(30)
	if(QDELETED(src))
		return
	playsound(src,'sound/machines/twobeep.ogg',50,FALSE)
	var/mutable_appearance/hologram = mutable_appearance(icon, "hologram")
	hologram.pixel_y = 16
	add_overlay(hologram)
	var/mutable_appearance/holosign = mutable_appearance(icon, "holosign")
	holosign.pixel_y = 16
	add_overlay(holosign)
	add_overlay("legs_extending")
	cut_overlay("legs_retracted")
	pixel_z += 4
	sleep(5)
	if(QDELETED(src))
		return
	add_overlay("legs_extended")
	cut_overlay("legs_extending")
	pixel_z += 4
	sleep(20)
	if(QDELETED(src))
		return
	add_overlay("screen_lines")
	sleep(5)
	if(QDELETED(src))
		return
	cut_overlay("screen_lines")
	sleep(5)
	if(QDELETED(src))
		return
	add_overlay("screen_lines")
	add_overlay("screen")
	sleep(5)
	if(QDELETED(src))
		return
	playsound(src,'sound/machines/triple_beep.ogg',50,FALSE)
	add_overlay("text")
	sleep(10)
	if(QDELETED(src))
		return
	add_overlay("legs")
	cut_overlay("legs_extended")
	cut_overlay("screen")
	add_overlay("screen")
	cut_overlay("screen_lines")
	add_overlay("screen_lines")
	cut_overlay("text")
	add_overlay("text")
	canwalk = TRUE
	START_PROCESSING(SSfastprocess, src)

/obj/structure/checkoutmachine/Destroy()
	stop_dumping()
	STOP_PROCESSING(SSfastprocess, src)
	priority_announce("The credit deposit machine at [get_area(src)] has been destroyed. Station funds have stopped draining!", sender_override = "CRAB-17 Protocol")
	explosion(src, light_impact_range = 1, flame_range = 2)
	REMOVE_TRAIT(SSeconomy, TRAIT_MARKET_CRASHING, REF(src))
	return ..()

/obj/structure/checkoutmachine/proc/start_dumping()
	accounts_to_rob = flatten_list(SSeconomy.bank_accounts_by_id)
	accounts_to_rob -= bogdanoff?.get_bank_account()
	for(var/i in accounts_to_rob)
		var/datum/bank_account/B = i
		B.dumpeet()
	dump()

/obj/structure/checkoutmachine/proc/dump()
	var/percentage_lost = (rand(5, 15) / 100)
	for(var/i in accounts_to_rob)
		var/datum/bank_account/B = i<commit_msg>Crab-17 No Longer Breaks Economy If You Swipe Too Fast (#70094)<commit_after>/obj/item/suspiciousphone
	name = "suspicious phone"
	desc = "This device raises pink levels to unknown highs."
	icon = 'icons/obj/weapons/items_and_weapons.dmi'
	icon_state = "suspiciousphone"
	w_class = WEIGHT_CLASS_SMALL
	attack_verb_continuous = list("dumps")
	attack_verb_simple = list("dump")
	var/dumped = FALSE

/obj/item/suspiciousphone/attack_self(mob/living/user)
	if(!ISADVANCEDTOOLUSER(user))
		to_chat(user, span_warning("This device is too advanced for you!"))
		return
	if(dumped)
		to_chat(user, span_warning("You already activated Protocol CRAB-17."))
		return FALSE
	if(tgui_alert(user, "Are you sure you want to crash this market with no survivors?", "Protocol CRAB-17", list("Yes", "No")) == "Yes")
		if(dumped || QDELETED(src)) //Prevents fuckers from cheesing alert
			return FALSE
		var/turf/targetturf = get_safe_random_station_turf()
		if (!targetturf)
			return FALSE
		var/list/accounts_to_rob = flatten_list(SSeconomy.bank_accounts_by_id)
		var/mob/living/L
		if(isliving(user))
			L = user
			accounts_to_rob -= L.get_bank_account()
		for(var/i in accounts_to_rob)
			var/datum/bank_account/B = i
			B.being_dumped = TRUE
		new /obj/effect/dumpeet_target(targetturf, L)

		to_chat(user, span_notice("You have activated Protocol CRAB-17."))
		message_admins("[ADMIN_LOOKUPFLW(user)] has activated Protocol CRAB-17.")
		user.log_message("activated Protocol CRAB-17.", LOG_GAME)

		dumped = TRUE

/obj/structure/checkoutmachine
	name = "\improper Nanotrasen Space-Coin Market"
	desc = "This is good for spacecoin because"
	icon = 'icons/obj/money_machine.dmi'
	icon_state = "bogdanoff"
	layer = ABOVE_ALL_MOB_LAYER
	plane = ABOVE_GAME_PLANE
	resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
	density = TRUE
	pixel_z = -8
	max_integrity = 5000
	var/list/accounts_to_rob
	var/mob/living/bogdanoff
	/// Are we able to start moving?
	var/canwalk = FALSE

/obj/structure/checkoutmachine/examine(mob/living/user)
	. = ..()
	. += span_info("It has a flashing <b>ID card reader</b> for convenient cashing out.")

/obj/structure/checkoutmachine/proc/check_if_finished()
	for(var/i in accounts_to_rob)
		var/datum/bank_account/B = i
		if (B.being_dumped)
			return FALSE
	return TRUE

/obj/structure/checkoutmachine/attackby(obj/item/attacking_item, mob/user, params)
	if(check_if_finished())
		qdel(src)
		return

	var/obj/item/card/id/card = attacking_item.GetID()
	if(!card)
		balloon_alert(user, "your [attacking_item.name] gets repelled by the id card reader")

		var/throwtarget = get_step(user, get_dir(src, user))
		user.safe_throw_at(throwtarget, 1, 1, force = MOVE_FORCE_EXTREMELY_STRONG)
		playsound(get_turf(src),'sound/magic/repulse.ogg', 100, TRUE)

		return

	if(!canwalk)
		to_chat(user, span_warning("Space-Coin only accepts transactions while mobile!"))
		return

	if(!card.registered_account)
		to_chat(user, span_warning("This card does not have a registered account!"))
		return

	if(!card.registered_account.being_dumped)
		to_chat(user, span_warning("It appears that your funds are safe from draining!"))
		return

	to_chat(user, span_warning("You quickly cash out your funds to a more secure banking location. Funds are safu.")) // This is a reference and not a typo
	card.registered_account.being_dumped = FALSE

	if(check_if_finished())
		qdel(src)
		return

/obj/structure/checkoutmachine/Initialize(mapload, mob/living/user)
	. = ..()
	if(QDELETED(src))
		return
	bogdanoff = user
	add_overlay("flaps")
	add_overlay("hatch")
	add_overlay("legs_retracted")
	addtimer(CALLBACK(src, .proc/startUp), 50)
	QDEL_IN(src, 8 MINUTES) //Self-destruct after 8 min
	ADD_TRAIT(SSeconomy, TRAIT_MARKET_CRASHING, REF(src))


/obj/structure/checkoutmachine/proc/startUp() //very VERY snowflake code that adds a neat animation when the pod lands.
	start_dumping() //The machine doesnt move during this time, giving people close by a small window to grab their funds before it starts running around
	sleep(10)
	if(QDELETED(src))
		return
	playsound(src, 'sound/machines/click.ogg', 15, TRUE, -3)
	cut_overlay("flaps")
	sleep(10)
	if(QDELETED(src))
		return
	playsound(src, 'sound/machines/click.ogg', 15, TRUE, -3)
	cut_overlay("hatch")
	sleep(30)
	if(QDELETED(src))
		return
	playsound(src,'sound/machines/twobeep.ogg',50,FALSE)
	var/mutable_appearance/hologram = mutable_appearance(icon, "hologram")
	hologram.pixel_y = 16
	add_overlay(hologram)
	var/mutable_appearance/holosign = mutable_appearance(icon, "holosign")
	holosign.pixel_y = 16
	add_overlay(holosign)
	add_overlay("legs_extending")
	cut_overlay("legs_retracted")
	pixel_z += 4
	sleep(5)
	if(QDELETED(src))
		return
	add_overlay("legs_extended")
	cut_overlay("legs_extending")
	pixel_z += 4
	sleep(20)
	if(QDELETED(src))
		return
	add_overlay("screen_lines")
	sleep(5)
	if(QDELETED(src))
		return
	cut_overlay("screen_lines")
	sleep(5)
	if(QDELETED(src))
		return
	add_overlay("screen_lines")
	add_overlay("screen")
	sleep(5)
	if(QDELETED(src))
		return
	playsound(src,'sound/machines/triple_beep.ogg',50,FALSE)
	add_overlay("text")
	sleep(10)
	if(QDELETED(src))
		return
	add_overlay("legs")
	cut_overlay("legs_extended")
	cut_overlay("screen")
	add_overlay("screen")
	cut_overlay("screen_lines")
	add_overlay("screen_lines")
	cut_overlay("text")
	add_overlay("text")
	START_PROCESSING(SSfastprocess, src) // we only start doing economy draining stuff once our machinery is initialized, thematically
	canwalk = TRUE

/obj/structure/checkoutmachine/Destroy()
	stop_dumping()
	STOP_PROCESSING(SSfastprocess, src)
	priority_announce("The credit deposit machine at [get_area(src)] has been destroyed. Station funds have stopped draining!", sender_override = "CRAB-17 Protocol")
	explosion(src, light_impact_range = 1, flame_range = 2)
	REMOVE_TRAIT(SSeconomy, TRAIT_MARKET_CRASHING, REF(src))
	return ..()

/obj/structure/checkoutmachine/proc/start_dumping()
	accounts_to_rob = flatten_list(SSeconomy.bank_accounts_by_id)
	accounts_to_rob -= bogdanoff?.get_bank_account()
	for(var/i in accounts_to_rob)
		var/datum/bank_account/B = i
		B.dumpeet()
	dump()

/obj/structure/checkoutmachine/proc/dump()
	var/percentage_lost = (rand(5, 15) / 100)
	for(var/i in accounts_to_rob)
		var/datum/bank_account/B = i
{'fraction_non_alphanumeric': 0.11982800584131105, 'fraction_numerical': 0.01095245821840013, 'mean_word_length': 5.403636363636363, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6794166', 'n_tokens_mistral': 4943, 'n_tokens_neox': 4591, 'n_words': 933}