mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-03 15:40:45 +00:00
New icons (#1287)
## Description: Add a new pixi layer for rendering structure icons Add new sprites for structures  ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Please put your Discord username so you can be contacted if a bug or regression is found: Vivacious Box --------- Co-authored-by: evanpelle <evanpelle@gmail.com>
This commit is contained in:
@@ -401,6 +401,39 @@ export function rectDistFN(
|
||||
}
|
||||
}
|
||||
|
||||
function isInIsometricTile(
|
||||
center: { x: number; y: number },
|
||||
tile: { x: number; y: number },
|
||||
yOffset: number,
|
||||
distance: number,
|
||||
): boolean {
|
||||
const dx = Math.abs(tile.x - center.x);
|
||||
const dy = Math.abs(tile.y - (center.y + yOffset));
|
||||
return dx + dy * 2 <= distance + 1;
|
||||
}
|
||||
|
||||
export function isometricDistFN(
|
||||
root: TileRef,
|
||||
dist: number,
|
||||
center: boolean = false,
|
||||
): (gm: GameMap, tile: TileRef) => boolean {
|
||||
if (!center) {
|
||||
return (gm: GameMap, n: TileRef) => gm.manhattanDist(root, n) <= dist;
|
||||
} else {
|
||||
return (gm: GameMap, n: TileRef) => {
|
||||
const rootX = gm.x(root) - 0.5;
|
||||
const rootY = gm.y(root) - 0.5;
|
||||
|
||||
return isInIsometricTile(
|
||||
{ x: rootX, y: rootY },
|
||||
{ x: gm.x(n), y: gm.y(n) },
|
||||
0,
|
||||
dist,
|
||||
);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function hexDistFN(
|
||||
root: TileRef,
|
||||
dist: number,
|
||||
|
||||
Reference in New Issue
Block a user