feat(world-builder): multi-layer tile opacity and blend mode validator - #136
feat(world-builder): multi-layer tile opacity and blend mode validator#136Rodrigoue9 wants to merge 6 commits into
Conversation
| const layerIndex = Math.max(0, Math.floor(config.layerIndex ?? 0)); | ||
| const opacity = Math.min(1.0, Math.max(0.0, config.opacity ?? 1.0)); |
There was a problem hiding this comment.
💡 Edge Case: NaN opacity/layerIndex bypass clamping
Math.max(0.0, Math.max/floor(NaN)) returns NaN, so a caller passing opacity: NaN (or layerIndex: NaN) produces a config with NaN values, violating the stated [0.0,1.0] normalization guarantee. Add a Number.isFinite fallback, e.g. const opacity = Number.isFinite(config.opacity) ? Math.min(1, Math.max(0, config.opacity!)) : 1.0; (and similarly for layerIndex).
Guard against NaN/Infinity before clamping:
const rawIndex = config.layerIndex;
const layerIndex = Number.isFinite(rawIndex) ? Math.max(0, Math.floor(rawIndex as number)) : 0;
const rawOpacity = config.opacity;
const opacity = Number.isFinite(rawOpacity) ? Math.min(1.0, Math.max(0.0, rawOpacity as number)) : 1.0;
- Apply fix
Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎
| # feat(world-builder): register uploaded graphics and extend palette schemas (#6) | ||
|
|
||
| ## Summary | ||
| Resolves #6 by providing `paletteEntrySchema` and `validatePaletteEntry` to validate multi-layer palette definitions, enforce non-colliding graphic index allocations (`UPLOADED_GRAPHIC_INDEX_START = 1_000_000`), and verify graphic existence across engine and uploaded assets. | ||
|
|
||
| ### Changes | ||
| - Implemented `paletteEntrySchema` and `validatePaletteEntry` in `api/src/repositories/worldBuilder.ts`. | ||
| - Added unit tests in `api/src/repositories/__tests__/paletteValidation.test.ts`. | ||
|
|
||
| Closes #6 |
There was a problem hiding this comment.
💡 Quality: Stray PR_DESCRIPTION_DRAFT.md committed to repo root
PR_DESCRIPTION_DRAFT.md appears to be a working draft accidentally committed, and its content describes a different feature (#6 palette schemas) unrelated to this PR. Remove it from the commit so it doesn't clutter the repository root.
Delete the accidentally committed draft file:
git rm PR_DESCRIPTION_DRAFT.md
- Apply fix
Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 0 resolved / 2 findingsAdds multi-layer tile opacity and blend mode validator alongside map NPC placement and database migration fixes. Consider addressing the NaN opacity/layerIndex bypass and removing the stray PR draft file. 💡 Edge Case: NaN opacity/layerIndex bypass clamping📄 api/src/lib/layerBlendMode.ts:14-15
Guard against NaN/Infinity before clamping💡 Quality: Stray PR_DESCRIPTION_DRAFT.md committed to repo root📄 PR_DESCRIPTION_DRAFT.md:1-10
Delete the accidentally committed draft file🤖 Prompt for agentsOptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Important Your trial ends in 7 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more. Was this helpful? React with 👍 / 👎 | Gitar |
Feature Summary
Resolves layer blending requirements! 🚀
Summary by Gitar
clan_memberstable definition and associated indexes before applying dependent migrations inapi/schema.sqlapi/src/repositories/mapNpcPlacement.tsnpcs.jsondataset for characters and vendors inapi/src/jsons/npcs.jsonThis will update automatically on new commits.