@nice2dev/game-engine 1.2.0 → 1.2.1
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 +103 -0
- package/dist/cjs/ai/BehaviorTree.js +4 -4
- package/dist/cjs/audio/AudioBridge.js +3 -1
- package/dist/cjs/build-cloud/GodotBuildCloud.js +1 -1
- package/dist/cjs/build-cloud/UnrealBuildCloud.js +1 -1
- package/dist/cjs/core/GameConfig.js +11 -9
- package/dist/cjs/devtools/GameplayAnalytics.js +3 -1
- package/dist/cjs/editor/AnimationRetargeting.js +110 -108
- package/dist/cjs/editor/CraftingEditor.js +2 -2
- package/dist/cjs/editor/NiceGameEditor.js +1 -1
- package/dist/cjs/editor/UndoRedoPro.js +49 -47
- package/dist/cjs/export/BevyExporter.js +1 -1
- package/dist/cjs/export/CocosExporter.js +4 -4
- package/dist/cjs/export/Construct3Exporter.js +4 -4
- package/dist/cjs/export/DefoldExporter.js +4 -4
- package/dist/cjs/export/GDevelopExporter.js +2 -2
- package/dist/cjs/export/GameMakerExporter.js +3 -3
- package/dist/cjs/export/GodotExporter.js +3 -3
- package/dist/cjs/export/MinecraftBedrockExporter.js +2 -2
- package/dist/cjs/export/MonoGameExporter.js +2 -2
- package/dist/cjs/export/Pico8Exporter.js +6 -6
- package/dist/cjs/export/RPGMakerExporter.js +4 -4
- package/dist/cjs/export/RobloxExporter.js +5 -5
- package/dist/cjs/export/Solar2DExporter.js +2 -2
- package/dist/cjs/export/ThreeJSExporter.js +3 -3
- package/dist/cjs/export/Tic80Exporter.js +6 -6
- package/dist/cjs/export/UnityExporter.js +4 -4
- package/dist/cjs/export/UnrealExporter.js +7 -7
- package/dist/cjs/export/WebExporter.js +2 -2
- package/dist/cjs/godot-integration/components/GodotProjectBrowser.js +4 -4
- package/dist/cjs/i18n/useTranslation.js +1 -1
- package/dist/cjs/import/GodotSceneImporter.js +4 -4
- package/dist/cjs/import/LDtkImporter.js +1 -1
- package/dist/cjs/import/OgmoImporter.js +1 -1
- package/dist/cjs/import/TiledMapImporter.js +1 -1
- package/dist/cjs/input/GamepadNavigation.js +1 -1
- package/dist/cjs/inventory/InventorySystem.js +1 -1
- package/dist/cjs/native-engine/NetworkingSystem.js +1 -1
- package/dist/cjs/rendering/WebGPURenderPipeline.js +41 -30
- package/dist/cjs/unity-integration/UnityImport.js +2 -2
- package/dist/cjs/unity-integration/components/UnityAssetStoreBrowser.js +4 -4
- package/dist/cjs/unity-integration/components/UnityProjectBrowser.js +8 -5
- package/dist/cjs/unreal-integration/components/UnrealProjectBrowser.js +5 -5
- package/dist/esm/ai/BehaviorTree.js +4 -4
- package/dist/esm/audio/AudioBridge.js +3 -1
- package/dist/esm/build-cloud/GodotBuildCloud.js +1 -1
- package/dist/esm/build-cloud/UnrealBuildCloud.js +1 -1
- package/dist/esm/core/GameConfig.js +11 -9
- package/dist/esm/devtools/GameplayAnalytics.js +3 -1
- package/dist/esm/editor/AnimationRetargeting.js +110 -108
- package/dist/esm/editor/CraftingEditor.js +2 -2
- package/dist/esm/editor/NiceGameEditor.js +2 -2
- package/dist/esm/editor/UndoRedoPro.js +49 -47
- package/dist/esm/export/BevyExporter.js +1 -1
- package/dist/esm/export/CocosExporter.js +4 -4
- package/dist/esm/export/Construct3Exporter.js +4 -4
- package/dist/esm/export/DefoldExporter.js +4 -4
- package/dist/esm/export/GDevelopExporter.js +2 -2
- package/dist/esm/export/GameMakerExporter.js +3 -3
- package/dist/esm/export/GodotExporter.js +3 -3
- package/dist/esm/export/MinecraftBedrockExporter.js +2 -2
- package/dist/esm/export/MonoGameExporter.js +2 -2
- package/dist/esm/export/Pico8Exporter.js +6 -6
- package/dist/esm/export/RPGMakerExporter.js +4 -4
- package/dist/esm/export/RobloxExporter.js +5 -5
- package/dist/esm/export/Solar2DExporter.js +2 -2
- package/dist/esm/export/ThreeJSExporter.js +3 -3
- package/dist/esm/export/Tic80Exporter.js +6 -6
- package/dist/esm/export/UnityExporter.js +4 -4
- package/dist/esm/export/UnrealExporter.js +7 -7
- package/dist/esm/export/WebExporter.js +2 -2
- package/dist/esm/godot-integration/components/GodotProjectBrowser.js +5 -5
- package/dist/esm/i18n/useTranslation.js +2 -2
- package/dist/esm/import/GodotSceneImporter.js +4 -4
- package/dist/esm/import/LDtkImporter.js +1 -1
- package/dist/esm/import/OgmoImporter.js +1 -1
- package/dist/esm/import/TiledMapImporter.js +1 -1
- package/dist/esm/input/GamepadNavigation.js +2 -2
- package/dist/esm/inventory/InventorySystem.js +1 -1
- package/dist/esm/native-engine/NetworkingSystem.js +1 -1
- package/dist/esm/rendering/WebGPURenderPipeline.js +41 -30
- package/dist/esm/unity-integration/UnityImport.js +2 -2
- package/dist/esm/unity-integration/components/UnityAssetStoreBrowser.js +5 -5
- package/dist/esm/unity-integration/components/UnityProjectBrowser.js +9 -6
- package/dist/esm/unreal-integration/components/UnrealProjectBrowser.js +6 -6
- package/dist/types/ai/BehaviorTree.d.ts +4 -4
- package/dist/types/editor/CraftingEditor.d.ts +1 -1
- package/dist/types/godot-integration/components/GodotProjectBrowser.d.ts +3 -1
- package/dist/types/unity-integration/components/UnityAssetStoreBrowser.d.ts +3 -1
- package/dist/types/unity-integration/components/UnityProjectBrowser.d.ts +3 -1
- package/dist/types/unreal-integration/components/UnrealProjectBrowser.d.ts +3 -1
- package/package.json +5 -5
|
@@ -836,59 +836,61 @@ class UndoRedoManager {
|
|
|
836
836
|
// ============================================================
|
|
837
837
|
// Common Action Executors
|
|
838
838
|
// ============================================================
|
|
839
|
-
const CommonExecutors = {
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
data
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
data
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
arrayPush: {
|
|
855
|
-
execute(data) {
|
|
856
|
-
data.array.push(data.value);
|
|
857
|
-
},
|
|
858
|
-
undo(data) {
|
|
859
|
-
data.array.pop();
|
|
839
|
+
const CommonExecutors = /* @__PURE__ */ (function () {
|
|
840
|
+
return {
|
|
841
|
+
setProperty: {
|
|
842
|
+
execute(data) {
|
|
843
|
+
data.target[data.property] = data.value;
|
|
844
|
+
},
|
|
845
|
+
undo(data) {
|
|
846
|
+
data.target[data.property] = data.oldValue;
|
|
847
|
+
},
|
|
848
|
+
merge(oldData, newData) {
|
|
849
|
+
if (oldData.property !== newData.property) {
|
|
850
|
+
return null;
|
|
851
|
+
}
|
|
852
|
+
return { ...oldData, value: newData.value };
|
|
853
|
+
},
|
|
860
854
|
},
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
855
|
+
arrayPush: {
|
|
856
|
+
execute(data) {
|
|
857
|
+
data.array.push(data.value);
|
|
858
|
+
},
|
|
859
|
+
undo(data) {
|
|
860
|
+
data.array.pop();
|
|
861
|
+
},
|
|
865
862
|
},
|
|
866
|
-
|
|
867
|
-
|
|
863
|
+
arrayRemove: {
|
|
864
|
+
execute(data) {
|
|
865
|
+
data.array.splice(data.index, 1);
|
|
866
|
+
},
|
|
867
|
+
undo(data) {
|
|
868
|
+
data.array.splice(data.index, 0, data.value);
|
|
869
|
+
},
|
|
868
870
|
},
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
871
|
+
mapSet: {
|
|
872
|
+
execute(data) {
|
|
873
|
+
data.map.set(data.key, data.value);
|
|
874
|
+
},
|
|
875
|
+
undo(data) {
|
|
876
|
+
if (data.hadValue) {
|
|
877
|
+
data.map.set(data.key, data.oldValue);
|
|
878
|
+
}
|
|
879
|
+
else {
|
|
880
|
+
data.map.delete(data.key);
|
|
881
|
+
}
|
|
882
|
+
},
|
|
873
883
|
},
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
data.map.set(data.key, data.oldValue);
|
|
877
|
-
}
|
|
878
|
-
else {
|
|
884
|
+
mapDelete: {
|
|
885
|
+
execute(data) {
|
|
879
886
|
data.map.delete(data.key);
|
|
880
|
-
}
|
|
887
|
+
},
|
|
888
|
+
undo(data) {
|
|
889
|
+
data.map.set(data.key, data.value);
|
|
890
|
+
},
|
|
881
891
|
},
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
execute(data) {
|
|
885
|
-
data.map.delete(data.key);
|
|
886
|
-
},
|
|
887
|
-
undo(data) {
|
|
888
|
-
data.map.set(data.key, data.value);
|
|
889
|
-
},
|
|
890
|
-
},
|
|
891
|
-
};
|
|
892
|
+
};
|
|
893
|
+
})();
|
|
892
894
|
// ============================================================
|
|
893
895
|
// Factory Functions
|
|
894
896
|
// ============================================================
|
|
@@ -136,7 +136,7 @@ runner = "wasm-server-runner"
|
|
|
136
136
|
`;
|
|
137
137
|
this.rustFiles.set('Cargo.toml', cargoToml);
|
|
138
138
|
}
|
|
139
|
-
generateMain(
|
|
139
|
+
generateMain(_project) {
|
|
140
140
|
const { useRapier, useAssetLoader, useStates, hotReloading } = this.config;
|
|
141
141
|
const imports = ['use bevy::prelude::*;'];
|
|
142
142
|
if (useRapier) {
|
|
@@ -267,7 +267,7 @@ class CocosExporter extends PlatformExporter {
|
|
|
267
267
|
this.generateEntityScript(entityType, options);
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
generateGameManager(project,
|
|
270
|
+
generateGameManager(project, _options) {
|
|
271
271
|
const ext = this.useTypeScript ? 'ts' : 'js';
|
|
272
272
|
const res = project.settings.resolution;
|
|
273
273
|
const script = `import { _decorator, Component, Node, director } from 'cc';
|
|
@@ -334,7 +334,7 @@ export class GameManager extends Component {
|
|
|
334
334
|
this.addTextFile(`assets/scripts/GameManager.${ext}`, script);
|
|
335
335
|
this.generateMetaFile(`assets/scripts/GameManager.${ext}`, 'typescript');
|
|
336
336
|
}
|
|
337
|
-
generateEntityScript(entityType,
|
|
337
|
+
generateEntityScript(entityType, _options) {
|
|
338
338
|
const ext = this.useTypeScript ? 'ts' : 'js';
|
|
339
339
|
const className = entityType.charAt(0).toUpperCase() + entityType.slice(1);
|
|
340
340
|
const script = `import { _decorator, Component, Node, Vec2, Vec3 } from 'cc';
|
|
@@ -411,7 +411,7 @@ export class ${className} extends Component {
|
|
|
411
411
|
this.generateMetaFile(`assets/scripts/entities/${className}.${ext}`, 'typescript');
|
|
412
412
|
}
|
|
413
413
|
/* ── Scene Export ───────────────────────────────────────────── */
|
|
414
|
-
async exportScene(scene, project,
|
|
414
|
+
async exportScene(scene, project, _options) {
|
|
415
415
|
const sceneData = this.buildSceneData(scene, project);
|
|
416
416
|
const scenePath = `assets/scenes/${scene.name}.scene`;
|
|
417
417
|
this.addTextFile(scenePath, JSON.stringify(sceneData, null, 2));
|
|
@@ -560,7 +560,7 @@ export class ${className} extends Component {
|
|
|
560
560
|
return value;
|
|
561
561
|
}
|
|
562
562
|
/* ── Prefab Export ──────────────────────────────────────────── */
|
|
563
|
-
async exportPrefab(prefab,
|
|
563
|
+
async exportPrefab(prefab, _options) {
|
|
564
564
|
const prefabData = this.buildPrefabData(prefab);
|
|
565
565
|
const prefabPath = `assets/prefabs/${prefab.name}.prefab`;
|
|
566
566
|
this.addTextFile(prefabPath, JSON.stringify(prefabData, null, 2));
|
|
@@ -275,7 +275,7 @@ class Construct3Exporter extends PlatformExporter {
|
|
|
275
275
|
await this.generateObjectType(typeName, prefab.entity, options);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
async generateObjectType(typeName, entity,
|
|
278
|
+
async generateObjectType(typeName, entity, _options) {
|
|
279
279
|
const behaviors = {};
|
|
280
280
|
const instanceVariables = {};
|
|
281
281
|
// Map components to behaviors
|
|
@@ -331,7 +331,7 @@ class Construct3Exporter extends PlatformExporter {
|
|
|
331
331
|
return result;
|
|
332
332
|
}
|
|
333
333
|
/* ── Layout Export ──────────────────────────────────────────── */
|
|
334
|
-
async exportLayout(scene, project,
|
|
334
|
+
async exportLayout(scene, project, _options) {
|
|
335
335
|
const layoutName = scene.name.replace(/[^a-zA-Z0-9_]/g, '_');
|
|
336
336
|
const layout = {
|
|
337
337
|
c3dtg: true,
|
|
@@ -398,7 +398,7 @@ class Construct3Exporter extends PlatformExporter {
|
|
|
398
398
|
};
|
|
399
399
|
}
|
|
400
400
|
/* ── Event Sheet ────────────────────────────────────────────── */
|
|
401
|
-
async generateEventSheet(scene, _project,
|
|
401
|
+
async generateEventSheet(scene, _project, _options) {
|
|
402
402
|
const sheetName = `${scene.name.replace(/[^a-zA-Z0-9_]/g, '_')}_Events`;
|
|
403
403
|
const eventSheet = {
|
|
404
404
|
c3eventsheet: true,
|
|
@@ -461,7 +461,7 @@ class Construct3Exporter extends PlatformExporter {
|
|
|
461
461
|
return events;
|
|
462
462
|
}
|
|
463
463
|
/* ── Scripts ────────────────────────────────────────────────── */
|
|
464
|
-
async generateScripts(project,
|
|
464
|
+
async generateScripts(project, _options) {
|
|
465
465
|
// Main script
|
|
466
466
|
const mainScript = `// ${project.name} - Nice2Dev Export for Construct 3
|
|
467
467
|
// Generated automatically
|
|
@@ -321,7 +321,7 @@ _plugins =
|
|
|
321
321
|
this.addTextFile('game.project', projectContent);
|
|
322
322
|
}
|
|
323
323
|
/* ── Main Collection ────────────────────────────────────────── */
|
|
324
|
-
async generateMainCollection(project,
|
|
324
|
+
async generateMainCollection(project, _options) {
|
|
325
325
|
const firstScene = project.scenes[0];
|
|
326
326
|
const sceneName = firstScene
|
|
327
327
|
? firstScene.name.toLowerCase().replace(/[^a-z0-9_]/g, '_')
|
|
@@ -437,7 +437,7 @@ scale_along_z: 0
|
|
|
437
437
|
}
|
|
438
438
|
`;
|
|
439
439
|
}
|
|
440
|
-
async generateGameObject(entity,
|
|
440
|
+
async generateGameObject(entity, _options) {
|
|
441
441
|
const name = (entity.name ?? entity.id).toLowerCase().replace(/[^a-z0-9_]/g, '_');
|
|
442
442
|
let goContent = '';
|
|
443
443
|
// Add components
|
|
@@ -684,7 +684,7 @@ end
|
|
|
684
684
|
`;
|
|
685
685
|
}
|
|
686
686
|
/* ── Shared Scripts ─────────────────────────────────────────── */
|
|
687
|
-
async generateSharedScripts(project,
|
|
687
|
+
async generateSharedScripts(project, _options) {
|
|
688
688
|
// Game Manager Script
|
|
689
689
|
const gameManagerScript = `-- Game Manager
|
|
690
690
|
-- Central game state and utility management
|
|
@@ -938,7 +938,7 @@ return M
|
|
|
938
938
|
this.addTextFile('main/scripts/utility.lua', utilityModule);
|
|
939
939
|
}
|
|
940
940
|
/* ── App Manifest ───────────────────────────────────────────── */
|
|
941
|
-
async generateAppManifest(_project,
|
|
941
|
+
async generateAppManifest(_project, _options) {
|
|
942
942
|
const manifest = `platforms:
|
|
943
943
|
x86_64-osx:
|
|
944
944
|
context:
|
|
@@ -355,7 +355,7 @@ class GDevelopExporter extends PlatformExporter {
|
|
|
355
355
|
};
|
|
356
356
|
}
|
|
357
357
|
/* ── Event Generation ───────────────────────────────────────── */
|
|
358
|
-
generateSceneEvents(scene, _project,
|
|
358
|
+
generateSceneEvents(scene, _project, _options) {
|
|
359
359
|
const events = [];
|
|
360
360
|
// Header comment
|
|
361
361
|
events.push({
|
|
@@ -675,7 +675,7 @@ class GDevelopExporter extends PlatformExporter {
|
|
|
675
675
|
sceneVariables: [],
|
|
676
676
|
};
|
|
677
677
|
}
|
|
678
|
-
async generateNice2DevExtension(project,
|
|
678
|
+
async generateNice2DevExtension(project, _options) {
|
|
679
679
|
// Extension is already embedded in the project, this generates a standalone version
|
|
680
680
|
const extension = this.createNice2DevExtension(project);
|
|
681
681
|
this.addTextFile('extensions/Nice2Dev.json', JSON.stringify(extension, null, 2));
|
|
@@ -87,7 +87,7 @@ class GameMakerExporter extends PlatformExporter {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
/* ── Project File ───────────────────────────────────────────── */
|
|
90
|
-
async generateProjectFile(project,
|
|
90
|
+
async generateProjectFile(project, _options) {
|
|
91
91
|
const projectFile = {
|
|
92
92
|
resourceType: 'GMProject',
|
|
93
93
|
resourceVersion: '1.6',
|
|
@@ -155,7 +155,7 @@ class GameMakerExporter extends PlatformExporter {
|
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
157
|
/* ── Scripts ────────────────────────────────────────────────── */
|
|
158
|
-
async generateScripts(
|
|
158
|
+
async generateScripts(_project, _options) {
|
|
159
159
|
// Utility script
|
|
160
160
|
const utilScript = `/// @description Nice2Dev Utility Functions
|
|
161
161
|
|
|
@@ -390,7 +390,7 @@ event_inherited();
|
|
|
390
390
|
id: { name: 'obj_nice2dev_base', path: 'objects/obj_nice2dev_base/obj_nice2dev_base.yy' },
|
|
391
391
|
});
|
|
392
392
|
}
|
|
393
|
-
async generateObjectFromEntity(entity, objectName,
|
|
393
|
+
async generateObjectFromEntity(entity, objectName, _options) {
|
|
394
394
|
const safeName = objectName.replace(/[^a-zA-Z0-9_]/g, '_');
|
|
395
395
|
const hasPhysics = entity.components.some((c) => c.type === 'rigidbody');
|
|
396
396
|
// Find sprite component
|
|
@@ -179,7 +179,7 @@ environment/defaults/default_clear_color=Color(${this.hexToGodotColor(project.se
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
/* ── Scenes ─────────────────────────────────────────────────── */
|
|
182
|
-
async exportScenes(project,
|
|
182
|
+
async exportScenes(project, _options) {
|
|
183
183
|
for (const scene of project.scenes) {
|
|
184
184
|
const tscn = this.createSceneTSCN(scene, project);
|
|
185
185
|
const path = `scenes/${this.sanitizeName(scene.name)}.tscn`;
|
|
@@ -498,7 +498,7 @@ environment/defaults/default_clear_color=Color(${this.hexToGodotColor(project.se
|
|
|
498
498
|
};
|
|
499
499
|
}
|
|
500
500
|
/* ── Prefabs ────────────────────────────────────────────────── */
|
|
501
|
-
async exportPrefabs(project,
|
|
501
|
+
async exportPrefabs(project, _options) {
|
|
502
502
|
for (const prefab of project.prefabs) {
|
|
503
503
|
const tscn = this.createPrefabTSCN(prefab, project);
|
|
504
504
|
const path = `prefabs/${this.sanitizeName(prefab.name)}.tscn`;
|
|
@@ -512,7 +512,7 @@ environment/defaults/default_clear_color=Color(${this.hexToGodotColor(project.se
|
|
|
512
512
|
return this.serializeTSCN(resources, [rootNode], prefab.name);
|
|
513
513
|
}
|
|
514
514
|
/* ── Resources ──────────────────────────────────────────────── */
|
|
515
|
-
async exportResources(project,
|
|
515
|
+
async exportResources(project, _options) {
|
|
516
516
|
// Export materials as ShaderMaterial resources
|
|
517
517
|
const materials = project.assets.filter((a) => a.type === 'material');
|
|
518
518
|
for (const material of materials) {
|
|
@@ -213,7 +213,7 @@ class MinecraftBedrockExporter extends PlatformExporter {
|
|
|
213
213
|
this.addTextFile(`${bpPath}/texts/en_US.lang`, `pack.name=${project.name} Behavior Pack\npack.description=Behavior pack from Nice2Dev project`);
|
|
214
214
|
}
|
|
215
215
|
/* ── Scripts ────────────────────────────────────────────────── */
|
|
216
|
-
async generateScripts(project,
|
|
216
|
+
async generateScripts(project, _options) {
|
|
217
217
|
const bpPath = `${this.projectName}_BP`;
|
|
218
218
|
// Main entry script
|
|
219
219
|
const mainScript = `// ${project.name} - Nice2Dev Minecraft Bedrock Export
|
|
@@ -452,7 +452,7 @@ export function playSound(dimension, soundId, location, options = {}) {
|
|
|
452
452
|
this.addTextFile(`${bpPath}/scripts/utilities.js`, utilities);
|
|
453
453
|
}
|
|
454
454
|
/* ── Prefab Export (Custom Entity) ──────────────────────────── */
|
|
455
|
-
async exportPrefab(prefab,
|
|
455
|
+
async exportPrefab(prefab, _options) {
|
|
456
456
|
const bpPath = `${this.projectName}_BP`;
|
|
457
457
|
const rpPath = `${this.projectName}_RP`;
|
|
458
458
|
const entityId = `${this.namespace}:${prefab.name.toLowerCase().replace(/[^a-z0-9_]/g, '_')}`;
|
|
@@ -88,7 +88,7 @@ class MonoGameExporter {
|
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
generateSolution(
|
|
91
|
+
generateSolution(_project) {
|
|
92
92
|
const projectGuid = this.generateGuid();
|
|
93
93
|
const solutionGuid = this.generateGuid();
|
|
94
94
|
const sln = `
|
|
@@ -167,7 +167,7 @@ ${packageRefs.map((r) => ` ${r}`).join('\n')}
|
|
|
167
167
|
`;
|
|
168
168
|
this.csharpFiles.set(`${this.config.solutionName}/${this.config.solutionName}.csproj`, csproj);
|
|
169
169
|
}
|
|
170
|
-
generateGame1(
|
|
170
|
+
generateGame1(_project) {
|
|
171
171
|
const { namespace, useECS, useNez } = this.config;
|
|
172
172
|
const usings = [
|
|
173
173
|
'using Microsoft.Xna.Framework;',
|
|
@@ -130,7 +130,7 @@ ${music}
|
|
|
130
130
|
}
|
|
131
131
|
return lines.join('\n');
|
|
132
132
|
}
|
|
133
|
-
generateCoreFunctions(project,
|
|
133
|
+
generateCoreFunctions(project, _options) {
|
|
134
134
|
return `
|
|
135
135
|
-- initialization
|
|
136
136
|
function _init()
|
|
@@ -200,7 +200,7 @@ function _draw()
|
|
|
200
200
|
end
|
|
201
201
|
`;
|
|
202
202
|
}
|
|
203
|
-
generateEntitySystem(
|
|
203
|
+
generateEntitySystem(_project, _options) {
|
|
204
204
|
return `
|
|
205
205
|
-- entity system
|
|
206
206
|
function make_entity(type,x,y,props)
|
|
@@ -278,7 +278,7 @@ function collides(a,b)
|
|
|
278
278
|
end
|
|
279
279
|
`;
|
|
280
280
|
}
|
|
281
|
-
generateEntityDefinitions(project,
|
|
281
|
+
generateEntityDefinitions(project, _options) {
|
|
282
282
|
const lines = [];
|
|
283
283
|
lines.push('');
|
|
284
284
|
lines.push('-- entity types');
|
|
@@ -395,7 +395,7 @@ end
|
|
|
395
395
|
}
|
|
396
396
|
return defaultValue;
|
|
397
397
|
}
|
|
398
|
-
generateSceneSetup(project,
|
|
398
|
+
generateSceneSetup(project, _options) {
|
|
399
399
|
const lines = [];
|
|
400
400
|
lines.push('');
|
|
401
401
|
lines.push('-- scenes');
|
|
@@ -576,7 +576,7 @@ end
|
|
|
576
576
|
`;
|
|
577
577
|
}
|
|
578
578
|
/* ── Data Sections ──────────────────────────────────────────── */
|
|
579
|
-
generateGfxSection(
|
|
579
|
+
generateGfxSection(_project, _options) {
|
|
580
580
|
// Generate placeholder sprite sheet (128x128 = 256 lines of 128 hex chars)
|
|
581
581
|
// Each pixel is 4 bits (one hex char)
|
|
582
582
|
const lines = [];
|
|
@@ -638,7 +638,7 @@ end
|
|
|
638
638
|
}
|
|
639
639
|
return lines.join('\n');
|
|
640
640
|
}
|
|
641
|
-
generateGffSection(
|
|
641
|
+
generateGffSection(_project) {
|
|
642
642
|
// Sprite flags: 256 bytes (2 per line, 128 lines)
|
|
643
643
|
// All zeros for placeholder
|
|
644
644
|
const lines = [];
|
|
@@ -59,7 +59,7 @@ class RPGMakerExporter extends PlatformExporter {
|
|
|
59
59
|
await this.generateDataFiles(project, options);
|
|
60
60
|
}
|
|
61
61
|
/* ── Main Plugin ────────────────────────────────────────────── */
|
|
62
|
-
async generateMainPlugin(project,
|
|
62
|
+
async generateMainPlugin(project, _options) {
|
|
63
63
|
const versionSpecific = this.version === 'MZ' ? this.getMZPluginHeader() : this.getMVPluginHeader();
|
|
64
64
|
const plugin = `/*:
|
|
65
65
|
* @target ${this.version}
|
|
@@ -377,7 +377,7 @@ ${this.version === 'MZ' ? this.getMZPluginCommands() : this.getMVPluginCommands(
|
|
|
377
377
|
};`;
|
|
378
378
|
}
|
|
379
379
|
/* ── Utility Plugin ─────────────────────────────────────────── */
|
|
380
|
-
async generateUtilityPlugin(
|
|
380
|
+
async generateUtilityPlugin(_project, _options) {
|
|
381
381
|
const utility = `/*:
|
|
382
382
|
* @target ${this.version}
|
|
383
383
|
* @plugindesc Nice2Dev Utility Functions
|
|
@@ -749,7 +749,7 @@ ${scene.entities
|
|
|
749
749
|
return commands;
|
|
750
750
|
}
|
|
751
751
|
/* ── Prefab Export ──────────────────────────────────────────── */
|
|
752
|
-
async exportPrefab(prefab,
|
|
752
|
+
async exportPrefab(prefab, _options) {
|
|
753
753
|
const safeName = prefab.name.replace(/[^a-zA-Z0-9]/g, '');
|
|
754
754
|
// Generate prefab registration script
|
|
755
755
|
const prefabScript = `// Prefab: ${prefab.name}
|
|
@@ -775,7 +775,7 @@ ${prefab.entity.components.map((c) => ` { type: '${c.type}', properti
|
|
|
775
775
|
this.addTextFile(`js/plugins/${this.pluginPrefix}_Prefab_${safeName}.js`, prefabScript);
|
|
776
776
|
}
|
|
777
777
|
/* ── Common Events ──────────────────────────────────────────── */
|
|
778
|
-
async generateCommonEvents(_project,
|
|
778
|
+
async generateCommonEvents(_project, _options) {
|
|
779
779
|
const commonEvents = [
|
|
780
780
|
null, // Index 0 is always null
|
|
781
781
|
{
|
|
@@ -62,7 +62,7 @@ class RobloxExporter extends PlatformExporter {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
/* ── Folder Structure ───────────────────────────────────────── */
|
|
65
|
-
async generateFolderStructure(project,
|
|
65
|
+
async generateFolderStructure(project, _options) {
|
|
66
66
|
// README for the export
|
|
67
67
|
const readme = `# ${project.name} - Roblox Export
|
|
68
68
|
|
|
@@ -92,7 +92,7 @@ Generated from Nice2Dev project v${project.version}
|
|
|
92
92
|
this.addTextFile('README.md', readme);
|
|
93
93
|
}
|
|
94
94
|
/* ── Core Scripts ───────────────────────────────────────────── */
|
|
95
|
-
async generateCoreScripts(project,
|
|
95
|
+
async generateCoreScripts(project, _options) {
|
|
96
96
|
// Game Manager Module
|
|
97
97
|
const gameManagerModule = `${this.useStrictMode ? '--!strict\n' : ''}--[[
|
|
98
98
|
Game Manager Module
|
|
@@ -466,7 +466,7 @@ print("[Game] ${project.name} initialized successfully!")
|
|
|
466
466
|
this.addTextFile('ServerScriptService/GameInit.server.lua', initScript);
|
|
467
467
|
}
|
|
468
468
|
/* ── Client Scripts ─────────────────────────────────────────── */
|
|
469
|
-
async generateClientScripts(
|
|
469
|
+
async generateClientScripts(_project, _options) {
|
|
470
470
|
// Client-side game controller
|
|
471
471
|
const clientController = `${this.useStrictMode ? '--!strict\n' : ''}--[[
|
|
472
472
|
Client Controller
|
|
@@ -568,7 +568,7 @@ print("[ClientController] Initialized")
|
|
|
568
568
|
this.addTextFile('StarterPlayer/StarterPlayerScripts/ClientController.client.lua', clientController);
|
|
569
569
|
}
|
|
570
570
|
/* ── Server Scripts ─────────────────────────────────────────── */
|
|
571
|
-
async generateServerScripts(project,
|
|
571
|
+
async generateServerScripts(project, _options) {
|
|
572
572
|
// Data handling script
|
|
573
573
|
const dataScript = `${this.useStrictMode ? '--!strict\n' : ''}--[[
|
|
574
574
|
Data Handler Script
|
|
@@ -669,7 +669,7 @@ return DataHandler
|
|
|
669
669
|
this.addTextFile('ServerScriptService/DataHandler.server.lua', dataScript);
|
|
670
670
|
}
|
|
671
671
|
/* ── Scene Export ───────────────────────────────────────────── */
|
|
672
|
-
async exportScene(scene, project,
|
|
672
|
+
async exportScene(scene, project, _options) {
|
|
673
673
|
// Generate scene as a Model in RBXMX format
|
|
674
674
|
const modelXml = this.generateSceneModel(scene, project);
|
|
675
675
|
this.addTextFile(`Workspace/${scene.name}.rbxmx`, modelXml);
|
|
@@ -315,7 +315,7 @@ composer.gotoScene("scenes.${firstSceneName}", {
|
|
|
315
315
|
this.addTextFile('main.lua', mainLua);
|
|
316
316
|
}
|
|
317
317
|
/* ── Utility Modules ────────────────────────────────────────── */
|
|
318
|
-
async generateUtilityModules(_project,
|
|
318
|
+
async generateUtilityModules(_project, _options) {
|
|
319
319
|
// Game Manager
|
|
320
320
|
const gameManagerLua = `-- Game Manager Module
|
|
321
321
|
-- Central game state and utilities
|
|
@@ -1092,7 +1092,7 @@ return scene
|
|
|
1092
1092
|
return `${r.toFixed(2)}, ${g.toFixed(2)}, ${b.toFixed(2)}`;
|
|
1093
1093
|
}
|
|
1094
1094
|
/* ── Prefab Export ──────────────────────────────────────────── */
|
|
1095
|
-
async exportPrefab(prefab,
|
|
1095
|
+
async exportPrefab(prefab, _options) {
|
|
1096
1096
|
const prefabName = prefab.name.toLowerCase().replace(/[^a-z0-9_]/g, '_');
|
|
1097
1097
|
const entity = prefab.entity;
|
|
1098
1098
|
const tags = entity.tags ?? [];
|
|
@@ -564,7 +564,7 @@ export class ${sceneName}Scene ${useTS ? 'implements GameScene' : ''} {
|
|
|
564
564
|
}
|
|
565
565
|
return code;
|
|
566
566
|
}
|
|
567
|
-
generateMeshCode(entity, project,
|
|
567
|
+
generateMeshCode(entity, project, _useTS) {
|
|
568
568
|
const meshComp = entity.components.find((c) => c.type === 'mesh' ||
|
|
569
569
|
c.type === 'box' ||
|
|
570
570
|
c.type === 'sphere' ||
|
|
@@ -616,7 +616,7 @@ export class ${sceneName}Scene ${useTS ? 'implements GameScene' : ''} {
|
|
|
616
616
|
entity.receiveShadow = true;
|
|
617
617
|
`;
|
|
618
618
|
}
|
|
619
|
-
generateModelCode(entity, component, _project,
|
|
619
|
+
generateModelCode(entity, component, _project, _useTS) {
|
|
620
620
|
const compProps = component.properties ?? {};
|
|
621
621
|
const modelPath = compProps.path;
|
|
622
622
|
return ` // Model loading is handled asynchronously
|
|
@@ -630,7 +630,7 @@ export class ${sceneName}Scene ${useTS ? 'implements GameScene' : ''} {
|
|
|
630
630
|
: ''}
|
|
631
631
|
`;
|
|
632
632
|
}
|
|
633
|
-
generateLightCode(entity, component,
|
|
633
|
+
generateLightCode(entity, component, _useTS) {
|
|
634
634
|
const compProps = component.properties ?? {};
|
|
635
635
|
const color = compProps.color ?? '#ffffff';
|
|
636
636
|
const intensity = compProps.intensity ?? 1;
|
|
@@ -159,7 +159,7 @@ class Tic80Exporter extends PlatformExporter {
|
|
|
159
159
|
lines.push(this.generateLuaUtilities(platformOpts.includeDebug ?? false));
|
|
160
160
|
return lines.join('\n');
|
|
161
161
|
}
|
|
162
|
-
generateLuaCoreFunctions(project,
|
|
162
|
+
generateLuaCoreFunctions(project, _options) {
|
|
163
163
|
const bgColor = this.getClosestTic80Color(project.scenes[0]?.background ?? '#1a1c2c');
|
|
164
164
|
return `
|
|
165
165
|
-- Boot (called once)
|
|
@@ -926,7 +926,7 @@ draw_debug = ->
|
|
|
926
926
|
return lines.join('\n');
|
|
927
927
|
}
|
|
928
928
|
/* ── Wren Code Generation ───────────────────────────────────── */
|
|
929
|
-
generateWrenCode(project,
|
|
929
|
+
generateWrenCode(project, _options) {
|
|
930
930
|
return `// ${project.name} - TIC-80 Wren
|
|
931
931
|
// Generated from Nice2Dev
|
|
932
932
|
|
|
@@ -1062,7 +1062,7 @@ class UI {
|
|
|
1062
1062
|
`;
|
|
1063
1063
|
}
|
|
1064
1064
|
/* ── Data Sections ──────────────────────────────────────────── */
|
|
1065
|
-
generateSpritesSection(
|
|
1065
|
+
generateSpritesSection(_project) {
|
|
1066
1066
|
// TIC-80 sprites: each line represents 8 pixels (1 byte = 2 pixels)
|
|
1067
1067
|
// 256 sprites in 16x16 grid = 128x128 pixels
|
|
1068
1068
|
const lines = [];
|
|
@@ -1116,7 +1116,7 @@ class UI {
|
|
|
1116
1116
|
lines.push('-- </TILES>');
|
|
1117
1117
|
return lines.join('\n');
|
|
1118
1118
|
}
|
|
1119
|
-
generateMapSection(
|
|
1119
|
+
generateMapSection(_project) {
|
|
1120
1120
|
const lines = [];
|
|
1121
1121
|
lines.push('-- <MAP>');
|
|
1122
1122
|
// 240x136 / 8 = 30x17 tiles
|
|
@@ -1130,7 +1130,7 @@ class UI {
|
|
|
1130
1130
|
lines.push('-- </MAP>');
|
|
1131
1131
|
return lines.join('\n');
|
|
1132
1132
|
}
|
|
1133
|
-
generateWavesSection(
|
|
1133
|
+
generateWavesSection(_project, _options) {
|
|
1134
1134
|
return `-- <WAVES>
|
|
1135
1135
|
-- 000:00000000ffffffff00000000ffffffff
|
|
1136
1136
|
-- 001:0123456789abcdeffedcba9876543210
|
|
@@ -1138,7 +1138,7 @@ class UI {
|
|
|
1138
1138
|
-- 003:fedcba9876543210fedcba9876543210
|
|
1139
1139
|
-- </WAVES>`;
|
|
1140
1140
|
}
|
|
1141
|
-
generateSfxSection(
|
|
1141
|
+
generateSfxSection(_project) {
|
|
1142
1142
|
return `-- <SFX>
|
|
1143
1143
|
-- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
|
|
1144
1144
|
-- </SFX>`;
|
|
@@ -81,7 +81,7 @@ class UnityExporter extends PlatformExporter {
|
|
|
81
81
|
this.exportPackageManifest(project);
|
|
82
82
|
}
|
|
83
83
|
/* ── Project Settings ───────────────────────────────────────── */
|
|
84
|
-
async exportProjectSettings(project,
|
|
84
|
+
async exportProjectSettings(project, _options, _unity) {
|
|
85
85
|
// ProjectSettings.asset
|
|
86
86
|
const settings = `%YAML 1.1
|
|
87
87
|
%TAG !u! tag:unity3d.com,2011:
|
|
@@ -132,7 +132,7 @@ Physics2DSettings:
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
/* ── Prefabs ────────────────────────────────────────────────── */
|
|
135
|
-
async exportPrefabs(project,
|
|
135
|
+
async exportPrefabs(project, _options) {
|
|
136
136
|
for (const prefab of project.prefabs) {
|
|
137
137
|
const yaml = this.createPrefabYAML(prefab, project);
|
|
138
138
|
const path = `Assets/Prefabs/${this.sanitizeFileName(prefab.name)}.prefab`;
|
|
@@ -193,7 +193,7 @@ Physics2DSettings:
|
|
|
193
193
|
return this.serializeUnityYAML({ objects });
|
|
194
194
|
}
|
|
195
195
|
/* ── Scenes ─────────────────────────────────────────────────── */
|
|
196
|
-
async exportScenes(project,
|
|
196
|
+
async exportScenes(project, _options) {
|
|
197
197
|
for (const scene of project.scenes) {
|
|
198
198
|
const yaml = this.createSceneYAML(scene, project);
|
|
199
199
|
const path = `Assets/Scenes/${this.sanitizeFileName(scene.name)}.unity`;
|
|
@@ -299,7 +299,7 @@ Physics2DSettings:
|
|
|
299
299
|
this.addEntityComponents(entity, objects, gameObjectId, project);
|
|
300
300
|
return transformId;
|
|
301
301
|
}
|
|
302
|
-
addEntityComponents(entity, objects, gameObjectId,
|
|
302
|
+
addEntityComponents(entity, objects, gameObjectId, _project) {
|
|
303
303
|
for (const component of entity.components) {
|
|
304
304
|
const props = component.properties ?? {};
|
|
305
305
|
switch (component.type) {
|