mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Fix research console showing duplicates, make pages more clear
This commit is contained in:
@@ -42,6 +42,9 @@
|
|||||||
data["busy_msg"] = busy_msg
|
data["busy_msg"] = busy_msg
|
||||||
data["search"] = search
|
data["search"] = search
|
||||||
|
|
||||||
|
data["builder_page"] = builder_page
|
||||||
|
data["design_page"] = design_page
|
||||||
|
|
||||||
data["info"] = null
|
data["info"] = null
|
||||||
if(!locked && !busy_msg)
|
if(!locked && !busy_msg)
|
||||||
data["info"] = list(
|
data["info"] = list(
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ research holder datum.
|
|||||||
** Master Types **
|
** Master Types **
|
||||||
** Includes all the helper procs and basic tech processing. **
|
** 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.
|
/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.
|
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.
|
var/list/known_designs = list() //List of available designs.
|
||||||
|
|
||||||
/datum/research/New() //Insert techs into possible_tech here. Known_tech automatically updated.
|
/datum/research/New() //Insert techs into possible_tech here. Known_tech automatically updated.
|
||||||
for(var/T in typesof(/datum/tech) - /datum/tech)
|
if(!LAZYLEN(GLOB.tech_levels))
|
||||||
known_tech += new T(src)
|
for(var/T in typesof(/datum/tech) - /datum/tech)
|
||||||
for(var/D in typesof(/datum/design) - /datum/design)
|
GLOB.tech_levels += new T
|
||||||
possible_designs += new D(src)
|
if(!LAZYLEN(GLOB.design_datums))
|
||||||
// generate_integrated_circuit_designs()
|
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()
|
RefreshResearch()
|
||||||
|
|
||||||
/datum/research/techonly
|
/datum/research/techonly
|
||||||
|
|
||||||
/datum/research/techonly/New()
|
/datum/research/techonly/New()
|
||||||
for(var/T in typesof(/datum/tech) - /datum/tech)
|
. = ..()
|
||||||
known_tech += new T(src)
|
possible_designs = list()
|
||||||
RefreshResearch()
|
known_designs = list()
|
||||||
|
|
||||||
|
/datum/research/techonly/RefreshResearch()
|
||||||
|
. = ..()
|
||||||
|
known_designs = list() // Just in case
|
||||||
|
|
||||||
//Checks to see if design has all the required pre-reqs.
|
//Checks to see if design has all the required pre-reqs.
|
||||||
//Input: datum/design; Output: 0/1 (false/true)
|
//Input: datum/design; Output: 0/1 (false/true)
|
||||||
@@ -117,21 +126,6 @@ research holder datum.
|
|||||||
var/datum/tech/check_tech = T
|
var/datum/tech/check_tech = T
|
||||||
if(initial(check_tech.id) == ID)
|
if(initial(check_tech.id) == ID)
|
||||||
return initial(check_tech.name)
|
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 **
|
** Technology Datums **
|
||||||
|
|||||||
@@ -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 PaginationChevrons = (props, context) => {
|
||||||
const { act } = useBackend(context);
|
const { act } = useBackend(context);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
length,
|
|
||||||
target,
|
target,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
@@ -67,14 +82,14 @@ const ResearchConsoleViewDesigns = (props, context) => {
|
|||||||
} = data;
|
} = data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Section title="Researched Technologies & Designs" buttons={
|
<Section title={<PaginationTitle title="Researched Technologies & Designs" target="design_page" />} buttons={
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<Button
|
<Button
|
||||||
icon="print"
|
icon="print"
|
||||||
onClick={() => act("print", { print: 2 })}>
|
onClick={() => act("print", { print: 2 })}>
|
||||||
Print This Page
|
Print This Page
|
||||||
</Button>
|
</Button>
|
||||||
{<PaginationChevrons length={designs && designs.length} target={"design_page"} /> || null}
|
{<PaginationChevrons target={"design_page"} /> || null}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
}>
|
}>
|
||||||
<Input
|
<Input
|
||||||
@@ -213,15 +228,17 @@ const DataDisk = (props, context) => {
|
|||||||
|
|
||||||
if (saveDialog) {
|
if (saveDialog) {
|
||||||
return (
|
return (
|
||||||
<Section title="Load Design to Disk" buttons={
|
<Section
|
||||||
<Fragment>
|
title={<PaginationTitle title="Load Design to Disk" target="design_page" />}
|
||||||
<Button
|
buttons={
|
||||||
icon="arrow-left"
|
<Fragment>
|
||||||
content="Back"
|
<Button
|
||||||
onClick={() => setSaveDialog(false)} />
|
icon="arrow-left"
|
||||||
{<PaginationChevrons length={designs && designs.length} target={"design_page"} /> || null}
|
content="Back"
|
||||||
</Fragment>
|
onClick={() => setSaveDialog(false)} />
|
||||||
}>
|
{<PaginationChevrons target={"design_page"} /> || null}
|
||||||
|
</Fragment>
|
||||||
|
}>
|
||||||
<Input
|
<Input
|
||||||
fluid
|
fluid
|
||||||
placeholder="Search for..."
|
placeholder="Search for..."
|
||||||
@@ -411,9 +428,11 @@ const ResearchConsoleBuildMenu = (props, context) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Section title="Designs" buttons={
|
<Section
|
||||||
<PaginationChevrons length={designs && designs.length} target={"builder_page"} />
|
title={<PaginationTitle target="builder_page" title="Designs" />}
|
||||||
}>
|
buttons={
|
||||||
|
<PaginationChevrons target={"builder_page"} />
|
||||||
|
}>
|
||||||
<Input
|
<Input
|
||||||
fluid
|
fluid
|
||||||
placeholder="Search for..."
|
placeholder="Search for..."
|
||||||
@@ -483,7 +502,7 @@ const ResearchConsoleConstructor = (props, context) => {
|
|||||||
if (!linked || !linked.present) {
|
if (!linked || !linked.present) {
|
||||||
return (
|
return (
|
||||||
<Section title={name}>
|
<Section title={name}>
|
||||||
No protolathe found.
|
No {name} found.
|
||||||
</Section>
|
</Section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user