-
-
Notifications
You must be signed in to change notification settings - Fork 23
Add bridge configurator with map editor, viewscreens, and auto-assignment #748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mechatronics-studio
wants to merge
16
commits into
develop
Choose a base branch
from
add-bridge-configurator
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
46e2bee
Initial Functionality Commit
mechatronics-studio 84b6ba2
Create proper viewscreen element when no bridge exists
mechatronics-studio 56e4752
Merge develop into add-bridge-configurator
mechatronics-studio 9bfcb92
Update theater.svg
mechatronics-studio 7bbd30d
Sprite sheet + fix selection box so that arrows are at right side
mechatronics-studio 2ca8d1b
Refinements
mechatronics-studio 56e149a
Add bridge auto-assignment for station clients
mechatronics-studio 66ba257
Merge develop into add-bridge-configurator
mechatronics-studio b06e5a1
Add viewscreens to named clients
mechatronics-studio c55c509
Fix formatting
mechatronics-studio 9dc0934
Revert "Fix formatting"
mechatronics-studio c834d69
ignore claude memory files local to contributors
mechatronics-studio 42c764c
Address PR Comments
mechatronics-studio 1f5b5bc
Merge develop into add-bridge-configurator
mechatronics-studio fe31b46
conform to current stationlookup methods
mechatronics-studio 65a0e51
Fix auto-assign in different station complements.
mechatronics-studio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ icons/sprite.svg | |
| /binaries/ | ||
|
|
||
| .wrangler | ||
| .claude/ | ||
|
|
||
| # Playwright | ||
| test-results | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| import type BasePlugin from "."; | ||
| import { Aspect } from "./Aspect"; | ||
| import { generateIncrementedName } from "@thorium/utils/generateIncrementedName"; | ||
|
|
||
| export interface BridgeClientAssignment { | ||
| clientName: string; | ||
| stationId: string | null; | ||
| isSoundPlayer: boolean; | ||
| tags: string[]; | ||
| } | ||
|
|
||
| export interface BridgeViewscreen { | ||
| id: string; | ||
| name: string; | ||
| tags: string[]; | ||
| isMainViewscreen?: boolean; | ||
| defaultPose: { poseId: string; pluginId: string } | null; | ||
| showGizmos?: boolean; | ||
| showLayout?: boolean; | ||
| brokenMode?: "fullyBroken" | "cameraBrokenOnly" | "invincible"; | ||
| /** Camera field of view in degrees (1–179). Values >= 180 yield a black screen because tan(fov/2) is mathematically undefined at 180°. Defaults to 45. */ | ||
| fov?: number; | ||
| } | ||
|
|
||
| interface BridgeMapElementBase { | ||
| id: string; | ||
| /** Horizontal position in pixels relative to the floor background image. */ | ||
| x: number; | ||
| /** Vertical position in pixels relative to the floor background image. */ | ||
| y: number; | ||
| /** Rotation in degrees. For viewscreens this is the default yaw angle. */ | ||
| rotation: number; | ||
| /** Element width in pixels. */ | ||
| widthPixels?: number; | ||
| /** Element height in pixels. */ | ||
| heightPixels?: number; | ||
| label?: string; | ||
| clientName?: string; | ||
| } | ||
|
|
||
| export interface BridgeMapStation extends BridgeMapElementBase { | ||
| type: "station"; | ||
| stationName?: string; | ||
| } | ||
|
|
||
| export interface BridgeMapViewscreen extends BridgeMapElementBase { | ||
| type: "viewscreen"; | ||
| viewscreenId?: string; | ||
| /** Pitch angle in degrees — the default camera pitch for this viewscreen. */ | ||
| pitch?: number; | ||
| } | ||
|
|
||
| export type BridgeMapElement = BridgeMapStation | BridgeMapViewscreen; | ||
| export type BridgeMapElementType = BridgeMapElement["type"]; | ||
|
|
||
| export interface BridgeFloor { | ||
| id: string; | ||
| name: string; | ||
| backgroundUrl: string; | ||
| /** Background image width in pixels. */ | ||
| widthPixels: number; | ||
| /** Background image height in pixels. */ | ||
| heightPixels: number; | ||
| elements: BridgeMapElement[]; | ||
| } | ||
|
|
||
| export interface StationAssignment { | ||
| clientAssignments: BridgeClientAssignment[]; | ||
| elementStations: Record<string, string>; // elementId -> stationName | ||
| } | ||
|
|
||
| export function complementKey(ref?: { | ||
| pluginId: string; | ||
| stationComplementId: string; | ||
| }): string | null { | ||
| return ref ? `${ref.pluginId}:${ref.stationComplementId}` : null; | ||
| } | ||
|
|
||
| export default class BridgePlugin extends Aspect { | ||
| apiVersion = "bridges/v1" as const; | ||
| kind = "bridges" as const; | ||
| name!: string; | ||
| description!: string; | ||
| stationComplementRef?: { pluginId: string; stationComplementId: string }; | ||
| /** Per-complement client and element assignments, keyed by "pluginId:complementId". */ | ||
| stationAssignments!: Record<string, StationAssignment>; | ||
| viewscreens!: BridgeViewscreen[]; | ||
| floors!: BridgeFloor[]; | ||
| /** Default size in pixels for map elements. When undefined, defaults to 7.5% of floor width. */ | ||
| elementScale?: number; | ||
| assets!: Record<string, string>; | ||
| constructor(params: Partial<BridgePlugin>, plugin: BasePlugin) { | ||
| const name = generateIncrementedName( | ||
| params.name || "New Bridge", | ||
| plugin.aspects.bridges.map((b) => b.name), | ||
| ); | ||
| super({ ...params, name }, { kind: "bridges" }, plugin, {}); | ||
|
|
||
| this.name = this.name || name; | ||
| this.description = this.description || params.description || ""; | ||
| this.stationComplementRef = | ||
| this.stationComplementRef || params.stationComplementRef || undefined; | ||
| this.stationAssignments = | ||
| this.stationAssignments || params.stationAssignments || {}; | ||
| this.viewscreens = this.viewscreens || params.viewscreens || []; | ||
| this.floors = this.floors || | ||
| params.floors || [ | ||
| { | ||
| id: crypto.randomUUID(), | ||
| name: "Main", | ||
| backgroundUrl: "", | ||
| widthPixels: 800, | ||
| heightPixels: 800, | ||
| elements: [], | ||
| }, | ||
| ]; | ||
| this.elementScale = this.elementScale || params.elementScale || undefined; | ||
| this.assets = this.assets || {}; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.