@nice2dev/game-engine 1.3.13 → 1.3.14
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/CHANGELOG.md +4 -0
- package/package.json +2 -2
- package/dist/types/accessibility/index.d.ts +0 -1
- package/dist/types/ai/index.d.ts +0 -1
- package/dist/types/animation/index.d.ts +0 -1
- package/dist/types/audio/HRTFAudio.d.ts +0 -180
- package/dist/types/audio/index.d.ts +0 -2
- package/dist/types/community/Community.d.ts +0 -112
- package/dist/types/community/index.d.ts +0 -1
- package/dist/types/core/TypeSafety.d.ts +0 -190
- package/dist/types/core/index.d.ts +0 -7
- package/dist/types/devtools/AssetStore.d.ts +0 -133
- package/dist/types/devtools/index.d.ts +0 -3
- package/dist/types/dialogue/index.d.ts +0 -2
- package/dist/types/docs/APIPlayground.d.ts +0 -26
- package/dist/types/docs/Cookbook.d.ts +0 -18
- package/dist/types/docs/Guides.d.ts +0 -18
- package/dist/types/docs/index.d.ts +0 -4
- package/dist/types/ecs/ECSOptimized.d.ts +0 -131
- package/dist/types/ecs/index.d.ts +0 -2
- package/dist/types/editor/NiceAnimationTimeline.d.ts +0 -114
- package/dist/types/editor/NiceLevelEditor.d.ts +0 -232
- package/dist/types/editor/NiceMaterialEditor.d.ts +0 -105
- package/dist/types/editor/NiceNodeGraph.d.ts +0 -87
- package/dist/types/editor/NiceParticleEditor.d.ts +0 -127
- package/dist/types/editor/behavior-tree/BTDebugPanel.d.ts +0 -102
- package/dist/types/editor/behavior-tree/BTEditorCanvas.d.ts +0 -79
- package/dist/types/editor/behavior-tree/BTEditorNode.d.ts +0 -58
- package/dist/types/editor/behavior-tree/BTEditorToolbar.d.ts +0 -75
- package/dist/types/editor/behavior-tree/BTNodePalette.d.ts +0 -72
- package/dist/types/editor/behavior-tree/BTPropertyPanel.d.ts +0 -66
- package/dist/types/editor/behavior-tree/BehaviorTreeEditor.d.ts +0 -186
- package/dist/types/editor/behavior-tree/index.d.ts +0 -14
- package/dist/types/editor/behavior-tree/serialization.d.ts +0 -30
- package/dist/types/editor/behavior-tree/types.d.ts +0 -299
- package/dist/types/editor/index.d.ts +0 -20
- package/dist/types/editor/state-machine/SMEditorCanvas.d.ts +0 -61
- package/dist/types/editor/state-machine/StateMachineEditor.d.ts +0 -139
- package/dist/types/editor/state-machine/index.d.ts +0 -11
- package/dist/types/editor/state-machine/serialization.d.ts +0 -23
- package/dist/types/editor/state-machine/types.d.ts +0 -241
- package/dist/types/engine/index.d.ts +0 -2
- package/dist/types/enterprise/index.d.ts +0 -1
- package/dist/types/epic/index.d.ts +0 -10
- package/dist/types/i18n/index.d.ts +0 -2
- package/dist/types/input/index.d.ts +0 -3
- package/dist/types/kids/index.d.ts +0 -2
- package/dist/types/legendary/index.d.ts +0 -57
- package/dist/types/monetization/index.d.ts +0 -1
- package/dist/types/multiplayer/NiceNetcode.d.ts +0 -434
- package/dist/types/multiplayer/index.d.ts +0 -5
- package/dist/types/network/index.d.ts +0 -2
- package/dist/types/pathfinding/index.d.ts +0 -1
- package/dist/types/performance/AssetCompression.d.ts +0 -137
- package/dist/types/performance/WASMModules.d.ts +0 -65
- package/dist/types/performance/WebGPUCompute.d.ts +0 -71
- package/dist/types/performance/index.d.ts +0 -1
- package/dist/types/physics/RapierIntegration.d.ts +0 -404
- package/dist/types/physics/index.d.ts +0 -2
- package/dist/types/plugins/index.d.ts +0 -2
- package/dist/types/procedural/index.d.ts +0 -2
- package/dist/types/release/index.d.ts +0 -1
- package/dist/types/rendering/WebGPUv2.d.ts +0 -173
- package/dist/types/rendering/index.d.ts +0 -3
- package/dist/types/runtime3d/index.d.ts +0 -2
- package/dist/types/scene/index.d.ts +0 -2
- package/dist/types/scripting/WasmCompiler.d.ts +0 -182
- package/dist/types/scripting/index.d.ts +0 -19
- package/dist/types/social/index.d.ts +0 -1
- package/dist/types/systems/NiceAI.d.ts +0 -637
- package/dist/types/systems/NiceAbility.d.ts +0 -225
- package/dist/types/systems/NiceAccessibility.d.ts +0 -230
- package/dist/types/systems/NiceAchievement.d.ts +0 -153
- package/dist/types/systems/NiceAchievementUI.d.ts +0 -196
- package/dist/types/systems/NiceAchievements.d.ts +0 -230
- package/dist/types/systems/NiceAction.d.ts +0 -81
- package/dist/types/systems/NiceAlchemy.d.ts +0 -195
- package/dist/types/systems/NiceAnalytics.d.ts +0 -493
- package/dist/types/systems/NiceAnimation.d.ts +0 -350
- package/dist/types/systems/NiceArena.d.ts +0 -215
- package/dist/types/systems/NiceAssetLoader.d.ts +0 -136
- package/dist/types/systems/NiceAuction.d.ts +0 -157
- package/dist/types/systems/NiceAudio.d.ts +0 -224
- package/dist/types/systems/NiceAugment.d.ts +0 -187
- package/dist/types/systems/NiceAura.d.ts +0 -193
- package/dist/types/systems/NiceBank.d.ts +0 -158
- package/dist/types/systems/NiceBattlePass.d.ts +0 -150
- package/dist/types/systems/NiceBehavior.d.ts +0 -160
- package/dist/types/systems/NiceBinding.d.ts +0 -96
- package/dist/types/systems/NiceBlacksmith.d.ts +0 -221
- package/dist/types/systems/NiceBuff.d.ts +0 -177
- package/dist/types/systems/NiceBuilding.d.ts +0 -207
- package/dist/types/systems/NiceBullet.d.ts +0 -167
- package/dist/types/systems/NiceCamera.d.ts +0 -252
- package/dist/types/systems/NiceCard.d.ts +0 -171
- package/dist/types/systems/NiceChat.d.ts +0 -148
- package/dist/types/systems/NiceCheat.d.ts +0 -375
- package/dist/types/systems/NiceClimbing.d.ts +0 -186
- package/dist/types/systems/NiceCloud.d.ts +0 -422
- package/dist/types/systems/NiceCollision.d.ts +0 -238
- package/dist/types/systems/NiceCombo.d.ts +0 -131
- package/dist/types/systems/NiceCommand.d.ts +0 -112
- package/dist/types/systems/NiceCompanion.d.ts +0 -182
- package/dist/types/systems/NiceController.d.ts +0 -144
- package/dist/types/systems/NiceCooking.d.ts +0 -193
- package/dist/types/systems/NiceCoroutine.d.ts +0 -101
- package/dist/types/systems/NiceCrafting.d.ts +0 -228
- package/dist/types/systems/NiceCutscene.d.ts +0 -437
- package/dist/types/systems/NiceDaily.d.ts +0 -133
- package/dist/types/systems/NiceDamage.d.ts +0 -271
- package/dist/types/systems/NiceDayNight.d.ts +0 -126
- package/dist/types/systems/NiceDebug.d.ts +0 -255
- package/dist/types/systems/NiceDestructible.d.ts +0 -150
- package/dist/types/systems/NiceDialogue.d.ts +0 -629
- package/dist/types/systems/NiceDungeon.d.ts +0 -202
- package/dist/types/systems/NiceECS.d.ts +0 -151
- package/dist/types/systems/NiceEnchant.d.ts +0 -148
- package/dist/types/systems/NiceEntityPool.d.ts +0 -127
- package/dist/types/systems/NiceEquipment.d.ts +0 -137
- package/dist/types/systems/NiceEvent.d.ts +0 -202
- package/dist/types/systems/NiceEventBus.d.ts +0 -164
- package/dist/types/systems/NiceFaction.d.ts +0 -173
- package/dist/types/systems/NiceFarming.d.ts +0 -163
- package/dist/types/systems/NiceFishing.d.ts +0 -196
- package/dist/types/systems/NiceFlocking.d.ts +0 -156
- package/dist/types/systems/NiceFog.d.ts +0 -137
- package/dist/types/systems/NiceFormation.d.ts +0 -140
- package/dist/types/systems/NiceGacha.d.ts +0 -134
- package/dist/types/systems/NiceGambling.d.ts +0 -175
- package/dist/types/systems/NiceGem.d.ts +0 -165
- package/dist/types/systems/NiceGesture.d.ts +0 -502
- package/dist/types/systems/NiceGrappling.d.ts +0 -154
- package/dist/types/systems/NiceGrid.d.ts +0 -142
- package/dist/types/systems/NiceGuild.d.ts +0 -162
- package/dist/types/systems/NiceHaptics.d.ts +0 -112
- package/dist/types/systems/NiceHousing.d.ts +0 -197
- package/dist/types/systems/NiceInput.d.ts +0 -280
- package/dist/types/systems/NiceInventory.d.ts +0 -534
- package/dist/types/systems/NiceLOD.d.ts +0 -144
- package/dist/types/systems/NiceLeaderboard.d.ts +0 -191
- package/dist/types/systems/NiceLevel.d.ts +0 -304
- package/dist/types/systems/NiceLighting.d.ts +0 -214
- package/dist/types/systems/NiceLocalization.d.ts +0 -148
- package/dist/types/systems/NiceLocomotion.d.ts +0 -398
- package/dist/types/systems/NiceLogger.d.ts +0 -117
- package/dist/types/systems/NiceLoot.d.ts +0 -176
- package/dist/types/systems/NiceMail.d.ts +0 -164
- package/dist/types/systems/NiceMap.d.ts +0 -234
- package/dist/types/systems/NiceMarriage.d.ts +0 -150
- package/dist/types/systems/NiceMastery.d.ts +0 -171
- package/dist/types/systems/NiceMatch.d.ts +0 -196
- package/dist/types/systems/NiceMatch3.d.ts +0 -118
- package/dist/types/systems/NiceMessageBus.d.ts +0 -115
- package/dist/types/systems/NiceMinimap.d.ts +0 -258
- package/dist/types/systems/NiceMining.d.ts +0 -175
- package/dist/types/systems/NiceModding.d.ts +0 -452
- package/dist/types/systems/NiceMount.d.ts +0 -152
- package/dist/types/systems/NiceNavigation.d.ts +0 -307
- package/dist/types/systems/NiceNetwork.d.ts +0 -568
- package/dist/types/systems/NiceNotification.d.ts +0 -438
- package/dist/types/systems/NiceObjective.d.ts +0 -395
- package/dist/types/systems/NiceParticle.d.ts +0 -639
- package/dist/types/systems/NiceParty.d.ts +0 -168
- package/dist/types/systems/NicePerformance.d.ts +0 -144
- package/dist/types/systems/NicePet.d.ts +0 -167
- package/dist/types/systems/NicePhotoMode.d.ts +0 -270
- package/dist/types/systems/NicePhysics.d.ts +0 -326
- package/dist/types/systems/NicePlatformer.d.ts +0 -158
- package/dist/types/systems/NicePool.d.ts +0 -128
- package/dist/types/systems/NicePortal.d.ts +0 -178
- package/dist/types/systems/NicePostProcess.d.ts +0 -254
- package/dist/types/systems/NiceProcedural.d.ts +0 -202
- package/dist/types/systems/NiceProfile.d.ts +0 -223
- package/dist/types/systems/NiceProjectile.d.ts +0 -157
- package/dist/types/systems/NicePvP.d.ts +0 -199
- package/dist/types/systems/NiceQTE.d.ts +0 -160
- package/dist/types/systems/NiceQuest.d.ts +0 -620
- package/dist/types/systems/NiceRaid.d.ts +0 -215
- package/dist/types/systems/NiceRanking.d.ts +0 -399
- package/dist/types/systems/NiceReplay.d.ts +0 -180
- package/dist/types/systems/NiceReputation.d.ts +0 -151
- package/dist/types/systems/NiceResource.d.ts +0 -200
- package/dist/types/systems/NiceRhythm.d.ts +0 -148
- package/dist/types/systems/NiceRoguelike.d.ts +0 -276
- package/dist/types/systems/NiceRune.d.ts +0 -202
- package/dist/types/systems/NiceSaveSystem.d.ts +0 -194
- package/dist/types/systems/NiceSceneManager.d.ts +0 -112
- package/dist/types/systems/NiceScore.d.ts +0 -186
- package/dist/types/systems/NiceScreenFX.d.ts +0 -235
- package/dist/types/systems/NiceScreenshot.d.ts +0 -443
- package/dist/types/systems/NiceScribe.d.ts +0 -239
- package/dist/types/systems/NiceSeason.d.ts +0 -176
- package/dist/types/systems/NiceSerialization.d.ts +0 -89
- package/dist/types/systems/NiceServiceLocator.d.ts +0 -94
- package/dist/types/systems/NiceShop.d.ts +0 -528
- package/dist/types/systems/NiceSignal.d.ts +0 -112
- package/dist/types/systems/NiceSkillTree.d.ts +0 -237
- package/dist/types/systems/NiceSocial.d.ts +0 -580
- package/dist/types/systems/NiceSpawner.d.ts +0 -237
- package/dist/types/systems/NiceSpell.d.ts +0 -216
- package/dist/types/systems/NiceState.d.ts +0 -224
- package/dist/types/systems/NiceStateMachine.d.ts +0 -108
- package/dist/types/systems/NiceStatus.d.ts +0 -116
- package/dist/types/systems/NiceStealth.d.ts +0 -204
- package/dist/types/systems/NiceSteam.d.ts +0 -255
- package/dist/types/systems/NiceStreaming.d.ts +0 -173
- package/dist/types/systems/NiceSwimming.d.ts +0 -166
- package/dist/types/systems/NiceTalent.d.ts +0 -154
- package/dist/types/systems/NiceTarget.d.ts +0 -121
- package/dist/types/systems/NiceTerrain.d.ts +0 -143
- package/dist/types/systems/NiceTilemap.d.ts +0 -218
- package/dist/types/systems/NiceTimer.d.ts +0 -153
- package/dist/types/systems/NiceTournament.d.ts +0 -190
- package/dist/types/systems/NiceTrading.d.ts +0 -238
- package/dist/types/systems/NiceTransmog.d.ts +0 -142
- package/dist/types/systems/NiceTutorial.d.ts +0 -248
- package/dist/types/systems/NiceTween.d.ts +0 -164
- package/dist/types/systems/NiceUI.d.ts +0 -364
- package/dist/types/systems/NiceVFX.d.ts +0 -333
- package/dist/types/systems/NiceVehicle.d.ts +0 -176
- package/dist/types/systems/NiceVoice.d.ts +0 -502
- package/dist/types/systems/NiceWater.d.ts +0 -162
- package/dist/types/systems/NiceWave.d.ts +0 -174
- package/dist/types/systems/NiceWaypoint.d.ts +0 -165
- package/dist/types/systems/NiceWeather.d.ts +0 -225
- package/dist/types/systems/NiceXR.d.ts +0 -187
- package/dist/types/systems/index.d.ts +0 -182
- package/dist/types/templates/index.d.ts +0 -2
- package/dist/types/tilemap/index.d.ts +0 -1
- package/dist/types/tutorials/TutorialEditor.d.ts +0 -43
- package/dist/types/tutorials/VoiceNarration.d.ts +0 -75
- package/dist/types/tutorials/content/Tutorials_T04.d.ts +0 -3
- package/dist/types/tutorials/content/UITutorials.d.ts +0 -14
- package/dist/types/tutorials/content/index.d.ts +0 -5
- package/dist/types/tutorials/index.d.ts +0 -6
- package/dist/types/ui/index.d.ts +0 -2
- package/dist/types/visual-scripting/VisualScriptDebugger.d.ts +0 -145
- package/dist/types/visual-scripting/VisualScriptExecutor.d.ts +0 -100
- package/dist/types/visual-scripting/VisualScriptGraph.d.ts +0 -173
- package/dist/types/visual-scripting/VisualScriptNode.d.ts +0 -157
- package/dist/types/visual-scripting/index.d.ts +0 -6
- package/dist/types/visual-scripting/nodes/ActionNodes.d.ts +0 -152
- package/dist/types/visual-scripting/nodes/EventNodes.d.ts +0 -95
- package/dist/types/visual-scripting/nodes/FlowControlNodes.d.ts +0 -134
- package/dist/types/visual-scripting/nodes/LogicNodes.d.ts +0 -122
- package/dist/types/visual-scripting/nodes/MathNodes.d.ts +0 -170
- package/dist/types/visual-scripting/nodes/UtilityNodes.d.ts +0 -131
- package/dist/types/visual-scripting/nodes/VariableNodes.d.ts +0 -107
- package/dist/types/visual-scripting/nodes/index.d.ts +0 -21
- package/dist/types/visual-scripting/nodes/registerNodes.d.ts +0 -29
- package/dist/types/visual-scripting/types.d.ts +0 -402
- package/dist/types/xr/WebXRLayers.d.ts +0 -319
- package/dist/types/xr/index.d.ts +0 -2
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
export type SpawnerId = string;
|
|
2
|
-
export type SpawnPointId = string;
|
|
3
|
-
export type SpawnZoneId = string;
|
|
4
|
-
export type WaveId = string;
|
|
5
|
-
export type EntityTypeId = string;
|
|
6
|
-
export type SpawnGroupId = string;
|
|
7
|
-
export type SpawnPattern = 'random' | 'sequential' | 'circular' | 'grid' | 'cluster' | 'line' | 'wave-radial';
|
|
8
|
-
export type SpawnTrigger = 'auto' | 'proximity' | 'event' | 'timer' | 'condition' | 'manual';
|
|
9
|
-
export interface Vec3 {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
z: number;
|
|
13
|
-
}
|
|
14
|
-
export interface SpawnTransform {
|
|
15
|
-
position: Vec3;
|
|
16
|
-
rotation?: Vec3;
|
|
17
|
-
scale?: Vec3;
|
|
18
|
-
}
|
|
19
|
-
export interface SpawnPointDefinition {
|
|
20
|
-
id: SpawnPointId;
|
|
21
|
-
position: Vec3;
|
|
22
|
-
/** Spawn radius */
|
|
23
|
-
radius?: number;
|
|
24
|
-
/** Spawn direction */
|
|
25
|
-
direction?: Vec3;
|
|
26
|
-
/** Entity types this point can spawn */
|
|
27
|
-
entityTypes?: EntityTypeId[];
|
|
28
|
-
/** Tags */
|
|
29
|
-
tags?: string[];
|
|
30
|
-
/** Active state */
|
|
31
|
-
active: boolean;
|
|
32
|
-
/** Cooldown after spawn */
|
|
33
|
-
cooldown?: number;
|
|
34
|
-
/** Max entities from this point */
|
|
35
|
-
maxEntities?: number;
|
|
36
|
-
}
|
|
37
|
-
export interface SpawnZoneDefinition {
|
|
38
|
-
id: SpawnZoneId;
|
|
39
|
-
name: string;
|
|
40
|
-
/** Zone bounds */
|
|
41
|
-
bounds: {
|
|
42
|
-
min: Vec3;
|
|
43
|
-
max: Vec3;
|
|
44
|
-
};
|
|
45
|
-
/** Spawn points within zone */
|
|
46
|
-
spawnPoints: SpawnPointId[];
|
|
47
|
-
/** Spawn pattern */
|
|
48
|
-
pattern: SpawnPattern;
|
|
49
|
-
/** Zone-wide population cap */
|
|
50
|
-
maxPopulation: number;
|
|
51
|
-
/** Current population */
|
|
52
|
-
currentPopulation: number;
|
|
53
|
-
/** Respawn delay */
|
|
54
|
-
respawnDelay: number;
|
|
55
|
-
/** Active state */
|
|
56
|
-
active: boolean;
|
|
57
|
-
/** Tags */
|
|
58
|
-
tags?: string[];
|
|
59
|
-
}
|
|
60
|
-
export interface SpawnEntityDefinition {
|
|
61
|
-
typeId: EntityTypeId;
|
|
62
|
-
name: string;
|
|
63
|
-
/** Factory function or prefab ID */
|
|
64
|
-
factory?: () => unknown;
|
|
65
|
-
prefabId?: string;
|
|
66
|
-
/** Base spawn weight */
|
|
67
|
-
weight: number;
|
|
68
|
-
/** Min level to spawn */
|
|
69
|
-
minLevel?: number;
|
|
70
|
-
/** Max level to spawn */
|
|
71
|
-
maxLevel?: number;
|
|
72
|
-
/** Is boss/elite */
|
|
73
|
-
isBoss?: boolean;
|
|
74
|
-
isElite?: boolean;
|
|
75
|
-
/** Population count (how many slots this takes) */
|
|
76
|
-
populationCost: number;
|
|
77
|
-
/** Spawn requirements */
|
|
78
|
-
conditions?: SpawnCondition[];
|
|
79
|
-
/** Tags */
|
|
80
|
-
tags?: string[];
|
|
81
|
-
}
|
|
82
|
-
export interface WaveEntry {
|
|
83
|
-
entityType: EntityTypeId;
|
|
84
|
-
count: number;
|
|
85
|
-
delay?: number;
|
|
86
|
-
/** Specific spawn points */
|
|
87
|
-
spawnPoints?: SpawnPointId[];
|
|
88
|
-
/** Spawn offset pattern */
|
|
89
|
-
pattern?: SpawnPattern;
|
|
90
|
-
}
|
|
91
|
-
export interface WaveDefinition {
|
|
92
|
-
id: WaveId;
|
|
93
|
-
name?: string;
|
|
94
|
-
entries: WaveEntry[];
|
|
95
|
-
/** Time before next wave */
|
|
96
|
-
nextWaveDelay: number;
|
|
97
|
-
/** Must clear this wave to proceed */
|
|
98
|
-
mustClear: boolean;
|
|
99
|
-
/** Bonus on wave clear */
|
|
100
|
-
clearBonus?: {
|
|
101
|
-
type: string;
|
|
102
|
-
value: number;
|
|
103
|
-
};
|
|
104
|
-
/** Modifiers for this wave */
|
|
105
|
-
modifiers?: {
|
|
106
|
-
healthMultiplier?: number;
|
|
107
|
-
damageMultiplier?: number;
|
|
108
|
-
speedMultiplier?: number;
|
|
109
|
-
experienceMultiplier?: number;
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
export interface WaveState {
|
|
113
|
-
waveId: WaveId;
|
|
114
|
-
waveNumber: number;
|
|
115
|
-
entriesSpawned: number;
|
|
116
|
-
totalEntries: number;
|
|
117
|
-
enemiesAlive: number;
|
|
118
|
-
startTime: number;
|
|
119
|
-
completed: boolean;
|
|
120
|
-
cleared: boolean;
|
|
121
|
-
}
|
|
122
|
-
export interface SpawnCondition {
|
|
123
|
-
type: 'time' | 'population' | 'level' | 'wave' | 'flag' | 'custom';
|
|
124
|
-
params: {
|
|
125
|
-
/** For time: min/max game time */
|
|
126
|
-
minTime?: number;
|
|
127
|
-
maxTime?: number;
|
|
128
|
-
/** For population */
|
|
129
|
-
minPopulation?: number;
|
|
130
|
-
maxPopulation?: number;
|
|
131
|
-
/** For level */
|
|
132
|
-
minPlayerLevel?: number;
|
|
133
|
-
maxPlayerLevel?: number;
|
|
134
|
-
/** For wave */
|
|
135
|
-
minWave?: number;
|
|
136
|
-
maxWave?: number;
|
|
137
|
-
/** For flag */
|
|
138
|
-
flag?: string;
|
|
139
|
-
flagValue?: boolean;
|
|
140
|
-
};
|
|
141
|
-
customCheck?: () => boolean;
|
|
142
|
-
}
|
|
143
|
-
export interface SpawnRequest {
|
|
144
|
-
entityType: EntityTypeId;
|
|
145
|
-
count: number;
|
|
146
|
-
position?: Vec3;
|
|
147
|
-
spawnPoint?: SpawnPointId;
|
|
148
|
-
zone?: SpawnZoneId;
|
|
149
|
-
pattern?: SpawnPattern;
|
|
150
|
-
delay?: number;
|
|
151
|
-
spread?: number;
|
|
152
|
-
modifiers?: Record<string, number>;
|
|
153
|
-
tags?: string[];
|
|
154
|
-
}
|
|
155
|
-
export interface SpawnResult {
|
|
156
|
-
success: boolean;
|
|
157
|
-
spawnedCount: number;
|
|
158
|
-
entities: unknown[];
|
|
159
|
-
positions: Vec3[];
|
|
160
|
-
reason?: string;
|
|
161
|
-
}
|
|
162
|
-
export interface SpawnerState {
|
|
163
|
-
spawnerId: SpawnerId;
|
|
164
|
-
totalSpawned: number;
|
|
165
|
-
activeEntities: Set<unknown>;
|
|
166
|
-
lastSpawnTime: number;
|
|
167
|
-
currentWave: number;
|
|
168
|
-
waveState: WaveState | null;
|
|
169
|
-
paused: boolean;
|
|
170
|
-
active: boolean;
|
|
171
|
-
}
|
|
172
|
-
export type SpawnerEventType = 'entity-spawned' | 'entity-despawned' | 'wave-started' | 'wave-completed' | 'wave-cleared' | 'all-waves-completed' | 'spawner-activated' | 'spawner-deactivated' | 'population-changed' | 'spawn-failed';
|
|
173
|
-
export interface SpawnerEvent {
|
|
174
|
-
type: SpawnerEventType;
|
|
175
|
-
timestamp: number;
|
|
176
|
-
spawnerId?: SpawnerId;
|
|
177
|
-
data: unknown;
|
|
178
|
-
}
|
|
179
|
-
export type SpawnerEventCallback = (event: SpawnerEvent) => void;
|
|
180
|
-
export interface SpawnerConfig {
|
|
181
|
-
/** Global population cap */
|
|
182
|
-
globalMaxPopulation: number;
|
|
183
|
-
/** Default spawn cooldown */
|
|
184
|
-
defaultCooldown: number;
|
|
185
|
-
/** Use object pooling */
|
|
186
|
-
usePooling: boolean;
|
|
187
|
-
/** Storage key */
|
|
188
|
-
storageKey: string;
|
|
189
|
-
}
|
|
190
|
-
export declare const DEFAULT_SPAWNER_CONFIG: SpawnerConfig;
|
|
191
|
-
export declare class NiceSpawner {
|
|
192
|
-
private config;
|
|
193
|
-
private entityTypes;
|
|
194
|
-
private spawnPoints;
|
|
195
|
-
private spawnZones;
|
|
196
|
-
private waves;
|
|
197
|
-
private spawnerStates;
|
|
198
|
-
private activeEntities;
|
|
199
|
-
private entityToSpawner;
|
|
200
|
-
private pendingSpawns;
|
|
201
|
-
private globalPopulation;
|
|
202
|
-
private flags;
|
|
203
|
-
private playerLevel;
|
|
204
|
-
private gameTime;
|
|
205
|
-
private eventListeners;
|
|
206
|
-
constructor(config?: Partial<SpawnerConfig>);
|
|
207
|
-
on(event: SpawnerEventType, callback: SpawnerEventCallback): () => void;
|
|
208
|
-
private emit;
|
|
209
|
-
registerEntityType(entity: SpawnEntityDefinition): void;
|
|
210
|
-
registerSpawnPoint(point: SpawnPointDefinition): void;
|
|
211
|
-
registerSpawnZone(zone: SpawnZoneDefinition): void;
|
|
212
|
-
registerWave(wave: WaveDefinition): void;
|
|
213
|
-
createSpawner(id: SpawnerId): SpawnerState;
|
|
214
|
-
getSpawner(id: SpawnerId): SpawnerState | undefined;
|
|
215
|
-
spawn(request: SpawnRequest, spawnerId?: SpawnerId): SpawnResult;
|
|
216
|
-
spawnDelayed(request: SpawnRequest, delay: number, callback?: (result: SpawnResult) => void): void;
|
|
217
|
-
private createEntity;
|
|
218
|
-
private getSpawnPositions;
|
|
219
|
-
private generatePatternPositions;
|
|
220
|
-
private getRandomPositionInZone;
|
|
221
|
-
despawn(entity: unknown): void;
|
|
222
|
-
despawnAll(spawnerId?: SpawnerId): void;
|
|
223
|
-
private getEntityDefForEntity;
|
|
224
|
-
startWaves(spawnerId: SpawnerId, waveIds: WaveId[]): void;
|
|
225
|
-
startWave(spawnerId: SpawnerId, waveId: WaveId): void;
|
|
226
|
-
private checkConditions;
|
|
227
|
-
private checkCondition;
|
|
228
|
-
setPlayerLevel(level: number): void;
|
|
229
|
-
setGameTime(time: number): void;
|
|
230
|
-
setFlag(flag: string, value?: boolean): void;
|
|
231
|
-
update(_deltaTime: number): void;
|
|
232
|
-
getPopulation(): number;
|
|
233
|
-
getActiveEntityCount(): number;
|
|
234
|
-
getSpawnerEntityCount(spawnerId: SpawnerId): number;
|
|
235
|
-
destroy(): void;
|
|
236
|
-
}
|
|
237
|
-
export declare function createSpawnerSystem(config?: Partial<SpawnerConfig>): NiceSpawner;
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
export type SpellId = string;
|
|
2
|
-
export type SchoolId = string;
|
|
3
|
-
export type EffectId = string;
|
|
4
|
-
export type SpellTargetType = 'self' | 'single' | 'aoe' | 'cone' | 'line' | 'ground' | 'chain';
|
|
5
|
-
export type ResourceType = 'mana' | 'stamina' | 'energy' | 'rage' | 'focus' | 'health' | 'custom';
|
|
6
|
-
export interface SpellDefinition {
|
|
7
|
-
id: SpellId;
|
|
8
|
-
name: string;
|
|
9
|
-
description: string;
|
|
10
|
-
schoolId: SchoolId;
|
|
11
|
-
element?: string;
|
|
12
|
-
targetType: SpellTargetType;
|
|
13
|
-
range: number;
|
|
14
|
-
radius?: number;
|
|
15
|
-
maxTargets?: number;
|
|
16
|
-
requiresLineOfSight: boolean;
|
|
17
|
-
resourceCost: number;
|
|
18
|
-
resourceType: ResourceType;
|
|
19
|
-
healthCost?: number;
|
|
20
|
-
castTime: number;
|
|
21
|
-
channeled: boolean;
|
|
22
|
-
channelDuration?: number;
|
|
23
|
-
channelTicks?: number;
|
|
24
|
-
cooldown: number;
|
|
25
|
-
globalCooldown: number;
|
|
26
|
-
effects: SpellEffect[];
|
|
27
|
-
levelRequired: number;
|
|
28
|
-
classRequired?: string[];
|
|
29
|
-
questRequired?: string;
|
|
30
|
-
canCrit: boolean;
|
|
31
|
-
critMultiplier?: number;
|
|
32
|
-
baseDamage?: number;
|
|
33
|
-
baseHealing?: number;
|
|
34
|
-
scaling?: SpellScaling;
|
|
35
|
-
icon: string;
|
|
36
|
-
castAnimation?: string;
|
|
37
|
-
projectileId?: string;
|
|
38
|
-
impactVfx?: string;
|
|
39
|
-
soundId?: string;
|
|
40
|
-
interruptible: boolean;
|
|
41
|
-
movementCancels: boolean;
|
|
42
|
-
damageCancels: boolean;
|
|
43
|
-
passive: boolean;
|
|
44
|
-
hidden: boolean;
|
|
45
|
-
comboSpellId?: SpellId;
|
|
46
|
-
comboWindow?: number;
|
|
47
|
-
tags?: string[];
|
|
48
|
-
}
|
|
49
|
-
export interface SpellEffect {
|
|
50
|
-
id: EffectId;
|
|
51
|
-
type: 'damage' | 'heal' | 'buff' | 'debuff' | 'summon' | 'teleport' | 'dispel' | 'interrupt' | 'knockback' | 'stun' | 'slow' | 'root' | 'silence' | 'custom';
|
|
52
|
-
delay?: number;
|
|
53
|
-
duration?: number;
|
|
54
|
-
tickInterval?: number;
|
|
55
|
-
baseValue?: number;
|
|
56
|
-
scaling?: SpellScaling;
|
|
57
|
-
applyTo: 'target' | 'caster' | 'area';
|
|
58
|
-
maxStacks?: number;
|
|
59
|
-
stackBehavior?: 'refresh' | 'add' | 'extend';
|
|
60
|
-
effectData?: Record<string, unknown>;
|
|
61
|
-
}
|
|
62
|
-
export interface SpellScaling {
|
|
63
|
-
stat: string;
|
|
64
|
-
coefficient: number;
|
|
65
|
-
perLevel?: number;
|
|
66
|
-
}
|
|
67
|
-
export interface SpellSchool {
|
|
68
|
-
id: SchoolId;
|
|
69
|
-
name: string;
|
|
70
|
-
description?: string;
|
|
71
|
-
color: string;
|
|
72
|
-
icon?: string;
|
|
73
|
-
resistanceStat?: string;
|
|
74
|
-
strongAgainst?: SchoolId[];
|
|
75
|
-
weakAgainst?: SchoolId[];
|
|
76
|
-
}
|
|
77
|
-
export interface ActiveSpell {
|
|
78
|
-
spellId: SpellId;
|
|
79
|
-
casterId: string;
|
|
80
|
-
targetId?: string;
|
|
81
|
-
targetPosition?: {
|
|
82
|
-
x: number;
|
|
83
|
-
y: number;
|
|
84
|
-
z?: number;
|
|
85
|
-
};
|
|
86
|
-
state: 'casting' | 'channeling' | 'traveling' | 'complete' | 'interrupted';
|
|
87
|
-
startTime: number;
|
|
88
|
-
progress: number;
|
|
89
|
-
ticksCompleted?: number;
|
|
90
|
-
hitTargets?: string[];
|
|
91
|
-
totalDamage?: number;
|
|
92
|
-
totalHealing?: number;
|
|
93
|
-
}
|
|
94
|
-
export interface CooldownState {
|
|
95
|
-
spellId: SpellId;
|
|
96
|
-
startTime: number;
|
|
97
|
-
duration: number;
|
|
98
|
-
remainingTime: number;
|
|
99
|
-
charges?: number;
|
|
100
|
-
maxCharges?: number;
|
|
101
|
-
}
|
|
102
|
-
export interface CasterState {
|
|
103
|
-
entityId: string;
|
|
104
|
-
resources: Map<ResourceType, {
|
|
105
|
-
current: number;
|
|
106
|
-
max: number;
|
|
107
|
-
regenRate: number;
|
|
108
|
-
}>;
|
|
109
|
-
cooldowns: Map<SpellId, CooldownState>;
|
|
110
|
-
globalCooldownEnd: number;
|
|
111
|
-
currentCast?: ActiveSpell;
|
|
112
|
-
castSpeed: number;
|
|
113
|
-
cooldownReduction: number;
|
|
114
|
-
resourceCostReduction: number;
|
|
115
|
-
knownSpells: Set<SpellId>;
|
|
116
|
-
spellRanks: Map<SpellId, number>;
|
|
117
|
-
spellPowerBonus: number;
|
|
118
|
-
critChance: number;
|
|
119
|
-
critMultiplier: number;
|
|
120
|
-
}
|
|
121
|
-
export interface CastResult {
|
|
122
|
-
success: boolean;
|
|
123
|
-
error?: string;
|
|
124
|
-
spell: SpellDefinition;
|
|
125
|
-
caster: CasterState;
|
|
126
|
-
targets?: Array<{
|
|
127
|
-
targetId: string;
|
|
128
|
-
effects: Array<{
|
|
129
|
-
effectId: EffectId;
|
|
130
|
-
value: number;
|
|
131
|
-
isCrit: boolean;
|
|
132
|
-
resisted?: boolean;
|
|
133
|
-
}>;
|
|
134
|
-
}>;
|
|
135
|
-
resourceSpent?: number;
|
|
136
|
-
healthSpent?: number;
|
|
137
|
-
castTime: number;
|
|
138
|
-
timestamp: number;
|
|
139
|
-
}
|
|
140
|
-
export type SpellEventType = 'spell-learned' | 'spell-unlearned' | 'cast-started' | 'cast-completed' | 'cast-interrupted' | 'cast-failed' | 'channel-tick' | 'spell-hit' | 'spell-miss' | 'spell-crit' | 'cooldown-started' | 'cooldown-ended' | 'resource-changed';
|
|
141
|
-
export interface SpellEvent {
|
|
142
|
-
type: SpellEventType;
|
|
143
|
-
timestamp: number;
|
|
144
|
-
data?: unknown;
|
|
145
|
-
}
|
|
146
|
-
export type SpellEventCallback = (event: SpellEvent) => void;
|
|
147
|
-
export interface SpellConfig {
|
|
148
|
-
globalCooldown: number;
|
|
149
|
-
maxCastQueue: number;
|
|
150
|
-
defaultCritChance: number;
|
|
151
|
-
defaultCritMultiplier: number;
|
|
152
|
-
resourceRegenInterval: number;
|
|
153
|
-
allowMovingWhileCasting: boolean;
|
|
154
|
-
storageKey: string;
|
|
155
|
-
}
|
|
156
|
-
export declare const DEFAULT_SPELL_CONFIG: SpellConfig;
|
|
157
|
-
export declare class NiceSpell {
|
|
158
|
-
private config;
|
|
159
|
-
private spells;
|
|
160
|
-
private schools;
|
|
161
|
-
private casters;
|
|
162
|
-
private eventListeners;
|
|
163
|
-
private regenInterval?;
|
|
164
|
-
private updateInterval?;
|
|
165
|
-
constructor(config?: Partial<SpellConfig>);
|
|
166
|
-
on(event: SpellEventType, callback: SpellEventCallback): () => void;
|
|
167
|
-
private emit;
|
|
168
|
-
private startLoops;
|
|
169
|
-
registerSpell(spell: SpellDefinition): void;
|
|
170
|
-
registerSchool(school: SpellSchool): void;
|
|
171
|
-
registerCaster(entityId: string, initialState?: Partial<CasterState>): CasterState;
|
|
172
|
-
getCaster(entityId: string): CasterState | undefined;
|
|
173
|
-
learnSpell(casterId: string, spellId: SpellId, rank?: number): boolean;
|
|
174
|
-
unlearnSpell(casterId: string, spellId: SpellId): boolean;
|
|
175
|
-
knowsSpell(casterId: string, spellId: SpellId): boolean;
|
|
176
|
-
canCast(casterId: string, spellId: SpellId): {
|
|
177
|
-
canCast: boolean;
|
|
178
|
-
reason?: string;
|
|
179
|
-
};
|
|
180
|
-
startCast(casterId: string, spellId: SpellId, targetId?: string, targetPosition?: {
|
|
181
|
-
x: number;
|
|
182
|
-
y: number;
|
|
183
|
-
z?: number;
|
|
184
|
-
}): CastResult | null;
|
|
185
|
-
completeCast(casterId: string): CastResult | null;
|
|
186
|
-
interruptCast(casterId: string, interrupterId?: string): boolean;
|
|
187
|
-
private applySpellEffects;
|
|
188
|
-
private calculateEffectValue;
|
|
189
|
-
private resolveTargets;
|
|
190
|
-
private startCooldown;
|
|
191
|
-
private updateCooldowns;
|
|
192
|
-
private updateCasts;
|
|
193
|
-
private updateResourceRegen;
|
|
194
|
-
private calculateCastTime;
|
|
195
|
-
private calculateResourceCost;
|
|
196
|
-
getSpell(id: SpellId): SpellDefinition | undefined;
|
|
197
|
-
getAllSpells(): SpellDefinition[];
|
|
198
|
-
getSpellsBySchool(schoolId: SchoolId): SpellDefinition[];
|
|
199
|
-
getSchool(id: SchoolId): SpellSchool | undefined;
|
|
200
|
-
getAllSchools(): SpellSchool[];
|
|
201
|
-
getKnownSpells(casterId: string): SpellDefinition[];
|
|
202
|
-
getCooldown(casterId: string, spellId: SpellId): CooldownState | undefined;
|
|
203
|
-
getResource(casterId: string, type: ResourceType): {
|
|
204
|
-
current: number;
|
|
205
|
-
max: number;
|
|
206
|
-
} | undefined;
|
|
207
|
-
isOnGlobalCooldown(casterId: string): boolean;
|
|
208
|
-
getCurrentCast(casterId: string): ActiveSpell | undefined;
|
|
209
|
-
setResource(casterId: string, type: ResourceType, current: number, max?: number): void;
|
|
210
|
-
modifyResource(casterId: string, type: ResourceType, amount: number): void;
|
|
211
|
-
private save;
|
|
212
|
-
private load;
|
|
213
|
-
reset(): void;
|
|
214
|
-
destroy(): void;
|
|
215
|
-
}
|
|
216
|
-
export declare function createSpellSystem(config?: Partial<SpellConfig>): NiceSpell;
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NiceState - Game Engine State Machine System
|
|
3
|
-
*
|
|
4
|
-
* Comprehensive state machine system supporting:
|
|
5
|
-
* - Finite State Machines (FSM)
|
|
6
|
-
* - Hierarchical State Machines (HSM)
|
|
7
|
-
* - Parallel states
|
|
8
|
-
* - State history
|
|
9
|
-
* - Guarded transitions
|
|
10
|
-
* - Entry/Exit/Update actions
|
|
11
|
-
* - State data and context
|
|
12
|
-
* - Pushdown automata (stack-based states)
|
|
13
|
-
*
|
|
14
|
-
* @packageDocumentation
|
|
15
|
-
*/
|
|
16
|
-
import { EventEmitter } from 'events';
|
|
17
|
-
export type StateId = string;
|
|
18
|
-
export type MachineId = string;
|
|
19
|
-
export type TransitionId = string;
|
|
20
|
-
export type ActionId = string;
|
|
21
|
-
export type StateStatus = 'inactive' | 'entering' | 'active' | 'exiting';
|
|
22
|
-
export interface StateContext<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
23
|
-
machineId: MachineId;
|
|
24
|
-
stateId: StateId;
|
|
25
|
-
data: TData;
|
|
26
|
-
deltaTime: number;
|
|
27
|
-
elapsedTime: number;
|
|
28
|
-
previousState?: StateId;
|
|
29
|
-
event?: StateEvent;
|
|
30
|
-
}
|
|
31
|
-
export type ActionFunction<TData extends Record<string, unknown> = Record<string, unknown>> = (context: StateContext<TData>) => void | Promise<void>;
|
|
32
|
-
export type GuardFunction<TData extends Record<string, unknown> = Record<string, unknown>> = (context: StateContext<TData>) => boolean;
|
|
33
|
-
export type ConditionFunction<TData extends Record<string, unknown> = Record<string, unknown>> = (context: StateContext<TData>) => boolean;
|
|
34
|
-
export interface StateEvent {
|
|
35
|
-
type: string;
|
|
36
|
-
payload?: unknown;
|
|
37
|
-
timestamp: number;
|
|
38
|
-
}
|
|
39
|
-
export interface StateTransition<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
40
|
-
id: TransitionId;
|
|
41
|
-
from: StateId | StateId[];
|
|
42
|
-
to: StateId;
|
|
43
|
-
event?: string;
|
|
44
|
-
guard?: GuardFunction<TData>;
|
|
45
|
-
actions?: ActionFunction<TData>[];
|
|
46
|
-
internal?: boolean;
|
|
47
|
-
}
|
|
48
|
-
export interface StateDefinition<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
49
|
-
id: StateId;
|
|
50
|
-
name?: string;
|
|
51
|
-
onEnter?: ActionFunction<TData>;
|
|
52
|
-
onExit?: ActionFunction<TData>;
|
|
53
|
-
onUpdate?: ActionFunction<TData>;
|
|
54
|
-
children?: StateDefinition<TData>[];
|
|
55
|
-
initialChild?: StateId;
|
|
56
|
-
parallel?: StateDefinition<TData>[];
|
|
57
|
-
historyType?: 'none' | 'shallow' | 'deep';
|
|
58
|
-
metadata?: Record<string, unknown>;
|
|
59
|
-
timeout?: {
|
|
60
|
-
duration: number;
|
|
61
|
-
target: StateId;
|
|
62
|
-
guard?: GuardFunction<TData>;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
export interface StateMachineDefinition<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
66
|
-
id: MachineId;
|
|
67
|
-
name?: string;
|
|
68
|
-
initialData?: TData;
|
|
69
|
-
initialState: StateId;
|
|
70
|
-
states: StateDefinition<TData>[];
|
|
71
|
-
transitions: StateTransition<TData>[];
|
|
72
|
-
globalActions?: {
|
|
73
|
-
onEnter?: ActionFunction<TData>;
|
|
74
|
-
onExit?: ActionFunction<TData>;
|
|
75
|
-
onUpdate?: ActionFunction<TData>;
|
|
76
|
-
onTransition?: ActionFunction<TData>;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
export interface StateInstance {
|
|
80
|
-
id: StateId;
|
|
81
|
-
status: StateStatus;
|
|
82
|
-
enteredAt: number;
|
|
83
|
-
elapsedTime: number;
|
|
84
|
-
activeChildren: StateId[];
|
|
85
|
-
history?: StateId;
|
|
86
|
-
}
|
|
87
|
-
export interface MachineInstance<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
88
|
-
id: string;
|
|
89
|
-
machineId: MachineId;
|
|
90
|
-
currentState: StateId;
|
|
91
|
-
previousState?: StateId;
|
|
92
|
-
stateStack: StateId[];
|
|
93
|
-
data: TData;
|
|
94
|
-
isRunning: boolean;
|
|
95
|
-
states: Map<StateId, StateInstance>;
|
|
96
|
-
eventQueue: StateEvent[];
|
|
97
|
-
startTime: number;
|
|
98
|
-
lastUpdateTime: number;
|
|
99
|
-
}
|
|
100
|
-
export type StateMachineEventType = 'started' | 'stopped' | 'state-enter' | 'state-exit' | 'state-update' | 'transition' | 'event-processed' | 'error';
|
|
101
|
-
export interface StateMachineEvent {
|
|
102
|
-
type: StateMachineEventType;
|
|
103
|
-
instanceId: string;
|
|
104
|
-
machineId: MachineId;
|
|
105
|
-
stateId?: StateId;
|
|
106
|
-
previousState?: StateId;
|
|
107
|
-
event?: StateEvent;
|
|
108
|
-
error?: Error;
|
|
109
|
-
timestamp: number;
|
|
110
|
-
}
|
|
111
|
-
export type StateMachineEventCallback = (event: StateMachineEvent) => void;
|
|
112
|
-
export interface StateMachineConfig {
|
|
113
|
-
maxEventQueueSize: number;
|
|
114
|
-
maxStackDepth: number;
|
|
115
|
-
enableHistory: boolean;
|
|
116
|
-
asyncActions: boolean;
|
|
117
|
-
logTransitions: boolean;
|
|
118
|
-
}
|
|
119
|
-
export declare const DEFAULT_STATE_CONFIG: StateMachineConfig;
|
|
120
|
-
export declare class NiceState extends EventEmitter {
|
|
121
|
-
private config;
|
|
122
|
-
private definitions;
|
|
123
|
-
private instances;
|
|
124
|
-
private stateMap;
|
|
125
|
-
private nextInstanceId;
|
|
126
|
-
private destroyed;
|
|
127
|
-
constructor(config?: Partial<StateMachineConfig>);
|
|
128
|
-
registerMachine<TData extends Record<string, unknown> = Record<string, unknown>>(definition: StateMachineDefinition<TData>): void;
|
|
129
|
-
private buildStateMap;
|
|
130
|
-
getMachineDefinition(machineId: MachineId): StateMachineDefinition | undefined;
|
|
131
|
-
unregisterMachine(machineId: MachineId): void;
|
|
132
|
-
create<TData extends Record<string, unknown> = Record<string, unknown>>(machineId: MachineId, initialData?: Partial<TData>): string;
|
|
133
|
-
start(instanceId: string): void;
|
|
134
|
-
stop(instanceId: string): void;
|
|
135
|
-
destroyInstance(instanceId: string): void;
|
|
136
|
-
getInstance(instanceId: string): MachineInstance | undefined;
|
|
137
|
-
private enterState;
|
|
138
|
-
private exitState;
|
|
139
|
-
transition(instanceId: string, targetState: StateId): boolean;
|
|
140
|
-
private performTransition;
|
|
141
|
-
send(instanceId: string, eventType: string, payload?: unknown): void;
|
|
142
|
-
private processEvents;
|
|
143
|
-
private transitionMatches;
|
|
144
|
-
pushState(instanceId: string, stateId: StateId): boolean;
|
|
145
|
-
popState(instanceId: string): StateId | undefined;
|
|
146
|
-
getStateStack(instanceId: string): StateId[];
|
|
147
|
-
update(_deltaTime: number): void;
|
|
148
|
-
private updateState;
|
|
149
|
-
private checkTimeout;
|
|
150
|
-
private executeAction;
|
|
151
|
-
private createContext;
|
|
152
|
-
getData<TData extends Record<string, unknown> = Record<string, unknown>>(instanceId: string): TData | undefined;
|
|
153
|
-
setData<TData extends Record<string, unknown> = Record<string, unknown>>(instanceId: string, data: Partial<TData>): void;
|
|
154
|
-
updateData<TData extends Record<string, unknown> = Record<string, unknown>>(instanceId: string, updater: (data: TData) => TData): void;
|
|
155
|
-
getCurrentState(instanceId: string): StateId | undefined;
|
|
156
|
-
isInState(instanceId: string, stateId: StateId): boolean;
|
|
157
|
-
canTransitionTo(instanceId: string, targetState: StateId): boolean;
|
|
158
|
-
getStateElapsedTime(instanceId: string, stateId?: StateId): number;
|
|
159
|
-
getAvailableTransitions(instanceId: string): StateTransition[];
|
|
160
|
-
getHistory(instanceId: string, stateId: StateId): StateId | undefined;
|
|
161
|
-
restoreHistory(instanceId: string, stateId: StateId): boolean;
|
|
162
|
-
clearHistory(instanceId: string, stateId?: StateId): void;
|
|
163
|
-
getAllInstances(): MachineInstance[];
|
|
164
|
-
getRunningInstances(): MachineInstance[];
|
|
165
|
-
getInstancesByMachine(machineId: MachineId): MachineInstance[];
|
|
166
|
-
getStats(): {
|
|
167
|
-
definitions: number;
|
|
168
|
-
instances: number;
|
|
169
|
-
runningInstances: number;
|
|
170
|
-
};
|
|
171
|
-
on(event: 'statemachine', callback: StateMachineEventCallback): this;
|
|
172
|
-
off(event: 'statemachine', callback: StateMachineEventCallback): this;
|
|
173
|
-
destroy(): void;
|
|
174
|
-
}
|
|
175
|
-
export declare function createStateMachine(config?: Partial<StateMachineConfig>): NiceState;
|
|
176
|
-
export declare class StateBuilder<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
177
|
-
private state;
|
|
178
|
-
constructor(id: StateId, name?: string);
|
|
179
|
-
onEnter(action: ActionFunction<TData>): this;
|
|
180
|
-
onExit(action: ActionFunction<TData>): this;
|
|
181
|
-
onUpdate(action: ActionFunction<TData>): this;
|
|
182
|
-
withChildren(children: StateDefinition<TData>[], initialChild: StateId): this;
|
|
183
|
-
withParallel(states: StateDefinition<TData>[]): this;
|
|
184
|
-
withHistory(type: 'shallow' | 'deep'): this;
|
|
185
|
-
withTimeout(duration: number, target: StateId, guard?: GuardFunction<TData>): this;
|
|
186
|
-
withMetadata(metadata: Record<string, unknown>): this;
|
|
187
|
-
build(): StateDefinition<TData>;
|
|
188
|
-
}
|
|
189
|
-
export declare class TransitionBuilder<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
190
|
-
private transition;
|
|
191
|
-
constructor(id: TransitionId, from: StateId | StateId[], to: StateId);
|
|
192
|
-
onEvent(eventType: string): this;
|
|
193
|
-
guard(condition: GuardFunction<TData>): this;
|
|
194
|
-
withActions(...actions: ActionFunction<TData>[]): this;
|
|
195
|
-
internal(): this;
|
|
196
|
-
build(): StateTransition<TData>;
|
|
197
|
-
}
|
|
198
|
-
export declare class MachineBuilder<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
199
|
-
private machine;
|
|
200
|
-
constructor(id: MachineId, name?: string);
|
|
201
|
-
withInitialData(data: TData): this;
|
|
202
|
-
initialState(stateId: StateId): this;
|
|
203
|
-
addState(state: StateDefinition<TData>): this;
|
|
204
|
-
addStates(...states: StateDefinition<TData>[]): this;
|
|
205
|
-
addTransition(transition: StateTransition<TData>): this;
|
|
206
|
-
addTransitions(...transitions: StateTransition<TData>[]): this;
|
|
207
|
-
withGlobalActions(actions: {
|
|
208
|
-
onEnter?: ActionFunction<TData>;
|
|
209
|
-
onExit?: ActionFunction<TData>;
|
|
210
|
-
onUpdate?: ActionFunction<TData>;
|
|
211
|
-
onTransition?: ActionFunction<TData>;
|
|
212
|
-
}): this;
|
|
213
|
-
build(): StateMachineDefinition<TData>;
|
|
214
|
-
}
|
|
215
|
-
export declare function state<TData extends Record<string, unknown> = Record<string, unknown>>(id: StateId, name?: string): StateBuilder<TData>;
|
|
216
|
-
export declare function transition<TData extends Record<string, unknown> = Record<string, unknown>>(id: TransitionId, from: StateId | StateId[], to: StateId): TransitionBuilder<TData>;
|
|
217
|
-
export declare function machine<TData extends Record<string, unknown> = Record<string, unknown>>(id: MachineId, name?: string): MachineBuilder<TData>;
|
|
218
|
-
export declare function createSimpleFSM<TData extends Record<string, unknown> = Record<string, unknown>>(machineId: MachineId, states: string[], transitions: Array<{
|
|
219
|
-
from: string;
|
|
220
|
-
to: string;
|
|
221
|
-
event: string;
|
|
222
|
-
}>): StateMachineDefinition<TData>;
|
|
223
|
-
export declare function createToggleMachine<TData extends Record<string, unknown> = Record<string, unknown>>(machineId: MachineId, offState?: StateId, onState?: StateId, toggleEvent?: string): StateMachineDefinition<TData>;
|
|
224
|
-
export declare function createSequenceMachine<TData extends Record<string, unknown> = Record<string, unknown>>(machineId: MachineId, states: StateId[], advanceEvent?: string): StateMachineDefinition<TData>;
|