Skip to content

Commit

Permalink
Fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
phisn committed May 13, 2024
1 parent 54a537b commit 6328efe
Show file tree
Hide file tree
Showing 11 changed files with 2,778 additions and 3,180 deletions.
Binary file added best.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions best.txt

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion packages/server/src/api/leaderboard/validate-replay.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import RAPIER from "@dimforge/rapier2d"
import { TRPCError } from "@trpc/server"
import { and, count, eq, lt } from "drizzle-orm"
import { DrizzleD1Database } from "drizzle-orm/d1"
Expand Down Expand Up @@ -135,7 +136,7 @@ function serverValidateReplay(worldname: string, gamemode: string, replayBuffer:
const replayModel = ReplayModel.decode(replayBuffer)
const worldModel = WorldModel.decode(Buffer.from(world.model, "base64"))

const stats = validateReplay(replayModel, worldModel, gamemode)
const stats = validateReplay(RAPIER, replayModel, worldModel, gamemode)

if (!stats) {
console.log("replay is invalid")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { BufferGeometry, Loader, LoadingManager, Shape, ShapePath, Vector2 } from "three"

export interface SVGResultPaths extends ShapePath {
userData?: Record<string, any> | undefined
}

export interface SVGResult {
paths: SVGResultPaths[]
xml: XMLDocument
}

export interface StrokeStyle {
strokeColor: string
strokeWidth: number
strokeLineJoin: string
strokeLineCap: string
strokeMiterLimit: number
}

export class SVGLoader extends Loader<SVGResult> {
constructor(manager?: LoadingManager)

defaultDPI: number
defaultUnit: string

parse(text: string): SVGResult

static getStrokeStyle(
width?: number,
color?: string,
lineJoin?: string,
lineCap?: string,
miterLimit?: number,
): StrokeStyle

/**
* Generates a stroke with some witdh around the given path.
* @remarks The path can be open or closed (last point equals to first point)
* @param points Array of Vector2D (the path). Minimum 2 points.
* @param style Object with SVG properties as returned by SVGLoader.getStrokeStyle(), or SVGLoader.parse() in the path.userData.style object
* @param arcDivisions Arc divisions for round joins and endcaps. (Optional)
* @param minDistance Points closer to this distance will be merged. (Optional)
* @returns BufferGeometry with stroke triangles (In plane z = 0). UV coordinates are generated ('u' along path. 'v' across it, from left to right)
*/
static pointsToStroke(
points: Vector2[],
style: StrokeStyle,
arcDivisions?: number,
minDistance?: number,
): BufferGeometry

static pointsToStrokeWithBuffers(
points: Vector2[],
style: StrokeStyle,
arcDivisions?: number,
minDistance?: number,
vertices?: number[],
normals?: number[],
uvs?: number[],
vertexOffset?: number,
): number

static createShapes(shapePath: ShapePath): Shape[]
}
Loading

0 comments on commit 6328efe

Please sign in to comment.