<commit_before>//This system is designed to act as an in-between for cargo and science, and the first major money sink in the game outside of just buying things from cargo (As of 10/9/19, anyway).

//economics defined values, subject to change should anything be too high or low in practice.

#define MACHINE_OPERATION 100000
#define MACHINE_OVERLOAD 500000
#define MAJOR_THRESHOLD 6*CARGO_CRATE_VALUE
#define MINOR_THRESHOLD 4*CARGO_CRATE_VALUE
#define STANDARD_DEVIATION 2*CARGO_CRATE_VALUE
#define PART_CASH_OFFSET_AMOUNT 0.5*CARGO_CRATE_VALUE

/obj/machinery/rnd/bepis
	name = "\improper B.E.P.I.S. Chamber"
	desc = "A high fidelity testing device which unlocks the secrets of the known universe using the two most powerful substances available to man: excessive amounts of electricity and capital."
	icon = 'icons/obj/machines/bepis.dmi'
	icon_state = "chamber"
	base_icon_state = "chamber"
	density = TRUE
	layer = ABOVE_MOB_LAYER
	plane = GAME_PLANE_UPPER
	circuit = /obj/item/circuitboard/machine/bepis

	///How much cash the UI and machine are depositing at a time.
	var/banking_amount = 100
	///How much stored player cash exists within the machine.
	var/banked_cash = 0
	///Payer's bank account.
	var/datum/bank_account/account
	///Name on the payer's bank account.
	var/account_name
	///When the BEPIS fails to hand out any reward, the ERROR cause will be a randomly picked string displayed on the UI.
	var/error_cause = null

	//Vars related to probability and chance of success for testing, using gaussian normal distribution.
	///How much cash you will need to obtain a Major Tech Disk reward.
	var/major_threshold = MAJOR_THRESHOLD
	///How much cash you will need to obtain a minor invention reward.
	var/minor_threshold = MINOR_THRESHOLD
	///The standard deviation of the BEPIS's gaussian normal distribution.
	var/std = STANDARD_DEVIATION

	//Stock part variables
	///Multiplier that lowers how much the BEPIS' power costs are. Maximum of 1, upgraded to a minimum of 0.7. See RefreshParts.
	var/power_saver = 1
	///Variability on the money you actively spend on the BEPIS, with higher inaccuracy making the most change, good and bad to spent cash.
	var/inaccuracy_percentage = 1.5
	///How much "cash" is added to your inserted cash efforts for free. Based on manipulator stock part level.
	var/positive_cash_offset = 0
	///How much "cost" is removed from both the minor and major threshold costs. Based on laser stock part level.
	var/negative_cash_offset = 0
	///List of objects that constitute your minor rewards. All rewards are unique or rare outside of the BEPIS.
	var/minor_rewards = list(
		//To add a new minor reward, add it here.
		/obj/item/stack/circuit_stack/full,
		/obj/item/pen/survival,
		/obj/item/circuitboard/machine/sleeper/party,
		/obj/item/toy/sprayoncan,
	)

/obj/machinery/rnd/bepis/attackby(obj/item/O, mob/user, params)
	if(!is_operational)
		to_chat(user, span_notice("[src] can't accept money when it's not functioning."))
		return
	if(istype(O, /obj/item/holochip) || istype(O, /obj/item/stack/spacecash))
		var/deposit_value = O.get_item_credit_value()
		banked_cash += deposit_value
		qdel(O)
		say("Deposited [deposit_value] credits into storage.")
		update_appearance()
		return
	if(istype(O, /obj/item/card/id))
		var/obj/item/card/id/Card = O
		if(Card.registered_account)
			account = Card.registered_account
			account_name = Card.registered_name
			say("New account detected. Console Updated.")
		else
			say("No account detected on card. Aborting.")
		return
	return ..()

/obj/machinery/rnd/bepis/screwdriver_act(mob/living/user, obj/item/tool)
	return default_deconstruction_screwdriver(user, "chamber_open", "chamber", tool)

