mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 11:12:14 +00:00
[MIRROR] Prevents abuse of the BEPIS to syphon cash from cargo. (#4224)
* Prevents abuse of the BEPIS to syphon cash from cargo. (#57610) Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com> * Prevents abuse of the BEPIS to syphon cash from cargo. Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com>
This commit is contained in:
@@ -108,20 +108,6 @@
|
|||||||
log_econ("[deposit_value] credits were inserted into [src] by [account.account_holder]")
|
log_econ("[deposit_value] credits were inserted into [src] by [account.account_holder]")
|
||||||
banked_cash += deposit_value
|
banked_cash += deposit_value
|
||||||
use_power(1000 * power_saver)
|
use_power(1000 * power_saver)
|
||||||
say("Cash deposit successful. There is [banked_cash] in the chamber.")
|
|
||||||
update_appearance()
|
|
||||||
return
|
|
||||||
|
|
||||||
/obj/machinery/rnd/bepis/proc/withdrawcash()
|
|
||||||
var/withdraw_value = 0
|
|
||||||
withdraw_value = banking_amount
|
|
||||||
if(withdraw_value > banked_cash)
|
|
||||||
say("Cannot withdraw more than stored funds. Aborting.")
|
|
||||||
else
|
|
||||||
banked_cash -= withdraw_value
|
|
||||||
new /obj/item/holochip(src.loc, withdraw_value)
|
|
||||||
say("Withdrawing [withdraw_value] credits from the chamber.")
|
|
||||||
update_appearance()
|
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/machinery/rnd/bepis/proc/calcsuccess()
|
/obj/machinery/rnd/bepis/proc/calcsuccess()
|
||||||
@@ -191,11 +177,14 @@
|
|||||||
ui = new(user, src, "Bepis", name)
|
ui = new(user, src, "Bepis", name)
|
||||||
ui.open()
|
ui.open()
|
||||||
RefreshParts()
|
RefreshParts()
|
||||||
|
if(isliving(user))
|
||||||
|
var/mob/living/customer = user
|
||||||
|
account = customer.get_bank_account()
|
||||||
|
|
||||||
/obj/machinery/rnd/bepis/ui_data(mob/user)
|
/obj/machinery/rnd/bepis/ui_data(mob/user)
|
||||||
var/list/data = list()
|
var/list/data = list()
|
||||||
var/powered = FALSE
|
var/powered = FALSE
|
||||||
var/zvalue = (banked_cash - (major_threshold - positive_cash_offset - negative_cash_offset))/(std)
|
var/zvalue = ((banking_amount + banked_cash) - (major_threshold - positive_cash_offset - negative_cash_offset))/(std)
|
||||||
var/std_success = 0
|
var/std_success = 0
|
||||||
var/prob_success = 0
|
var/prob_success = 0
|
||||||
//Admittedly this is messy, but not nearly as messy as the alternative, which is jury-rigging an entire Z-table into the code, or making an adaptive z-table.
|
//Admittedly this is messy, but not nearly as messy as the alternative, which is jury-rigging an entire Z-table into the code, or making an adaptive z-table.
|
||||||
@@ -223,7 +212,7 @@
|
|||||||
powered = TRUE
|
powered = TRUE
|
||||||
data["account_owner"] = account_name
|
data["account_owner"] = account_name
|
||||||
data["amount"] = banking_amount
|
data["amount"] = banking_amount
|
||||||
data["stored_cash"] = banked_cash
|
data["stored_cash"] = account?.account_balance
|
||||||
data["mean_value"] = (major_threshold - positive_cash_offset - negative_cash_offset)
|
data["mean_value"] = (major_threshold - positive_cash_offset - negative_cash_offset)
|
||||||
data["error_name"] = error_cause
|
data["error_name"] = error_cause
|
||||||
data["power_saver"] = power_saver
|
data["power_saver"] = power_saver
|
||||||
@@ -240,19 +229,12 @@
|
|||||||
if(.)
|
if(.)
|
||||||
return
|
return
|
||||||
switch(action)
|
switch(action)
|
||||||
if("deposit_cash")
|
|
||||||
if(use_power == IDLE_POWER_USE)
|
|
||||||
return
|
|
||||||
depositcash()
|
|
||||||
if("withdraw_cash")
|
|
||||||
if(use_power == IDLE_POWER_USE)
|
|
||||||
return
|
|
||||||
withdrawcash()
|
|
||||||
if("begin_experiment")
|
if("begin_experiment")
|
||||||
if(use_power == IDLE_POWER_USE)
|
if(use_power == IDLE_POWER_USE)
|
||||||
return
|
return
|
||||||
|
depositcash()
|
||||||
if(banked_cash == 0)
|
if(banked_cash == 0)
|
||||||
say("Please deposit funds to begin testing.")
|
say("Please select funds to deposit to begin testing.")
|
||||||
return
|
return
|
||||||
calcsuccess()
|
calcsuccess()
|
||||||
use_power(MACHINE_OPERATION * power_saver) //This thing should eat your APC battery if you're not careful.
|
use_power(MACHINE_OPERATION * power_saver) //This thing should eat your APC battery if you're not careful.
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export const Bepis = (props, context) => {
|
|||||||
<Grid.Column size={1.5}>
|
<Grid.Column size={1.5}>
|
||||||
<Section title="Stored Data and Statistics">
|
<Section title="Stored Data and Statistics">
|
||||||
<LabeledList>
|
<LabeledList>
|
||||||
<LabeledList.Item label="Deposited Credits">
|
<LabeledList.Item label="Available Credits">
|
||||||
{data.stored_cash}
|
{data.stored_cash}
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
<LabeledList.Item label="Investment Variability">
|
<LabeledList.Item label="Investment Variability">
|
||||||
@@ -74,16 +74,11 @@ export const Bepis = (props, context) => {
|
|||||||
<Box>
|
<Box>
|
||||||
<Button
|
<Button
|
||||||
icon="donate"
|
icon="donate"
|
||||||
content="Deposit Credits"
|
content="Deposit Credits and Start"
|
||||||
disabled={data.manual_power === 1
|
disabled={data.manual_power === 1
|
||||||
|| data.silicon_check === 1}
|
|| data.silicon_check === 1}
|
||||||
onClick={() => act('deposit_cash')}
|
onClick={() => act('begin_experiment')}
|
||||||
/>
|
/>
|
||||||
<Button
|
|
||||||
icon="eject"
|
|
||||||
content="Withdraw Credits"
|
|
||||||
disabled={data.manual_power === 1}
|
|
||||||
onClick={() => act('withdraw_cash')} />
|
|
||||||
</Box>
|
</Box>
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
<Grid.Column>
|
<Grid.Column>
|
||||||
@@ -100,12 +95,6 @@ export const Bepis = (props, context) => {
|
|||||||
Please insert more money for future success.
|
Please insert more money for future success.
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
<Box m={1} />
|
|
||||||
<Button
|
|
||||||
icon="microscope"
|
|
||||||
disabled={data.manual_power === 1}
|
|
||||||
onClick={() => act('begin_experiment')}
|
|
||||||
content="Begin Testing" />
|
|
||||||
</Section>
|
</Section>
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
Reference in New Issue
Block a user