Fix research console showing duplicates, make pages more clear

This commit is contained in:
ShadowLarkens
2020-08-29 12:49:45 -07:00
parent f7553f76fc
commit 732b4a9530
4 changed files with 57 additions and 41 deletions

View File

@@ -42,6 +42,9 @@
data["busy_msg"] = busy_msg
data["search"] = search
data["builder_page"] = builder_page
data["design_page"] = design_page
data["info"] = null
if(!locked && !busy_msg)
data["info"] = list(

View File

@@ -43,6 +43,8 @@ research holder datum.
** Master Types **
** Includes all the helper procs and basic tech processing. **
***************************************************************/
GLOBAL_LIST_INIT(tech_levels, list())
GLOBAL_LIST_INIT(design_datums, list())
/datum/research //Holder for all the existing, archived, and known tech. Individual to console.
var/list/known_tech = list() //List of locally known tech. Datum/tech go here.
@@ -50,19 +52,26 @@ research holder datum.
var/list/known_designs = list() //List of available designs.
/datum/research/New() //Insert techs into possible_tech here. Known_tech automatically updated.
if(!LAZYLEN(GLOB.tech_levels))
for(var/T in typesof(/datum/tech) - /datum/tech)
known_tech += new T(src)
for(var/D in typesof(/datum/design) - /datum/design)
possible_designs += new D(src)
// generate_integrated_circuit_designs()
GLOB.tech_levels += new T
if(!LAZYLEN(GLOB.design_datums))
for(var/T in typesof(/datum/design) - /datum/design)
GLOB.design_datums += new T
known_tech = GLOB.tech_levels
possible_designs = GLOB.design_datums
RefreshResearch()
/datum/research/techonly
/datum/research/techonly/New()
for(var/T in typesof(/datum/tech) - /datum/tech)
known_tech += new T(src)
RefreshResearch()
. = ..()
possible_designs = list()
known_designs = list()
/datum/research/techonly/RefreshResearch()
. = ..()
known_designs = list() // Just in case
//Checks to see if design has all the required pre-reqs.
//Input: datum/design; Output: 0/1 (false/true)
@@ -117,21 +126,6 @@ research holder datum.
var/datum/tech/check_tech = T
if(initial(check_tech.id) == ID)
return initial(check_tech.name)
/*
/datum/research/proc/generate_integrated_circuit_designs()
spawn(2 SECONDS) // So the list has time to initialize.
for(var/obj/item/integrated_circuit/IC in all_integrated_circuits)
if(IC.spawn_flags & IC_SPAWN_RESEARCH)
var/datum/design/D = new /datum/design/circuit(src)
D.name = "Custom circuitry \[[IC.category_text]\] ([IC.name])"
D.id = "ic-[lowertext(IC.name)]"
if(IC.origin_tech && IC.origin_tech.len)
D.req_tech = IC.origin_tech.Copy()
else
D.req_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2)
D.build_path = IC.type
possible_designs += D
*/
/***************************************************************
** Technology Datums **

View File

@@ -36,11 +36,26 @@ const ResearchConsoleViewResearch = (props, context) => {
);
};
const PaginationTitle = (props, context) => {
const { data } = useBackend(context);
const {
title,
target,
} = props;
let page = data[target];
if (typeof page === "number") {
return title + " - Page " + (page + 1);
}
return title;
};
const PaginationChevrons = (props, context) => {
const { act } = useBackend(context);
const {
length,
target,
} = props;
@@ -67,14 +82,14 @@ const ResearchConsoleViewDesigns = (props, context) => {
} = data;
return (
<Section title="Researched Technologies & Designs" buttons={
<Section title={<PaginationTitle title="Researched Technologies & Designs" target="design_page" />} buttons={
<Fragment>
<Button
icon="print"
onClick={() => act("print", { print: 2 })}>
Print This Page
</Button>
{<PaginationChevrons length={designs && designs.length} target={"design_page"} /> || null}
{<PaginationChevrons target={"design_page"} /> || null}
</Fragment>
}>
<Input
@@ -213,13 +228,15 @@ const DataDisk = (props, context) => {
if (saveDialog) {
return (
<Section title="Load Design to Disk" buttons={
<Section
title={<PaginationTitle title="Load Design to Disk" target="design_page" />}
buttons={
<Fragment>
<Button
icon="arrow-left"
content="Back"
onClick={() => setSaveDialog(false)} />
{<PaginationChevrons length={designs && designs.length} target={"design_page"} /> || null}
{<PaginationChevrons target={"design_page"} /> || null}
</Fragment>
}>
<Input
@@ -411,8 +428,10 @@ const ResearchConsoleBuildMenu = (props, context) => {
}
return (
<Section title="Designs" buttons={
<PaginationChevrons length={designs && designs.length} target={"builder_page"} />
<Section
title={<PaginationTitle target="builder_page" title="Designs" />}
buttons={
<PaginationChevrons target={"builder_page"} />
}>
<Input
fluid
@@ -483,7 +502,7 @@ const ResearchConsoleConstructor = (props, context) => {
if (!linked || !linked.present) {
return (
<Section title={name}>
No protolathe found.
No {name} found.
</Section>
);
}

File diff suppressed because one or more lines are too long