diff --git a/docs/.vitepress/config.js b/docs/.vitepress/config.js index 7d4e58f1..8a010e0a 100644 --- a/docs/.vitepress/config.js +++ b/docs/.vitepress/config.js @@ -144,6 +144,7 @@ const guideMenu = [{ { text: "Create event (NPC)", link: "/guide/create-event" }, { text: "Create items", link: "/guide/create-database" }, { text: "Create shape", link: "/guide/create-shape" }, + { text: "Add music in map", link: "/guide/create-sound" }, { text: "Create animated tile", link: "/guide/animation-tile" }, { text: "Save the player's progress", link: "/guide/save" }, { text: "Production", link: "/guide/production" }, diff --git a/docs/guide/create-sound.md b/docs/guide/create-sound.md index 40521b9e..a2533013 100644 --- a/docs/guide/create-sound.md +++ b/docs/guide/create-sound.md @@ -1,8 +1,43 @@ -# Step 8. Put sounds and music +# Put sounds and music -## Prerequisites +
-1. You must have an sound +## Structure + +Here is the structure: + +* main + * sounds + * town.(mp3|ogg) + +## Add sound in map + +To quickly add a sound, add a personality property to the map (in Tiled Map Editor) named sounds. Put the sound ID of the resource + +![tiled world](/assets/map-sound.png) + + + +## Parameters of the sound (optional) + +Add a file named `town.ts` in the directory `sounds` and add the following code: + +```ts +import { Sound } from '@rpgjs/client' + +@Sound({ + sounds: { + town: require('./town.mp3'), + }, + loop: true +}) +export class TownMusic {} +``` + +More information on the parameters: [Sound Class](/classes/sound.html) + +
+
## Structure @@ -61,4 +96,5 @@ import { RpgMap, MapData } from '@rpgjs/server' sounds: ['town'] // You can add several musics }) export class MedievalMap extends RpgMap { } -``` \ No newline at end of file +``` +
\ No newline at end of file diff --git a/docs/guide/create-world-maps.md b/docs/guide/create-world-maps.md index 2d23ed20..0e3a37b6 100644 --- a/docs/guide/create-world-maps.md +++ b/docs/guide/create-world-maps.md @@ -64,12 +64,6 @@ Just add JSON file in The world creates maps automatically and the map ID will be the file name. Be aware that if you already have a map with the same ID, the world will use this map ::: -::: tip -To quickly add a sound, add a personality property to the map (in Tiled Map Editor) named sounds. Put the sound ID of the resource, client side (see [Create Sound](/guide/create-sound.html)) - -![tiled world](/assets/map-sound.png) -::: - ## Bonus. Prevent map change There are several reasons for this. For example, diff --git a/packages/client/src/RpgClient.ts b/packages/client/src/RpgClient.ts index 4151b8bb..1730d29a 100644 --- a/packages/client/src/RpgClient.ts +++ b/packages/client/src/RpgClient.ts @@ -179,7 +179,7 @@ export interface RpgClient { * @example * * ```ts - * import { RpgClient, RpgModule } from '@rpgjs/server' + * import { RpgClient, RpgModule } from '@rpgjs/client' * * @RpgModule({ * hooks: { @@ -198,7 +198,7 @@ export interface RpgClient { * And listen to the hook: * * ```ts - * import { RpgClientEngineHooks, RpgSprite } from '@rpgjs/server' + * import { type RpgClientEngineHooks, RpgSprite } from '@rpgjs/client' * * const sprite: RpgSpriteHooks = { * onAuth(player: RpgSprite) { diff --git a/packages/server/package-lock.json b/packages/server/package-lock.json index 6edca05c..dda60497 100644 --- a/packages/server/package-lock.json +++ b/packages/server/package-lock.json @@ -20,7 +20,7 @@ "pretty-error": "^4.0.0", "rxjs": "7.8.0", "sat": "^0.9.0", - "simple-room": "^3.1.2", + "simple-room": "^3.1.3", "socket.io": "^4.6.1" }, "devDependencies": { @@ -2468,11 +2468,11 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "node_modules/@rpgjs/common": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@rpgjs/common/-/common-4.2.0.tgz", - "integrity": "sha512-r7+abn8oKjljhfHd3liOnf08MiwXL1T5Dc2+tQaeL/8KQx0M7eTbbjQIrwxmqvDyF0h5qxJyTATlFDN6+CYlMQ==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rpgjs/common/-/common-4.2.1.tgz", + "integrity": "sha512-g1Zf4jFRWzT+A/Mb05YuY9iGGevMsrg9w25KoimwTbalmQqsx674E8s8+vl5Z5plo8PRdXcZoNfUJQWBaUzl9Q==", "dependencies": { - "@rpgjs/tiled": "^4.0.5", + "@rpgjs/tiled": "^4.2.1", "@rpgjs/types": "^4.0.5", "rbush": "^3.0.1", "rxjs": "^7.8.0", @@ -2481,9 +2481,9 @@ } }, "node_modules/@rpgjs/compiler": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@rpgjs/compiler/-/compiler-4.2.0.tgz", - "integrity": "sha512-x2eOAZ/UmGtA6QVt/rG9pvVVnzChrzH9WKA9YkdkG8DBkeT0uS12WW+SnZHTj4gdtQ3565vdDiiHKCC49a03DQ==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rpgjs/compiler/-/compiler-4.2.1.tgz", + "integrity": "sha512-cpjXmKH1c3dcODWdFMCDbph0/Dg9VVyesuFez3EDRBV3FgSXqNZyjEsdhiNaMCDhchs2DNlrnCP8b7NDWpom+w==", "dev": true, "dependencies": { "@babel/core": "^7.21.4", @@ -2524,14 +2524,14 @@ } }, "node_modules/@rpgjs/database": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@rpgjs/database/-/database-4.2.0.tgz", - "integrity": "sha512-MBpBxSm5YydfRkKSIh1FzN2CpKOTIZNYZ33+yB5tRljaoQ0ci9kWjowjbJN58NXOTGED8ubuQMEV7V2tndpHDw==" + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rpgjs/database/-/database-4.2.1.tgz", + "integrity": "sha512-XQlimoG1zbWEqOjR2UEAv1qa8xx8lGnaZJ9grELPCojB9f4/TUs7b54Kd8+zZ4772NJLMb+BaEQ76BDXMGqePw==" }, "node_modules/@rpgjs/tiled": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/@rpgjs/tiled/-/tiled-4.0.5.tgz", - "integrity": "sha512-v8/ApphBMrGvGU0Mr2WCiWSjR8uQNz54CiSRMdxER6X4KDmXfSdwdMi1viSXtcy37VCu7FXpeN9MPHczRn+GbA==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rpgjs/tiled/-/tiled-4.2.1.tgz", + "integrity": "sha512-bNk2SEOEB/tKtCp62Tg7XlHJFwhmyZCEz64owI4rAPckRIYrkfF+/YwiowNGhYAKgV+jofb4+Mf5/3XavFBKgQ==", "dependencies": { "axios": "^1.3.4", "buffer": "^6.0.3", @@ -6881,9 +6881,9 @@ } }, "node_modules/simple-room": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/simple-room/-/simple-room-3.1.2.tgz", - "integrity": "sha512-XUzbO2+ahpxgaM67G+7+BgErxtvoCr1wlqsVNJZ2YZzBbiUc/RlsAfJU5lxBopT7634YYqRaoHDgDt0hsHgXuw==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/simple-room/-/simple-room-3.1.3.tgz", + "integrity": "sha512-DJr8V0xU9OG3S+ooYG1q9Ku5ZEkqBpmMCGm4RojT/8yKMwxr4/VBrm8Tth3O0VstS1GyPre9IhC3r9TgU7XYIg==", "dependencies": { "@google-cloud/agones-sdk": "^1.35.0", "msgpack-lite": "0.1.26", @@ -10744,11 +10744,11 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "@rpgjs/common": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@rpgjs/common/-/common-4.2.0.tgz", - "integrity": "sha512-r7+abn8oKjljhfHd3liOnf08MiwXL1T5Dc2+tQaeL/8KQx0M7eTbbjQIrwxmqvDyF0h5qxJyTATlFDN6+CYlMQ==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rpgjs/common/-/common-4.2.1.tgz", + "integrity": "sha512-g1Zf4jFRWzT+A/Mb05YuY9iGGevMsrg9w25KoimwTbalmQqsx674E8s8+vl5Z5plo8PRdXcZoNfUJQWBaUzl9Q==", "requires": { - "@rpgjs/tiled": "^4.0.5", + "@rpgjs/tiled": "^4.2.1", "@rpgjs/types": "^4.0.5", "rbush": "^3.0.1", "rxjs": "^7.8.0", @@ -10757,9 +10757,9 @@ } }, "@rpgjs/compiler": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@rpgjs/compiler/-/compiler-4.2.0.tgz", - "integrity": "sha512-x2eOAZ/UmGtA6QVt/rG9pvVVnzChrzH9WKA9YkdkG8DBkeT0uS12WW+SnZHTj4gdtQ3565vdDiiHKCC49a03DQ==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rpgjs/compiler/-/compiler-4.2.1.tgz", + "integrity": "sha512-cpjXmKH1c3dcODWdFMCDbph0/Dg9VVyesuFez3EDRBV3FgSXqNZyjEsdhiNaMCDhchs2DNlrnCP8b7NDWpom+w==", "dev": true, "requires": { "@babel/core": "^7.21.4", @@ -10797,14 +10797,14 @@ } }, "@rpgjs/database": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@rpgjs/database/-/database-4.2.0.tgz", - "integrity": "sha512-MBpBxSm5YydfRkKSIh1FzN2CpKOTIZNYZ33+yB5tRljaoQ0ci9kWjowjbJN58NXOTGED8ubuQMEV7V2tndpHDw==" + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rpgjs/database/-/database-4.2.1.tgz", + "integrity": "sha512-XQlimoG1zbWEqOjR2UEAv1qa8xx8lGnaZJ9grELPCojB9f4/TUs7b54Kd8+zZ4772NJLMb+BaEQ76BDXMGqePw==" }, "@rpgjs/tiled": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/@rpgjs/tiled/-/tiled-4.0.5.tgz", - "integrity": "sha512-v8/ApphBMrGvGU0Mr2WCiWSjR8uQNz54CiSRMdxER6X4KDmXfSdwdMi1viSXtcy37VCu7FXpeN9MPHczRn+GbA==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rpgjs/tiled/-/tiled-4.2.1.tgz", + "integrity": "sha512-bNk2SEOEB/tKtCp62Tg7XlHJFwhmyZCEz64owI4rAPckRIYrkfF+/YwiowNGhYAKgV+jofb4+Mf5/3XavFBKgQ==", "requires": { "axios": "^1.3.4", "buffer": "^6.0.3", @@ -14067,9 +14067,9 @@ "dev": true }, "simple-room": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/simple-room/-/simple-room-3.1.2.tgz", - "integrity": "sha512-XUzbO2+ahpxgaM67G+7+BgErxtvoCr1wlqsVNJZ2YZzBbiUc/RlsAfJU5lxBopT7634YYqRaoHDgDt0hsHgXuw==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/simple-room/-/simple-room-3.1.3.tgz", + "integrity": "sha512-DJr8V0xU9OG3S+ooYG1q9Ku5ZEkqBpmMCGm4RojT/8yKMwxr4/VBrm8Tth3O0VstS1GyPre9IhC3r9TgU7XYIg==", "requires": { "@google-cloud/agones-sdk": "^1.35.0", "msgpack-lite": "0.1.26", diff --git a/packages/server/package.json b/packages/server/package.json index ab7aff44..502bd3e3 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -38,7 +38,7 @@ "pretty-error": "^4.0.0", "rxjs": "7.8.0", "sat": "^0.9.0", - "simple-room": "^3.1.2", + "simple-room": "^3.1.3", "socket.io": "^4.6.1" }, "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee",