From c8a2562b0daceb2b05c369b1b5f511fc508ba68f Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Wed, 1 May 2024 19:45:32 -0300 Subject: [PATCH 01/21] feat: Add prop to actions --- src/definitions.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/definitions.ts b/src/definitions.ts index 9c29613f3..f355cc8e9 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -209,10 +209,10 @@ export const ActionSchemas = { export type ActionPayload = T extends keyof typeof ActionSchemas - ? (typeof ActionSchemas)[T] extends ISchema - ? ReturnType<(typeof ActionSchemas)[T]['deserialize']> - : {} - : {} + ? (typeof ActionSchemas)[T] extends ISchema + ? ReturnType<(typeof ActionSchemas)[T]['deserialize']> + : {} + : {} export function getComponent(componentName: string, engine: IEngine) { try { @@ -255,6 +255,7 @@ export function createComponents(engine: IEngine) { type: Schemas.String, jsonPayload: Schemas.String, allowedInBasicView: Schemas.Optional(Schemas.Boolean), + basicViewId: Schemas.Optional(Schemas.String), }), ), }) From 5808587bd2d4ae9036c7ca0f5652766d4641cb55 Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 2 May 2024 17:00:51 -0300 Subject: [PATCH 02/21] chore: Add gha to generate a package preview on PR --- .github/workflows/build-and-publish.yml | 71 +++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/build-and-publish.yml diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 000000000..f28ab3d8b --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -0,0 +1,71 @@ +name: build and publish + +on: + pull_request: + +jobs: + check_and_build: + runs-on: ubuntu-latest + permissions: + id-token: write + outputs: + s3_bucket_key: ${{ steps.publish_package.outputs.s3-bucket-key }} + steps: + - uses: actions/checkout@v3 + - name: Install + run: npm ci + - name: Build + run: npm run build && cp -r bin dist + - name: Publish + uses: menduz/oddish-action@master + id: publish_package + with: + registry-url: 'https://registry.npmjs.org' + access: public + ## use action runId instead of current date to generate snapshot numbers + deterministic-snapshot: true + + ## publish every package to s3 + s3-bucket: ${{ secrets.SDK_TEAM_S3_BUCKET }} + s3-bucket-key-prefix: '@dcl/${{ github.event.repository.name }}/branch/${{ github.head_ref }}' + s3-bucket-region: ${{ secrets.SDK_TEAM_AWS_REGION }} + + ## inform gitlab after publishing to proceed with CDN propagation + gitlab-token: ${{ secrets.GITLAB_TOKEN }} + gitlab-pipeline-url: ${{ secrets.GITLAB_URL }} + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + AWS_DEFAULT_REGION: us-east-1 + AWS_ACCESS_KEY_ID: ${{ secrets.SDK_TEAM_AWS_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SDK_TEAM_AWS_SECRET }} + + notify_deployment: + needs: [check_and_build] + if: ${{ github.event.pull_request.number && !startsWith(github.head_ref, 'dependabot/') }} + runs-on: ubuntu-latest + name: Deployment Notification + steps: + - name: Find Comment + uses: peter-evans/find-comment@v2 + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: Test this pull request + + - name: Generate S3 URL + id: url-generator + run: echo "body=${{ secrets.SDK_TEAM_S3_BASE_URL }}/${{ needs.check_and_build.outputs.s3_bucket_key }}" >> $GITHUB_OUTPUT + + - name: Create or update comment + uses: peter-evans/create-or-update-comment@v3 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body: | + # Test this pull request + - The package can be tested by running + ```bash + npm upgrade "${{ steps.url-generator.outputs.body }}" + ``` + edit-mode: replace From 712d360d21a044891f33905f99e234ada21add5c Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 2 May 2024 17:50:53 -0300 Subject: [PATCH 03/21] fix: Remove unrequired env vars --- .github/workflows/build-and-publish.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index f28ab3d8b..2375829bb 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -29,10 +29,6 @@ jobs: s3-bucket: ${{ secrets.SDK_TEAM_S3_BUCKET }} s3-bucket-key-prefix: '@dcl/${{ github.event.repository.name }}/branch/${{ github.head_ref }}' s3-bucket-region: ${{ secrets.SDK_TEAM_AWS_REGION }} - - ## inform gitlab after publishing to proceed with CDN propagation - gitlab-token: ${{ secrets.GITLAB_TOKEN }} - gitlab-pipeline-url: ${{ secrets.GITLAB_URL }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} AWS_DEFAULT_REGION: us-east-1 From 687dda4b0fe711ca44771aa529c601a332ddbb25 Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Mon, 6 May 2024 12:45:05 -0300 Subject: [PATCH 04/21] feat: Add config component to the game smart items --- packs/smart_items/assets/barrel/data.json | 18 +++++++- packs/smart_items/assets/first_aid/data.json | 36 +++++++++++---- .../smart_items/assets/healing_pad/data.json | 44 ++++++++++++++++--- packs/smart_items/assets/health_bar/data.json | 43 +++++++++++++++--- .../smart_items/assets/respawn_pad/data.json | 3 +- packs/smart_items/assets/robot/data.json | 22 ++++++++-- packs/smart_items/assets/spikes/data.json | 44 ++++++++++++++++--- packs/smart_items/assets/sword/data.json | 24 +++++++++- .../smart_items/assets/wooden_wall/data.json | 26 ++++++++++- 9 files changed, 226 insertions(+), 34 deletions(-) diff --git a/packs/smart_items/assets/barrel/data.json b/packs/smart_items/assets/barrel/data.json index 4711bc4ad..18379607b 100644 --- a/packs/smart_items/assets/barrel/data.json +++ b/packs/smart_items/assets/barrel/data.json @@ -18,7 +18,8 @@ { "name": "Explode", "type": "batch", - "jsonPayload": "{ \"actions\": [\"Play Explosion Animation\", \"Damage\", \"Delay Remove\"] }" + "jsonPayload": "{ \"actions\": [\"Play Explosion Animation\", \"Damage\", \"Delay Remove\"] }", + "allowedInBasicView": true }, { "name": "Play Explosion Animation", @@ -28,7 +29,8 @@ { "name": "Damage", "type": "damage", - "jsonPayload": "{ \"radius\": 10, \"hits\": 30, \"layer\": \"all\" }" + "jsonPayload": "{ \"radius\": 10, \"hits\": 30, \"layer\": \"all\" }", + "basicViewId": "action-damage" }, { "name": "Remove", @@ -41,6 +43,18 @@ "jsonPayload": "{ \"actions\": [\"Remove\"], \"timeout\": 1 }" } ] + }, + "inspector::Config": { + "isBasicViewEnabled": true, + "componentName": "Barrel", + "fields": [ + { + "name": "Damage ", + "type": "asset-packs::Actions", + "basicViewId": "action-damage", + "layout": "{\"radius\": { \"field\": \"TextField\", \"type\": \"number\" }, \"hits\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Damage Points\" }, \"layer\": { \"field\": \"Dropdown\", \"label\": \"Damage Target\" }}" + } + ] } } } \ No newline at end of file diff --git a/packs/smart_items/assets/first_aid/data.json b/packs/smart_items/assets/first_aid/data.json index 8fa19e613..e9be35a00 100644 --- a/packs/smart_items/assets/first_aid/data.json +++ b/packs/smart_items/assets/first_aid/data.json @@ -17,29 +17,49 @@ { "name": "Heal Player", "type": "heal_player", - "jsonPayload": "{ \"multiplier\": 100 }" + "jsonPayload": "{ \"multiplier\": 100 }", + "basicViewId": "action-heal-player" }, { "name": "Remove", "type": "remove_entity", "jsonPayload": "{ }" + }, + { + "name": "Heal", + "type": "batch", + "jsonPayload": "{ \"actions\": [\"Heal Player\", \"Remove\"] }", + "allowedInBasicView": true } ] }, "asset-packs::Triggers": { "value": [ { - "type": "on_click", + "type": "on_input_action", "actions": [ { "id": "{self:asset-packs::Actions}", - "name": "Heal Player" - }, - { - "id": "{self:asset-packs::Actions}", - "name": "Remove" + "name": "Heal" } - ] + ], + "basicViewId": "trigger-when-clicked" + } + ] + }, + "inspector::Config": { + "isBasicViewEnabled": true, + "componentName": "First Aid", + "fields": [ + { + "name": "Healing Points", + "type": "asset-packs::Actions", + "basicViewId": "action-heal-player" + }, + { + "name": "When Clicked", + "type": "asset-packs::Triggers", + "basicViewId": "trigger-when-clicked" } ] } diff --git a/packs/smart_items/assets/healing_pad/data.json b/packs/smart_items/assets/healing_pad/data.json index f4ecfa279..b282920c2 100644 --- a/packs/smart_items/assets/healing_pad/data.json +++ b/packs/smart_items/assets/healing_pad/data.json @@ -22,17 +22,21 @@ { "name": "Heal Player", "type": "heal_player", - "jsonPayload": "{ \"multiplier\": 5 }" + "jsonPayload": "{ \"multiplier\": 5 }", + "basicViewId": "action-heal-player" }, { "name": "Start Healing", "type": "start_loop", - "jsonPayload": "{ \"actions\": [\"Heal Player\"], \"interval\": 0.5 }" + "jsonPayload": "{ \"actions\": [\"Heal Player\"], \"interval\": 0.5 }", + "basicViewId": "action-healing-interval", + "allowedInBasicView": true }, { "name": "Stop Healing", "type": "stop_loop", - "jsonPayload": "{ \"action\": \"Heal Player\" }" + "jsonPayload": "{ \"action\": \"Heal Player\" }", + "allowedInBasicView": true } ] }, @@ -49,7 +53,8 @@ "id": "{self:asset-packs::Actions}", "name": "Play Heal Sound" } - ] + ], + "basicViewId": "trigger-when-start-healing" }, { "type": "on_player_leaves_area", @@ -58,7 +63,36 @@ "id": "{self:asset-packs::Actions}", "name": "Stop Healing" } - ] + ], + "basicViewId": "trigger-when-stop-healing" + } + ] + }, + "inspector::Config": { + "isBasicViewEnabled": true, + "componentName": "Healing Pad", + "fields": [ + { + "name": "Healing Points", + "type": "asset-packs::Actions", + "basicViewId": "action-heal-player", + "layout": "{\"multiplier\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Healing Points\" } }" + }, + { + "name": "Interval Healing", + "type": "asset-packs::Actions", + "basicViewId": "action-healing-interval", + "layout": "{\"interval\": { \"field\": \"RangeField\", \"label\": \"Healing Interval\", \"step\": \"0.1\" } }" + }, + { + "name": "When Start Healing", + "type": "asset-packs::Triggers", + "basicViewId": "trigger-when-start-healing" + }, + { + "name": "When Stop Healing", + "type": "asset-packs::Triggers", + "basicViewId": "trigger-when-stop-healing" } ] } diff --git a/packs/smart_items/assets/health_bar/data.json b/packs/smart_items/assets/health_bar/data.json index 16a738a76..1dc67c734 100644 --- a/packs/smart_items/assets/health_bar/data.json +++ b/packs/smart_items/assets/health_bar/data.json @@ -19,17 +19,20 @@ { "name": "Heal", "type": "increment_counter", - "jsonPayload": "{ \"amount\": 1 }" + "jsonPayload": "{ \"amount\": 1 }", + "allowedInBasicView": true }, { "name": "Damage", "type": "decrease_counter", - "jsonPayload": "{ \"amount\": 1 }" + "jsonPayload": "{ \"amount\": 1 }", + "allowedInBasicView": true }, { "name": "Reset", "type": "set_counter", - "jsonPayload": "{ \"counter\": 100 }" + "jsonPayload": "{ \"counter\": 100 }", + "allowedInBasicView": true }, { "name": "Remove", @@ -47,7 +50,8 @@ "id": "{self:asset-packs::Actions}", "name": "Damage" } - ] + ], + "basicViewId": "trigger-when-damaged" }, { "type": "on_heal_player", @@ -56,7 +60,8 @@ "id": "{self:asset-packs::Actions}", "name": "Heal" } - ] + ], + "basicViewId": "trigger-when-healed" }, { "type": "on_counter_change", @@ -72,7 +77,8 @@ "id": "{self:asset-packs::Actions}", "name": "Remove" } - ] + ], + "basicViewId": "trigger-when-health-reached-zero" } ] }, @@ -84,6 +90,31 @@ "maxValue": 100, "primaryColor": "#00FF00", "secondaryColor:": "#FF0000" + }, + "inspector::Config": { + "isBasicViewEnabled": true, + "componentName": "Health Bar", + "fields": [ + { + "name": "Health Points", + "type": "asset-packs::CounterBar" + }, + { + "name": "When Healed", + "type": "asset-packs::Triggers", + "basicViewId": "trigger-when-healed" + }, + { + "name": "When Damaged", + "type": "asset-packs::Triggers", + "basicViewId": "trigger-when-damaged" + }, + { + "name": "When Health Reached Zero", + "type": "asset-packs::Triggers", + "basicViewId": "trigger-when-health-reached-zero" + } + ] } } } \ No newline at end of file diff --git a/packs/smart_items/assets/respawn_pad/data.json b/packs/smart_items/assets/respawn_pad/data.json index 2d609649f..e9232c6aa 100644 --- a/packs/smart_items/assets/respawn_pad/data.json +++ b/packs/smart_items/assets/respawn_pad/data.json @@ -18,7 +18,8 @@ { "name": "Respawn Player", "type": "batch", - "jsonPayload": "{ \"actions\": [\"Move Player\", \"Play Spawn Sound\"] }" + "jsonPayload": "{ \"actions\": [\"Move Player\", \"Play Spawn Sound\"] }", + "allowedInBasicView": true }, { "name": "Move Player", diff --git a/packs/smart_items/assets/robot/data.json b/packs/smart_items/assets/robot/data.json index 1fce34994..892439bea 100644 --- a/packs/smart_items/assets/robot/data.json +++ b/packs/smart_items/assets/robot/data.json @@ -16,12 +16,14 @@ { "name": "Die", "type": "batch", - "jsonPayload": "{ \"actions\": [\"Play Explosion Animation\", \"Stop Attack Loop\", \"Delay Remove\"] }" + "jsonPayload": "{ \"actions\": [\"Play Explosion Animation\", \"Stop Attack Loop\", \"Delay Remove\"] }", + "allowedInBasicView": true }, { "name": "Follow", "type": "follow_player", - "jsonPayload": "{ \"speed\": 1, \"minDistance\": 2, \"x\": true, \"y\": false, \"z\": true }" + "jsonPayload": "{ \"speed\": 1, \"minDistance\": 2, \"x\": true, \"y\": false, \"z\": true }", + "allowedInBasicView": true }, { "name": "Play Attack Animation", @@ -31,7 +33,9 @@ { "name": "Damage", "type": "damage", - "jsonPayload": "{ \"radius\": 3, \"hits\": 10, \"layer\": \"player\" }" + "jsonPayload": "{ \"radius\": 3, \"hits\": 10, \"layer\": \"player\" }", + "basicViewId": "action-damage", + "allowedInBasicView": true }, { "name": "Attack Loop", @@ -92,6 +96,18 @@ ] } ] + }, + "inspector::Config": { + "isBasicViewEnabled": true, + "componentName": "Robot Enemy", + "fields": [ + { + "name": "Damage ", + "type": "asset-packs::Actions", + "basicViewId": "action-damage", + "layout":"{\"radius\": { \"field\": \"TextField\", \"type\": \"number\" }, \"hits\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Damage Points\" }, \"layer\": { \"field\": \"Dropdown\", \"label\": \"Damage Target\" }}" + } + ] } } } \ No newline at end of file diff --git a/packs/smart_items/assets/spikes/data.json b/packs/smart_items/assets/spikes/data.json index 598871cf1..3657c06dc 100644 --- a/packs/smart_items/assets/spikes/data.json +++ b/packs/smart_items/assets/spikes/data.json @@ -22,17 +22,21 @@ { "name": "Damage", "type": "damage", - "jsonPayload": "{ \"radius\": 5, \"hits\": 15, \"layer\": \"player\" }" + "jsonPayload": "{ \"radius\": 5, \"hits\": 15, \"layer\": \"player\" }", + "basicViewId": "action-damage" }, { "name": "Start Damage", "type": "start_loop", - "jsonPayload": "{ \"actions\": [\"Damage Batch\"], \"interval\": 2 }" + "jsonPayload": "{ \"actions\": [\"Damage Batch\"], \"interval\": 2 }", + "basicViewId": "action-damage-interval", + "allowedInBasicView": true }, { "name": "Stop Damage", "type": "stop_loop", - "jsonPayload": "{ \"action\": \"Damage Batch\" }" + "jsonPayload": "{ \"action\": \"Damage Batch\" }", + "allowedInBasicView": true }, { "name": "Damage Batch", @@ -50,7 +54,8 @@ "id": "{self:asset-packs::Actions}", "name": "Start Damage" } - ] + ], + "basicViewId": "trigger-when-start-damaing" }, { "type": "on_player_leaves_area", @@ -59,7 +64,36 @@ "id": "{self:asset-packs::Actions}", "name": "Stop Damage" } - ] + ], + "basicViewId": "trigger-when-stop-damaing" + } + ] + }, + "inspector::Config": { + "isBasicViewEnabled": true, + "componentName": "Spikes", + "fields": [ + { + "name": "Damage", + "type": "asset-packs::Actions", + "basicViewId": "action-damage", + "layout":"{\"radius\": { \"field\": \"TextField\", \"type\": \"number\" }, \"hits\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Damage Points\" }, \"layer\": { \"field\": \"Dropdown\", \"label\": \"Damage Target\" }}" + }, + { + "name": "Interval Damage", + "type": "asset-packs::Actions", + "basicViewId": "action-damage-interval", + "layout": "{\"interval\": { \"field\": \"RangeField\", \"label\": \"Damage Interval\", \"step\": \"0.1\" } }" + }, + { + "name": "When Start Damaing", + "type": "asset-packs::Triggers", + "basicViewId": "trigger-when-start-damaing" + }, + { + "name": "When Stop Damaing", + "type": "asset-packs::Triggers", + "basicViewId": "trigger-when-stop-damaing" } ] } diff --git a/packs/smart_items/assets/sword/data.json b/packs/smart_items/assets/sword/data.json index 4cd97ec93..be4854e5c 100644 --- a/packs/smart_items/assets/sword/data.json +++ b/packs/smart_items/assets/sword/data.json @@ -37,7 +37,8 @@ { "name": "Damage", "type": "damage", - "jsonPayload": "{ \"radius\": 3, \"hits\": 10, \"layer\": \"non_player\" }" + "jsonPayload": "{ \"radius\": 3, \"hits\": 10, \"layer\": \"non_player\" }", + "basicViewId": "action-damage" }, { "name": "Set Cooling Down", @@ -47,7 +48,8 @@ { "name": "Start Cool Down Delay", "type": "start_delay", - "jsonPayload": "{ \"actions\": [\"Set Ready\"], \"timeout\": 0.5 }" + "jsonPayload": "{ \"actions\": [\"Set Ready\"], \"timeout\": 0.5 }", + "basicViewId": "action-cool-down-delay" }, { "name": "Cool Down", @@ -114,6 +116,24 @@ "Cooling Down" ], "defaultValue": "Idle" + }, + "inspector::Config": { + "isBasicViewEnabled": true, + "componentName": "Sword", + "fields": [ + { + "name": "Damage", + "type": "asset-packs::Actions", + "basicViewId": "action-damage", + "layout":"{\"radius\": { \"field\": \"TextField\", \"type\": \"number\" }, \"hits\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Damage Points\" }, \"layer\": { \"field\": \"Dropdown\", \"label\": \"Damage Target\" }}" + }, + { + "name": "Cooldown", + "type": "asset-packs::Actions", + "basicViewId": "action-cool-down-delay", + "layout": "{\"timeout\": { \"field\": \"RangeField\", \"label\": \"Cooldown\", \"step\": \"0.1\" } }" + } + ] } } } \ No newline at end of file diff --git a/packs/smart_items/assets/wooden_wall/data.json b/packs/smart_items/assets/wooden_wall/data.json index 11515257e..59568610b 100644 --- a/packs/smart_items/assets/wooden_wall/data.json +++ b/packs/smart_items/assets/wooden_wall/data.json @@ -52,7 +52,8 @@ "id": "{self:asset-packs::Actions}", "name": "Decrease Counter" } - ] + ], + "basicViewId": "trigger-when-damaged" }, { "type": "on_counter_change", @@ -88,13 +89,34 @@ "id": "{self:asset-packs::Actions}", "name": "Play Fall Sound" } - ] + ], + "basicViewId": "trigger-when-destroyed" } ] }, "asset-packs::Counter": { "id": "{self}", "value": 30 + }, + "inspector::Config": { + "isBasicViewEnabled": true, + "componentName": "Wooden Wall", + "fields": [ + { + "name": "Health Points", + "type": "asset-packs::Counter" + }, + { + "name": "When Damaged", + "type": "asset-packs::Triggers", + "basicViewId": "trigger-when-damaged" + }, + { + "name": "When Destroyed", + "type": "asset-packs::Triggers", + "basicViewId": "trigger-when-destroyed" + } + ] } } } \ No newline at end of file From a1fc76d00e24f73c1844f25016a4f355043258cc Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Mon, 6 May 2024 12:48:29 -0300 Subject: [PATCH 05/21] fix: Prettier --- .prettierrc.json | 6 ++++++ src/definitions.ts | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .prettierrc.json diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 000000000..b9cd521b2 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "tabWidth": 2, + "semi": false, + "printWidth": 80 +} diff --git a/src/definitions.ts b/src/definitions.ts index f355cc8e9..cff4a7b2c 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -209,10 +209,10 @@ export const ActionSchemas = { export type ActionPayload = T extends keyof typeof ActionSchemas - ? (typeof ActionSchemas)[T] extends ISchema - ? ReturnType<(typeof ActionSchemas)[T]['deserialize']> - : {} - : {} + ? (typeof ActionSchemas)[T] extends ISchema + ? ReturnType<(typeof ActionSchemas)[T]['deserialize']> + : {} + : {} export function getComponent(componentName: string, engine: IEngine) { try { From 681fa7f1e1141347aec4c0065380912cdb85108e Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 11:46:50 -0300 Subject: [PATCH 06/21] fix: Rename sword field Cooldown to Attack Cooldown --- packs/smart_items/assets/sword/data.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packs/smart_items/assets/sword/data.json b/packs/smart_items/assets/sword/data.json index be4854e5c..f38a7481f 100644 --- a/packs/smart_items/assets/sword/data.json +++ b/packs/smart_items/assets/sword/data.json @@ -128,7 +128,7 @@ "layout":"{\"radius\": { \"field\": \"TextField\", \"type\": \"number\" }, \"hits\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Damage Points\" }, \"layer\": { \"field\": \"Dropdown\", \"label\": \"Damage Target\" }}" }, { - "name": "Cooldown", + "name": "Attack Cooldown", "type": "asset-packs::Actions", "basicViewId": "action-cool-down-delay", "layout": "{\"timeout\": { \"field\": \"RangeField\", \"label\": \"Cooldown\", \"step\": \"0.1\" } }" From 289ebcbf952199e03b559e91bf534bc75ba83d54 Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 11:51:32 -0300 Subject: [PATCH 07/21] fix: Enable sword basic view actions Pick Up and Start Cool Down Delay --- packs/smart_items/assets/sword/data.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packs/smart_items/assets/sword/data.json b/packs/smart_items/assets/sword/data.json index f38a7481f..37cd976f4 100644 --- a/packs/smart_items/assets/sword/data.json +++ b/packs/smart_items/assets/sword/data.json @@ -17,7 +17,8 @@ { "name": "Pick Up", "type": "batch", - "jsonPayload": "{ \"actions\": [\"Set Ready\"] }" + "jsonPayload": "{ \"actions\": [\"Set Ready\"] }", + "allowedInBasicView": true }, { "name": "Set Ready", @@ -49,7 +50,8 @@ "name": "Start Cool Down Delay", "type": "start_delay", "jsonPayload": "{ \"actions\": [\"Set Ready\"], \"timeout\": 0.5 }", - "basicViewId": "action-cool-down-delay" + "basicViewId": "action-cool-down-delay", + "allowedInBasicView": true }, { "name": "Cool Down", From 2094766f1a6ecfc0105c65b09fd251f282668182 Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 12:10:04 -0300 Subject: [PATCH 08/21] fix: Remove action field radius and triggers from spikes' basic view --- packs/smart_items/assets/spikes/data.json | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/packs/smart_items/assets/spikes/data.json b/packs/smart_items/assets/spikes/data.json index 3657c06dc..76dc84635 100644 --- a/packs/smart_items/assets/spikes/data.json +++ b/packs/smart_items/assets/spikes/data.json @@ -54,8 +54,7 @@ "id": "{self:asset-packs::Actions}", "name": "Start Damage" } - ], - "basicViewId": "trigger-when-start-damaing" + ] }, { "type": "on_player_leaves_area", @@ -64,8 +63,7 @@ "id": "{self:asset-packs::Actions}", "name": "Stop Damage" } - ], - "basicViewId": "trigger-when-stop-damaing" + ] } ] }, @@ -77,23 +75,13 @@ "name": "Damage", "type": "asset-packs::Actions", "basicViewId": "action-damage", - "layout":"{\"radius\": { \"field\": \"TextField\", \"type\": \"number\" }, \"hits\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Damage Points\" }, \"layer\": { \"field\": \"Dropdown\", \"label\": \"Damage Target\" }}" + "layout":"{\"hits\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Damage Points\" }, \"layer\": { \"field\": \"Dropdown\", \"label\": \"Damage Target\" }}" }, { "name": "Interval Damage", "type": "asset-packs::Actions", "basicViewId": "action-damage-interval", "layout": "{\"interval\": { \"field\": \"RangeField\", \"label\": \"Damage Interval\", \"step\": \"0.1\" } }" - }, - { - "name": "When Start Damaing", - "type": "asset-packs::Triggers", - "basicViewId": "trigger-when-start-damaing" - }, - { - "name": "When Stop Damaing", - "type": "asset-packs::Triggers", - "basicViewId": "trigger-when-stop-damaing" } ] } From a419c0ebdf9b585d8bebba4fd366159154599d01 Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 12:37:40 -0300 Subject: [PATCH 09/21] fix: Wooden Wall - Rename Decrease Counter action to Damage and create a new one Destroy to set counter in 0 --- .../smart_items/assets/wooden_wall/data.json | 39 +++++++++---------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/packs/smart_items/assets/wooden_wall/data.json b/packs/smart_items/assets/wooden_wall/data.json index 59568610b..eee3fad24 100644 --- a/packs/smart_items/assets/wooden_wall/data.json +++ b/packs/smart_items/assets/wooden_wall/data.json @@ -30,9 +30,21 @@ "jsonPayload": "{ \"src\": \"{assetPath}/fall.mp3\" }" }, { - "name": "Decrease Counter", + "name": "Damage", "type": "decrease_counter", - "jsonPayload": "{ \"amount\": 1 }" + "jsonPayload": "{ \"amount\": 1 }", + "allowedInBasicView": true + }, + { + "name": "Destroy", + "type": "set_counter", + "jsonPayload": "{ \"counter\": 0 }", + "allowedInBasicView": true + }, + { + "name": "Destroy Batch", + "type": "batch", + "jsonPayload": "{ \"actions\": [\"Play Fall Animation\", \"Play Fall Sound\"] }" } ] }, @@ -50,7 +62,7 @@ "actions": [ { "id": "{self:asset-packs::Actions}", - "name": "Decrease Counter" + "name": "Damage" } ], "basicViewId": "trigger-when-damaged" @@ -83,14 +95,9 @@ "actions": [ { "id": "{self:asset-packs::Actions}", - "name": "Play Fall Animation" - }, - { - "id": "{self:asset-packs::Actions}", - "name": "Play Fall Sound" + "name": "Destroy Batch" } - ], - "basicViewId": "trigger-when-destroyed" + ] } ] }, @@ -103,18 +110,8 @@ "componentName": "Wooden Wall", "fields": [ { - "name": "Health Points", + "name": "Item Health Points", "type": "asset-packs::Counter" - }, - { - "name": "When Damaged", - "type": "asset-packs::Triggers", - "basicViewId": "trigger-when-damaged" - }, - { - "name": "When Destroyed", - "type": "asset-packs::Triggers", - "basicViewId": "trigger-when-destroyed" } ] } From 90c9a1afbcd3c3144296de1c9fca2d417afe4342 Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 12:41:52 -0300 Subject: [PATCH 10/21] fix: Healing Pad - Remove triggers from basic view --- packs/smart_items/assets/healing_pad/data.json | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/packs/smart_items/assets/healing_pad/data.json b/packs/smart_items/assets/healing_pad/data.json index b282920c2..ac838d79c 100644 --- a/packs/smart_items/assets/healing_pad/data.json +++ b/packs/smart_items/assets/healing_pad/data.json @@ -83,16 +83,6 @@ "type": "asset-packs::Actions", "basicViewId": "action-healing-interval", "layout": "{\"interval\": { \"field\": \"RangeField\", \"label\": \"Healing Interval\", \"step\": \"0.1\" } }" - }, - { - "name": "When Start Healing", - "type": "asset-packs::Triggers", - "basicViewId": "trigger-when-start-healing" - }, - { - "name": "When Stop Healing", - "type": "asset-packs::Triggers", - "basicViewId": "trigger-when-stop-healing" } ] } From 86cfbda1a988b94ee470f88b1f83eec86083c006 Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 12:53:22 -0300 Subject: [PATCH 11/21] fix: Sword - Rename Cooldown to Attack Cooldown --- packs/smart_items/assets/sword/data.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packs/smart_items/assets/sword/data.json b/packs/smart_items/assets/sword/data.json index 37cd976f4..426cba388 100644 --- a/packs/smart_items/assets/sword/data.json +++ b/packs/smart_items/assets/sword/data.json @@ -133,7 +133,7 @@ "name": "Attack Cooldown", "type": "asset-packs::Actions", "basicViewId": "action-cool-down-delay", - "layout": "{\"timeout\": { \"field\": \"RangeField\", \"label\": \"Cooldown\", \"step\": \"0.1\" } }" + "layout": "{\"timeout\": { \"field\": \"RangeField\", \"label\": \"Attack Cooldown\", \"step\": \"0.1\" } }" } ] } From 427743997d9ab65b12a01f609b4ab8ba92940088 Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 12:54:36 -0300 Subject: [PATCH 12/21] fix: Barrel - Add remove action to basic view --- packs/smart_items/assets/barrel/data.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packs/smart_items/assets/barrel/data.json b/packs/smart_items/assets/barrel/data.json index 18379607b..9d294200b 100644 --- a/packs/smart_items/assets/barrel/data.json +++ b/packs/smart_items/assets/barrel/data.json @@ -35,7 +35,8 @@ { "name": "Remove", "type": "remove_entity", - "jsonPayload": "{ }" + "jsonPayload": "{ }", + "allowedInBasicView": true }, { "name": "Delay Remove", From 03a296c2a949767614e9c0722ebf073a78e7990c Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 12:55:21 -0300 Subject: [PATCH 13/21] fix: First Aid - Add remove action to basic view --- packs/smart_items/assets/first_aid/data.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packs/smart_items/assets/first_aid/data.json b/packs/smart_items/assets/first_aid/data.json index e9be35a00..69ed2a3aa 100644 --- a/packs/smart_items/assets/first_aid/data.json +++ b/packs/smart_items/assets/first_aid/data.json @@ -23,7 +23,8 @@ { "name": "Remove", "type": "remove_entity", - "jsonPayload": "{ }" + "jsonPayload": "{ }", + "allowedInBasicView": true }, { "name": "Heal", From 17ff1fe83e177c1577d42d9c0d2d55a3daa5beb2 Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 14:44:55 -0300 Subject: [PATCH 14/21] fix: Barrel - Rename props --- packs/smart_items/assets/barrel/data.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packs/smart_items/assets/barrel/data.json b/packs/smart_items/assets/barrel/data.json index 9d294200b..d27929f38 100644 --- a/packs/smart_items/assets/barrel/data.json +++ b/packs/smart_items/assets/barrel/data.json @@ -50,12 +50,12 @@ "componentName": "Barrel", "fields": [ { - "name": "Damage ", + "name": "Damage", "type": "asset-packs::Actions", "basicViewId": "action-damage", - "layout": "{\"radius\": { \"field\": \"TextField\", \"type\": \"number\" }, \"hits\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Damage Points\" }, \"layer\": { \"field\": \"Dropdown\", \"label\": \"Damage Target\" }}" + "layout": "{\"radius\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Explosion Radius\" }, \"hits\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Explosion Damage\" }, \"layer\": { \"field\": \"Dropdown\", \"label\": \"Damage Target\" }}" } ] } } -} \ No newline at end of file +} From d550a35c727808dd519d04bc7dcf2ca05ac1bbd7 Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 14:50:46 -0300 Subject: [PATCH 15/21] fix: Robot - Add Stop Following action and allow modify speed property --- packs/smart_items/assets/robot/data.json | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/packs/smart_items/assets/robot/data.json b/packs/smart_items/assets/robot/data.json index 892439bea..69587c332 100644 --- a/packs/smart_items/assets/robot/data.json +++ b/packs/smart_items/assets/robot/data.json @@ -23,6 +23,13 @@ "name": "Follow", "type": "follow_player", "jsonPayload": "{ \"speed\": 1, \"minDistance\": 2, \"x\": true, \"y\": false, \"z\": true }", + "basicViewId": "action-follow-player", + "allowedInBasicView": true + }, + { + "name": "Stop Following Player", + "type": "stop_following_player", + "jsonPayload": "{ }", "allowedInBasicView": true }, { @@ -102,12 +109,18 @@ "componentName": "Robot Enemy", "fields": [ { - "name": "Damage ", + "name": "Damage", "type": "asset-packs::Actions", "basicViewId": "action-damage", - "layout":"{\"radius\": { \"field\": \"TextField\", \"type\": \"number\" }, \"hits\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Damage Points\" }, \"layer\": { \"field\": \"Dropdown\", \"label\": \"Damage Target\" }}" + "layout":"{\"radius\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Attack Radius\" }, \"hits\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Attack Damage Points\" }, \"layer\": { \"field\": \"Dropdown\", \"label\": \"Damage Target\" } }" + }, + { + "name": "Speed", + "type": "asset-packs::Actions", + "basicViewId": "action-follow-player", + "layout":"{\"speed\": { \"field\": \"TextField\", \"type\": \"number\" } }" } ] } } -} \ No newline at end of file +} From 62ef1aba215a16c2896cf4096e7e583b368eb3a8 Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 14:53:45 -0300 Subject: [PATCH 16/21] fix: First Aid - Remove on click trigger from basic view and modify heal player multiplier text --- packs/smart_items/assets/first_aid/data.json | 10 +++------- packs/smart_items/assets/healing_pad/data.json | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packs/smart_items/assets/first_aid/data.json b/packs/smart_items/assets/first_aid/data.json index 69ed2a3aa..faf6caefb 100644 --- a/packs/smart_items/assets/first_aid/data.json +++ b/packs/smart_items/assets/first_aid/data.json @@ -55,14 +55,10 @@ { "name": "Healing Points", "type": "asset-packs::Actions", - "basicViewId": "action-heal-player" - }, - { - "name": "When Clicked", - "type": "asset-packs::Triggers", - "basicViewId": "trigger-when-clicked" + "basicViewId": "action-heal-player", + "layout": "{\"multiplier\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Healing Points Amount\" } }" } ] } } -} \ No newline at end of file +} diff --git a/packs/smart_items/assets/healing_pad/data.json b/packs/smart_items/assets/healing_pad/data.json index ac838d79c..0d42e7ed0 100644 --- a/packs/smart_items/assets/healing_pad/data.json +++ b/packs/smart_items/assets/healing_pad/data.json @@ -76,7 +76,7 @@ "name": "Healing Points", "type": "asset-packs::Actions", "basicViewId": "action-heal-player", - "layout": "{\"multiplier\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Healing Points\" } }" + "layout": "{\"multiplier\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Healing Points Amount\" } }" }, { "name": "Interval Healing", From f1d2b787bf759b2130f79ec8abad310d2ce4bb32 Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 15:01:33 -0300 Subject: [PATCH 17/21] feat: Add on_player_spawn trigger --- src/actions.ts | 2 ++ src/enums.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/src/actions.ts b/src/actions.ts index 0b4e03f14..f6f258406 100644 --- a/src/actions.ts +++ b/src/actions.ts @@ -1076,6 +1076,8 @@ export function createActionsSystem(engine: IEngine) { ) { const here = getWorldPosition(entity) void movePlayerTo({ newRelativePosition: here }) + const triggerEvents = getTriggerEvents(entity) + triggerEvents.emit(TriggerType.ON_PLAYER_SPAWN) } // PLACE_ON_PLAYER diff --git a/src/enums.ts b/src/enums.ts index 43557f140..b32927d25 100644 --- a/src/enums.ts +++ b/src/enums.ts @@ -102,6 +102,7 @@ export enum TriggerType { ON_GLOBAL_SECONDARY = 'on_global_secondary', ON_TICK = 'on_tick', ON_HEAL_PLAYER = 'on_heal_player', + ON_PLAYER_SPAWN = 'on_player_spawn', } export enum TriggerConditionType { From 8cc259b744d06518394357406ddae536fd6fa15a Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 15:01:59 -0300 Subject: [PATCH 18/21] fix: Respawn pad - Add trigger on_player_spawn and a basic view --- .../smart_items/assets/respawn_pad/data.json | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/packs/smart_items/assets/respawn_pad/data.json b/packs/smart_items/assets/respawn_pad/data.json index e9232c6aa..4b29ad6de 100644 --- a/packs/smart_items/assets/respawn_pad/data.json +++ b/packs/smart_items/assets/respawn_pad/data.json @@ -32,6 +32,26 @@ "jsonPayload": "{ \"src\": \"{assetPath}/spawn.mp3\" }" } ] + }, + "asset-packs::Triggers": { + "value": [ + { + "type": "on_player_spawn", + "actions": [], + "basicViewId": "trigger-when-player-spawn" + } + ] + }, + "inspector::Config": { + "isBasicViewEnabled": true, + "componentName": "Respawn Pad", + "fields": [ + { + "name": "When Player Spawns Here", + "type": "asset-packs::Triggers", + "basicViewId": "trigger-when-player-spawn" + } + ] } } -} \ No newline at end of file +} From c95307d361f499dfa0c5829d024a66c1525ff372 Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 15:05:43 -0300 Subject: [PATCH 19/21] chore: Update gha test message --- .github/workflows/build-and-publish.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 2375829bb..47b46c7f0 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -62,6 +62,8 @@ jobs: # Test this pull request - The package can be tested by running ```bash - npm upgrade "${{ steps.url-generator.outputs.body }}" + npm i "${{ steps.url-generator.outputs.body }}" ``` + Remember, if new assets are added in the PR, they won't be avaliable on the CDN until it gets merged. + So this can be used to test changes on the `package's` JS or the `catalog.json`, but won't work to test newly added items. edit-mode: replace From 933fa06a7a4a5430875a85173e4fc2afd655819d Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 15:11:19 -0300 Subject: [PATCH 20/21] chore: Add quotation to test PR message --- .github/workflows/build-and-publish.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 47b46c7f0..9eeb3e60b 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -64,6 +64,5 @@ jobs: ```bash npm i "${{ steps.url-generator.outputs.body }}" ``` - Remember, if new assets are added in the PR, they won't be avaliable on the CDN until it gets merged. - So this can be used to test changes on the `package's` JS or the `catalog.json`, but won't work to test newly added items. + > Remember, if new assets are added in the PR, they won't be avaliable on the CDN until it gets merged. So this can be used to test changes on the `package's` JS or the `catalog.json`, but won't work to test newly added items. edit-mode: replace From 8f42cf0b85e2f588ff9fd4bff5516c77f47b80df Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Thu, 9 May 2024 16:06:02 -0300 Subject: [PATCH 21/21] fix: Health Bar - Remove triggers from basic view --- packs/smart_items/assets/health_bar/data.json | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/packs/smart_items/assets/health_bar/data.json b/packs/smart_items/assets/health_bar/data.json index 1dc67c734..0f3a9efed 100644 --- a/packs/smart_items/assets/health_bar/data.json +++ b/packs/smart_items/assets/health_bar/data.json @@ -78,7 +78,7 @@ "name": "Remove" } ], - "basicViewId": "trigger-when-health-reached-zero" + "basicViewId": "trigger-when-health-reaches-zero" } ] }, @@ -97,22 +97,12 @@ "fields": [ { "name": "Health Points", - "type": "asset-packs::CounterBar" + "type": "asset-packs::Counter" }, { - "name": "When Healed", + "name": "When Health Reaches Zero", "type": "asset-packs::Triggers", - "basicViewId": "trigger-when-healed" - }, - { - "name": "When Damaged", - "type": "asset-packs::Triggers", - "basicViewId": "trigger-when-damaged" - }, - { - "name": "When Health Reached Zero", - "type": "asset-packs::Triggers", - "basicViewId": "trigger-when-health-reached-zero" + "basicViewId": "trigger-when-health-reaches-zero" } ] }