Improve MineGeo UI and application flows
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 2m37s
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 2m37s
This commit is contained in:
@@ -155,7 +155,9 @@ export function parseUploadManifest(value: unknown) {
|
||||
!manifest.contributionTo &&
|
||||
new Set(manifest.viewpoints.map(panoramaLocationKey)).size < 5
|
||||
)
|
||||
throw new Error("Capture at least five panoramas from different block positions");
|
||||
throw new Error(
|
||||
"Capture at least five panoramas from different block positions",
|
||||
);
|
||||
if (manifest.mediaFormat)
|
||||
throw new Error("Use map import for rendered archives");
|
||||
manifest.serverAddress =
|
||||
@@ -183,11 +185,25 @@ export const difficulties = {
|
||||
hard: { seconds: 30, zoom: false, label: "Hard" },
|
||||
} as const;
|
||||
export type Difficulty = keyof typeof difficulties;
|
||||
export const difficultyRuleDefaults = {
|
||||
pan: true,
|
||||
compass: true,
|
||||
coordinates: true,
|
||||
mapZoom: true,
|
||||
scoring: "normal" as const,
|
||||
};
|
||||
export type ScoringMode = "normal" | "strict" | "gentle";
|
||||
export type DifficultyPreset = {
|
||||
id: string;
|
||||
name: string;
|
||||
seconds: number;
|
||||
zoom: boolean;
|
||||
// Optional for sessions created before expanded rules were introduced.
|
||||
pan?: boolean;
|
||||
compass?: boolean;
|
||||
coordinates?: boolean;
|
||||
mapZoom?: boolean;
|
||||
scoring?: ScoringMode;
|
||||
};
|
||||
export const customDifficultySchema = z
|
||||
.object({
|
||||
@@ -200,9 +216,7 @@ export const customDifficultySchema = z
|
||||
)
|
||||
.refine(
|
||||
(name) =>
|
||||
!/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/u.test(
|
||||
name,
|
||||
),
|
||||
!/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/u.test(name),
|
||||
"Difficulty names cannot contain hidden controls",
|
||||
),
|
||||
seconds: z
|
||||
@@ -212,12 +226,18 @@ export const customDifficultySchema = z
|
||||
.max(600)
|
||||
.refine((seconds) => seconds % 15 === 0),
|
||||
zoom: z.boolean(),
|
||||
pan: z.boolean().default(true),
|
||||
compass: z.boolean().default(true),
|
||||
coordinates: z.boolean().default(true),
|
||||
mapZoom: z.boolean().default(true),
|
||||
scoring: z.enum(["normal", "strict", "gentle"]).default("normal"),
|
||||
})
|
||||
.strict();
|
||||
export function scoreGuess(
|
||||
a: Pick<Point, "x" | "z">,
|
||||
b: Pick<Point, "x" | "z">,
|
||||
bounds: Bounds,
|
||||
scoring: ScoringMode = "normal",
|
||||
) {
|
||||
const distance = Math.hypot(a.x - b.x, a.z - b.z);
|
||||
return {
|
||||
@@ -228,7 +248,8 @@ export function scoreGuess(
|
||||
: Math.round(
|
||||
5000 *
|
||||
Math.exp(
|
||||
(-5 * distance) /
|
||||
(-(scoring === "strict" ? 8 : scoring === "gentle" ? 3 : 5) *
|
||||
distance) /
|
||||
Math.hypot(
|
||||
bounds.maxX - bounds.minX,
|
||||
bounds.maxZ - bounds.minZ,
|
||||
|
||||
Reference in New Issue
Block a user