@wildshard/shard-format 0.5.7 → 0.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/format/creatures.ts +6 -3
- package/src/format/look-light.ts +29 -3
- package/src/format/targets.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildshard/shard-format",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"description": "The raw shardfile format: the spec, the validator and a validate CLI. The public, versioned contract every other repo builds on.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -402,8 +402,8 @@
|
|
|
402
402
|
"scripts": {
|
|
403
403
|
"pnpm:devPreinstall": "git rev-parse --is-inside-work-tree >/dev/null 2>&1 && git config core.hooksPath .githooks || true",
|
|
404
404
|
"typecheck": "tsc -p kit/tsconfig.json && tsc -p src/format/tsconfig.json && tsc -p src/format/tsconfig.lib.json",
|
|
405
|
-
"lint": "node kit/scripts/lint.mjs --type-aware --deny-warnings --no-error-on-unmatched-pattern --ignore-pattern '.githooks/**' --ignore-pattern '.agents/**' --ignore-pattern 'scripts/agent-parity.mjs' --ignore-pattern 'scripts/agent-sync.mjs' --ignore-pattern 'scripts/scratch-dir*' --ignore-pattern 'scripts/scratch-sweep*' --ignore-pattern 'tmp/**' --ignore-pattern 'src/format/**' --ignore-pattern 'scripts/chromium-keychain*' --ignore-pattern 'scripts/worktree-ignore*' --ignore-pattern 'scripts/land*' --ignore-pattern 'scripts/worktree.mjs' --ignore-pattern 'scripts/worktree-reap.mjs' --ignore-pattern 'scripts/pid-lock*' --ignore-pattern 'scripts/apfs-clone.mjs' --ignore-pattern 'scripts/assert-store-layout.mjs' --ignore-pattern 'test/tooling/worktree-guard.test.mjs' --ignore-pattern 'scripts/vite-tmp*' --ignore-pattern 'vitest.config.ts' --ignore-pattern 'test/tooling/chrome-keychain.test.mjs' --ignore-pattern 'packages/wire/frozen/**' --ignore-pattern 'packages/wire/lib/**'",
|
|
406
|
-
"lint:fix": "node kit/scripts/lint.mjs --type-aware --fix --ignore-pattern '.githooks/**' --ignore-pattern '.agents/**' --ignore-pattern 'scripts/agent-parity.mjs' --ignore-pattern 'scripts/agent-sync.mjs' --ignore-pattern 'scripts/scratch-dir*' --ignore-pattern 'scripts/scratch-sweep*' --ignore-pattern 'tmp/**' --ignore-pattern 'src/format/**'",
|
|
405
|
+
"lint": "node kit/scripts/lint.mjs --type-aware --deny-warnings --no-error-on-unmatched-pattern --ignore-pattern '.githooks/**' --ignore-pattern '.agents/**' --ignore-pattern 'scripts/agent-parity.mjs' --ignore-pattern 'scripts/agent-sync.mjs' --ignore-pattern 'scripts/scratch-dir*' --ignore-pattern 'scripts/scratch-sweep*' --ignore-pattern 'scripts/lane-live*' --ignore-pattern 'scripts/leftovers-report*' --ignore-pattern 'scripts/keep-copy*' --ignore-pattern 'scripts/disk-audit*' --ignore-pattern 'test/tooling/disk-land.test.mjs' --ignore-pattern 'test/tooling/land-fixture.mjs' --ignore-pattern 'test/tooling/owned-scratch.mjs' --ignore-pattern 'test/tooling/lane-live.test.mjs' --ignore-pattern 'test/tooling/keep-copy.test.mjs' --ignore-pattern 'test/tooling/leftovers-report.test.mjs' --ignore-pattern 'test/tooling/reap-report.test.mjs' --ignore-pattern 'tmp/**' --ignore-pattern 'src/format/**' --ignore-pattern 'scripts/chromium-keychain*' --ignore-pattern 'scripts/worktree-ignore*' --ignore-pattern 'scripts/land*' --ignore-pattern 'scripts/worktree.mjs' --ignore-pattern 'scripts/worktree-reap.mjs' --ignore-pattern 'scripts/pid-lock*' --ignore-pattern 'scripts/apfs-clone.mjs' --ignore-pattern 'scripts/assert-store-layout.mjs' --ignore-pattern 'test/tooling/worktree-guard.test.mjs' --ignore-pattern 'scripts/vite-tmp*' --ignore-pattern 'vitest.config.ts' --ignore-pattern 'test/tooling/chrome-keychain.test.mjs' --ignore-pattern 'packages/wire/frozen/**' --ignore-pattern 'packages/wire/lib/**'",
|
|
406
|
+
"lint:fix": "node kit/scripts/lint.mjs --type-aware --fix --ignore-pattern '.githooks/**' --ignore-pattern '.agents/**' --ignore-pattern 'scripts/agent-parity.mjs' --ignore-pattern 'scripts/agent-sync.mjs' --ignore-pattern 'scripts/scratch-dir*' --ignore-pattern 'scripts/scratch-sweep*' --ignore-pattern 'scripts/lane-live*' --ignore-pattern 'scripts/leftovers-report*' --ignore-pattern 'scripts/keep-copy*' --ignore-pattern 'scripts/disk-audit*' --ignore-pattern 'test/tooling/disk-land.test.mjs' --ignore-pattern 'test/tooling/land-fixture.mjs' --ignore-pattern 'test/tooling/owned-scratch.mjs' --ignore-pattern 'test/tooling/lane-live.test.mjs' --ignore-pattern 'test/tooling/keep-copy.test.mjs' --ignore-pattern 'test/tooling/leftovers-report.test.mjs' --ignore-pattern 'test/tooling/reap-report.test.mjs' --ignore-pattern 'tmp/**' --ignore-pattern 'src/format/**'",
|
|
407
407
|
"lint:format": "node src/tools/format-ratchet.ts",
|
|
408
408
|
"format": "oxfmt -c kit/.oxfmtrc.json kit src '!src/format/**' '!src/test/fixtures/**'",
|
|
409
409
|
"format:check": "oxfmt -c kit/.oxfmtrc.json --check kit src '!src/format/**' '!src/test/fixtures/**'",
|
|
@@ -418,7 +418,7 @@
|
|
|
418
418
|
"agents:sync": "node scripts/agent-sync.mjs",
|
|
419
419
|
"md:wrap": "node kit/scripts/md-wrap.mjs",
|
|
420
420
|
"test:hooks": "node --test '.githooks/*.test.mjs'",
|
|
421
|
-
"check": "pnpm typecheck && pnpm lint && pnpm lint:format && pnpm format:check && pnpm test && pnpm test:format && pnpm check:asks && pnpm check:agents && pnpm check:agent-sync && pnpm test:agent-hooks && pnpm check:parity && node --check scripts/chromium-keychain-check.mjs && node --test test/tooling/chrome-keychain.test.mjs && pnpm check:wire",
|
|
421
|
+
"check": "pnpm typecheck && pnpm lint && pnpm lint:format && pnpm format:check && pnpm test && pnpm test:format && pnpm check:asks && pnpm check:agents && pnpm check:agent-sync && pnpm test:agent-hooks && pnpm check:parity && node --check scripts/chromium-keychain-check.mjs && node --test test/tooling/chrome-keychain.test.mjs test/tooling/disk-land.test.mjs test/tooling/lane-live.test.mjs test/tooling/keep-copy.test.mjs test/tooling/leftovers-report.test.mjs test/tooling/reap-report.test.mjs && pnpm check:wire",
|
|
422
422
|
"check:wire": "pnpm --dir packages/wire check && pnpm --dir packages/wire test && pnpm check:wire-proofs",
|
|
423
423
|
"check:wire-proofs": "node --test src/scripts/wire/recordings-proof.mjs src/scripts/wire/graph-proof.mjs src/scripts/wire/prepared-frame-proof.mjs",
|
|
424
424
|
"bench": "pnpm --dir packages/wire bench"
|
package/src/format/creatures.ts
CHANGED
|
@@ -54,7 +54,10 @@ export const CreatureBodyRecipeSchema: v.GenericSchema<CreatureBodyRecipeRowsInp
|
|
|
54
54
|
/** Serializable selection of the native motor and the exact existing creature-contact protocol. */
|
|
55
55
|
export type CreatureBodyRecipe = Omit<v.InferOutput<typeof CreatureBodyRecipeSchema>, 'actions'> & { readonly actions?: CreatureMemoryActions };
|
|
56
56
|
const phase = v.pipe(finite, v.minValue(-2 * Math.PI), v.maxValue(2 * Math.PI));
|
|
57
|
-
|
|
57
|
+
/** Seconds after its death that a spawn's body comes back at its `at` (TEMPLATE-E2E TC-E2); absent, it stays dead. */
|
|
58
|
+
const RESPAWN_MAX = 3600, RESPAWN_MIN = 1;
|
|
59
|
+
const respawn = v.pipe(finite, v.minValue(RESPAWN_MIN), v.maxValue(RESPAWN_MAX));
|
|
60
|
+
const spawn = v.strictObject({ phaseOffset: v.optional(phase), home: v.optional(CreatureHomeSchema), respawn: v.optional(respawn), id, species: id, variant: id, brain: v.nullable(id), strike: v.nullable(id), seed: v.pipe(finite, v.integer(), v.minValue(0), v.maxValue(0xffffffff)), scale: v.pipe(finite, v.minValue(0.1), v.maxValue(10)), at: v.tuple([coord, coord, coord]), yaw: finite });
|
|
58
61
|
/** Pure-data creature archetypes and stable spawn layouts, expanded before the local sim boots. */
|
|
59
62
|
export const CreaturesSchema: v.GenericSchema<ShardCreaturesInput, ShardCreatures> = v.pipe(v.strictObject({ brains: v.pipe(v.array(v.variant('kind', [brain, SkirmisherSchema, GuardianSchema, PerchHunterSchema, ScriptBrainSchema, RamGrazerSchema, ChallengeGrazerSchema, OrbitDiverSchema, PatrolDiverSchema, BurstFlyerSchema, GrazerSchema, DiverSchema, GuardianPatternsSchema, StalkerSchema])), v.maxLength(64)), groups: v.optional(v.pipe(v.array(GroupBrainSchema), v.maxLength(64)), []), spawns: v.pipe(v.array(spawn), v.maxLength(10000)) }),
|
|
60
63
|
v.check((c) => creatureRules(c).length === 0, 'creature reference rules'));
|
|
@@ -159,8 +162,8 @@ export interface CreatureMemoryActionsRows { stateKey: string; states: (string)[
|
|
|
159
162
|
export interface CreatureBodyRecipeRowsInput { actions?: CreatureMemoryActionsRowsInput; offset?: { field: string; from: number; to: number; }; kind: 'animal'; motion: 'ground' | 'flight'; attack: 'keeper' | 'unlimited'; stunned: 'none' | 'look-hold'; contact: ({ kind: 'environment'; halfArc: number; }) | ({ kind: 'actor'; halfArc: number; move: string; }); }
|
|
160
163
|
export interface CreatureBodyRecipeRows { actions?: CreatureMemoryActionsRows; offset?: { field: string; from: number; to: number; }; kind: 'animal'; motion: 'ground' | 'flight'; attack: 'keeper' | 'unlimited'; stunned: 'none' | 'look-hold'; contact: ({ kind: 'environment'; halfArc: number; }) | ({ kind: 'actor'; halfArc: number; move: string; }); }
|
|
161
164
|
// oxlint-disable-next-line typescript/consistent-type-definitions -- Valibot's readonly defaults need the alias's implicit dictionary compatibility.
|
|
162
|
-
export type ShardCreaturesInput = { brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferInput<typeof SkirmisherSchema>) | (v.InferInput<typeof GuardianSchema>) | (v.InferInput<typeof PerchHunterSchema>) | (v.InferInput<typeof ScriptBrainSchema>) | (v.InferInput<typeof RamGrazerSchema>) | (v.InferInput<typeof ChallengeGrazerSchema>) | (v.InferInput<typeof OrbitDiverSchema>) | (v.InferInput<typeof PatrolDiverSchema>) | (v.InferInput<typeof BurstFlyerSchema>) | (v.InferInput<typeof GrazerSchema>) | (v.InferInput<typeof DiverSchema>) | (v.InferInput<typeof GuardianPatternsSchema>) | (v.InferInput<typeof StalkerSchema>))[]; groups?: (v.InferInput<typeof GroupBrainSchema>)[] | undefined; spawns: ({ phaseOffset?: number | undefined; home?: ShardCreatureHomeInput | undefined; id: string; species: string; variant: string; brain: (string) | null; strike: (string) | null; seed: number; scale: number; at: [number, number, number]; yaw: number; })[]; };
|
|
163
|
-
export interface ShardCreatures { brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferOutput<typeof SkirmisherSchema>) | (v.InferOutput<typeof GuardianSchema>) | (v.InferOutput<typeof PerchHunterSchema>) | (v.InferOutput<typeof ScriptBrainSchema>) | (v.InferOutput<typeof RamGrazerSchema>) | (v.InferOutput<typeof ChallengeGrazerSchema>) | (v.InferOutput<typeof OrbitDiverSchema>) | (v.InferOutput<typeof PatrolDiverSchema>) | (v.InferOutput<typeof BurstFlyerSchema>) | (v.InferOutput<typeof GrazerSchema>) | (v.InferOutput<typeof DiverSchema>) | (v.InferOutput<typeof GuardianPatternsSchema>) | (v.InferOutput<typeof StalkerSchema>))[]; groups: (v.InferOutput<typeof GroupBrainSchema>)[]; spawns: ({ phaseOffset?: number | undefined; home?: ShardCreatureHome | undefined; id: string; species: string; variant: string; brain: (string) | null; strike: (string) | null; seed: number; scale: number; at: [number, number, number]; yaw: number; })[]; }
|
|
165
|
+
export type ShardCreaturesInput = { brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferInput<typeof SkirmisherSchema>) | (v.InferInput<typeof GuardianSchema>) | (v.InferInput<typeof PerchHunterSchema>) | (v.InferInput<typeof ScriptBrainSchema>) | (v.InferInput<typeof RamGrazerSchema>) | (v.InferInput<typeof ChallengeGrazerSchema>) | (v.InferInput<typeof OrbitDiverSchema>) | (v.InferInput<typeof PatrolDiverSchema>) | (v.InferInput<typeof BurstFlyerSchema>) | (v.InferInput<typeof GrazerSchema>) | (v.InferInput<typeof DiverSchema>) | (v.InferInput<typeof GuardianPatternsSchema>) | (v.InferInput<typeof StalkerSchema>))[]; groups?: (v.InferInput<typeof GroupBrainSchema>)[] | undefined; spawns: ({ phaseOffset?: number | undefined; respawn?: number | undefined; home?: ShardCreatureHomeInput | undefined; id: string; species: string; variant: string; brain: (string) | null; strike: (string) | null; seed: number; scale: number; at: [number, number, number]; yaw: number; })[]; };
|
|
166
|
+
export interface ShardCreatures { brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferOutput<typeof SkirmisherSchema>) | (v.InferOutput<typeof GuardianSchema>) | (v.InferOutput<typeof PerchHunterSchema>) | (v.InferOutput<typeof ScriptBrainSchema>) | (v.InferOutput<typeof RamGrazerSchema>) | (v.InferOutput<typeof ChallengeGrazerSchema>) | (v.InferOutput<typeof OrbitDiverSchema>) | (v.InferOutput<typeof PatrolDiverSchema>) | (v.InferOutput<typeof BurstFlyerSchema>) | (v.InferOutput<typeof GrazerSchema>) | (v.InferOutput<typeof DiverSchema>) | (v.InferOutput<typeof GuardianPatternsSchema>) | (v.InferOutput<typeof StalkerSchema>))[]; groups: (v.InferOutput<typeof GroupBrainSchema>)[]; spawns: ({ phaseOffset?: number | undefined; respawn?: number | undefined; home?: ShardCreatureHome | undefined; id: string; species: string; variant: string; brain: (string) | null; strike: (string) | null; seed: number; scale: number; at: [number, number, number]; yaw: number; })[]; }
|
|
164
167
|
export type CreatureStrikeRowsInput = CreatureStrikeRows;
|
|
165
168
|
export interface CreatureStrikeRows { id: string; shape: ({ kind: 'arc'; radius: number; halfAngle: number; yawOffset?: number; }) | ({ kind: 'lane'; length: number; width: number; }) | ({ kind: 'ring'; inner: number; outer: number; }) | ({ kind: 'wedge'; length: number; halfAngle: number; }) | ({ kind: 'point'; radius: number; exclusive?: boolean; }) | ({ kind: 'sphere'; radius: number; }); windup: number; active: number; recover: number; cooldown: number; range: (number) | null; damage: number; tags: (`${string}.${string}`)[]; weight: ({ kind: 'constant'; value: number; }) | ({ kind: 'horizontal-distance'; above: number; far: number; near: number; }); units?: 'world' | 'actor'; alternatives?: (({ kind: 'arc'; radius: number; halfAngle: number; yawOffset?: number; }) | ({ kind: 'lane'; length: number; width: number; }) | ({ kind: 'ring'; inner: number; outer: number; }) | ({ kind: 'wedge'; length: number; halfAngle: number; }) | ({ kind: 'point'; radius: number; exclusive?: boolean; }) | ({ kind: 'sphere'; radius: number; }))[]; motion?: { speed?: number; delay?: number; track?: 'none' | 'lead' | 'follow'; overshoot?: number; skid?: number; }; eligibility?: { maxDy?: number; jumpDodges?: boolean; }; }
|
|
166
169
|
export type CreatureStrikesInput = unknown;
|
package/src/format/look-light.ts
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* per metre above it. It adds to the day keys' distance fog, so a shard can drop that to 0 and keep mist only low.
|
|
9
9
|
* - `pools`: warm light pools on the ground under lamps, drawn as one additive decal draw (no dynamic light per lamp):
|
|
10
10
|
* a disc of `radius` metres at each `at` point, in `colour` × `intensity`.
|
|
11
|
-
* - `lamps` (meta TEMPLATES-CLEANROOM B2): real point lights for lanterns, tent lamps and fires, at most
|
|
11
|
+
* - `lamps` (meta TEMPLATES-CLEANROOM B2): real point lights for lanterns, tent lamps and fires, at most 256 (SHARD-SOURCE
|
|
12
|
+
* AP28; the engine lights the nearest `LOOK_LIGHT_LIT_MAX` each frame, 4 on a phone), each at
|
|
12
13
|
* `at` in linear `colour` × `intensity` (candela), out to `distance` metres with physical (2) decay, no shadow.
|
|
13
14
|
* - `bounce` (B2): a warm fill from the ground: one shadowless directional light from the anti-sun heading, lifted
|
|
14
15
|
* by `lift` (0 level, 1 straight up), in linear `colour` × `intensity`.
|
|
@@ -35,6 +36,8 @@ import {
|
|
|
35
36
|
number,
|
|
36
37
|
picklist,
|
|
37
38
|
pipe,
|
|
39
|
+
regex,
|
|
40
|
+
string,
|
|
38
41
|
strictObject,
|
|
39
42
|
tuple,
|
|
40
43
|
} from 'valibot'
|
|
@@ -75,8 +78,10 @@ const POOL_INTENSITY_MAX = 4
|
|
|
75
78
|
const POOL_RADIUS_MIN = 0.1
|
|
76
79
|
const POOL_RADIUS_MAX = 20
|
|
77
80
|
const BLOOM_INTENSITY_MAX = 4
|
|
78
|
-
/** At most this many lamps in one look (
|
|
79
|
-
const LOOK_LIGHT_LAMPS_MAX =
|
|
81
|
+
/** At most this many lamps in one look (SHARD-SOURCE AP28: authored; only the nearest `LOOK_LIGHT_LIT_MAX` light). */
|
|
82
|
+
const LOOK_LIGHT_LAMPS_MAX = 256
|
|
83
|
+
/** At most this many lamps light a frame (real point lights: each costs every lit draw a light loop step). */
|
|
84
|
+
const LOOK_LIGHT_LIT_MAX = 16
|
|
80
85
|
const LAMP_INTENSITY_MAX = 100
|
|
81
86
|
const LAMP_DISTANCE_MIN = 0.1
|
|
82
87
|
const LAMP_DISTANCE_MAX = 50
|
|
@@ -107,9 +112,18 @@ interface LookPools {
|
|
|
107
112
|
radius: number
|
|
108
113
|
at: Point[]
|
|
109
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* SHARD-SOURCE AP24a: a lamp that rides an actor (a creature or boss by its spawn id) or one of its rig's bones. Its `at`
|
|
117
|
+
* is then an offset in that actor's (or bone's) frame, applied each frame; with no actor in the world the lamp is dark.
|
|
118
|
+
*/
|
|
119
|
+
interface LookLampFollow {
|
|
120
|
+
actor: string
|
|
121
|
+
bone?: string
|
|
122
|
+
}
|
|
110
123
|
/** One lamp: a point light at `at`, `colour` × `intensity` (candela), out to `distance` metres, decay 2, no shadow. */
|
|
111
124
|
interface LookLamp {
|
|
112
125
|
at: Point
|
|
126
|
+
follow?: LookLampFollow
|
|
113
127
|
colour: Rgb
|
|
114
128
|
intensity: number
|
|
115
129
|
distance: number
|
|
@@ -182,8 +196,19 @@ const LookPoolsSchema: GenericSchema<LookPools, LookPools> = strictObject({
|
|
|
182
196
|
radius: range(POOL_RADIUS_MIN, POOL_RADIUS_MAX),
|
|
183
197
|
at: pipe(array(point), minLength(FULL), maxLength(LOOK_LIGHT_POOLS_MAX)),
|
|
184
198
|
})
|
|
199
|
+
const ACTOR_ID_MAX = 128
|
|
200
|
+
const BONE_NAME_MAX = 64
|
|
201
|
+
const actorId = pipe(
|
|
202
|
+
string(),
|
|
203
|
+
regex(/^[a-z][a-z0-9.:-]*$/u),
|
|
204
|
+
maxLength(ACTOR_ID_MAX),
|
|
205
|
+
)
|
|
206
|
+
const boneName = pipe(string(), minLength(FULL), maxLength(BONE_NAME_MAX))
|
|
207
|
+
const LookLampFollowSchema: GenericSchema<LookLampFollow, LookLampFollow> =
|
|
208
|
+
strictObject({ actor: actorId, bone: exactOptional(boneName) })
|
|
185
209
|
const LookLampSchema: GenericSchema<LookLamp, LookLamp> = strictObject({
|
|
186
210
|
at: point,
|
|
211
|
+
follow: exactOptional(LookLampFollowSchema),
|
|
187
212
|
colour,
|
|
188
213
|
intensity: range(NONE, LAMP_INTENSITY_MAX),
|
|
189
214
|
distance: range(LAMP_DISTANCE_MIN, LAMP_DISTANCE_MAX),
|
|
@@ -233,6 +258,7 @@ const LookBloomSchema: GenericSchema<LookBloom, LookBloom> = strictObject({
|
|
|
233
258
|
|
|
234
259
|
export {
|
|
235
260
|
LOOK_LIGHT_LAMPS_MAX,
|
|
261
|
+
LOOK_LIGHT_LIT_MAX,
|
|
236
262
|
LOOK_LIGHT_POOLS_MAX,
|
|
237
263
|
LookAoSchema,
|
|
238
264
|
LookBloomSchema,
|
package/src/format/targets.ts
CHANGED
|
@@ -30,6 +30,8 @@ export const TargetsSchema: v.GenericSchema<ShardTargetsInput, ShardTargets> = v
|
|
|
30
30
|
|
|
31
31
|
/** A declared lever-action (TE-ENG2) is the one weapon an item scene may name: its action 3 takes it from a rack, 4 reloads it. */
|
|
32
32
|
const LEVER_FAMILY = 'kit.lever';
|
|
33
|
+
/** A melee weapon an item scene takes off its rack (action 3), TEMPLATE-E2E TC-E4. */
|
|
34
|
+
const MELEE_FAMILY = 'kit.melee', RACK_TAKE = 3;
|
|
33
35
|
/** Each row's id. */
|
|
34
36
|
function idsOf(rows: readonly Readonly<{ id: string }>[]): Set<string> {
|
|
35
37
|
const out = new Set<string>();
|
|
@@ -122,7 +124,7 @@ export function targetRules(targets: ShardTargets, shard: { state: v.InferOutput
|
|
|
122
124
|
errors.push(...spentRules(targets, shard.hooks.conditions));
|
|
123
125
|
if (targets.panels.length > 0 && shard.sim.bindings.length === 0) errors.push('target fields require script bindings');
|
|
124
126
|
const actions = targets.itemActions ?? [], fields = targets.itemFields ?? [];
|
|
125
|
-
if (new Set(actions.map((row) => row.scene)).size !== actions.length || actions.some((row) => !scenes.has(row.scene) || !shard.items.rows.some((item) => item.id === row.item && (item.kind === 'tool' || item.family === LEVER_FAMILY)))) errors.push('declared item action scenes');
|
|
127
|
+
if (new Set(actions.map((row) => row.scene)).size !== actions.length || actions.some((row) => !scenes.has(row.scene) || !shard.items.rows.some((item) => item.id === row.item && (item.kind === 'tool' || item.family === LEVER_FAMILY || item.family === MELEE_FAMILY && row.action === RACK_TAKE)))) errors.push('declared item action scenes');
|
|
126
128
|
if (new Set(fields.map((row) => row.fieldId)).size !== fields.length || fields.some((row) => {
|
|
127
129
|
const field = shard.state.player.find((entry) => entry.id === row.fieldId);
|
|
128
130
|
return !projects(shard.items.rows, row) || field === undefined || field.privacy === 'host' || field.type !== (row.property === 'fuel' ? 'f64' : 'bool') || (field.min ?? 0) > 0 || (field.max ?? 1) < 1;
|