Skip to content

Commit

Permalink
Req qols. (#53)
Browse files Browse the repository at this point in the history
* Optimizes and declutters the requests panel (#16245)

* Fixes requesting console screen width (#16291)

* Fixes supply tgui bluescreen (#16293)

* Makes large req export histories more readable and less laggy (#16213)

* Further declutters the export history (#16235)

* Update map_blips.dmi

* eh

* Update minimaps.dm

Signed-off-by: Helg2 <[email protected]>

---------

Signed-off-by: Helg2 <[email protected]>
Co-authored-by: Ldip999 <[email protected]>
  • Loading branch information
Helg2 and Ldip999 authored Jul 29, 2024
1 parent 1ae44c7 commit 4d8d93d
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 26 deletions.
12 changes: 8 additions & 4 deletions code/__DEFINES/obj_flags.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// Flags for the obj_flags var on /obj

#define IN_USE (1<<0) // If we have a user using us, this will be set on. We will check if the user has stopped using us, and thus stop updating and LAGGING EVERYTHING!
#define CAN_BE_HIT (1<<1) //can this be bludgeoned by items?
#define PROJ_IGNORE_DENSITY (1<<2) // If non-dense structures can still get hit by projectiles
#define LIGHT_CAN_BE_SHUT (1<<3) // Is sensible to nightfall ability, and its light will be turned off
///If we have a user using us, this will be set on. We will check if the user has stopped using us, and thus stop updating and LAGGING EVERYTHING!
#define IN_USE (1<<0)
///can this be bludgeoned by items?
#define CAN_BE_HIT (1<<1)
///If non-dense structures can still get hit by projectiles
#define PROJ_IGNORE_DENSITY (1<<2)
///Is sensible to nightfall ability, and its light will be turned off
#define LIGHT_CAN_BE_SHUT (1<<3)

//Fire and Acid stuff, for resistance_flags
#define INDESTRUCTIBLE (1<<0) //doesn't take damage
Expand Down
62 changes: 49 additions & 13 deletions code/modules/reqs/supply.dm
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,10 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
var/cost = 0
for(var/P in SO.pack)
var/datum/supply_packs/SP = P
packs += SP.type
if(packs[SP.type])
packs[SP.type] += 1
else
packs[SP.type] = 1
cost += SP.cost
.["requests"] += list(list("id" = SO.id, "orderer" = SO.orderer, "orderer_rank" = SO.orderer_rank, "reason" = SO.reason, "cost" = cost, "packs" = packs, "authed_by" = SO.authorised_by))
.["deniedrequests"] = list()
Expand All @@ -347,7 +350,10 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
var/cost = 0
for(var/P in SO.pack)
var/datum/supply_packs/SP = P
packs += SP.type
if(packs[SP.type])
packs[SP.type] += 1
else
packs[SP.type] = 1
cost += SP.cost
.["deniedrequests"] += list(list("id" = SO.id, "orderer" = SO.orderer, "orderer_rank" = SO.orderer_rank, "reason" = SO.reason, "cost" = cost, "packs" = packs, "authed_by" = SO.authorised_by))
.["approvedrequests"] = list()
Expand All @@ -357,8 +363,12 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
continue
var/list/packs = list()
var/cost = 0
for(var/datum/supply_packs/SP AS in SO.pack)
packs += SP.type
for(var/P in SO.pack)
var/datum/supply_packs/SP = P
if(packs[SP.type])
packs[SP.type] += 1
else
packs[SP.type] = 1
cost += SP.cost
.["approvedrequests"] += list(list("id" = SO.id, "orderer" = SO.orderer, "orderer_rank" = SO.orderer_rank, "reason" = SO.reason, "cost" = cost, "packs" = packs, "authed_by" = SO.authorised_by))
.["awaiting_delivery"] = list()
Expand All @@ -367,16 +377,30 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
var/datum/supply_order/SO = LAZYACCESSASSOC(SSpoints.shoppinglist, faction, key)
.["awaiting_delivery_orders"]++
var/list/packs = list()
for(var/datum/supply_packs/SP AS in SO.pack)
packs += SP.type
.["awaiting_delivery"] += list(list("id" = SO.id, "orderer" = SO.orderer, "orderer_rank" = SO.orderer_rank, "reason" = SO.reason, "packs" = packs, "authed_by" = SO.authorised_by))
var/cost = 0
for(var/P in SO.pack)
var/datum/supply_packs/SP = P
if(packs[SP.type])
packs[SP.type] += 1
else
packs[SP.type] = 1
cost += SP.cost
.["awaiting_delivery"] += list(list("id" = SO.id, "orderer" = SO.orderer, "orderer_rank" = SO.orderer_rank, "reason" = SO.reason, "cost" = cost, "packs" = packs, "authed_by" = SO.authorised_by))
.["export_history"] = list()
var/id = 0
var/lastexport = ""
for(var/datum/export_report/report AS in SSpoints.export_history)
if(report.faction != user.faction)
continue
.["export_history"] += list(list("id" = id, "name" = report.export_name, "points" = report.points))
id++
if(report.points == 0)
continue
if(report.export_name == lastexport)
.["export_history"][id]["amount"] += 1
.["export_history"][id]["total"] += report.points
else
.["export_history"] += list(list("id" = id, "name" = report.export_name, "points" = report.points, "amount" = 1, total = report.points))
id++
lastexport = report.export_name
.["shopping_history"] = list()
for(var/datum/supply_order/SO AS in SSpoints.shopping_history)
if(SO.faction != user.faction)
Expand All @@ -385,7 +409,10 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
var/cost = 0
for(var/P in SO.pack)
var/datum/supply_packs/SP = P
packs += SP.type
if(packs[SP.type])
packs[SP.type] += 1
else
packs[SP.type] = 1
cost += SP.cost
.["shopping_history"] += list(list("id" = SO.id, "orderer" = SO.orderer, "orderer_rank" = SO.orderer_rank, "reason" = SO.reason, "cost" = cost, "packs" = packs, "authed_by" = SO.authorised_by))
.["shopping_list_cost"] = 0
Expand Down Expand Up @@ -542,7 +569,10 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
var/cost = 0
for(var/P in SO.pack)
var/datum/supply_packs/SP = P
packs += SP.type
if(packs[SP.type])
packs[SP.type] += 1
else
packs[SP.type] = 1
cost += SP.cost
.["requests"] += list(list("id" = SO.id, "orderer" = SO.orderer, "orderer_rank" = SO.orderer_rank, "reason" = SO.reason, "cost" = cost, "packs" = packs, "authed_by" = SO.authorised_by))
.["deniedrequests"] = list()
Expand All @@ -554,7 +584,10 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
var/cost = 0
for(var/P in SO.pack)
var/datum/supply_packs/SP = P
packs += SP.type
if(packs[SP.type])
packs[SP.type] += 1
else
packs[SP.type] = 1
cost += SP.cost
.["deniedrequests"] += list(list("id" = SO.id, "orderer" = SO.orderer, "orderer_rank" = SO.orderer_rank, "reason" = SO.reason, "cost" = cost, "packs" = packs, "authed_by" = SO.authorised_by))
.["approvedrequests"] = list()
Expand All @@ -566,7 +599,10 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
var/cost = 0
for(var/P in SO.pack)
var/datum/supply_packs/SP = P
packs += SP.type
if(packs[SP.type])
packs[SP.type] += 1
else
packs[SP.type] = 1
cost += SP.cost
.["approvedrequests"] += list(list("id" = SO.id, "orderer" = SO.orderer, "orderer_rank" = SO.orderer_rank, "reason" = SO.reason, "cost" = cost, "packs" = packs, "authed_by" = SO.authorised_by))
.["awaiting_delivery"] = list()
Expand Down
Binary file modified icons/UI_Icons/map_blips.dmi
Binary file not shown.
24 changes: 15 additions & 9 deletions tgui/packages/tgui/interfaces/Cargo.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const Cargo = (props, context) => {
: null;

return (
<Window width={900} height={700}>
<Window width={1100} height={700}>
<Flex height="650px" align="stretch">
<Flex.Item width="280px">
<Menu />
Expand Down Expand Up @@ -84,7 +84,9 @@ const Exports = (props, context) => {
{export_history.map((exp) => (
<Table.Row key={exp.id}>
<Table.Cell>{exp.name}</Table.Cell>
<Table.Cell>{exp.points} points</Table.Cell>
<Table.Cell>
{exp.amount} x {exp.points} points ({exp.total})
</Table.Cell>
</Table.Row>
))}
</Table>
Expand Down Expand Up @@ -312,18 +314,21 @@ const Packs = (props, context) => {
const { act, data } = useBackend(context);
const { packs } = props;

return packs.map((pack) => <Pack pack={pack} key={pack} />);
return Object.keys(packs).map((pack) => (
<Pack pack={pack} key={pack} amount={packs[pack]} />
));
};

const Pack = (props, context) => {
const { act, data } = useBackend(context);
const { pack } = props;
const { pack, amount } = props;
const { supplypackscontents } = data;
const { name, cost, contains } = supplypackscontents[pack];

return !!contains && contains.constructor === Object ? (
<Collapsible
color="gray"
title={<PackName cost={cost} name={name} pl={0} />}>
title={<PackName cost={cost} name={name} pl={0} amount={amount} />}>
<Table>
<PackContents contains={contains} />
</Table>
Expand All @@ -334,12 +339,13 @@ const Pack = (props, context) => {
};

const PackName = (props, context) => {
const { cost, name, pl } = props;
const { cost, name, pl, amount } = props;

return (
<Box inline pl={pl}>
<Box textAlign="right" inline width="65px">
{cost} points
<Box textAlign="right" inline width="140px">
{amount ? amount + 'x' : ''}
{cost} points {amount ? '(' + amount * cost + ')' : ''}
</Box>
<Box width="15px" inline />
<Box inline>{name}</Box>
Expand Down Expand Up @@ -583,7 +589,7 @@ export const CargoRequest = (props, context) => {
: null;

return (
<Window width={900} height={700}>
<Window width={1100} height={700}>
<Flex height="650px" align="stretch">
<Flex.Item width="280px">
<Menu readOnly={1} />
Expand Down

0 comments on commit 4d8d93d

Please sign in to comment.