From 687dda4b0fe711ca44771aa529c601a332ddbb25 Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Mon, 6 May 2024 12:45:05 -0300 Subject: [PATCH] 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