Skip to content

Commit 988f39a

Browse files
Merge branch 'dev' into ryan/2033/add-confirmation-before-dev-tool-removal
2 parents f9d0900 + 7307511 commit 988f39a

File tree

62 files changed

+922
-412
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+922
-412
lines changed

.github/workflows/FissionBuild.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,8 @@ jobs:
3535
run: |
3636
cd fission
3737
bun run build && echo "Build Passed" || (echo "Build Failed" && exit 1)
38+
39+
- name: Build Electron Version of Fission
40+
run: |
41+
cd fission
42+
bun run electron:make && echo "Build Passed" || (echo "Build Failed" && exit 1)

exporter/SynthesisFusionAddin/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"dev": "NODE_ENV=dev vite build --watch",
88
"dev:ui": "vite --open",
9-
"build": "vite build",
9+
"build": "tsc -p tsconfig.app.json && vite build",
1010
"lint": "biome lint",
1111
"lint:fix": "biome lint --fix",
1212
"style": "biome format",

exporter/SynthesisFusionAddin/web/src/lib/joints.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const signalInfo: Record<SignalType, { bg: string; outline: string; fg: s
2828

2929
export function createJoint(fusionJoint: FusionJoint): Joint {
3030
return {
31-
entityToken: fusionJoint.entityToken,
31+
jointToken: fusionJoint.entityToken,
3232
name: fusionJoint.name,
3333
type: fusionJoint.jointType,
3434
parent: JointParentType.ROOT,

exporter/SynthesisFusionAddin/web/tsconfig.app.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"extends": "./tsconfig.json",
23
"compilerOptions": {
34
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
45
"target": "ES2022",

exporter/SynthesisFusionAddin/web/tsconfig.node.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"extends": "./tsconfig.json",
23
"compilerOptions": {
34
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
45
"target": "ES2023",
@@ -11,7 +12,7 @@
1112
"verbatimModuleSyntax": true,
1213
"moduleDetection": "force",
1314
"noEmit": true,
14-
15+
"composite": true,
1516
"strict": true,
1617
"noUnusedLocals": true,
1718
"noUnusedParameters": true,
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import { defineConfig, mergeConfig } from "vite"
1+
import { defineConfig, mergeConfig, type UserConfig } from "vite"
22
import baseConfig from "../vite.config"
33

44
// https://vitejs.dev/config
5-
export default defineConfig((env) => mergeConfig(baseConfig(env), {}))
5+
export default defineConfig(async (env) => {
6+
const base = typeof baseConfig === 'function' ? await baseConfig(env) : baseConfig
7+
return mergeConfig(base, {} as UserConfig)
8+
})

fission/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"style": "bun run fmt && bun run lint",
2323
"style:fix": "bun run fmt:fix && bun run lint:fix",
2424
"assetpack": "git lfs pull && tar -xf public/assetpack.zip -C public/",
25+
"assetpack:update": "cd public && zip -FS -r assetpack.zip Downloadables",
2526
"playwright:install": "bun x playwright install",
2627
"electron:start": "electron-forge start",
2728
"electron:package": "electron-forge package",

fission/public/assetpack.zip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:985ef0918d3b8200fc076cc31d9af0199b08586e45fda4ecc716555a01660fee
3-
size 193149510
2+
oid sha256:23bfaf7899d84b00331c12bf1ada20d27d3c50856b14bb5733821b44848812ba
3+
size 193147860

fission/src/mirabuf/FieldMiraEditor.ts

Lines changed: 90 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
import type { ScoringZonePreferences } from "@/systems/preferences/PreferenceTypes"
2-
import { mirabuf } from "../proto/mirabuf"
1+
import type MirabufSceneObject from "@/mirabuf/MirabufSceneObject.ts"
2+
import { mirabuf } from "@/proto/mirabuf"
3+
import {
4+
defaultFieldPreferences,
5+
type FieldPreferences,
6+
type ScoringZonePreferences,
7+
} from "@/systems/preferences/PreferenceTypes"
38

4-
interface DevtoolMiraData {
9+
export interface DevtoolMiraData {
510
"devtool:scoring_zones": ScoringZonePreferences[]
611
"devtool:camera_locations": unknown
7-
"devtool:spawn_points": unknown
12+
"devtool:spawn_locations": FieldPreferences["spawnLocations"]
813
"devtool:a": unknown
914
"devtool:b": unknown
1015
"devtool:test": unknown
@@ -15,6 +20,87 @@ interface DevtoolMiraData {
1520
// additional devtool keys to be added in future
1621
}
1722

23+
export const devtoolHandlers = {
24+
"devtool:scoring_zones": {
25+
get(field) {
26+
return field.fieldPreferences?.scoringZones ?? defaultFieldPreferences().scoringZones
27+
},
28+
set(field, val) {
29+
val ??= defaultFieldPreferences().scoringZones
30+
if (!field.fieldPreferences || !this.validate(val)) {
31+
console.warn("validation failed", val, field.fieldPreferences)
32+
return
33+
}
34+
field.fieldPreferences.scoringZones = val
35+
field.updateScoringZones()
36+
},
37+
validate(val): val is ScoringZonePreferences[] {
38+
if (!Array.isArray(val)) return false
39+
return val.every(
40+
z =>
41+
typeof z === "object" &&
42+
z !== null &&
43+
typeof z.name === "string" &&
44+
(z.alliance === "red" || z.alliance === "blue") &&
45+
(typeof z.parentNode === "string" || z.parentNode === undefined) &&
46+
typeof z.points === "number" &&
47+
typeof z.destroyGamepiece === "boolean" &&
48+
typeof z.persistentPoints === "boolean" &&
49+
Array.isArray(z.deltaTransformation)
50+
)
51+
},
52+
},
53+
"devtool:spawn_locations": {
54+
get(field) {
55+
return field.fieldPreferences?.spawnLocations ?? defaultFieldPreferences().spawnLocations
56+
},
57+
set(field, val) {
58+
val ??= defaultFieldPreferences().spawnLocations
59+
if (!field.fieldPreferences || !this.validate(val)) {
60+
console.warn("validation failed", val, field.fieldPreferences)
61+
return
62+
}
63+
field.fieldPreferences.spawnLocations = val
64+
},
65+
validate(val: unknown): val is FieldPreferences["spawnLocations"] {
66+
const isStructureCorrect =
67+
typeof val === "object" &&
68+
val != null &&
69+
"red" in val &&
70+
"blue" in val &&
71+
"default" in val &&
72+
"hasConfiguredLocations" in val
73+
74+
if (!isStructureCorrect) return false
75+
return (["red", "blue"] as const).every(v => {
76+
const obj = val[v]
77+
if (!(typeof obj === "object" && obj != null && 1 in obj && 2 in obj && 3 in obj)) return false
78+
return ([1, 2, 3] as const).every(v => {
79+
const spawnposition = obj[v]
80+
return (
81+
typeof spawnposition == "object" &&
82+
spawnposition != null &&
83+
"pos" in spawnposition &&
84+
"yaw" in spawnposition &&
85+
Array.isArray(spawnposition["pos"]) &&
86+
spawnposition["pos"].length == 3 &&
87+
typeof spawnposition["yaw"] == "number"
88+
)
89+
})
90+
})
91+
},
92+
},
93+
} as const satisfies Partial<{
94+
[K in keyof DevtoolMiraData]: {
95+
get(field: MirabufSceneObject): DevtoolMiraData[K]
96+
set(field: MirabufSceneObject, val: unknown | null): void
97+
validate(val: unknown): val is DevtoolMiraData[K]
98+
}
99+
}>
100+
101+
export type DevtoolKey = keyof typeof devtoolHandlers
102+
export const devtoolKeys = Object.keys(devtoolHandlers) as DevtoolKey[]
103+
18104
/**
19105
* Utility for reading and writing developer tool data in the mira file's UserData field.
20106
* Docs: https://www.mirabuf.dev/#mirabuf.UserData

0 commit comments

Comments
 (0)