Merge pull request #15940 from squib-bot/fermichemwork

Re-Adding Bounty Consoles
This commit is contained in:
Timothy Teakettle
2023-02-11 00:06:37 +00:00
committed by GitHub
11 changed files with 349 additions and 2 deletions
+13 -1
View File
@@ -30029,6 +30029,9 @@
/obj/machinery/keycard_auth{
pixel_y = 25
},
/obj/machinery/computer/bounty{
dir = 4
},
/turf/open/floor/plasteel,
/area/cargo/qm)
"bvG" = (
@@ -54946,6 +54949,15 @@
"gjl" = (
/turf/closed/wall,
/area/cargo/warehouse)
"gkP" = (
/obj/machinery/atmospherics/pipe/simple/supply/hidden{
dir = 4
},
/obj/machinery/computer/bounty{
dir = 8
},
/turf/open/floor/plasteel,
/area/cargo/office)
"gnf" = (
/obj/structure/disposalpipe/segment{
dir = 4
@@ -89992,7 +90004,7 @@ bnG
bnz
bpA
bbR
bkM
gkP
jlm
bud
eyM
@@ -115731,6 +115731,9 @@
/obj/effect/turf_decal/tile/brown{
dir = 4
},
/obj/machinery/computer/bounty{
dir = 8
},
/turf/open/floor/plasteel,
/area/cargo/qm)
"twd" = (
@@ -121630,6 +121633,9 @@
/obj/effect/turf_decal/tile/brown{
dir = 8
},
/obj/machinery/computer/bounty{
dir = 8
},
/turf/open/floor/plasteel,
/area/cargo/office)
"vEI" = (
@@ -65483,6 +65483,7 @@
/obj/effect/turf_decal/tile/brown{
dir = 4
},
/obj/machinery/computer/bounty,
/turf/open/floor/plasteel,
/area/cargo/qm)
"mSd" = (
@@ -72113,6 +72114,7 @@
/obj/effect/turf_decal/tile/brown{
dir = 8
},
/obj/machinery/computer/bounty,
/turf/open/floor/plasteel,
/area/cargo/office)
"qBq" = (
@@ -6773,6 +6773,9 @@
/obj/effect/turf_decal/tile/brown{
dir = 8
},
/obj/machinery/computer/bounty{
dir = 4
},
/turf/open/floor/plasteel,
/area/cargo/storage)
"amw" = (
@@ -21132,6 +21132,9 @@
/obj/machinery/status_display/supply{
pixel_x = -32
},
/obj/machinery/computer/bounty{
dir = 4
},
/turf/open/floor/plasteel,
/area/cargo/office)
"aZk" = (
@@ -22999,6 +23002,9 @@
/obj/effect/turf_decal/tile/brown{
dir = 4
},
/obj/machinery/computer/bounty{
dir = 8
},
/turf/open/floor/plasteel,
/area/cargo/qm)
"bdI" = (
@@ -581,6 +581,10 @@
name = "Supply Request Console (Computer Board)"
build_path = /obj/machinery/computer/cargo/request
/obj/item/circuitboard/computer/bounty
name = "Nanotrasen Bounty Console (Computer Board)"
build_path = /obj/machinery/computer/bounty
/obj/item/circuitboard/computer/ferry
name = "Transport Ferry (Computer Board)"
icon_state = "supply"
+67
View File
@@ -0,0 +1,67 @@
#define PRINTER_TIMEOUT 10
/obj/machinery/computer/bounty
name = "\improper Nanotrasen bounty console"
desc = "Used to check and claim bounties offered by Nanotrasen"
icon_screen = "bounty"
circuit = /obj/item/circuitboard/computer/bounty
light_color = "#E2853D"//orange
var/printer_ready = 0 //cooldown var
var/static/datum/bank_account/cargocash
/obj/machinery/computer/bounty/Initialize(mapload)
. = ..()
printer_ready = world.time + PRINTER_TIMEOUT
cargocash = SSeconomy.get_dep_account(ACCOUNT_CAR)
/obj/machinery/computer/bounty/proc/print_paper()
new /obj/item/paper/bounty_printout(loc)
/obj/item/paper/bounty_printout
name = "paper - Bounties"
/obj/item/paper/bounty_printout/Initialize(mapload)
. = ..()
info = "<h2>Nanotrasen Cargo Bounties</h2></br>"
update_icon()
for(var/datum/bounty/B in GLOB.bounties_list)
if(B.claimed)
continue
info += {"<h3>[B.name]</h3>
<ul><li>Reward: [B.reward_string()]</li>
<li>Completed: [B.completion_string()]</li></ul>"}
/obj/machinery/computer/bounty/ui_interact(mob/user, datum/tgui/ui)
if(!GLOB.bounties_list.len)
setup_bounties()
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "CargoBountyConsole", name)
ui.open()
/obj/machinery/computer/bounty/ui_data(mob/user)
var/list/data = list()
var/list/bountyinfo = list()
for(var/datum/bounty/B in GLOB.bounties_list)
bountyinfo += list(list("name" = B.name, "description" = B.description, "reward_string" = B.reward_string(), "completion_string" = B.completion_string() , "claimed" = B.claimed, "can_claim" = B.can_claim(), "priority" = B.high_priority, "bounty_ref" = REF(B)))
data["stored_cash"] = cargocash.account_balance
data["bountydata"] = bountyinfo
return data
/obj/machinery/computer/bounty/ui_act(action,params)
if(..())
return
switch(action)
if("ClaimBounty")
var/datum/bounty/cashmoney = locate(params["bounty"]) in GLOB.bounties_list
if(cashmoney)
cashmoney.claim()
return TRUE
if("Print")
if(printer_ready < world.time)
printer_ready = world.time + PRINTER_TIMEOUT
print_paper()
return
@@ -17,7 +17,15 @@
build_path = /obj/item/circuitboard/computer/cargo/request
category = list("Computer Boards")
departmental_flags = DEPARTMENTAL_FLAG_CARGO
/datum/design/board/bounty
name = "Computer Design (Bounty Console)"
desc = "Allows for the construction of circuit boards used to build a Bounty Console."
id = "bounty"
build_path = /obj/item/circuitboard/computer/bounty
category = list("Computer Boards")
departmental_flags = DEPARTMENTAL_FLAG_CARGO
/datum/design/board/mining
name = "Computer Design (Outpost Status Display)"
desc = "Allows for the construction of circuit boards used to build an outpost status display console."
+1
View File
@@ -1945,6 +1945,7 @@
#include "code\modules\buildmode\submodes\throwing.dm"
#include "code\modules\buildmode\submodes\variable_edit.dm"
#include "code\modules\cargo\bounty.dm"
#include "code\modules\cargo\bounty_console.dm"
#include "code\modules\cargo\centcom_podlauncher.dm"
#include "code\modules\cargo\console.dm"
#include "code\modules\cargo\coupon.dm"
@@ -0,0 +1,119 @@
import { useBackend } from '../backend';
import { AnimatedNumber, Box, Button, Section, Table } from '../components';
import { formatMoney } from '../format';
import { Window } from '../layouts';
export const CargoBountyConsole = (props, context) => {
const { act, data } = useBackend(context);
const {
bountydata = [],
} = data;
return (
<Window
width={750}
height={600}
resizable>
<Window.Content scrollable>
<Section
title={<BountyHeader />}
buttons={(
<Button
icon="print"
content="Print Bounty List"
onClick={() => act('Print')} />
)}>
<Table border>
<Table.Row
bold
italic
color="label"
fontSize={1.25}>
<Table.Cell p={1} textAlign="center">
Bounty Object
</Table.Cell>
<Table.Cell p={1} textAlign="center">
Description
</Table.Cell>
<Table.Cell p={1} textAlign="center">
Progress
</Table.Cell>
<Table.Cell p={1} textAlign="center">
Value
</Table.Cell>
<Table.Cell p={1} textAlign="center">
Claim
</Table.Cell>
</Table.Row>
{bountydata.map(bounty => (
<Table.Row
key={bounty.name}
backgroundColor={bounty.priority === 1
? 'rgba(252, 152, 3, 0.25)'
: ''}>
<Table.Cell bold p={1}>
{bounty.name}
</Table.Cell>
<Table.Cell
italic
textAlign="center"
p={1}>
{bounty.description}
</Table.Cell>
<Table.Cell
bold
p={1}
textAlign="center">
{bounty.priority === 1
? <Box>High Priority</Box>
: ""}
{bounty.completion_string}
</Table.Cell>
<Table.Cell
bold
p={1}
textAlign="center">
{bounty.reward_string}
</Table.Cell>
<Table.Cell
bold
p={1}>
<Button
fluid
textAlign="center"
icon={bounty.claimed === 1
? "check"
: ""}
content={bounty.claimed === 1
? "Claimed"
: "Claim"}
disabled={bounty.claimed === 1}
color={bounty.can_claim === 1
? 'green'
: 'red'}
onClick={() => act('ClaimBounty', {
bounty: bounty.bounty_ref,
})} />
</Table.Cell>
</Table.Row>
))}
</Table>
</Section>
</Window.Content>
</Window>
);
};
const BountyHeader = (props, context) => {
const { act, data } = useBackend(context);
const {
stored_cash,
} = data;
return (
<Box inline bold>
<AnimatedNumber
value={stored_cash}
format={value => formatMoney(value)} />
{' credits'}
</Box>
);
};
@@ -0,0 +1,119 @@
import { useBackend } from '../backend';
import { AnimatedNumber, Box, Button, Section, Table } from '../components';
import { formatMoney } from '../format';
import { NtosWindow } from '../layouts';
export const NtosBountyConsole = (props, context) => {
const { act, data } = useBackend(context);
const {
bountydata = [],
} = data;
return (
<NtosWindow
width={750}
height={600}
resizable>
<NtosWindow.Content scrollable>
<Section
title={<BountyHeader />}
buttons={(
<Button
icon="print"
content="Print Bounty List"
onClick={() => act('Print')} />
)}>
<Table border>
<Table.Row
bold
italic
color="label"
fontSize={1.25}>
<Table.Cell p={1} textAlign="center">
Bounty Object
</Table.Cell>
<Table.Cell p={1} textAlign="center">
Description
</Table.Cell>
<Table.Cell p={1} textAlign="center">
Progress
</Table.Cell>
<Table.Cell p={1} textAlign="center">
Value
</Table.Cell>
<Table.Cell p={1} textAlign="center">
Claim
</Table.Cell>
</Table.Row>
{bountydata.map(bounty => (
<Table.Row
key={bounty.name}
backgroundColor={bounty.priority === 1
? 'rgba(252, 152, 3, 0.25)'
: ''}>
<Table.Cell bold p={1}>
{bounty.name}
</Table.Cell>
<Table.Cell
italic
textAlign="center"
p={1}>
{bounty.description}
</Table.Cell>
<Table.Cell
bold
p={1}
textAlign="center">
{bounty.priority === 1
? <Box>High Priority</Box>
: ""}
{bounty.completion_string}
</Table.Cell>
<Table.Cell
bold
p={1}
textAlign="center">
{bounty.reward_string}
</Table.Cell>
<Table.Cell
bold
p={1}>
<Button
fluid
textAlign="center"
icon={bounty.claimed === 1
? "check"
: ""}
content={bounty.claimed === 1
? "Claimed"
: "Claim"}
disabled={bounty.claimed === 1}
color={bounty.can_claim === 1
? 'green'
: 'red'}
onClick={() => act('ClaimBounty', {
bounty: bounty.bounty_ref,
})} />
</Table.Cell>
</Table.Row>
))}
</Table>
</Section>
</NtosWindow.Content>
</NtosWindow>
);
};
const BountyHeader = (props, context) => {
const { act, data } = useBackend(context);
const {
stored_cash,
} = data;
return (
<Box inline bold>
<AnimatedNumber
value={stored_cash}
format={value => formatMoney(value)} />
{' credits'}
</Box>
);
};