mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-11 10:22:13 +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)
|
playsound(loc, 'sound/machines/synth_yes.ogg', 30 , TRUE)
|
||||||
sending = FALSE
|
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)
|
/obj/machinery/computer/piratepad_control/civilian/AltClick(mob/user)
|
||||||
. = ..()
|
. = ..()
|
||||||
id_eject(user, inserted_scan_id)
|
id_eject(user, inserted_scan_id)
|
||||||
@@ -122,9 +148,20 @@
|
|||||||
data["status_report"] = status_report
|
data["status_report"] = status_report
|
||||||
data["id_inserted"] = inserted_scan_id
|
data["id_inserted"] = inserted_scan_id
|
||||||
if(inserted_scan_id && inserted_scan_id.registered_account)
|
if(inserted_scan_id && inserted_scan_id.registered_account)
|
||||||
data["id_bounty_info"] = inserted_scan_id.registered_account.bounty_text()
|
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_num"] = inserted_scan_id.registered_account.bounty_num()
|
||||||
data["id_bounty_value"] = inserted_scan_id.registered_account.bounty_value()
|
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
|
return data
|
||||||
|
|
||||||
/obj/machinery/computer/piratepad_control/civilian/ui_act(action, params)
|
/obj/machinery/computer/piratepad_control/civilian/ui_act(action, params)
|
||||||
@@ -141,19 +178,13 @@
|
|||||||
start_sending()
|
start_sending()
|
||||||
if("stop")
|
if("stop")
|
||||||
stop_sending()
|
stop_sending()
|
||||||
|
if("pick")
|
||||||
|
pick_bounty(params["value"])
|
||||||
if("bounty")
|
if("bounty")
|
||||||
if(!inserted_scan_id || !inserted_scan_id.registered_account)
|
add_bounties()
|
||||||
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
|
|
||||||
if("eject")
|
if("eject")
|
||||||
id_eject(usr, inserted_scan_id)
|
id_eject(usr, inserted_scan_id)
|
||||||
|
inserted_scan_id = null
|
||||||
. = TRUE
|
. = TRUE
|
||||||
|
|
||||||
///Self explanitory, holds the ID card inthe console for bounty payout and manipulation.
|
///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/being_dumped = FALSE //pink levels are rising
|
||||||
var/withdrawDelay = 0
|
var/withdrawDelay = 0
|
||||||
var/datum/bounty/civilian_bounty
|
var/datum/bounty/civilian_bounty
|
||||||
|
var/list/datum/bounty/bounties
|
||||||
COOLDOWN_DECLARE(bounty_timer)
|
COOLDOWN_DECLARE(bounty_timer)
|
||||||
|
|
||||||
/datum/bank_account/New(newname, job)
|
/datum/bank_account/New(newname, job)
|
||||||
|
|||||||
@@ -264,12 +264,12 @@
|
|||||||
I.buffer = src
|
I.buffer = src
|
||||||
return TRUE
|
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(!.)
|
if(!.)
|
||||||
return default_deconstruction_screwdriver(user, "lpad-idle-open", "lpad-idle-off", screw)
|
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)
|
default_deconstruction_crowbar(tool)
|
||||||
return TRUE
|
return TRUE
|
||||||
@@ -285,6 +285,8 @@
|
|||||||
var/datum/export_report/total_report
|
var/datum/export_report/total_report
|
||||||
var/sending_timer
|
var/sending_timer
|
||||||
var/cargo_hold_id
|
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)
|
/obj/machinery/computer/piratepad_control/Initialize(mapload)
|
||||||
..()
|
..()
|
||||||
|
|||||||
@@ -1,75 +1,63 @@
|
|||||||
import { Fragment } from 'inferno';
|
|
||||||
import { useBackend } from '../backend';
|
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';
|
import { Window } from '../layouts';
|
||||||
|
|
||||||
export const CivCargoHoldTerminal = (props, context) => {
|
export const CivCargoHoldTerminal = (props, context) => {
|
||||||
const { act, data } = useBackend(context);
|
const { act, data } = useBackend(context);
|
||||||
const {
|
const { pad, sending, status_report, id_inserted, id_bounty_info, picking } =
|
||||||
pad,
|
data;
|
||||||
sending,
|
const in_text = 'Welcome valued employee.';
|
||||||
status_report,
|
const out_text = 'To begin, insert your ID into the console.';
|
||||||
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.";
|
|
||||||
return (
|
return (
|
||||||
<Window resizable
|
<Window width={580} height={375}>
|
||||||
width={500}
|
|
||||||
height={375}>
|
|
||||||
<Window.Content scrollable>
|
<Window.Content scrollable>
|
||||||
<Flex>
|
<Flex>
|
||||||
<Flex.Item>
|
<Flex.Item>
|
||||||
<NoticeBox
|
<NoticeBox color={!id_inserted ? 'default' : 'blue'}>
|
||||||
color={!id_inserted ? 'default': 'blue'}>
|
|
||||||
{id_inserted ? in_text : out_text}
|
{id_inserted ? in_text : out_text}
|
||||||
</NoticeBox>
|
</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>
|
||||||
<LabeledList.Item
|
<LabeledList.Item label="Status" color={pad ? 'good' : 'bad'}>
|
||||||
label="Status"
|
{pad ? 'Online' : 'Not Found'}
|
||||||
color={pad ? "good" : "bad"}>
|
|
||||||
{pad ? "Online" : "Not Found"}
|
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
<LabeledList.Item label="Cargo Report">
|
<LabeledList.Item label="Cargo Report">
|
||||||
{status_report}
|
{status_report}
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
</LabeledList>
|
</LabeledList>
|
||||||
</Section>
|
</Section>
|
||||||
<BountyTextBox />
|
{picking ? <BountyPickBox /> : <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>
|
|
||||||
</Flex.Item>
|
</Flex.Item>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Window.Content>
|
</Window.Content>
|
||||||
@@ -79,12 +67,8 @@ export const CivCargoHoldTerminal = (props, context) => {
|
|||||||
|
|
||||||
const BountyTextBox = (props, context) => {
|
const BountyTextBox = (props, context) => {
|
||||||
const { data } = useBackend(context);
|
const { data } = useBackend(context);
|
||||||
const {
|
const { id_bounty_info, id_bounty_value, id_bounty_num } = data;
|
||||||
id_bounty_info,
|
const na_text = 'N/A, please add a new bounty.';
|
||||||
id_bounty_value,
|
|
||||||
id_bounty_num,
|
|
||||||
} = data;
|
|
||||||
const na_text = "N/A, please add a new bounty.";
|
|
||||||
return (
|
return (
|
||||||
<Section title="Bounty Info">
|
<Section title="Bounty Info">
|
||||||
<LabeledList>
|
<LabeledList>
|
||||||
@@ -92,12 +76,50 @@ const BountyTextBox = (props, context) => {
|
|||||||
{id_bounty_info ? id_bounty_info : na_text}
|
{id_bounty_info ? id_bounty_info : na_text}
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
<LabeledList.Item label="Quantity">
|
<LabeledList.Item label="Quantity">
|
||||||
{id_bounty_info ? id_bounty_num : "N/A"}
|
{id_bounty_info ? id_bounty_num : 'N/A'}
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
<LabeledList.Item label="Value">
|
<LabeledList.Item label="Value">
|
||||||
{id_bounty_info ? id_bounty_value : "N/A"}
|
{id_bounty_info ? id_bounty_value : 'N/A'}
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
</LabeledList>
|
</LabeledList>
|
||||||
</Section>
|
</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