Skip to content

Commit

Permalink
move clampheading to common and fix simulator bot rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
democat3457 committed Nov 19, 2024
1 parent 99b40af commit 8592552
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/client/debug/simulator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from "../../common/message/simulator-message";
import { Tag, CompoundTag } from "@blueprintjs/core";
import "./simulator.scss";
import { clampHeading } from "../../common/units";

const tileSize = 60;
const robotSize = tileSize / 2;
Expand Down Expand Up @@ -298,7 +299,7 @@ function Robot(props: {
<Tooltip content={`${props.robotId}: ${JSON.stringify(props.pos)}`}>
<div
style={{
transform: `rotate(-${props.pos.headingRadians}rad)`,
transform: `rotate(-${clampHeading(props.pos.headingRadians)}rad)`,
backgroundColor: "white",
borderRadius: "50%",
border: `4px solid ${props.onTopOfRobots.length > 0 ? "red" : "black"}`,
Expand Down
2 changes: 1 addition & 1 deletion src/common/game-types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Square } from "chess.js";
import type { Robot } from "../server/robot/robot";
import { DEGREE } from "../server/utils/units";
import { DEGREE } from "./units";

/**
* Defines a specific piece.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/server/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { SaveManager } from "./save-manager";
import { CommandExecutor } from "../command/executor";
import { VirtualBotTunnel, virtualRobots } from "../simulator";
import { Position } from "../robot/position";
import { DEGREE } from "../utils/units";
import { DEGREE } from "../../common/units";

export const tcpServer: TCPServer | null =
USE_VIRTUAL_ROBOTS ? null : new TCPServer();
Expand Down
3 changes: 1 addition & 2 deletions src/server/robot/robot.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { FULL_ROTATION, RADIAN, clampHeading } from "../utils/units";
import { FULL_ROTATION, RADIAN, clampHeading } from "../../common/units";
import { Position, ZERO_POSITION } from "./position";
import { GridIndices } from "./grid-indices";
import { tcpServer } from "../api/api";
import type { BotTunnel } from "../api/tcp-interface";


/**
* Represents a robot.
* Includes information about the current location as well as tooling for communication.
Expand Down

0 comments on commit 8592552

Please sign in to comment.