Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add prop to actions #111

Merged
merged 21 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c8a2562
feat: Add prop to actions
cyaiox May 1, 2024
5808587
chore: Add gha to generate a package preview on PR
cyaiox May 2, 2024
712d360
fix: Remove unrequired env vars
cyaiox May 2, 2024
687dda4
feat: Add config component to the game smart items
cyaiox May 6, 2024
a1fc76d
fix: Prettier
cyaiox May 6, 2024
681fa7f
fix: Rename sword field Cooldown to Attack Cooldown
cyaiox May 9, 2024
289ebcb
fix: Enable sword basic view actions Pick Up and Start Cool Down Delay
cyaiox May 9, 2024
2094766
fix: Remove action field radius and triggers from spikes' basic view
cyaiox May 9, 2024
a419c0e
fix: Wooden Wall - Rename Decrease Counter action to Damage and creat…
cyaiox May 9, 2024
90c9a1a
fix: Healing Pad - Remove triggers from basic view
cyaiox May 9, 2024
86cfbda
fix: Sword - Rename Cooldown to Attack Cooldown
cyaiox May 9, 2024
4277439
fix: Barrel - Add remove action to basic view
cyaiox May 9, 2024
03a296c
fix: First Aid - Add remove action to basic view
cyaiox May 9, 2024
17ff1fe
fix: Barrel - Rename props
cyaiox May 9, 2024
d550a35
fix: Robot - Add Stop Following action and allow modify speed property
cyaiox May 9, 2024
62ef1ab
fix: First Aid - Remove on click trigger from basic view and modify h…
cyaiox May 9, 2024
f1d2b78
feat: Add on_player_spawn trigger
cyaiox May 9, 2024
8cc259b
fix: Respawn pad - Add trigger on_player_spawn and a basic view
cyaiox May 9, 2024
c95307d
chore: Update gha test message
cyaiox May 9, 2024
933fa06
chore: Add quotation to test PR message
cyaiox May 9, 2024
8f42cf0
fix: Health Bar - Remove triggers from basic view
cyaiox May 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
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 }}
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 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
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": true,
"tabWidth": 2,
"semi": false,
"printWidth": 80
}
23 changes: 19 additions & 4 deletions packs/smart_items/assets/barrel/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -28,19 +29,33 @@
{
"name": "Damage",
"type": "damage",
"jsonPayload": "{ \"radius\": 10, \"hits\": 30, \"layer\": \"all\" }"
"jsonPayload": "{ \"radius\": 10, \"hits\": 30, \"layer\": \"all\" }",
"basicViewId": "action-damage"
},
{
"name": "Remove",
"type": "remove_entity",
"jsonPayload": "{ }"
"jsonPayload": "{ }",
"allowedInBasicView": true
},
{
"name": "Delay Remove",
"type": "start_delay",
"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\", \"label\": \"Explosion Radius\" }, \"hits\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Explosion Damage\" }, \"layer\": { \"field\": \"Dropdown\", \"label\": \"Damage Target\" }}"
}
]
}
}
}
}
37 changes: 27 additions & 10 deletions packs/smart_items/assets/first_aid/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,48 @@
{
"name": "Heal Player",
"type": "heal_player",
"jsonPayload": "{ \"multiplier\": 100 }"
"jsonPayload": "{ \"multiplier\": 100 }",
"basicViewId": "action-heal-player"
},
{
"name": "Remove",
"type": "remove_entity",
"jsonPayload": "{ }"
"jsonPayload": "{ }",
"allowedInBasicView": true
},
{
"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",
"layout": "{\"multiplier\": { \"field\": \"TextField\", \"type\": \"number\", \"label\": \"Healing Points Amount\" } }"
}
]
}
}
}
}
34 changes: 29 additions & 5 deletions packs/smart_items/assets/healing_pad/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
},
Expand All @@ -49,7 +53,8 @@
"id": "{self:asset-packs::Actions}",
"name": "Play Heal Sound"
}
]
],
"basicViewId": "trigger-when-start-healing"
},
{
"type": "on_player_leaves_area",
Expand All @@ -58,7 +63,26 @@
"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 Amount\" } }"
},
{
"name": "Interval Healing",
"type": "asset-packs::Actions",
"basicViewId": "action-healing-interval",
"layout": "{\"interval\": { \"field\": \"RangeField\", \"label\": \"Healing Interval\", \"step\": \"0.1\" } }"
}
]
}
Expand Down
33 changes: 27 additions & 6 deletions packs/smart_items/assets/health_bar/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -47,7 +50,8 @@
"id": "{self:asset-packs::Actions}",
"name": "Damage"
}
]
],
"basicViewId": "trigger-when-damaged"
},
{
"type": "on_heal_player",
Expand All @@ -56,7 +60,8 @@
"id": "{self:asset-packs::Actions}",
"name": "Heal"
}
]
],
"basicViewId": "trigger-when-healed"
},
{
"type": "on_counter_change",
Expand All @@ -72,7 +77,8 @@
"id": "{self:asset-packs::Actions}",
"name": "Remove"
}
]
],
"basicViewId": "trigger-when-health-reaches-zero"
}
]
},
Expand All @@ -84,6 +90,21 @@
"maxValue": 100,
"primaryColor": "#00FF00",
"secondaryColor:": "#FF0000"
},
"inspector::Config": {
"isBasicViewEnabled": true,
"componentName": "Health Bar",
"fields": [
{
"name": "Health Points",
"type": "asset-packs::Counter"
},
{
"name": "When Health Reaches Zero",
"type": "asset-packs::Triggers",
"basicViewId": "trigger-when-health-reaches-zero"
}
]
}
}
}
25 changes: 23 additions & 2 deletions packs/smart_items/assets/respawn_pad/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -31,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"
}
]
}
}
}
}
Loading
Loading