[MIRROR] Stacking machine input, output rotation [MDB IGNORE] (#18076)

* Stacking machine input, output rotation (#71870)

All stacking machines spawn var edited. You could build one, but you
couldn't select the directions.

Now you can rebuild a stacking machine and rotate input/output as it was
before destruction.

* Stacking machine input, output rotation

Co-authored-by: Andrew <mt.forspam@gmail.com>
This commit is contained in:
SkyratBot
2022-12-11 18:54:39 +00:00
committed by GitHub
co-authored by Andrew
parent 7a62b0427b
commit 9133bb81c4
2 changed files with 55 additions and 2 deletions
+14
View File
@@ -43,6 +43,8 @@
data["contents"] = list()
if(machine)
data["stacking_amount"] = machine.stack_amt
data["input_direction"] = dir2text(machine.input_dir)
data["output_direction"] = dir2text(machine.output_dir)
for(var/stack_type in machine.stack_list)
var/obj/item/stack/sheet/stored_sheet = machine.stack_list[stack_type]
if(stored_sheet.amount <= 0)
@@ -69,6 +71,10 @@
inp.amount = 0
machine.unload_mineral(out)
return TRUE
if("rotate")
var/input = text2num(params["input"])
machine.rotate(input)
return TRUE
/**********************Mineral stacking unit**************************/
@@ -118,6 +124,14 @@
to_chat(user, span_notice("You link [src] to the console in [M]'s buffer."))
return TRUE
/obj/machinery/mineral/stacking_machine/proc/rotate(input)
if (input)
input_dir = turn(input_dir, 90)
else
output_dir = turn(output_dir, 90)
if (input_dir == output_dir)
rotate(input)
/obj/machinery/mineral/stacking_machine/proc/process_sheet(obj/item/stack/sheet/inp)
if(QDELETED(inp))
return
@@ -1,5 +1,5 @@
import { useBackend } from '../backend';
import { Button, LabeledList, NoticeBox, Section } from '../components';
import { Box, Button, LabeledList, NoticeBox, Section } from '../components';
import { Window } from '../layouts';
export const StackingConsole = (props, context) => {
@@ -20,7 +20,12 @@ export const StackingConsole = (props, context) => {
export const StackingConsoleContent = (props, context) => {
const { act, data } = useBackend(context);
const { stacking_amount, contents = [] } = data;
const {
input_direction,
output_direction,
stacking_amount,
contents = [],
} = data;
return (
<>
<Section>
@@ -28,6 +33,40 @@ export const StackingConsoleContent = (props, context) => {
<LabeledList.Item label="Stacking Amount">
{stacking_amount || 'Unknown'}
</LabeledList.Item>
<LabeledList.Item
label="Input"
buttons={
<Button
icon="rotate"
content="Rotate"
onClick={() =>
act('rotate', {
input: 1,
})
}
/>
}>
<Box style={{ 'text-transform': 'capitalize' }}>
{input_direction}
</Box>
</LabeledList.Item>
<LabeledList.Item
label="Output"
buttons={
<Button
icon="rotate"
content="Rotate"
onClick={() =>
act('rotate', {
input: 0,
})
}
/>
}>
<Box style={{ 'text-transform': 'capitalize' }}>
{output_direction}
</Box>
</LabeledList.Item>
</LabeledList>
</Section>
<Section title="Stored Materials">