@wildshard/kit 0.0.0 → 0.4.0

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.
Files changed (129) hide show
  1. package/GUIDE.md +221 -0
  2. package/content/abilities/bite.json +24 -0
  3. package/content/abilities/charge.json +25 -0
  4. package/content/abilities/claw.json +24 -0
  5. package/content/abilities/slam.json +24 -0
  6. package/content/abilities/swing.json +25 -0
  7. package/content/animated/bear/pbr/black-blaze.glb +0 -0
  8. package/content/animated/bear/pbr/black-blaze.json +1 -0
  9. package/content/animated/bear/pbr/black-old.glb +0 -0
  10. package/content/animated/bear/pbr/black-old.json +1 -0
  11. package/content/animated/bear/pbr/black.glb +0 -0
  12. package/content/animated/bear/pbr/black.json +1 -0
  13. package/content/animated/bear/pbr/brown-old.glb +0 -0
  14. package/content/animated/bear/pbr/brown-old.json +1 -0
  15. package/content/animated/bear/pbr/brown.glb +0 -0
  16. package/content/animated/bear/pbr/brown.json +1 -0
  17. package/content/animated/bear/toon/black-blaze.glb +0 -0
  18. package/content/animated/bear/toon/black-blaze.json +1 -0
  19. package/content/animated/bear/toon/black-old.glb +0 -0
  20. package/content/animated/bear/toon/black-old.json +1 -0
  21. package/content/animated/bear/toon/black.glb +0 -0
  22. package/content/animated/bear/toon/black.json +1 -0
  23. package/content/animated/bear/toon/brown-old.glb +0 -0
  24. package/content/animated/bear/toon/brown-old.json +1 -0
  25. package/content/animated/bear/toon/brown.glb +0 -0
  26. package/content/animated/bear/toon/brown.json +1 -0
  27. package/content/animated/boar/pbr/big.glb +0 -0
  28. package/content/animated/boar/pbr/big.json +1 -0
  29. package/content/animated/boar/pbr/black.glb +0 -0
  30. package/content/animated/boar/pbr/black.json +1 -0
  31. package/content/animated/boar/pbr/boar.glb +0 -0
  32. package/content/animated/boar/pbr/boar.json +1 -0
  33. package/content/animated/boar/pbr/ironhide.glb +0 -0
  34. package/content/animated/boar/pbr/ironhide.json +1 -0
  35. package/content/animated/boar/pbr/scarback.glb +0 -0
  36. package/content/animated/boar/pbr/scarback.json +1 -0
  37. package/content/animated/boar/pbr/sow.glb +0 -0
  38. package/content/animated/boar/pbr/sow.json +1 -0
  39. package/content/animated/boar/toon/big.glb +0 -0
  40. package/content/animated/boar/toon/big.json +1 -0
  41. package/content/animated/boar/toon/black.glb +0 -0
  42. package/content/animated/boar/toon/black.json +1 -0
  43. package/content/animated/boar/toon/boar.glb +0 -0
  44. package/content/animated/boar/toon/boar.json +1 -0
  45. package/content/animated/boar/toon/ironhide.glb +0 -0
  46. package/content/animated/boar/toon/ironhide.json +1 -0
  47. package/content/animated/boar/toon/scarback.glb +0 -0
  48. package/content/animated/boar/toon/scarback.json +1 -0
  49. package/content/animated/boar/toon/sow.glb +0 -0
  50. package/content/animated/boar/toon/sow.json +1 -0
  51. package/content/animated/catalogue.json +1 -0
  52. package/content/bodies/biped.json +5 -0
  53. package/content/bodies/quadruped.json +5 -0
  54. package/content/clips/quadruped.json +1 -0
  55. package/content/creatures/bear/look.json +199 -0
  56. package/content/creatures/bear/pbr/black-blaze.glb +0 -0
  57. package/content/creatures/bear/pbr/black-old.glb +0 -0
  58. package/content/creatures/bear/pbr/black.glb +0 -0
  59. package/content/creatures/bear/pbr/brown-old.glb +0 -0
  60. package/content/creatures/bear/pbr/brown.glb +0 -0
  61. package/content/creatures/bear/toon/black-blaze.glb +0 -0
  62. package/content/creatures/bear/toon/black-old.glb +0 -0
  63. package/content/creatures/bear/toon/black.glb +0 -0
  64. package/content/creatures/bear/toon/brown-old.glb +0 -0
  65. package/content/creatures/bear/toon/brown.glb +0 -0
  66. package/content/creatures/bear.json +257 -0
  67. package/content/creatures/boar/look.json +184 -0
  68. package/content/creatures/boar/pbr/big.glb +0 -0
  69. package/content/creatures/boar/pbr/black.glb +0 -0
  70. package/content/creatures/boar/pbr/boar.glb +0 -0
  71. package/content/creatures/boar/pbr/ironhide.glb +0 -0
  72. package/content/creatures/boar/pbr/scarback.glb +0 -0
  73. package/content/creatures/boar/pbr/sow.glb +0 -0
  74. package/content/creatures/boar/toon/big.glb +0 -0
  75. package/content/creatures/boar/toon/black.glb +0 -0
  76. package/content/creatures/boar/toon/boar.glb +0 -0
  77. package/content/creatures/boar/toon/ironhide.glb +0 -0
  78. package/content/creatures/boar/toon/scarback.glb +0 -0
  79. package/content/creatures/boar/toon/sow.glb +0 -0
  80. package/content/creatures/boar.json +275 -0
  81. package/content/creatures/bodies.json +4754 -0
  82. package/content/harvest-items.json +98 -0
  83. package/content/harvest.json +31 -0
  84. package/content/journal-icons/antlers.png +0 -0
  85. package/content/journal-icons/bear.png +0 -0
  86. package/content/journal-icons/boar.png +0 -0
  87. package/content/journal-icons/deer.png +0 -0
  88. package/content/journal-icons/elk.png +0 -0
  89. package/content/journal-icons/ghost.png +0 -0
  90. package/content/journal-icons/ironhide.png +0 -0
  91. package/content/journal-icons.json +9 -0
  92. package/content/shared/pickupCatalogue.json +1008 -0
  93. package/content/shared/starterBow.json +21 -0
  94. package/content/species/bear.json +144 -0
  95. package/content/species/boar.json +147 -0
  96. package/content/sword-debris.json +7 -0
  97. package/content/temperaments.json +519 -0
  98. package/content/tuning/bear.json +43 -0
  99. package/content/tuning/boar.json +32 -0
  100. package/content/tuning/deer.json +32 -0
  101. package/content/tuning/pursue.json +12 -0
  102. package/package.json +57 -4
  103. package/src/abilities.ts +85 -0
  104. package/src/body.ts +25 -0
  105. package/src/clips.ts +139 -0
  106. package/src/creatures.ts +76 -0
  107. package/src/geometry/arms.ts +725 -0
  108. package/src/geometry/bear.ts +521 -0
  109. package/src/geometry/boar.ts +604 -0
  110. package/src/geometry/bowProfile.ts +34 -0
  111. package/src/geometry/export.ts +101 -0
  112. package/src/geometry/meleeProfile.ts +261 -0
  113. package/src/geometry/nativeInteractionFacts.ts +7 -0
  114. package/src/geometry/nativeLooks.ts +54 -0
  115. package/src/geometry/riderArms.ts +215 -0
  116. package/src/geometry/sharedSpecs.ts +26 -0
  117. package/src/geometry/species.ts +768 -0
  118. package/src/geometry/specimenCatalogue.ts +80 -0
  119. package/src/geometry/starterCombat.ts +194 -0
  120. package/src/geometry/starterGlyphs.ts +12 -0
  121. package/src/geometry/starterMeleeProfile.ts +134 -0
  122. package/src/geometry/starterMoves.ts +172 -0
  123. package/src/index.ts +26 -0
  124. package/src/legacyCombat.ts +25 -0
  125. package/src/legacyHarvest.ts +104 -0
  126. package/src/legacyJournalIcons.ts +10 -0
  127. package/src/legacySpecies.ts +127 -0
  128. package/src/temperament.ts +97 -0
  129. package/README.md +0 -3
