[MIRROR] Civilian Bounties now offer a choice of three different bounties to pick from. (#2510)

* Civilian Bounties now offer a choice of three different bounties to pick from.

* Rebuild tgui

Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: Avunia Takiya <git@takiya.cloud>
This commit is contained in:
SkyratBot
2021-01-06 04:03:28 +01:00
committed by GitHub
co-authored by ArcaneMusic Avunia Takiya
parent 3168dbec8c
commit 6582d77084
4 changed files with 141 additions and 51 deletions
+46 -17
View File
@@ -111,6 +111,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)
@@ -121,6 +147,7 @@
ui = new(user, src, "CivCargoHoldTerminal", name)
ui.open()
/obj/machinery/computer/piratepad_control/civilian/ui_data(mob/user)
var/list/data = list()
data["points"] = points
@@ -129,9 +156,21 @@
data["status_report"] = status_report
data["id_inserted"] = inserted_scan_id
if(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)
@@ -149,23 +188,13 @@
start_sending()
if("stop")
stop_sending()
if("pick")
pick_bounty(params["value"])
if("bounty")
//Here is where cargo bounties are added to the player's bank accounts, then adjusted and scaled into a civilian 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
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/datum/bounty/crumbs = random_bounty(pot_acc.account_job.bounty_types) //It's a good scene from War Dogs (2016).
pot_acc.bounty_timer = world.time
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.
+1
View File
@@ -10,6 +10,7 @@
var/account_id
var/being_dumped = FALSE //pink levels are rising
var/datum/bounty/civilian_bounty
var/list/datum/bounty/bounties
var/bounty_timer = 0
/datum/bank_account/New(newname, job, modifier = 1)
@@ -1,6 +1,6 @@
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) => {
@@ -13,6 +13,9 @@ export const CivCargoHoldTerminal = (props, context) => {
id_bounty_info,
id_bounty_value,
id_bounty_num,
picking,
id_bounty_names,
id_bounty_values,
} = data;
const in_text = "Welcome valued employee.";
const out_text = "To begin, insert your ID into the console.";
@@ -27,7 +30,34 @@ export const CivCargoHoldTerminal = (props, context) => {
color={!id_inserted ? 'default': 'blue'}>
{id_inserted ? in_text : out_text}
</NoticeBox>
<Section title="Cargo Pad">
<Section
title="Cargo Pad"
buttons={(
<Fragment>
<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')} />
</Fragment>
)}>
<LabeledList>
<LabeledList.Item
label="Status"
@@ -39,37 +69,7 @@ export const CivCargoHoldTerminal = (props, context) => {
</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>
@@ -101,3 +101,63 @@ const BountyTextBox = (props, context) => {
</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
icon="check"
color="green"
content={id_bounty_names[0]}
onClick={() => act('pick', { 'value': 1 })}>
<Box fontSize="14px">
Payout: {id_bounty_values[0]}
</Box>
</Button>
</Flex.Item>
<Flex.Item
shrink={0}
grow={0.5}
px={1}>
<Button
fluid
icon="check"
color="green"
content={id_bounty_names[1]}
onClick={() => act('pick', { 'value': 2 })}>
<Box fontSize="14px">
Payout: {id_bounty_values[1]}
</Box>
</Button>
</Flex.Item>
<Flex.Item
shrink={0}
grow={0.5}>
<Button
fluid
icon="check"
color="green"
content={id_bounty_names[2]}
onClick={() => act('pick', { 'value': 3 })}>
<Box fontSize="14px">
Payout: {id_bounty_values[2]}
</Box>
</Button>
</Flex.Item>
</Flex>
</Section>
);
};
File diff suppressed because one or more lines are too long