Skip to content

Commit

Permalink
feat: Add config component to the game smart items
Browse files Browse the repository at this point in the history
  • Loading branch information
cyaiox committed May 6, 2024
1 parent 712d360 commit 687dda4
Show file tree
Hide file tree
Showing 9 changed files with 226 additions and 34 deletions.
18 changes: 16 additions & 2 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,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",
Expand All @@ -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\" }}"
}
]
}
}
}
36 changes: 28 additions & 8 deletions packs/smart_items/assets/first_aid/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
Expand Down
44 changes: 39 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,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"
}
]
}
Expand Down
43 changes: 37 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-reached-zero"
}
]
},
Expand All @@ -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"
}
]
}
}
}
3 changes: 2 additions & 1 deletion 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 Down
22 changes: 19 additions & 3 deletions packs/smart_items/assets/robot/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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\" }}"
}
]
}
}
}
44 changes: 39 additions & 5 deletions packs/smart_items/assets/spikes/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -50,7 +54,8 @@
"id": "{self:asset-packs::Actions}",
"name": "Start Damage"
}
]
],
"basicViewId": "trigger-when-start-damaing"
},
{
"type": "on_player_leaves_area",
Expand All @@ -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"
}
]
}
Expand Down
Loading

0 comments on commit 687dda4

Please sign in to comment.