Trying to get the sleeper and clockworkslab to work

This commit is contained in:
Artur
2020-05-08 19:50:49 +03:00
parent b2d8e70998
commit ccae3aebd5
6 changed files with 271 additions and 326 deletions

View File

@@ -171,7 +171,7 @@
return FALSE
if(!is_servant_of_ratvar(user))
to_chat(user, "<span class='warning'>The information on [src]'s display shifts rapidly. After a moment, your head begins to pound, and you tear your eyes away.</span>")
if(user.confused || user.dizziness) //We dont want this to stack.
if(user.confused || user.dizziness)
user.confused += 5
user.dizziness += 5
return FALSE
@@ -432,7 +432,6 @@
data["scriptures"] = list()
for(var/s in GLOB.all_scripture)
var/datum/clockwork_scripture/S = GLOB.all_scripture[s]
if(S.tier == selected_scripture) //display only scriptures of the selected tier
var/scripture_color = get_component_color_bright(S.primary_component)
var/list/temp_info = list("name" = "<font color=[scripture_color]><b>[S.name]</b></font>",
"descname" = "<font color=[scripture_color]>([S.descname])</font>",
@@ -452,20 +451,7 @@
/obj/item/clockwork/slab/ui_static_data(mob/user)
var/list/data = list()
switch(selected_scripture) //display info based on selected scripture tier
if(SCRIPTURE_DRIVER)
data["tier_info"] = "<font color=#B18B25><b>These scriptures are permanently unlocked.</b></font>"
if(SCRIPTURE_SCRIPT)
if(SSticker.scripture_states[SCRIPTURE_SCRIPT])
data["tier_info"] = "<font color=#B18B25><b>These scriptures are permanently unlocked.</b></font>"
else
data["tier_info"] = "<font color=#B18B25><i>These scriptures will automatically unlock when the Ark is halfway ready or if [DisplayPower(SCRIPT_UNLOCK_THRESHOLD)] of power is reached.</i></font>"
if(SCRIPTURE_APPLICATION)
if(SSticker.scripture_states[SCRIPTURE_APPLICATION])
data["tier_info"] = "<font color=#B18B25><b>These scriptures are permanently unlocked.</b></font>"
else
data["tier_info"] = "<font color=#B18B25><i>Unlock these optional scriptures by converting another servant or if [DisplayPower(APPLICATION_UNLOCK_THRESHOLD)] of power is reached..</i></font>"
data["selected"] = selected_scripture
data["scripturecolors"] = "<font color=#DAAA18>Scriptures in <b>yellow</b> are related to construction and building.</font><br>\
<font color=#6E001A>Scriptures in <b>red</b> are related to attacking and offense.</font><br>\
@@ -474,7 +460,6 @@
<font color=#DAAA18><i>Scriptures with italicized names are important to success.</i></font>"
generate_all_scripture()
data["recollection"] = recollecting
if(recollecting)
data["recollection_categories"] = GLOB.ratvar_awakens ? list() : list(\
list("name" = "Getting Started", "desc" = "First-time servant? Read this first."), \
list("name" = "Basics", "desc" = "A primer on how to play as a servant."), \

View File

@@ -103,7 +103,7 @@
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "ChemHeater", name, 275, 400, master_ui, state)
ui = new(user, src, ui_key, "ChemHeater", name, 280, 400, master_ui, state)
ui.open()
/obj/machinery/chem_heater/ui_data()

View File

@@ -62,7 +62,7 @@ export const ChemHeater = (props, context) => {
<Fragment>
<Box inline color="label" mr={2}>
{beakerCurrentVolume} / {beakerMaxVolume} units,
{data.beakerCurrentpH} pH
{data.currentpH} pH
</Box>
<Button
icon="eject"

View File

@@ -1,165 +1,124 @@
import { Fragment } from 'inferno';
import { useBackend } from '../backend';
import { Button, LabeledList, Section, Tabs, Input } from '../components';
import { Box, Section, LabeledList, Button, ProgressBar } from '../components';
import { Fragment } from 'inferno';
import { Window } from '../layouts';
export const Sleeper = (props, context) => {
const { act, data } = useBackend(context);
export const ClockworkSlab = props => {
const { act, data } = useBackend(props);
const {
recollection,
rec_text,
recollection_categories,
rec_section,
rec_binds,
open,
occupant = {},
occupied,
} = data;
return (
<Fragment theme="syndicate">
<Section>
<Button
content={recollection ? "Recital" : "Recollection"}
onClick={() => act('toggle')}
/>
</Section>
{!!recollection && (
<Section title="Recollection">
{rec_text}
{recollection_categories.map(categories => {
return (
<Fragment key={categories.name} >
<br />
<Button
content={`${categories.name} - ${categories.desc}`}
onClick={() => act('rec_category', {
"category": categories.name,
})} />
</Fragment>
);
})}
{rec_section}
{rec_binds}
</Section>
)}
{recollection && (
<Fragment>
<Section title="Power">
{data.power}
</Section>
<Section title="Recital">
{data.tier_info}
{data.scripturecolors}
<Tabs>
<Tabs.Tab
key="driver"
label="Driver">
{() => (
<Section>
<LabeledList>
{data.scripture.driver.map(script => {
return (
<LabeledList.Item
key={script.name}
label={script.name}
buttons={(
<Fragment>
<Button
content={`Recite (${script.required} W)`}
onClick={() => act('recite', {
'category': script.name,
})} />
<Button
content={
script.quickbind
? `Unbind ${script.quickbind}`
: 'Quickbind'
const preSortChems = data.chems || [];
const chems = preSortChems.sort((a, b) => {
const descA = a.name.toLowerCase();
const descB = b.name.toLowerCase();
if (descA < descB) {
return -1;
}
onClick={() => act('bind', {
'category': script.name,
})} />
</Fragment>
)}>
{`${script.descname} ${script.invokers}`}
</LabeledList.Item>
);
})}
</LabeledList>
</Section>
)}
</Tabs.Tab>
<Tabs.Tab
key="script"
label="Script">
{() => (
<Section>
<LabeledList>
{data.scripture.script.map(script => {
if (descA > descB) {
return 1;
}
return 0;
});
const damageTypes = [
{
label: 'Brute',
type: 'bruteLoss',
},
{
label: 'Burn',
type: 'fireLoss',
},
{
label: 'Toxin',
type: 'toxLoss',
},
{
label: 'Oxygen',
type: 'oxyLoss',
},
];
return (
<LabeledList.Item
key={script.name}
label={script.name}
buttons={(
<Fragment>
<Button
content={`Recite (${script.required} W)`}
onClick={() => act('recite', {
'category': script.name,
})} />
<Button
content={script.quickbind
? `Unbind ${script.quickbind}`
: 'Quickbind'}
onClick={() => act('bind', {
'category': script.name,
})} />
</Fragment>
<Window>
<Window.Content>
<Section
title={occupant.name ? occupant.name : 'No Occupant'}
minHeight="210px"
buttons={!!occupant.stat && (
<Box
inline
bold
color={occupant.statstate}>
{occupant.stat}
</Box>
)}>
{`${script.descname} ${script.invokers}`}
</LabeledList.Item>
);
})}
</LabeledList>
</Section>
)}
</Tabs.Tab>
<Tabs.Tab
key="application"
label="Application">
{() => (
<Section>
{!!occupied && (
<Fragment>
<ProgressBar
value={occupant.health}
minValue={occupant.minHealth}
maxValue={occupant.maxHealth}
ranges={{
good: [50, Infinity],
average: [0, 50],
bad: [-Infinity, 0],
}} />
<Box mt={1} />
<LabeledList>
{data.scripture.application.map(script => {
return (
{damageTypes.map(type => (
<LabeledList.Item
key={script.name}
label={script.name}
buttons={(
<Fragment>
<Button
content={`Recite (${script.required} W)`}
onClick={() => act('recite', {
'category': script.name,
})} />
<Button
content={script.quickbind
? `Unbind ${script.quickbind}`
: 'Quickbind'}
onClick={() => act('bind', {
'category': script.name,
})} />
</Fragment>
)}>
{`${script.descname} ${script.invokers}`}
key={type.type}
label={type.label}>
<ProgressBar
value={occupant[type.type]}
minValue={0}
maxValue={occupant.maxHealth}
color="bad" />
</LabeledList.Item>
))}
<LabeledList.Item
label="Cells"
color={occupant.cloneLoss ? 'bad' : 'good'}>
{occupant.cloneLoss ? 'Damaged' : 'Healthy'}
</LabeledList.Item>
<LabeledList.Item
label="Brain"
color={occupant.brainLoss ? 'bad' : 'good'}>
{occupant.brainLoss ? 'Abnormal' : 'Healthy'}
</LabeledList.Item>
);
})}
</LabeledList>
</Section>
)}
</Tabs.Tab>
</Tabs>
</Section>
</Fragment>
)}
</Fragment>
</Section>
<Section
title="Medicines"
minHeight="205px"
buttons={(
<Button
icon={open ? 'door-open' : 'door-closed'}
content={open ? 'Open' : 'Closed'}
onClick={() => act('door')} />
)}>
{chems.map(chem => (
<Button
key={chem.name}
icon="flask"
content={chem.name}
disabled={!(occupied && chem.allowed)}
width="140px"
onClick={() => act('inject', {
chem: chem.id,
})}
/>
))}
</Section>
</Window.Content>
</Window>
);
};

View File

@@ -1,10 +1,10 @@
import { useBackend } from '../backend';
import { Box, Section, LabeledList, Button, ProgressBar, Flex, AnimatedNumber } from '../components';
import { Box, Section, LabeledList, Button, ProgressBar, AnimatedNumber } from '../components';
import { Fragment } from 'inferno';
import { Window } from '../layouts';
export const Sleeper = props => {
const { act, data } = useBackend(props);
const {
occupied,
open,
@@ -56,11 +56,10 @@ export const Sleeper = props => {
];
return (
<Fragment>
<Window>
<Window.Content>
<Section
title={occupant.name
? occupant.name
: 'No Occupant'}
title={occupant.name ? occupant.name : 'No Occupant'}
minHeight="210px"
buttons={!!occupant.stat && (
<Box
@@ -178,6 +177,8 @@ export const Sleeper = props => {
/>
))}
</Section>
</Fragment>
</Window.Content>
</Window>
);
};

File diff suppressed because one or more lines are too long