mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 15:47:15 +01:00
canvas year is properly synced with STATION_YEAR_OFFSET define (#95067)
## About The Pull Request Passes the define to the UI via static data. Works fine: <img width="419" height="596" alt="image" src="https://github.com/user-attachments/assets/e84ed5df-ae72-43b4-a266-fa8fc9dd6533" /> ## Why It's Good For The Game We have defines for a reason, even if its a bit annoying, tsx files should respect them as well. ## Changelog N/A. unless your a downstream that changed the define number (Hi that's me)
This commit is contained in:
@@ -132,6 +132,10 @@ GLOBAL_LIST_INIT(canvas_dimensions, init_canvas_dimensions())
|
||||
ui_interact(user)
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
/obj/item/canvas/ui_static_data(mob/user)
|
||||
. = ..()
|
||||
.["year_offset"] = STATION_YEAR_OFFSET
|
||||
|
||||
/obj/item/canvas/ui_data(mob/user)
|
||||
. = ..()
|
||||
var/list/metadata = list(
|
||||
|
||||
@@ -30,6 +30,7 @@ type CanvasData = {
|
||||
editable: BooleanLike;
|
||||
allowColorPicker: BooleanLike;
|
||||
showPlaque: BooleanLike;
|
||||
year_offset: number;
|
||||
};
|
||||
|
||||
type ZoomProps = {
|
||||
@@ -222,7 +223,7 @@ const EditableCanvas = (props: EditableCanvasProps) => {
|
||||
|
||||
type FinalizedCanvasProps = { data: AdvancedCanvasPropsBase['data'] } & Pick<
|
||||
CanvasData,
|
||||
'metadata' | 'showPlaque'
|
||||
'metadata' | 'showPlaque' | 'year_offset'
|
||||
> &
|
||||
CanvasCommonProps;
|
||||
|
||||
@@ -236,6 +237,7 @@ const FinalizedCanvas = (props: FinalizedCanvasProps) => {
|
||||
pixelsPerUnit,
|
||||
width,
|
||||
height,
|
||||
year_offset,
|
||||
} = props;
|
||||
const { title, author, date, medium, patron } = metadata;
|
||||
const { act } = useBackend();
|
||||
@@ -270,7 +272,7 @@ const FinalizedCanvas = (props: FinalizedCanvasProps) => {
|
||||
</Box>
|
||||
<Box bold>
|
||||
{author}
|
||||
{date && `- ${new Date(date).getFullYear() + 540}`}
|
||||
{date && `- ${new Date(date).getFullYear() + year_offset}`}
|
||||
</Box>
|
||||
<Box italic>{medium}</Box>
|
||||
<Box italic>
|
||||
@@ -300,6 +302,7 @@ export const Canvas = () => {
|
||||
editable,
|
||||
allowColorPicker,
|
||||
showPlaque,
|
||||
year_offset,
|
||||
} = data;
|
||||
const { sprite } = editorData;
|
||||
const { width, height } = sprite;
|
||||
@@ -320,6 +323,7 @@ export const Canvas = () => {
|
||||
zoom,
|
||||
setZoom,
|
||||
pixelsPerUnit,
|
||||
year_offset,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user