mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-09 16:07:40 +00:00
port of https://github.com/tgstation/tgstation/pull/55762, credit to ArcaneMusic.
This commit is contained in:
@@ -104,6 +104,32 @@
|
||||
playsound(loc, 'sound/machines/synth_yes.ogg', 30 , TRUE)
|
||||
sending = FALSE
|
||||
|
||||
///Here is where cargo bounties are added to the player's bank accounts, then adjusted and scaled into a civilian bounty.
|
||||
/obj/machinery/computer/piratepad_control/civilian/proc/add_bounties()
|
||||
if(!inserted_scan_id || !inserted_scan_id.registered_account)
|
||||
return
|
||||
var/datum/bank_account/pot_acc = inserted_scan_id.registered_account
|
||||
if(pot_acc.civilian_bounty && ((world.time) < pot_acc.bounty_timer + 5 MINUTES))
|
||||
var/curr_time = round(((pot_acc.bounty_timer + (5 MINUTES))-world.time)/ (1 MINUTES), 0.01)
|
||||
to_chat(usr, "<span class='warning'>Internal ID network spools coiling, try again in [curr_time] minutes!</span>")
|
||||
return FALSE
|
||||
if(!pot_acc.account_job)
|
||||
to_chat(usr, "<span class='warning'>The console smartly rejects your ID card, as it lacks a job assignment!</span>")
|
||||
return FALSE
|
||||
var/list/datum/bounty/crumbs = list(random_bounty(pot_acc.account_job.bounty_types), // We want to offer 2 bounties from their appropriate job catagories
|
||||
random_bounty(pot_acc.account_job.bounty_types), // and 1 guarenteed assistant bounty if the other 2 suck.
|
||||
random_bounty(CIV_JOB_BASIC))
|
||||
pot_acc.bounty_timer = world.time
|
||||
pot_acc.bounties = crumbs
|
||||
|
||||
/obj/machinery/computer/piratepad_control/civilian/proc/pick_bounty(choice)
|
||||
if(inserted_scan_id?.registered_account)
|
||||
playsound(loc, 'sound/machines/synth_no.ogg', 40 , TRUE)
|
||||
return
|
||||
inserted_scan_id.registered_account.civilian_bounty = inserted_scan_id.registered_account.bounties[choice]
|
||||
inserted_scan_id.registered_account.bounties = null
|
||||
return inserted_scan_id.registered_account.civilian_bounty
|
||||
|
||||
/obj/machinery/computer/piratepad_control/civilian/AltClick(mob/user)
|
||||
. = ..()
|
||||
id_eject(user, inserted_scan_id)
|
||||
@@ -122,9 +148,20 @@
|
||||
data["status_report"] = status_report
|
||||
data["id_inserted"] = inserted_scan_id
|
||||
if(inserted_scan_id && inserted_scan_id.registered_account)
|
||||
data["id_bounty_info"] = inserted_scan_id.registered_account.bounty_text()
|
||||
data["id_bounty_num"] = inserted_scan_id.registered_account.bounty_num()
|
||||
data["id_bounty_value"] = inserted_scan_id.registered_account.bounty_value()
|
||||
if(inserted_scan_id.registered_account.civilian_bounty)
|
||||
data["id_bounty_info"] = inserted_scan_id.registered_account.civilian_bounty.description
|
||||
data["id_bounty_num"] = inserted_scan_id.registered_account.bounty_num()
|
||||
data["id_bounty_value"] = inserted_scan_id.registered_account.civilian_bounty.reward
|
||||
if(inserted_scan_id.registered_account.bounties)
|
||||
data["picking"] = TRUE
|
||||
data["id_bounty_names"] = list(inserted_scan_id.registered_account.bounties[1].name,
|
||||
inserted_scan_id.registered_account.bounties[2].name,
|
||||
inserted_scan_id.registered_account.bounties[3].name)
|
||||
data["id_bounty_values"] = list(inserted_scan_id.registered_account.bounties[1].reward,
|
||||
inserted_scan_id.registered_account.bounties[2].reward,
|
||||
inserted_scan_id.registered_account.bounties[3].reward)
|
||||
else
|
||||
data["picking"] = FALSE
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/piratepad_control/civilian/ui_act(action, params)
|
||||
@@ -141,19 +178,13 @@
|
||||
start_sending()
|
||||
if("stop")
|
||||
stop_sending()
|
||||
if("pick")
|
||||
pick_bounty(params["value"])
|
||||
if("bounty")
|
||||
if(!inserted_scan_id || !inserted_scan_id.registered_account)
|
||||
return
|
||||
var/datum/bank_account/pot_acc = inserted_scan_id.registered_account
|
||||
if(pot_acc.civilian_bounty && ((world.time) < pot_acc.bounty_timer + 5 MINUTES))
|
||||
var/curr_time = round(((pot_acc.bounty_timer + (5 MINUTES))-world.time)/ (1 MINUTES), 0.01)
|
||||
to_chat(usr, "<span class='warning'>You already have an incomplete civilian bounty, try again in [curr_time] minutes to replace it!</span>")
|
||||
return FALSE
|
||||
var/datum/bounty/crumbs = random_bounty(pot_acc.account_job.bounty_types)
|
||||
COOLDOWN_START(pot_acc, bounty_timer, 5 MINUTES)
|
||||
pot_acc.civilian_bounty = crumbs
|
||||
add_bounties()
|
||||
if("eject")
|
||||
id_eject(usr, inserted_scan_id)
|
||||
inserted_scan_id = null
|
||||
. = TRUE
|
||||
|
||||
///Self explanitory, holds the ID card inthe console for bounty payout and manipulation.
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
var/being_dumped = FALSE //pink levels are rising
|
||||
var/withdrawDelay = 0
|
||||
var/datum/bounty/civilian_bounty
|
||||
var/list/datum/bounty/bounties
|
||||
COOLDOWN_DECLARE(bounty_timer)
|
||||
|
||||
/datum/bank_account/New(newname, job)
|
||||
|
||||
@@ -264,12 +264,12 @@
|
||||
I.buffer = src
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/piratepad/screwdriver_act_secondary(mob/living/user, obj/item/screwdriver/screw)
|
||||
/obj/machinery/piratepad/screwdriver_act(mob/living/user, obj/item/screwdriver/screw)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return default_deconstruction_screwdriver(user, "lpad-idle-open", "lpad-idle-off", screw)
|
||||
|
||||
/obj/machinery/piratepad/crowbar_act_secondary(mob/living/user, obj/item/tool)
|
||||
/obj/machinery/piratepad/crowbar_act(mob/living/user, obj/item/tool)
|
||||
. = ..()
|
||||
default_deconstruction_crowbar(tool)
|
||||
return TRUE
|
||||
@@ -285,6 +285,8 @@
|
||||
var/datum/export_report/total_report
|
||||
var/sending_timer
|
||||
var/cargo_hold_id
|
||||
///Reference to the specific pad that the control computer is linked up to.
|
||||
var/datum/weakref/pad_ref
|
||||
|
||||
/obj/machinery/computer/piratepad_control/Initialize(mapload)
|
||||
..()
|
||||
|
||||
@@ -1,75 +1,63 @@
|
||||
import { Fragment } from 'inferno';
|
||||
import { useBackend } from '../backend';
|
||||
import { Button, Flex, LabeledList, NoticeBox, Section } from '../components';
|
||||
import { Box, Button, Flex, LabeledList, NoticeBox, Section } from '../components';
|
||||
import { Window } from '../layouts';
|
||||
|
||||
export const CivCargoHoldTerminal = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const {
|
||||
pad,
|
||||
sending,
|
||||
status_report,
|
||||
id_inserted,
|
||||
id_bounty_info,
|
||||
id_bounty_value,
|
||||
id_bounty_num,
|
||||
} = data;
|
||||
const in_text = "Welcome valued employee.";
|
||||
const out_text = "To begin, insert your ID into the console.";
|
||||
const { pad, sending, status_report, id_inserted, id_bounty_info, picking } =
|
||||
data;
|
||||
const in_text = 'Welcome valued employee.';
|
||||
const out_text = 'To begin, insert your ID into the console.';
|
||||
return (
|
||||
<Window resizable
|
||||
width={500}
|
||||
height={375}>
|
||||
<Window width={580} height={375}>
|
||||
<Window.Content scrollable>
|
||||
<Flex>
|
||||
<Flex.Item>
|
||||
<NoticeBox
|
||||
color={!id_inserted ? 'default': 'blue'}>
|
||||
<NoticeBox color={!id_inserted ? 'default' : 'blue'}>
|
||||
{id_inserted ? in_text : out_text}
|
||||
</NoticeBox>
|
||||
<Section title="Cargo Pad">
|
||||
<Section
|
||||
title="Cargo Pad"
|
||||
buttons={
|
||||
<>
|
||||
<Button
|
||||
icon={'sync'}
|
||||
tooltip={'Check Contents'}
|
||||
disabled={!pad || !id_inserted}
|
||||
onClick={() => act('recalc')}
|
||||
/>
|
||||
<Button
|
||||
icon={sending ? 'times' : 'arrow-up'}
|
||||
tooltip={sending ? 'Stop Sending' : 'Send Goods'}
|
||||
selected={sending}
|
||||
disabled={!pad || !id_inserted}
|
||||
onClick={() => act(sending ? 'stop' : 'send')}
|
||||
/>
|
||||
<Button
|
||||
icon={id_bounty_info ? 'recycle' : 'pen'}
|
||||
color={id_bounty_info ? 'green' : 'default'}
|
||||
tooltip={id_bounty_info ? 'Replace Bounty' : 'New Bounty'}
|
||||
disabled={!id_inserted}
|
||||
onClick={() => act('bounty')}
|
||||
/>
|
||||
<Button
|
||||
icon={'download'}
|
||||
content={'Eject ID'}
|
||||
disabled={!id_inserted}
|
||||
onClick={() => act('eject')}
|
||||
/>
|
||||
</>
|
||||
}>
|
||||
<LabeledList>
|
||||
<LabeledList.Item
|
||||
label="Status"
|
||||
color={pad ? "good" : "bad"}>
|
||||
{pad ? "Online" : "Not Found"}
|
||||
<LabeledList.Item label="Status" color={pad ? 'good' : 'bad'}>
|
||||
{pad ? 'Online' : 'Not Found'}
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Cargo Report">
|
||||
{status_report}
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
<BountyTextBox />
|
||||
</Flex.Item>
|
||||
<Flex.Item m={1}>
|
||||
<Fragment>
|
||||
<Button
|
||||
fluid
|
||||
icon={"sync"}
|
||||
content={"Check Contents"}
|
||||
disabled={!pad || !id_inserted}
|
||||
onClick={() => act('recalc')} />
|
||||
<Button
|
||||
fluid
|
||||
icon={sending ? 'times' : 'arrow-up'}
|
||||
content={sending ? "Stop Sending" : "Send Goods"}
|
||||
selected={sending}
|
||||
disabled={!pad || !id_inserted}
|
||||
onClick={() => act(sending ? 'stop' : 'send')} />
|
||||
<Button
|
||||
fluid
|
||||
icon={id_bounty_info ? 'recycle' : 'pen'}
|
||||
color={id_bounty_info ? 'green' : 'default'}
|
||||
content={id_bounty_info ? "Replace Bounty" : "New Bounty"}
|
||||
disabled={!id_inserted}
|
||||
onClick={() => act('bounty')} />
|
||||
<Button
|
||||
fluid
|
||||
icon={'download'}
|
||||
content={"Eject"}
|
||||
disabled={!id_inserted}
|
||||
onClick={() => act('eject')} />
|
||||
</Fragment>
|
||||
{picking ? <BountyPickBox /> : <BountyTextBox />}
|
||||
</Flex.Item>
|
||||
</Flex>
|
||||
</Window.Content>
|
||||
@@ -79,12 +67,8 @@ export const CivCargoHoldTerminal = (props, context) => {
|
||||
|
||||
const BountyTextBox = (props, context) => {
|
||||
const { data } = useBackend(context);
|
||||
const {
|
||||
id_bounty_info,
|
||||
id_bounty_value,
|
||||
id_bounty_num,
|
||||
} = data;
|
||||
const na_text = "N/A, please add a new bounty.";
|
||||
const { id_bounty_info, id_bounty_value, id_bounty_num } = data;
|
||||
const na_text = 'N/A, please add a new bounty.';
|
||||
return (
|
||||
<Section title="Bounty Info">
|
||||
<LabeledList>
|
||||
@@ -92,12 +76,50 @@ const BountyTextBox = (props, context) => {
|
||||
{id_bounty_info ? id_bounty_info : na_text}
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Quantity">
|
||||
{id_bounty_info ? id_bounty_num : "N/A"}
|
||||
{id_bounty_info ? id_bounty_num : 'N/A'}
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Value">
|
||||
{id_bounty_info ? id_bounty_value : "N/A"}
|
||||
{id_bounty_info ? id_bounty_value : 'N/A'}
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
);
|
||||
};
|
||||
|
||||
const BountyPickBox = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const { id_bounty_names, id_bounty_values } = data;
|
||||
return (
|
||||
<Section title="Please Select a Bounty:" textAlign="center">
|
||||
<Flex width="100%" wrap>
|
||||
<Flex.Item shrink={0} grow={0.5}>
|
||||
<Button
|
||||
fluid
|
||||
color="green"
|
||||
content={id_bounty_names[0]}
|
||||
onClick={() => act('pick', { 'value': 1 })}>
|
||||
<Box fontSize="14px">Payout: {id_bounty_values[0]} cr</Box>
|
||||
</Button>
|
||||
</Flex.Item>
|
||||
<Flex.Item shrink={0} grow={0.5} px={1}>
|
||||
<Button
|
||||
fluid
|
||||
color="green"
|
||||
content={id_bounty_names[1]}
|
||||
onClick={() => act('pick', { 'value': 2 })}>
|
||||
<Box fontSize="14px">Payout: {id_bounty_values[1]} cr</Box>
|
||||
</Button>
|
||||
</Flex.Item>
|
||||
<Flex.Item shrink={0} grow={0.5}>
|
||||
<Button
|
||||
fluid
|
||||
color="green"
|
||||
content={id_bounty_names[2]}
|
||||
onClick={() => act('pick', { 'value': 3 })}>
|
||||
<Box fontSize="14px">Payout: {id_bounty_values[2]} cr</Box>
|
||||
</Button>
|
||||
</Flex.Item>
|
||||
</Flex>
|
||||
</Section>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user