diff --git a/src/starter/files/astraplus/contents/astraplus/items/glider.json b/src/starter/files/astraplus/contents/astraplus/items/glider.json index b1f55db..393f6fe 100644 --- a/src/starter/files/astraplus/contents/astraplus/items/glider.json +++ b/src/starter/files/astraplus/contents/astraplus/items/glider.json @@ -14,6 +14,14 @@ "hidden_components": ["minecraft:charged_projectiles"] } }, + "properties": { + "gliding": { + "type": "number", + "defaultValue": 0, + "min": 0, + "max": 1 + } + }, "display": { "ground": { "rotation": [0, 0, 0], @@ -60,34 +68,58 @@ "version": 1, "nodes": [ { "id": "flight_tick", "type": "event:owner_tick", "inputs": { "itemScope": "either_hand", "interval": 1 }, "x": 40, "y": 40 }, + { "id": "tick_sequence", "type": "flow:sequence", "inputs": {}, "x": 360, "y": 40 }, { "id": "vertical_speed", "type": "context:number", "inputs": { "path": "actor.velocity_y" }, "x": 40, "y": 240 }, - { "id": "descending", "type": "compare:lt", "inputs": { "b": 0 }, "x": 360, "y": 240 }, - { "id": "airborne", "type": "context:boolean", "inputs": { "path": "actor.airborne" }, "x": 360, "y": 420 }, - { "id": "can_glide", "type": "boolean:and", "inputs": {}, "x": 680, "y": 240 }, - { "id": "flight_gate", "type": "flow:branch", "inputs": {}, "x": 1000, "y": 40 }, - { "id": "owner", "type": "context:entity", "inputs": { "path": "actor.entity" }, "x": 1000, "y": 420 }, - { "id": "smooth_descent", "type": "action:glide", "inputs": { "gravity": 0, "lift": 0, "fallRecovery": 0.3, "fallToForward": 0.1, "climbConversion": 0.04, "climbLift": 3.2, "steering": 0.1, "horizontalDrag": 0.99, "verticalDrag": 0.98 }, "x": 1320, "y": 40 }, - { "id": "safe_landing", "type": "action:reset_fall_distance", "inputs": {}, "x": 1640, "y": 40 }, + { "id": "descending_fast", "type": "compare:lt", "inputs": { "b": -0.5 }, "x": 360, "y": 240 }, + { "id": "glide_state", "type": "state:get", "inputs": { "property": "gliding" }, "x": 40, "y": 420 }, + { "id": "was_gliding", "type": "compare:gte", "inputs": { "b": 1 }, "x": 360, "y": 420 }, + { "id": "start_or_active", "type": "boolean:or", "inputs": {}, "x": 680, "y": 300 }, + { "id": "airborne", "type": "context:boolean", "inputs": { "path": "actor.airborne" }, "x": 680, "y": 500 }, + { "id": "can_glide", "type": "boolean:and", "inputs": {}, "x": 1000, "y": 300 }, + { "id": "flight_gate", "type": "flow:branch", "inputs": {}, "x": 680, "y": 40 }, + { "id": "already_gliding_gate", "type": "flow:branch", "inputs": {}, "x": 1000, "y": 40 }, + { "id": "remember_glide", "type": "state:set", "inputs": { "property": "gliding", "value": 1 }, "x": 1320, "y": 180 }, + { "id": "owner", "type": "context:entity", "inputs": { "path": "actor.entity" }, "x": 1000, "y": 500 }, + { "id": "smooth_descent", "type": "action:glide", "inputs": { "gravity": 0, "lift": 0, "fallRecovery": 0.3, "fallToForward": 0.1, "climbConversion": 0.04, "climbLift": 3.2, "steering": 0.1, "horizontalDrag": 0.99, "verticalDrag": 0.98 }, "x": 1640, "y": 40 }, + { "id": "safe_landing", "type": "action:reset_fall_distance", "inputs": {}, "x": 1960, "y": 40 }, + { "id": "not_airborne", "type": "boolean:not", "inputs": {}, "x": 680, "y": 680 }, + { "id": "should_reset", "type": "boolean:and", "inputs": {}, "x": 1000, "y": 680 }, + { "id": "reset_glide_gate", "type": "flow:branch", "inputs": {}, "x": 680, "y": 820 }, + { "id": "clear_glide", "type": "state:set", "inputs": { "property": "gliding", "value": 0 }, "x": 1000, "y": 820 }, - { "id": "wear_tick", "type": "event:owner_tick", "inputs": { "itemScope": "either_hand", "interval": 20 }, "x": 40, "y": 650 }, - { "id": "wear_gate", "type": "flow:branch", "inputs": {}, "x": 1000, "y": 650 }, - { "id": "wear", "type": "action:item_damage", "inputs": { "slot": -1, "amount": 1 }, "x": 1320, "y": 650 }, + { "id": "wear_tick", "type": "event:owner_tick", "inputs": { "itemScope": "either_hand", "interval": 20 }, "x": 40, "y": 1040 }, + { "id": "wear_gate", "type": "flow:branch", "inputs": {}, "x": 1000, "y": 1040 }, + { "id": "wear", "type": "action:item_damage", "inputs": { "slot": -1, "amount": 1 }, "x": 1320, "y": 1040 }, - { "id": "use_air", "type": "event:use_in_air", "inputs": { "itemScope": "either_hand" }, "x": 40, "y": 900 }, - { "id": "use_block", "type": "event:use_on_block", "inputs": { "itemScope": "either_hand" }, "x": 40, "y": 1080 }, - { "id": "use_entity", "type": "event:use_entity", "inputs": { "itemScope": "either_hand" }, "x": 40, "y": 1260 }, - { "id": "cancel_crossbow", "type": "action:cancel", "inputs": {}, "x": 360, "y": 1080 } + { "id": "use_air", "type": "event:use_in_air", "inputs": { "itemScope": "either_hand" }, "x": 40, "y": 1280 }, + { "id": "use_block", "type": "event:use_on_block", "inputs": { "itemScope": "either_hand" }, "x": 40, "y": 1460 }, + { "id": "use_entity", "type": "event:use_entity", "inputs": { "itemScope": "either_hand" }, "x": 40, "y": 1640 }, + { "id": "cancel_crossbow", "type": "action:cancel", "inputs": {}, "x": 360, "y": 1460 } ], "edges": [ - { "from": { "node": "flight_tick", "port": "next" }, "to": { "node": "flight_gate", "port": "in" } }, - { "from": { "node": "vertical_speed", "port": "value" }, "to": { "node": "descending", "port": "a" } }, - { "from": { "node": "descending", "port": "value" }, "to": { "node": "can_glide", "port": "a" } }, + { "from": { "node": "flight_tick", "port": "next" }, "to": { "node": "tick_sequence", "port": "in" } }, + { "from": { "node": "tick_sequence", "port": "first" }, "to": { "node": "flight_gate", "port": "in" } }, + { "from": { "node": "vertical_speed", "port": "value" }, "to": { "node": "descending_fast", "port": "a" } }, + { "from": { "node": "descending_fast", "port": "value" }, "to": { "node": "start_or_active", "port": "a" } }, + { "from": { "node": "glide_state", "port": "value" }, "to": { "node": "was_gliding", "port": "a" } }, + { "from": { "node": "was_gliding", "port": "value" }, "to": { "node": "start_or_active", "port": "b" } }, + { "from": { "node": "start_or_active", "port": "value" }, "to": { "node": "can_glide", "port": "a" } }, { "from": { "node": "airborne", "port": "value" }, "to": { "node": "can_glide", "port": "b" } }, { "from": { "node": "can_glide", "port": "value" }, "to": { "node": "flight_gate", "port": "condition" } }, - { "from": { "node": "flight_gate", "port": "true" }, "to": { "node": "smooth_descent", "port": "in" } }, + { "from": { "node": "flight_gate", "port": "true" }, "to": { "node": "already_gliding_gate", "port": "in" } }, + { "from": { "node": "was_gliding", "port": "value" }, "to": { "node": "already_gliding_gate", "port": "condition" } }, + { "from": { "node": "already_gliding_gate", "port": "true" }, "to": { "node": "smooth_descent", "port": "in" } }, + { "from": { "node": "already_gliding_gate", "port": "false" }, "to": { "node": "remember_glide", "port": "in" } }, + { "from": { "node": "remember_glide", "port": "next" }, "to": { "node": "smooth_descent", "port": "in" } }, { "from": { "node": "owner", "port": "value" }, "to": { "node": "smooth_descent", "port": "entity" } }, { "from": { "node": "smooth_descent", "port": "next" }, "to": { "node": "safe_landing", "port": "in" } }, { "from": { "node": "owner", "port": "value" }, "to": { "node": "safe_landing", "port": "entity" } }, + { "from": { "node": "tick_sequence", "port": "next" }, "to": { "node": "reset_glide_gate", "port": "in" } }, + { "from": { "node": "airborne", "port": "value" }, "to": { "node": "not_airborne", "port": "value" } }, + { "from": { "node": "not_airborne", "port": "value" }, "to": { "node": "should_reset", "port": "a" } }, + { "from": { "node": "was_gliding", "port": "value" }, "to": { "node": "should_reset", "port": "b" } }, + { "from": { "node": "should_reset", "port": "value" }, "to": { "node": "reset_glide_gate", "port": "condition" } }, + { "from": { "node": "reset_glide_gate", "port": "true" }, "to": { "node": "clear_glide", "port": "in" } }, { "from": { "node": "wear_tick", "port": "next" }, "to": { "node": "wear_gate", "port": "in" } }, { "from": { "node": "can_glide", "port": "value" }, "to": { "node": "wear_gate", "port": "condition" } },