@@ -0,0 +1,104 @@
1
+ import { ItemsSchema, type ShardItems } from '@wildshard/shard-format/items'
2
+ import {
3
+ array,
4
+ check,
5
+ exactOptional,
6
+ integer,
7
+ maxLength,
8
+ maxValue,
9
+ minValue,
10
+ number,
11
+ parse,
12
+ pipe,
13
+ record,
14
+ regex,
15
+ strictObject,
16
+ string,
17
+ } from 'valibot'
18
+
19
+ import itemContent from '../content/harvest-items.json' with { type: 'json' }
20
+ import content from '../content/harvest.json' with { type: 'json' }
21
+
22
+ import type { HarvestDrop } from '@wildshard/shard-format/harvestRows'
23
+
24
+ /** The one admitted harvest declaration, copied by the kit's source compatibility helper. */
25
+ export type HarvestContentRow = HarvestDrop
26
+ const MAX_ROWS = 64
27
+ const MAX_VARIANTS = 128
28
+ const id = pipe(string(), regex(/^[a-z][a-zA-Z0-9.:-]*$/u), maxLength(128))
29
+ const names = pipe(array(id), maxLength(MAX_VARIANTS))
30
+ const rule = pipe(
31
+ strictObject({
32
+ item: id,
33
+ count: pipe(number(), integer(), minValue(1), maxValue(MAX_ROWS)),
34
+ oneOf: exactOptional(names),
35
+ except: exactOptional(names),
36
+ contains: exactOptional(names),
37
+ }),
38
+ check(
39
+ row =>
40
+ [row.oneOf, row.except, row.contains].filter(value => value !== undefined)
41
+ .length <= 1,
42
+ 'One harvest selector',
43
+ ),
44
+ )
45
+ const rules = parse(record(id, pipe(array(rule), maxLength(MAX_ROWS))), content)
46
+ const items = parse(ItemsSchema, {
47
+ version: 1,
48
+ rows: [],
49
+ contexts: [],
50
+ catalogue: itemContent,
51
+ loadout: { primary: null, secondary: null, tools: [] },
52
+ }).catalogue
53
+
54
+ /** Copy only referenced old item metadata; an author's existing catalogue remains its own. */
55
+ export function legacyHarvestItems(
56
+ identities: readonly string[],
57
+ ): NonNullable<ShardItems['catalogue']> {
58
+ return [...new Set(identities)].map(identity => {
59
+ const row = items?.find(item => item.id === identity)
60
+ if (row === undefined)
61
+ throw new Error(`Missing kit harvest item: ${identity}`)
62
+ return {
63
+ id: row.id,
64
+ label: row.label,
65
+ icon: row.icon,
66
+ travels: row.travels,
67
+ }
68
+ })
69
+ }
70
+
71
+ /** Copy the former source law over an explicit roster. No kit selector is shipped to the engine. */
72
+ export function legacyHarvest(
73
+ kind: string,
74
+ variants: readonly string[],
75
+ ): HarvestContentRow[] | undefined {
76
+ const roster = parse(names, variants)
77
+ if (new Set(roster).size !== roster.length)
78
+ throw new Error('Duplicate harvest variant')
79
+ const source = Object.hasOwn(rules, kind) ? rules[kind] : undefined
80
+ return source?.flatMap(row => {
81
+ if (
82
+ row.oneOf === undefined &&
83
+ row.except === undefined &&
84
+ row.contains === undefined
85
+ )
86
+ return [{ item: row.item, count: row.count }]
87
+ const selected = roster.filter(
88
+ variant =>
89
+ row.oneOf?.includes(variant) ??
90
+ (row.except === undefined
91
+ ? row.contains?.some(part => variant.includes(part))
92
+ : !row.except.includes(variant)),
93
+ )
94
+ const drops: HarvestContentRow[] = []
95
+ for (let start = 0; start < selected.length; start += MAX_ROWS) {
96
+ drops.push({
97
+ item: row.item,
98
+ count: row.count,
99
+ variants: selected.slice(start, start + MAX_ROWS),
100
+ })
101
+ }
102
+ return drops
103
+ })
104
+ }
@@ -0,0 +1,10 @@
1
+ import content from '../content/journal-icons.json' with { type: 'json' }
2
+
3
+ /** Exact former journal glyph bytes for source compilation; authors may supply any admitted image instead. */
4
+ export function legacyJournalIcon(name: string): string {
5
+ if (!Object.hasOwn(content, name))
6
+ throw new Error(`Unknown kit journal icon: ${name}`)
7
+ const row = Object.entries(content).find(([id]) => id === name)
8
+ if (row === undefined) throw new Error(`Missing kit journal icon: ${name}`)
9
+ return row[1]
10
+ }
@@ -0,0 +1,127 @@
1
+ import {
2
+ CreatureTypeSchema,
3
+ CreatureTemperamentSchema,
4
+ CreatureSensesSchema,
5
+ CreaturePresentationSchema,
6
+ type CreatureTemperament,
7
+ type CreatureSenses,
8
+ type CreaturePresentation,
9
+ type CreatureType,
10
+ } from '@wildshard/shard-format/creatureLayers'
11
+ import { HuntTuningSchema } from '@wildshard/shard-format/speciesPrograms'
12
+ import {
13
+ parse,
14
+ strictObject,
15
+ type GenericSchema,
16
+ type InferOutput,
17
+ } from 'valibot'
18
+
19
+ import bear from '../content/species/bear.json' with { type: 'json' }
20
+ import boar from '../content/species/boar.json' with { type: 'json' }
21
+ import deerTuning from '../content/tuning/deer.json' with { type: 'json' }
22
+ import pursue from '../content/tuning/pursue.json' with { type: 'json' }
23
+
24
+ /** Build-only compatibility content; running creatures never choose a kit preset by kind. */
25
+ export interface LegacyCreatureProfile {
26
+ type: CreatureType
27
+ temperament: CreatureTemperament
28
+ senses: CreatureSenses
29
+ presentation: CreaturePresentation
30
+ }
31
+ const ProfileSchema: GenericSchema<LegacyCreatureProfile> = strictObject({
32
+ type: CreatureTypeSchema,
33
+ temperament: CreatureTemperamentSchema,
34
+ senses: CreatureSensesSchema,
35
+ presentation: CreaturePresentationSchema,
36
+ })
37
+ function hunt(
38
+ tuning: unknown,
39
+ reaction: CreatureTemperament['reaction'],
40
+ sounds: CreaturePresentation['sounds'],
41
+ motion?: {
42
+ walkSpeed: number
43
+ chargeSpeed: number
44
+ chargeWindup: number
45
+ ringRadius: number
46
+ trampleRadius: number
47
+ },
48
+ ): LegacyCreatureProfile {
49
+ const numbers = parse(HuntTuningSchema, tuning)
50
+ return {
51
+ type: 'beast',
52
+ temperament: {
53
+ brain: 'hunt',
54
+ reaction,
55
+ leash: numbers.fleeUntilMax,
56
+ assist: numbers.herdAlertRadius,
57
+ home: { speed: numbers.trotSpeed, stop: 1.5 },
58
+ tuning:
59
+ motion === undefined
60
+ ? numbers
61
+ : {
62
+ ...numbers,
63
+ motion: {
64
+ walkSpeed: motion.walkSpeed,
65
+ chargeSpeed: motion.chargeSpeed,
66
+ chargeWindup: motion.chargeWindup,
67
+ ringRadius: motion.ringRadius,
68
+ trampleRadius: motion.trampleRadius,
69
+ },
70
+ },
71
+ },
72
+ senses: {
73
+ notice: numbers.sightRange,
74
+ sight: {
75
+ range: numbers.sightRange,
76
+ cone: numbers.sightCone,
77
+ graze: numbers.sightRangeGraze,
78
+ },
79
+ hearing: {
80
+ still: numbers.hearStill,
81
+ crouch: numbers.hearCrouch,
82
+ walk: numbers.hearWalk,
83
+ sprint: numbers.hearSprint,
84
+ },
85
+ },
86
+ presentation: { blood: true, sounds },
87
+ }
88
+ }
89
+ const profiles: ReadonlyMap<string, LegacyCreatureProfile> = new Map([
90
+ ['boar', hunt(boar.tuning, 'aggressive', boar.sounds, boar)],
91
+ ['bear', hunt(bear.tuning, 'aggressive', bear.sounds, bear)],
92
+ [
93
+ 'deer',
94
+ hunt(deerTuning, 'skittish', { call: 'deer_call', hurt: 'deer_call' }),
95
+ ],
96
+ [
97
+ 'greyBlob',
98
+ {
99
+ type: 'aberration',
100
+ temperament: {
101
+ brain: 'pursue',
102
+ reaction: 'aggressive',
103
+ leash: pursue.leashRadius,
104
+ assist: 0,
105
+ home: { speed: pursue.returnSpeed, stop: pursue.stopDistance },
106
+ tuning: pursue,
107
+ },
108
+ senses: { notice: pursue.awareRadius },
109
+ presentation: { blood: true, sounds: {} },
110
+ },
111
+ ],
112
+ ])
113
+
114
+ /** Exact former hunt-owner baseline for an old native declaration's explicit aggressive flag. */
115
+ export function legacyHuntTuning(
116
+ aggressive: boolean,
117
+ ): InferOutput<typeof HuntTuningSchema> {
118
+ return parse(HuntTuningSchema, aggressive ? boar.tuning : deerTuning)
119
+ }
120
+
121
+ /** A fresh validated compatibility profile for an old source label, or no implicit expansion. */
122
+ export function legacyCreatureProfile(
123
+ kind: string,
124
+ ): LegacyCreatureProfile | undefined {
125
+ const profile = profiles.get(kind)
126
+ return profile === undefined ? undefined : parse(ProfileSchema, profile)
127
+ }
@@ -0,0 +1,97 @@
1
+ import {
2
+ CreatureTemperamentSchema,
3
+ CreatureSensesSchema,
4
+ type CreatureSenses,
5
+ type CreatureTemperament,
6
+ } from '@wildshard/shard-format/creatureLayers'
7
+ import { parse, strictObject, type GenericSchema } from 'valibot'
8
+
9
+ import plain from '../content/temperaments.json' with { type: 'json' }
10
+
11
+ interface TemperamentProfile {
12
+ temperament: CreatureTemperament
13
+ senses: CreatureSenses
14
+ }
15
+ interface TemperamentOptions {
16
+ readonly aggro?: number
17
+ readonly leash?: number
18
+ readonly assist?: number
19
+ readonly homeSpeed?: number
20
+ readonly homeStop?: number
21
+ }
22
+ type PresetName =
23
+ | 'passive'
24
+ | 'skittish'
25
+ | 'neutral'
26
+ | 'aggressive'
27
+ | 'pack'
28
+ | 'territorial'
29
+ | 'ambush'
30
+ | 'flee'
31
+ | 'pursue'
32
+ type TemperamentHelper = (
33
+ options?: Readonly<TemperamentOptions>,
34
+ ) => TemperamentProfile
35
+ const ProfileSchema: GenericSchema<TemperamentProfile> = strictObject({
36
+ temperament: CreatureTemperamentSchema,
37
+ senses: CreatureSensesSchema,
38
+ })
39
+
40
+ function override(value: number | undefined, fallback: number): number {
41
+ if (value === undefined) {
42
+ return fallback
43
+ }
44
+ return value
45
+ }
46
+
47
+ /** JSON is the catalogue; helpers apply explicit numeric overrides to fresh rows. */
48
+ function profile(
49
+ name: PresetName,
50
+ options: Readonly<TemperamentOptions> = {},
51
+ ): TemperamentProfile {
52
+ const row = parse(ProfileSchema, plain[name])
53
+ return parse(ProfileSchema, {
54
+ temperament: {
55
+ ...row.temperament,
56
+ leash: override(options.leash, row.temperament.leash),
57
+ assist: override(options.assist, row.temperament.assist),
58
+ home: {
59
+ speed: override(options.homeSpeed, row.temperament.home.speed),
60
+ stop: override(options.homeStop, row.temperament.home.stop),
61
+ },
62
+ },
63
+ senses: {
64
+ ...row.senses,
65
+ notice: override(options.aggro, row.senses.notice),
66
+ },
67
+ })
68
+ }
69
+
70
+ const temperament: Readonly<Record<PresetName, TemperamentHelper>> = {
71
+ passive: (options?: Readonly<TemperamentOptions>): TemperamentProfile =>
72
+ profile('passive', options),
73
+ skittish: (options?: Readonly<TemperamentOptions>): TemperamentProfile =>
74
+ profile('skittish', options),
75
+ neutral: (options?: Readonly<TemperamentOptions>): TemperamentProfile =>
76
+ profile('neutral', options),
77
+ aggressive: (options?: Readonly<TemperamentOptions>): TemperamentProfile =>
78
+ profile('aggressive', options),
79
+ pack: (options?: Readonly<TemperamentOptions>): TemperamentProfile =>
80
+ profile('pack', options),
81
+ territorial: (options?: Readonly<TemperamentOptions>): TemperamentProfile =>
82
+ profile('territorial', options),
83
+ ambush: (options?: Readonly<TemperamentOptions>): TemperamentProfile =>
84
+ profile('ambush', options),
85
+ flee: (options?: Readonly<TemperamentOptions>): TemperamentProfile =>
86
+ profile('flee', options),
87
+ pursue: (options?: Readonly<TemperamentOptions>): TemperamentProfile =>
88
+ profile('pursue', options),
89
+ }
90
+
91
+ export { temperament }
92
+ export type {
93
+ TemperamentOptions,
94
+ TemperamentProfile,
95
+ TemperamentHelper,
96
+ PresetName,
97
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # @wildshard/kit
2
-
3
- Placeholder. The first real release publishes from CI (project-wildshard/sharddev, npm-publish.yml). Do not install 0.0.0.