/obj/machinery/rnd/bepis/RefreshParts()
	. = ..()
	var/C = 0
	var/M = 0<commit_msg>BEPIS no longer phases into the astral plane when screwdrivered (#67507)<commit_after>//This system is designed to act as an in-between for cargo and science, and the first major money sink in the game outside of just buying things from cargo (As of 10/9/19, anyway).

//economics defined values, subject to change should anything be too high or low in practice.

#define MACHINE_OPERATION 100000
#define MACHINE_OVERLOAD 500000
#define MAJOR_THRESHOLD 6*CARGO_CRATE_VALUE
#define MINOR_THRESHOLD 4*CARGO_CRATE_VALUE
#define STANDARD_DEVIATION 2*CARGO_CRATE_VALUE
#define PART_CASH_OFFSET_AMOUNT 0.5*CARGO_CRATE_VALUE

/obj/machinery/rnd/bepis
	name = "\improper B.E.P.I.S. Chamber"
	desc = "A high fidelity testing device which unlocks the secrets of the known universe using the two most powerful substances available to man: excessive amounts of electricity and capital."
	icon = 'icons/obj/machines/bepis.dmi'
	icon_state = "chamber"
	base_icon_state = "chamber"
	density = TRUE
	layer = ABOVE_MOB_LAYER
	plane = GAME_PLANE_UPPER
	circuit = /obj/item/circuitboard/machine/bepis

	///How much cash the UI and machine are depositing at a time.
	var/banking_amount = 100
	///How much stored player cash exists within the machine.
	var/banked_cash = 0
	///Payer's bank account.
	var/datum/bank_account/account
	///Name on the payer's bank account.
	var/account_name
	///When the BEPIS fails to hand out any reward, the ERROR cause will be a randomly picked string displayed on the UI.
	var/error_cause = null

	//Vars related to probability and chance of success for testing, using gaussian normal distribution.
	///How much cash you will need to obtain a Major Tech Disk reward.
	var/major_threshold = MAJOR_THRESHOLD
	///How much cash you will need to obtain a minor invention reward.
	var/minor_threshold = MINOR_THRESHOLD
	///The standard deviation of the BEPIS's gaussian normal distribution.
	var/std = STANDARD_DEVIATION

	//Stock part variables
	///Multiplier that lowers how much the BEPIS' power costs are. Maximum of 1, upgraded to a minimum of 0.7. See RefreshParts.
	var/power_saver = 1
	///Variability on the money you actively spend on the BEPIS, with higher inaccuracy making the most change, good and bad to spent cash.
	var/inaccuracy_percentage = 1.5
	///How much "cash" is added to your inserted cash efforts for free. Based on manipulator stock part level.
	var/positive_cash_offset = 0
	///How much "cost" is removed from both the minor and major threshold costs. Based on laser stock part level.
	var/negative_cash_offset = 0
	///List of objects that constitute your minor rewards. All rewards are unique or rare outside of the BEPIS.
	var/minor_rewards = list(
		//To add a new minor reward, add it here.
		/obj/item/stack/circuit_stack/full,
		/obj/item/pen/survival,
		/obj/item/circuitboard/machine/sleeper/party,
		/obj/item/toy/sprayoncan,
	)

/obj/machinery/rnd/bepis/attackby(obj/item/O, mob/user, params)
	if(!is_operational)
		to_chat(user, span_notice("[src] can't accept money when it's not functioning."))
		return
	if(istype(O, /obj/item/holochip) || istype(O, /obj/item/stack/spacecash))
		var/deposit_value = O.get_item_credit_value()
		banked_cash += deposit_value
		qdel(O)
		say("Deposited [deposit_value] credits into storage.")
		update_appearance()
		return
	if(istype(O, /obj/item/card/id))
		var/obj/item/card/id/Card = O
		if(Card.registered_account)
			account = Card.registered_account
			account_name = Card.registered_name
			say("New account detected. Console Updated.")
		else
			say("No account detected on card. Aborting.")
		return
	return ..()

/obj/machinery/rnd/bepis/screwdriver_act(mob/living/user, obj/item/tool)
	return default_deconstruction_screwdriver(user, "chamber_open", "chamber", tool)

/obj/machinery/rnd/bepis/screwdriver_act_secondary(mob/living/user, obj/item/tool)
	return default_deconstruction_screwdriver(user, "chamber_open", "chamber", tool)

/obj/machinery/rnd/bepis/RefreshParts()
	. = ..()
	var/C = 0
	var/M = 0
{'fraction_non_alphanumeric': 0.09012488734389082, 'fraction_numerical': 0.00991373760782799, 'mean_word_length': 4.161461794019933, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5692460', 'n_tokens_mistral': 2748, 'n_tokens_neox': 2531, 'n_words': 852}