feat(stage): complete phase 20b action plans
This commit is contained in:
@@ -14,6 +14,7 @@ You are a Godot 4 / GDScript 2.0 implementation developer. Adhere to coding stan
|
|||||||
- **Static Typing:** Enforce explicit type hints for all signatures and variables.
|
- **Static Typing:** Enforce explicit type hints for all signatures and variables.
|
||||||
- **Decoupling:** Follow "call down, signal up".
|
- **Decoupling:** Follow "call down, signal up".
|
||||||
- **Validation:** Resolve the Godot 4.7.1 binary for the current platform using `AGENTS.md`. Run syntax/import checks, relevant existing suites, and focused automated tests of the feature's observable outcomes. For runtime interactions, exercise a minimal scene or fixture through the real production path, advance frames or physics ticks, and assert the result. Fix failures and rerun the affected checks. Inspect rendered output when available; state clearly when visual behavior could not be checked.
|
- **Validation:** Resolve the Godot 4.7.1 binary for the current platform using `AGENTS.md`. Run syntax/import checks, relevant existing suites, and focused automated tests of the feature's observable outcomes. For runtime interactions, exercise a minimal scene or fixture through the real production path, advance frames or physics ticks, and assert the result. Fix failures and rerun the affected checks. Inspect rendered output when available; state clearly when visual behavior could not be checked.
|
||||||
|
- **Windows visual verification:** The Windows screenshot service repeatedly times out on Project Manager/Godot windows. Do not retry it; use a focused Godot GUI run or harness that saves a viewport PNG, inspect the saved image locally, and assert the relevant interactions in the same focused verification workflow.
|
||||||
|
|
||||||
## Output Format
|
## Output Format
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ model_reasoning_effort = "high"
|
|||||||
sandbox_mode = "read-only"
|
sandbox_mode = "read-only"
|
||||||
|
|
||||||
developer_instructions = """
|
developer_instructions = """
|
||||||
|
## Windows UI visual checks
|
||||||
|
|
||||||
|
The Windows screenshot service repeatedly times out when capturing Project Manager/Godot windows. Do not rely on or retry its live-window feed. When a visual implementation check is needed, direct the developer to run a focused Godot scene or harness that saves a viewport PNG and inspect that local image; pair it with interaction checks for the relevant controls.
|
||||||
|
|
||||||
## Worktree choice
|
## Worktree choice
|
||||||
|
|
||||||
You are read-only and must not create worktrees or write project files. For any handoff that will create project files, confirm that the orchestrator has asked the user whether to use a worktree and supplied the selected project path and branch. Do not require a worktree when the user chooses the current checkout.
|
You are read-only and must not create worktrees or write project files. For any handoff that will create project files, confirm that the orchestrator has asked the user whether to use a worktree and supplied the selected project path and branch. Do not require a worktree when the user chooses the current checkout.
|
||||||
|
|||||||
@@ -46,6 +46,11 @@
|
|||||||
- A load failure shows a "Could Not Load Scene" dialog and falls back to a blank scene.
|
- A load failure shows a "Could Not Load Scene" dialog and falls back to a blank scene.
|
||||||
- **Richer debug logs:** append `--verbose` to the scene-playback (or headless) command to surface engine warnings/errors alongside your own `print()` lines.
|
- **Richer debug logs:** append `--verbose` to the scene-playback (or headless) command to surface engine warnings/errors alongside your own `print()` lines.
|
||||||
|
|
||||||
|
## Visual verification on Windows
|
||||||
|
|
||||||
|
- The Windows screenshot service repeatedly times out when capturing the Project Manager or Godot windows. Do not retry or depend on its live-window feed.
|
||||||
|
- For visual UI verification, run a focused Godot scene or test harness that exercises the relevant controls and saves a viewport PNG, then inspect that image locally. Keep interaction assertions in the focused run as well; use headless runs for behavior that does not need rendered output.
|
||||||
|
|
||||||
## Project overview
|
## Project overview
|
||||||
|
|
||||||
Stickman Studio is a kid-friendly 2D scene-building and directing project—not only a
|
Stickman Studio is a kid-friendly 2D scene-building and directing project—not only a
|
||||||
|
|||||||
@@ -0,0 +1,293 @@
|
|||||||
|
{
|
||||||
|
"version": "1.9",
|
||||||
|
"scene_name": "Phase 20b - Moving Prop Chase",
|
||||||
|
"sky_id": "sky_neutral",
|
||||||
|
"background_kind": "sky",
|
||||||
|
"plain_color": "#F5EFE0",
|
||||||
|
"camera": {
|
||||||
|
"position": {
|
||||||
|
"y": -240.0,
|
||||||
|
"x": -180.0
|
||||||
|
},
|
||||||
|
"zoom": 0.55
|
||||||
|
},
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"file_id": "terrain_1",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -960.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_2",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -768.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_3",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -576.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_4",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -384.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_5",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -192.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_6",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 0.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_7",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 192.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_8",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 384.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_9",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 576.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_10",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 768.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_11",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 960.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "stickman_1",
|
||||||
|
"type": "stickman",
|
||||||
|
"position": {
|
||||||
|
"y": -225.0,
|
||||||
|
"x": -700.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"stk_path": "res://content/stickmen/break.stk",
|
||||||
|
"stage_object_id": "stage_phase20b_test2_chaser",
|
||||||
|
"stage_name": "Chaser",
|
||||||
|
"facing_profile": "FORWARD",
|
||||||
|
"action_plan": [
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "wait",
|
||||||
|
"action_id": "action_phase20b_test2_wait",
|
||||||
|
"duration": 1.0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"action_id": "action_phase20b_test2_pursue",
|
||||||
|
"type": "move_to",
|
||||||
|
"style": "run",
|
||||||
|
"destination": {
|
||||||
|
"kind": "prop",
|
||||||
|
"last_known_approach": {
|
||||||
|
"y": -215.0,
|
||||||
|
"x": -30.0
|
||||||
|
},
|
||||||
|
"target_prop_id": "stage_phase20b_test2_baseball",
|
||||||
|
"approach_offset": {
|
||||||
|
"y": 0.0,
|
||||||
|
"x": -80.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "prop_ramp",
|
||||||
|
"type": "prop",
|
||||||
|
"position": {
|
||||||
|
"y": -38.0,
|
||||||
|
"x": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 30.0,
|
||||||
|
"asset_id": "res://content/props/prop_coffee_table-v1.prop",
|
||||||
|
"stage_object_id": "stage_phase20b_test2_ramp",
|
||||||
|
"stage_name": "Tilted Ramp",
|
||||||
|
"roles": {
|
||||||
|
"depth": "behind",
|
||||||
|
"start_motion": "still",
|
||||||
|
"holds_other_props": true,
|
||||||
|
"blocks_stickmen": false,
|
||||||
|
"can_pick_up": false,
|
||||||
|
"released_blocks_stickmen": true,
|
||||||
|
"released_bumps_other_props": true,
|
||||||
|
"legacy_draw_order": false
|
||||||
|
},
|
||||||
|
"use_spots": [],
|
||||||
|
"next_use_spot_number": 1,
|
||||||
|
"wobble_on_impact": false,
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"material_preset": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "prop_rolling_baseball",
|
||||||
|
"type": "prop",
|
||||||
|
"position": {
|
||||||
|
"y": -215.0,
|
||||||
|
"x": 50.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "res://content/props/baseball.prop",
|
||||||
|
"stage_object_id": "stage_phase20b_test2_baseball",
|
||||||
|
"stage_name": "Rolling Baseball",
|
||||||
|
"roles": {
|
||||||
|
"depth": "behind",
|
||||||
|
"start_motion": "physics",
|
||||||
|
"holds_other_props": false,
|
||||||
|
"blocks_stickmen": false,
|
||||||
|
"can_pick_up": true,
|
||||||
|
"released_blocks_stickmen": true,
|
||||||
|
"released_bumps_other_props": true,
|
||||||
|
"legacy_draw_order": false
|
||||||
|
},
|
||||||
|
"use_spots": [],
|
||||||
|
"next_use_spot_number": 1,
|
||||||
|
"wobble_on_impact": false,
|
||||||
|
"scale": {
|
||||||
|
"x": 0.99999862909317,
|
||||||
|
"y": 0.99999862909317
|
||||||
|
},
|
||||||
|
"material_preset": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"event_rules": [],
|
||||||
|
"metadata": {
|
||||||
|
"created_unix": 1793685806,
|
||||||
|
"source_path": "",
|
||||||
|
"autosave": false,
|
||||||
|
"modified_unix": 1793686116
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,884 @@
|
|||||||
|
{
|
||||||
|
"version": "1.9",
|
||||||
|
"scene_name": "Phase 20b - Timeout and Missing Target",
|
||||||
|
"sky_id": "sky_neutral",
|
||||||
|
"background_kind": "sky",
|
||||||
|
"plain_color": "#F5EFE0",
|
||||||
|
"camera": {
|
||||||
|
"zoom": 0.15,
|
||||||
|
"position": {
|
||||||
|
"x": -2800.0,
|
||||||
|
"y": -240.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"file_id": "terrain_1",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -7680.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_2",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -7488.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_3",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -7296.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_4",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -7104.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_5",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -6912.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_6",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -6720.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_7",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -6528.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_8",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -6336.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_9",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -6144.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_10",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -5952.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_11",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -5760.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_12",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -5568.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_13",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -5376.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_14",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -5184.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_15",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -4992.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_16",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -4800.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_17",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -4608.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_18",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -4416.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_19",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -4224.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_20",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -4032.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_21",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -3840.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_22",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -3648.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_23",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -3456.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_24",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -3264.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_25",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -3072.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_26",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -2880.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_27",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -2688.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_28",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -2496.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_29",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -2304.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_30",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -2112.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_31",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -1920.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_32",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -1728.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_33",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -1536.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_34",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -1344.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_35",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -1152.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_36",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -960.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_37",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -768.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_38",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -576.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_39",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -384.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_40",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -192.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_41",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_42",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 192.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_43",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 384.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_44",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 576.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_45",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 768.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_46",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 960.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_47",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 1152.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_48",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 1344.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_49",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 1536.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_50",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 1728.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_51",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 1920.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "stickman_timeout_test",
|
||||||
|
"type": "stickman",
|
||||||
|
"position": {
|
||||||
|
"x": -6000.0,
|
||||||
|
"y": -225.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"stk_path": "res://content/stickmen/break.stk",
|
||||||
|
"stage_object_id": "stage_phase20b_test3_chaser",
|
||||||
|
"stage_name": "Chaser",
|
||||||
|
"facing_profile": "FORWARD",
|
||||||
|
"action_plan": [
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"action_id": "action_phase20b_test3_chase",
|
||||||
|
"type": "move_to",
|
||||||
|
"destination": {
|
||||||
|
"target_prop_id": "stage_phase20b_test3_target",
|
||||||
|
"last_known_approach": {
|
||||||
|
"x": -30.0,
|
||||||
|
"y": -215.0
|
||||||
|
},
|
||||||
|
"kind": "prop",
|
||||||
|
"approach_offset": {
|
||||||
|
"x": -80.0,
|
||||||
|
"y": 0.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"style": "run"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "prop_ramp",
|
||||||
|
"type": "prop",
|
||||||
|
"position": {
|
||||||
|
"x": 160.0,
|
||||||
|
"y": -38.0
|
||||||
|
},
|
||||||
|
"rotation": 30.0,
|
||||||
|
"asset_id": "res://content/props/prop_coffee_table-v1.prop",
|
||||||
|
"stage_object_id": "stage_phase20b_test3_ramp",
|
||||||
|
"stage_name": "Rolling Ramp",
|
||||||
|
"roles": {
|
||||||
|
"depth": "behind",
|
||||||
|
"start_motion": "still",
|
||||||
|
"holds_other_props": true,
|
||||||
|
"blocks_stickmen": false,
|
||||||
|
"can_pick_up": false,
|
||||||
|
"released_blocks_stickmen": true,
|
||||||
|
"released_bumps_other_props": true,
|
||||||
|
"legacy_draw_order": false
|
||||||
|
},
|
||||||
|
"use_spots": [],
|
||||||
|
"next_use_spot_number": 1,
|
||||||
|
"wobble_on_impact": false,
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"material_preset": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "prop_timeout_target",
|
||||||
|
"type": "prop",
|
||||||
|
"position": {
|
||||||
|
"x": 50.0,
|
||||||
|
"y": -215.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "res://content/props/baseball.prop",
|
||||||
|
"stage_object_id": "stage_phase20b_test3_target",
|
||||||
|
"stage_name": "Target Ball",
|
||||||
|
"roles": {
|
||||||
|
"depth": "behind",
|
||||||
|
"start_motion": "physics",
|
||||||
|
"holds_other_props": false,
|
||||||
|
"blocks_stickmen": false,
|
||||||
|
"can_pick_up": true,
|
||||||
|
"released_blocks_stickmen": true,
|
||||||
|
"released_bumps_other_props": true,
|
||||||
|
"legacy_draw_order": false
|
||||||
|
},
|
||||||
|
"use_spots": [],
|
||||||
|
"next_use_spot_number": 1,
|
||||||
|
"wobble_on_impact": false,
|
||||||
|
"scale": {
|
||||||
|
"x": 0.99999862909317,
|
||||||
|
"y": 0.99999862909317
|
||||||
|
},
|
||||||
|
"material_preset": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"event_rules": [],
|
||||||
|
"metadata": {
|
||||||
|
"autosave": false,
|
||||||
|
"source_path": "",
|
||||||
|
"modified_unix": 1793757248,
|
||||||
|
"created_unix": 1793757048
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,413 @@
|
|||||||
|
{
|
||||||
|
"version": "1.9",
|
||||||
|
"scene_name": "Phase 20b - Pause During Pursuit",
|
||||||
|
"sky_id": "sky_neutral",
|
||||||
|
"background_kind": "sky",
|
||||||
|
"plain_color": "#F5EFE0",
|
||||||
|
"camera": {
|
||||||
|
"position": {
|
||||||
|
"x": -650.0,
|
||||||
|
"y": -240.0
|
||||||
|
},
|
||||||
|
"zoom": 0.42
|
||||||
|
},
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"file_id": "terrain_1",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -1920
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_2",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -1728
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_3",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -1536
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_4",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -1344
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_5",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -1152
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_6",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -960
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_7",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -768
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_8",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -576
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_9",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -384
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_10",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -192
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_11",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_12",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 192
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_13",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 384
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_14",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 576
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_15",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 768
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_16",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 960
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_17",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 1152
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_18",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 1344
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_19",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 1536
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "stickman_test4_walker",
|
||||||
|
"type": "stickman",
|
||||||
|
"position": {
|
||||||
|
"x": -1300.0,
|
||||||
|
"y": -225.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"stk_path": "res://content/stickmen/break.stk",
|
||||||
|
"stage_object_id": "stage_phase20b_test4_walker",
|
||||||
|
"stage_name": "Walker",
|
||||||
|
"facing_profile": "FORWARD",
|
||||||
|
"action_plan": [
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "wait",
|
||||||
|
"duration": 0.5,
|
||||||
|
"action_id": "action_phase20b_test4_wait"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "move_to",
|
||||||
|
"style": "run",
|
||||||
|
"destination": {
|
||||||
|
"kind": "prop",
|
||||||
|
"target_prop_id": "stage_phase20b_test4_ball",
|
||||||
|
"approach_offset": {
|
||||||
|
"x": -80.0,
|
||||||
|
"y": 0.0
|
||||||
|
},
|
||||||
|
"last_known_approach": {
|
||||||
|
"x": -30.0,
|
||||||
|
"y": -215.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"action_id": "action_phase20b_test4_pursue"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "prop_test4_ramp",
|
||||||
|
"type": "prop",
|
||||||
|
"position": {
|
||||||
|
"x": 160.0,
|
||||||
|
"y": -38.0
|
||||||
|
},
|
||||||
|
"rotation": 30.0,
|
||||||
|
"asset_id": "res://content/props/prop_coffee_table-v1.prop",
|
||||||
|
"stage_object_id": "stage_phase20b_test4_ramp",
|
||||||
|
"stage_name": "Tilted Ramp",
|
||||||
|
"roles": {
|
||||||
|
"depth": "behind",
|
||||||
|
"start_motion": "still",
|
||||||
|
"holds_other_props": true,
|
||||||
|
"blocks_stickmen": false,
|
||||||
|
"can_pick_up": false,
|
||||||
|
"released_blocks_stickmen": true,
|
||||||
|
"released_bumps_other_props": true,
|
||||||
|
"legacy_draw_order": false
|
||||||
|
},
|
||||||
|
"use_spots": [],
|
||||||
|
"next_use_spot_number": 1,
|
||||||
|
"wobble_on_impact": false,
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"material_preset": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "prop_test4_ball",
|
||||||
|
"type": "prop",
|
||||||
|
"position": {
|
||||||
|
"x": 50.0,
|
||||||
|
"y": -215.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "res://content/props/baseball.prop",
|
||||||
|
"stage_object_id": "stage_phase20b_test4_ball",
|
||||||
|
"stage_name": "Rolling Ball",
|
||||||
|
"roles": {
|
||||||
|
"depth": "behind",
|
||||||
|
"start_motion": "physics",
|
||||||
|
"holds_other_props": false,
|
||||||
|
"blocks_stickmen": false,
|
||||||
|
"can_pick_up": true,
|
||||||
|
"released_blocks_stickmen": true,
|
||||||
|
"released_bumps_other_props": true,
|
||||||
|
"legacy_draw_order": false
|
||||||
|
},
|
||||||
|
"use_spots": [],
|
||||||
|
"next_use_spot_number": 1,
|
||||||
|
"wobble_on_impact": false,
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"material_preset": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"event_rules": [],
|
||||||
|
"metadata": {
|
||||||
|
"created_unix": 1793765197,
|
||||||
|
"source_path": "",
|
||||||
|
"autosave": false,
|
||||||
|
"modified_unix": 1793765197
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,270 @@
|
|||||||
|
{
|
||||||
|
"version": "1.9",
|
||||||
|
"scene_name": "Phase 20b - Target Identity and Repair",
|
||||||
|
"sky_id": "sky_neutral",
|
||||||
|
"background_kind": "sky",
|
||||||
|
"plain_color": "#F5EFE0",
|
||||||
|
"camera": {
|
||||||
|
"position": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": -240.0
|
||||||
|
},
|
||||||
|
"zoom": 0.519999980926514
|
||||||
|
},
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"file_id": "terrain_1",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -960.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_2",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -768.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_3",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -576.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_4",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -384.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_5",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -192.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_6",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_7",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 192.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_8",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 384.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_9",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 576.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_10",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 768.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_11",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 960.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "stickman_1",
|
||||||
|
"type": "stickman",
|
||||||
|
"position": {
|
||||||
|
"x": -620.0,
|
||||||
|
"y": -225.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"stk_path": "res://content/stickmen/break.stk",
|
||||||
|
"stage_object_id": "stage_phase20b_test5_walker",
|
||||||
|
"stage_name": "Walker",
|
||||||
|
"facing_profile": "FORWARD",
|
||||||
|
"action_plan": [
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "move_to",
|
||||||
|
"style": "walk",
|
||||||
|
"destination": {
|
||||||
|
"kind": "prop",
|
||||||
|
"target_prop_id": "stage_phase20b_test5_briefcase",
|
||||||
|
"approach_offset": {
|
||||||
|
"x": -40.0,
|
||||||
|
"y": 0.0
|
||||||
|
},
|
||||||
|
"last_known_approach": {
|
||||||
|
"x": 220.0,
|
||||||
|
"y": -225.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"action_id": "action_phase20b_test5_move_to_prop"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "move_to",
|
||||||
|
"style": "walk",
|
||||||
|
"destination": {
|
||||||
|
"kind": "place",
|
||||||
|
"position": {
|
||||||
|
"x": 360.0,
|
||||||
|
"y": -225.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"action_id": "action_phase20b_test5_free_place"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "prop_1",
|
||||||
|
"type": "prop",
|
||||||
|
"position": {
|
||||||
|
"x": 260.0,
|
||||||
|
"y": 64.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "res://content/props/briefcase.prop",
|
||||||
|
"stage_object_id": "stage_phase20b_test5_briefcase",
|
||||||
|
"stage_name": "Named Briefcase",
|
||||||
|
"roles": {
|
||||||
|
"depth": "behind",
|
||||||
|
"start_motion": "still",
|
||||||
|
"holds_other_props": false,
|
||||||
|
"blocks_stickmen": false,
|
||||||
|
"can_pick_up": true,
|
||||||
|
"released_blocks_stickmen": true,
|
||||||
|
"released_bumps_other_props": true,
|
||||||
|
"legacy_draw_order": false
|
||||||
|
},
|
||||||
|
"use_spots": [],
|
||||||
|
"next_use_spot_number": 1,
|
||||||
|
"wobble_on_impact": false,
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"material_preset": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"event_rules": [],
|
||||||
|
"metadata": {
|
||||||
|
"created_unix": 1793765197,
|
||||||
|
"modified_unix": 1793765903.57,
|
||||||
|
"autosave": false,
|
||||||
|
"source_path": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,262 @@
|
|||||||
|
{
|
||||||
|
"version": "1.9",
|
||||||
|
"scene_name": "Phase 20b - DIRECT Editing and Focus",
|
||||||
|
"sky_id": "sky_neutral",
|
||||||
|
"background_kind": "sky",
|
||||||
|
"plain_color": "#F5EFE0",
|
||||||
|
"camera": {
|
||||||
|
"position": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": -240.0
|
||||||
|
},
|
||||||
|
"zoom": 0.52
|
||||||
|
},
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"file_id": "terrain_1",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -960
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_2",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -768
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_3",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -576
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_4",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -384
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_5",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -192
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_6",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_7",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 192
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_8",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 384
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_9",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 576
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_10",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 768
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_11",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 960
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "stickman_test6_direct",
|
||||||
|
"type": "stickman",
|
||||||
|
"position": {
|
||||||
|
"x": -500.0,
|
||||||
|
"y": -225.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"stk_path": "res://content/stickmen/break.stk",
|
||||||
|
"stage_object_id": "stage_phase20b_test6_direct",
|
||||||
|
"stage_name": "Director",
|
||||||
|
"facing_profile": "FORWARD",
|
||||||
|
"action_plan": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "prop_test6_table",
|
||||||
|
"type": "prop",
|
||||||
|
"position": {
|
||||||
|
"x": 320.0,
|
||||||
|
"y": 32.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "res://content/props/prop_coffee_table-v1.prop",
|
||||||
|
"stage_object_id": "stage_phase20b_test6_table",
|
||||||
|
"stage_name": "Coffee Table",
|
||||||
|
"roles": {
|
||||||
|
"depth": "behind",
|
||||||
|
"start_motion": "still",
|
||||||
|
"holds_other_props": true,
|
||||||
|
"blocks_stickmen": false,
|
||||||
|
"can_pick_up": false,
|
||||||
|
"released_blocks_stickmen": true,
|
||||||
|
"released_bumps_other_props": true,
|
||||||
|
"legacy_draw_order": false
|
||||||
|
},
|
||||||
|
"use_spots": [],
|
||||||
|
"next_use_spot_number": 1,
|
||||||
|
"wobble_on_impact": false,
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"material_preset": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "prop_test6_case",
|
||||||
|
"type": "prop",
|
||||||
|
"position": {
|
||||||
|
"x": 560.0,
|
||||||
|
"y": 64.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "res://content/props/briefcase.prop",
|
||||||
|
"stage_object_id": "stage_phase20b_test6_case",
|
||||||
|
"stage_name": "Briefcase",
|
||||||
|
"roles": {
|
||||||
|
"depth": "behind",
|
||||||
|
"start_motion": "still",
|
||||||
|
"holds_other_props": false,
|
||||||
|
"blocks_stickmen": false,
|
||||||
|
"can_pick_up": true,
|
||||||
|
"released_blocks_stickmen": true,
|
||||||
|
"released_bumps_other_props": true,
|
||||||
|
"legacy_draw_order": false
|
||||||
|
},
|
||||||
|
"use_spots": [],
|
||||||
|
"next_use_spot_number": 1,
|
||||||
|
"wobble_on_impact": false,
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"material_preset": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"event_rules": [],
|
||||||
|
"metadata": {
|
||||||
|
"created_unix": 1793765197,
|
||||||
|
"source_path": "",
|
||||||
|
"autosave": false,
|
||||||
|
"modified_unix": 1793765197
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,285 @@
|
|||||||
|
{
|
||||||
|
"version": "1.9",
|
||||||
|
"scene_name": "Phase 20b - Target Picking and Cancel",
|
||||||
|
"sky_id": "sky_neutral",
|
||||||
|
"background_kind": "sky",
|
||||||
|
"plain_color": "#F5EFE0",
|
||||||
|
"camera": {
|
||||||
|
"position": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": -240.0
|
||||||
|
},
|
||||||
|
"zoom": 0.52
|
||||||
|
},
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"file_id": "terrain_1",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -960
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_2",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -768
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_3",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -576
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_4",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -384
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_5",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": -192
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_6",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_7",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 192
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_8",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 384
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_9",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 576
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_10",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 768
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_11",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"y": 160.0,
|
||||||
|
"x": 960
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "stickman_test7_capture",
|
||||||
|
"type": "stickman",
|
||||||
|
"position": {
|
||||||
|
"x": -520.0,
|
||||||
|
"y": -225.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"stk_path": "res://content/stickmen/break.stk",
|
||||||
|
"stage_object_id": "stage_phase20b_test7_capture",
|
||||||
|
"stage_name": "Director",
|
||||||
|
"facing_profile": "FORWARD",
|
||||||
|
"action_plan": [
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "pick_up_prop",
|
||||||
|
"target_prop_id": "stage_phase20b_test7_case",
|
||||||
|
"hand": "auto",
|
||||||
|
"action_id": "action_phase20b_test7_pickup"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "set_down_prop",
|
||||||
|
"target_position": {
|
||||||
|
"x": 320.0,
|
||||||
|
"y": -256.0
|
||||||
|
},
|
||||||
|
"action_id": "action_phase20b_test7_setdown"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "prop_test7_case",
|
||||||
|
"type": "prop",
|
||||||
|
"position": {
|
||||||
|
"x": -220.0,
|
||||||
|
"y": 64.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "res://content/props/briefcase.prop",
|
||||||
|
"stage_object_id": "stage_phase20b_test7_case",
|
||||||
|
"stage_name": "Briefcase",
|
||||||
|
"roles": {
|
||||||
|
"depth": "behind",
|
||||||
|
"start_motion": "still",
|
||||||
|
"holds_other_props": false,
|
||||||
|
"blocks_stickmen": false,
|
||||||
|
"can_pick_up": true,
|
||||||
|
"released_blocks_stickmen": true,
|
||||||
|
"released_bumps_other_props": true,
|
||||||
|
"legacy_draw_order": false
|
||||||
|
},
|
||||||
|
"use_spots": [],
|
||||||
|
"next_use_spot_number": 1,
|
||||||
|
"wobble_on_impact": false,
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"material_preset": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "prop_test7_table",
|
||||||
|
"type": "prop",
|
||||||
|
"position": {
|
||||||
|
"x": 320.0,
|
||||||
|
"y": 32.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "res://content/props/prop_coffee_table-v1.prop",
|
||||||
|
"stage_object_id": "stage_phase20b_test7_table",
|
||||||
|
"stage_name": "Coffee Table",
|
||||||
|
"roles": {
|
||||||
|
"depth": "behind",
|
||||||
|
"start_motion": "still",
|
||||||
|
"holds_other_props": true,
|
||||||
|
"blocks_stickmen": false,
|
||||||
|
"can_pick_up": false,
|
||||||
|
"released_blocks_stickmen": true,
|
||||||
|
"released_bumps_other_props": true,
|
||||||
|
"legacy_draw_order": false
|
||||||
|
},
|
||||||
|
"use_spots": [],
|
||||||
|
"next_use_spot_number": 1,
|
||||||
|
"wobble_on_impact": false,
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"material_preset": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"event_rules": [],
|
||||||
|
"metadata": {
|
||||||
|
"created_unix": 1793765197,
|
||||||
|
"source_path": "",
|
||||||
|
"autosave": false,
|
||||||
|
"modified_unix": 1793765197
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,206 @@
|
|||||||
|
{
|
||||||
|
"version": "1.9",
|
||||||
|
"scene_name": "Phase 20b - Together Timing",
|
||||||
|
"sky_id": "sky_neutral",
|
||||||
|
"background_kind": "sky",
|
||||||
|
"plain_color": "#F5EFE0",
|
||||||
|
"camera": {
|
||||||
|
"position": {
|
||||||
|
"x": -300.0,
|
||||||
|
"y": -240.0
|
||||||
|
},
|
||||||
|
"zoom": 0.55
|
||||||
|
},
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"file_id": "terrain_1",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -768.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_2",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -576.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_3",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -384.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_4",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": -192.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_5",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_6",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 192.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_7",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 384.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_8",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 576.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "terrain_9",
|
||||||
|
"type": "terrain",
|
||||||
|
"position": {
|
||||||
|
"x": 768.0,
|
||||||
|
"y": 160.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"asset_id": "ground",
|
||||||
|
"scale": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 1.0
|
||||||
|
},
|
||||||
|
"finish_id": "finish_ground_grass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file_id": "stickman_timing_test",
|
||||||
|
"type": "stickman",
|
||||||
|
"position": {
|
||||||
|
"x": -400.0,
|
||||||
|
"y": -225.0
|
||||||
|
},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"stk_path": "res://content/stickmen/break.stk",
|
||||||
|
"stage_object_id": "stage_phase20b_test3_walker",
|
||||||
|
"stage_name": "Walker",
|
||||||
|
"facing_profile": "FORWARD",
|
||||||
|
"action_plan": [
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"destination": {
|
||||||
|
"kind": "place",
|
||||||
|
"position": {
|
||||||
|
"x": -220.0,
|
||||||
|
"y": -225.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"action_id": "action_phase20b_test3_walk",
|
||||||
|
"type": "move_to",
|
||||||
|
"style": "walk"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "speak",
|
||||||
|
"text": "I am walking and talking!",
|
||||||
|
"stop_current": false,
|
||||||
|
"action_id": "action_phase20b_test3_say",
|
||||||
|
"duration": 3.0,
|
||||||
|
"keep_acting": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"action_id": "action_phase20b_test3_wait",
|
||||||
|
"type": "wait",
|
||||||
|
"duration": 0.5
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"event_rules": [],
|
||||||
|
"metadata": {
|
||||||
|
"source_path": "",
|
||||||
|
"created_unix": 1793745212,
|
||||||
|
"autosave": false,
|
||||||
|
"modified_unix": 1793745212
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -92,6 +92,10 @@ This document tracks known technical debt, optimization opportunities, and minor
|
|||||||
| 80 | **Stickman panel nodes currently own both document shapes and local view state** — rebuilding a panel for a focused layout would reset selection, zoom, and pan and risk save/preview drift. | Medium | Spec prepared; implementation pending | Move the same ten BodyPartPanel instances between Overview and Focus hosts, retain one permanent WholeStickmanPreview sibling, and defer switching while a drag or popup is active. The controller owns session-only view choice and active part; manually chosen views survive resize, and narrow Overview remains scrollable. A future document-model extraction is warranted only if new editor features make live-node ownership limiting. See `docs/specs/editor_visual_harmonization.md`. (2026-10-23) |
|
| 80 | **Stickman panel nodes currently own both document shapes and local view state** — rebuilding a panel for a focused layout would reset selection, zoom, and pan and risk save/preview drift. | Medium | Spec prepared; implementation pending | Move the same ten BodyPartPanel instances between Overview and Focus hosts, retain one permanent WholeStickmanPreview sibling, and defer switching while a drag or popup is active. The controller owns session-only view choice and active part; manually chosen views survive resize, and narrow Overview remains scrollable. A future document-model extraction is warranted only if new editor features make live-node ownership limiting. See `docs/specs/editor_visual_harmonization.md`. (2026-10-23) |
|
||||||
| 81 | **Stickman authored transforms lack a complete dirty-state boundary** — preview translation emits `part_moved`, while rotation and scale currently have no commit signal; Save/Load/Clear do not track unsaved work. | Medium | Spec prepared; implementation pending | Add a controller-observable transform commit path for position, rotation, and scale, plus `_dirty`/`_current_path` and Save/Discard Changes/Cancel transactions for replacement and close. Keep Overview/Focus, guide, grid, selection, and zoom/pan as session UI state that never marks dirty. Preserve the `.stk` format. See `docs/specs/editor_visual_harmonization.md`. (2026-10-23) |
|
| 81 | **Stickman authored transforms lack a complete dirty-state boundary** — preview translation emits `part_moved`, while rotation and scale currently have no commit signal; Save/Load/Clear do not track unsaved work. | Medium | Spec prepared; implementation pending | Add a controller-observable transform commit path for position, rotation, and scale, plus `_dirty`/`_current_path` and Save/Discard Changes/Cancel transactions for replacement and close. Keep Overview/Focus, guide, grid, selection, and zoom/pan as session UI state that never marks dirty. Preserve the `.stk` format. See `docs/specs/editor_visual_harmonization.md`. (2026-10-23) |
|
||||||
| 82 | **Phase 20a introduces persistent stage identity alongside temporary save IDs** — props already use persistent `stage_object_id`, while stickmen currently depend on runtime instance IDs and each save regenerates `file_id` by World order. | Medium | Spec prepared; implementation pending | Keep `file_id` for the current rule remap, retain existing prop IDs, and add a persistent character ID plus scene-unique display names independent of assets. Migrate legacy character IDs deterministically from their pre-migration `file_id`; preserve IDs and names through missing-asset placeholders. A scene-scoped World scan for name allocation is simpler than a mutable registry at current scene sizes. Phase 20b–20e may consume these IDs for authored links; this spec does not implement those links. See `docs/specs/phase_20a_stage_identities_and_names.md`. (2026-10-25) |
|
| 82 | **Phase 20a introduces persistent stage identity alongside temporary save IDs** — props already use persistent `stage_object_id`, while stickmen currently depend on runtime instance IDs and each save regenerates `file_id` by World order. | Medium | Spec prepared; implementation pending | Keep `file_id` for the current rule remap, retain existing prop IDs, and add a persistent character ID plus scene-unique display names independent of assets. Migrate legacy character IDs deterministically from their pre-migration `file_id`; preserve IDs and names through missing-asset placeholders. A scene-scoped World scan for name allocation is simpler than a mutable registry at current scene sizes. Phase 20b–20e may consume these IDs for authored links; this spec does not implement those links. See `docs/specs/phase_20a_stage_identities_and_names.md`. (2026-10-25) |
|
||||||
|
| 83 | **Phase 20b needs persistent action identity and a plan migration across flat queue callers** — current integer IDs regenerate at load/PLAY, and flat encoders strip unknown action fields. | High | Spec prepared; implementation pending | Save v1.9 nested steps and scene-unique string action IDs; derive deterministic IDs from actor ID and flat index for older scenes. Keep IDs across edit/reorder/regroup/retarget, regenerate on actor duplication, and validate current-format collisions before World apply. Adapt queue/editor/visual/rule callers through typed plan APIs and a derived flat compatibility view; never persist session integer IDs or use stage names as keys. The v1.8 `speak.keep_acting` overlap may require a narrow legacy-only execution flag when it cannot become a compatible Move/Wait+Say step. See `docs/specs/phase_20b_action_plans_and_direct_authoring.md`. (2026-10-26) |
|
||||||
|
| 84 | **Live named-prop pursuit can churn navigation or finish at a stale point** — a rigid prop can translate and spin while an authored Move runs. | Medium | Spec prepared; tuning pending | Store a world-aligned offset from the stable prop ID, retarget only for meaningful translation without restarting gait, and cap unpaused pursuit time. Check both current approach arrival and live prop reach before success; a missing target, blocked route, invalid projection, or timeout fails and emits no reached-endpoint event. Initial 16-unit/0.1-second retarget and 12-second budget values are tuning candidates for repeatable behavior and rendered checks, not permanent schema fields. Future Follow has a separate continuing stop contract. See `docs/specs/phase_20b_action_plans_and_direct_authoring.md`. (2026-10-26) |
|
||||||
|
| 85 | **A just-set-down prop can be bumped by the releasing stickman during the next queued move** — the actor may still be beside the new placement when the following action begins. | Low | Implemented; 57 focused runtime checks pass | Set Down alone adds a temporary collision exception for the releasing rig, and that rig's movement sweep skips the prop until its collision shapes remain clear by 24 px for two physics frames. Keep the authored released flags, support contact, and all other actors' contacts unchanged; Drop, Throw, and ragdoll release receive no grace. This deliberately revises Phase 17a's earlier no-owner-grace rule to protect the immediate Set Down → Move sequence. See `docs/specs/phase_17a_prop_roles.md`. (2026-11-02) |
|
||||||
|
| 86 | **A stickman can bump a reserved pickup target while approaching it** — normal collision handling can move the prop before the reach completes. | Low | Implemented; 68 focused runtime checks pass | Keep a pair-specific exception for the reserving actor and target throughout approach/reach. Successful pickup clears it through the HELD collision profile; cancel/failure changes it to clearance grace. The target retains support and contact with every other actor and prop. See `docs/specs/phase_17a_prop_roles.md`. (2026-11-02) |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -197,4 +201,10 @@ This document tracks known technical debt, optimization opportunities, and minor
|
|||||||
|
|
||||||
| 2026-10-25 | Prepared the Phase 20a identities, names, and overlap-selection architecture specification (`docs/specs/phase_20a_stage_identities_and_names.md`) for user sign-off. It specifies persistent character/prop IDs and scene-unique names alongside the existing temporary rule `file_id`, deterministic legacy migration to scene v1.8, shared EDIT name inspectors, and a visible-geometry click check with a transient overlap preview. Updated open #12 for the bounded character/prop precision plan and added #82 for the identity and migration trade-off. No runtime code or tests changed. |
|
| 2026-10-25 | Prepared the Phase 20a identities, names, and overlap-selection architecture specification (`docs/specs/phase_20a_stage_identities_and_names.md`) for user sign-off. It specifies persistent character/prop IDs and scene-unique names alongside the existing temporary rule `file_id`, deterministic legacy migration to scene v1.8, shared EDIT name inspectors, and a visible-geometry click check with a transient overlap preview. Updated open #12 for the bounded character/prop precision plan and added #82 for the identity and migration trade-off. No runtime code or tests changed. |
|
||||||
|
|
||||||
|
| 2026-10-26 | Prepared the Phase 20b Step Stack UI/architecture specification (`docs/specs/phase_20b_action_plans_and_direct_authoring.md`) for final user sign-off. It records the approved Move/Wait+Say compatibility, explicit free-place versus named-prop links, finite world-aligned moving-prop pursuit, future-only paused regroup/reorder, scene v1.9 plan/action-ID migration, runtime group barrier, and three verification gates. Added #83–#84 for the flat-queue compatibility and pursuit tuning trade-offs. No implementation code or tests changed. |
|
||||||
|
|
||||||
|
| 2026-11-02 | Revised Phase 17a's Set Down release rule for the reported Set Down → Move collision: only the releasing rig receives a contact exception, held until its collision shapes clear the prop by 24 px for two physics frames. The exception also applies to that rig's movement sweep, and the prop retains its authored collision role with supports and other actors. Added #85; `test_phase17a_prop_roles.gd` passes 57 runtime checks. |
|
||||||
|
|
||||||
|
| 2026-11-02 | Added reserved-pickup collision protection: the pickup target remains exempt only for its reserving rig through approach and reach, then returns to normal contact on pickup or clearance after cancellation/failure. The existing locomotion sweep honors the same target-specific exemption. Added #86; `test_phase17a_prop_roles.gd` passes 68 focused runtime checks. |
|
||||||
|
|
||||||
_End of Log_
|
_End of Log_
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ The Sandbox Stage establishes a useful baseline for hierarchy, contrast, child-f
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| Sandbox Stage | SandboxTheme loads validated tokens from [sandbox_theme.json](../../sandbox_theme.json). Stage inspector controls live under [scripts/shared/stage_ui](../../scripts/shared/stage_ui/). | Use as the product reference for semantic colors, readable type, focus, action roles, and reusable theme access. |
|
| Sandbox Stage | SandboxTheme loads validated tokens from [sandbox_theme.json](../../sandbox_theme.json). Stage inspector controls live under [scripts/shared/stage_ui](../../scripts/shared/stage_ui/). | Use as the product reference for semantic colors, readable type, focus, action roles, and reusable theme access. |
|
||||||
| Stage inspector | The approved [Stage panel UI system](../specs/stage_panel_ui_system.md) targets in-stage selected-object cards. | Do not insert StageInspectorPanel into editor inspectors by default. Borrow fitting rules and state behavior; use its components only if the layout and ownership match. |
|
| Stage inspector | The approved [Stage panel UI system](../specs/stage_panel_ui_system.md) targets in-stage selected-object cards. | Do not insert StageInspectorPanel into editor inspectors by default. Borrow fitting rules and state behavior; use its components only if the layout and ownership match. |
|
||||||
|
| Stage action plans | [Phase 20b](../specs/phase_20b_action_plans_and_direct_authoring.md) defines the DIRECT Step Stack, action markers, target capture, and action picker. | Use these as Stage-specific references. Reuse their general feedback principles in editor workflows only when the interaction fits. |
|
||||||
| Stage object names and overlap chooser | [Phase 20a](../specs/phase_20a_stage_identities_and_names_ui_ux.md) defines the name-and-Rename inspector header and the anchored **Objects here** chooser. | Reuse the rename interaction for other renameable objects; reuse the chooser shell and state tokens for similar non-modal object pickers. Follow the click-versus-drag and transform-handle priority in §4.6. Keep object-specific naming rules with the owning feature. |
|
| Stage object names and overlap chooser | [Phase 20a](../specs/phase_20a_stage_identities_and_names_ui_ux.md) defines the name-and-Rename inspector header and the anchored **Objects here** chooser. | Reuse the rename interaction for other renameable objects; reuse the chooser shell and state tokens for similar non-modal object pickers. Follow the click-versus-drag and transform-handle priority in §4.6. Keep object-specific naming rules with the owning feature. |
|
||||||
| Stage and editor dialogs | [StageDialogStyler](../../scripts/shared/stage_ui/stage_dialog_styler.gd) draws the shared confirmation card over the active scene while retaining native dialog signals. The style reads `popups.confirmation` from SandboxTheme. | Use this shared card for Prop and Stickman confirmation, recovery, and short action dialogs. Native file picker content remains native. |
|
| Stage and editor dialogs | [StageDialogStyler](../../scripts/shared/stage_ui/stage_dialog_styler.gd) draws the shared confirmation card over the active scene while retaining native dialog signals. The style reads `popups.confirmation` from SandboxTheme. | Use this shared card for Prop and Stickman confirmation, recovery, and short action dialogs. Native file picker content remains native. |
|
||||||
| Shared editor chrome | [EditorVisualTheme](../../scripts/shared/editor_ui/editor_visual_theme.gd) loads validated tokens from [editor_visual_theme.json](../../editor_visual_theme.json) and builds each editor's local control Theme. `EditorSelectionDropdown` and `EditorContextMenu` supply shared selection and canvas-menu styling. | Use shared semantic tokens and controls for matching editor workflows. Keep editor-specific document behavior in its owner. |
|
| Shared editor chrome | [EditorVisualTheme](../../scripts/shared/editor_ui/editor_visual_theme.gd) loads validated tokens from [editor_visual_theme.json](../../editor_visual_theme.json) and builds each editor's local control Theme. `EditorSelectionDropdown` and `EditorContextMenu` supply shared selection and canvas-menu styling. | Use shared semantic tokens and controls for matching editor workflows. Keep editor-specific document behavior in its owner. |
|
||||||
@@ -70,6 +71,7 @@ Use these Stage examples as starting points, then tune them for the denser edito
|
|||||||
- Stage inspector shell: **12 px** padding, **8 px** header gap, **12 px** section gap, **10 px** corner radius.
|
- Stage inspector shell: **12 px** padding, **8 px** header gap, **12 px** section gap, **10 px** corner radius.
|
||||||
- Stage choice row: **56 px** minimum height; Stage toggle row: **64 px** minimum, increasing when helper text is visible.
|
- Stage choice row: **56 px** minimum height; Stage toggle row: **64 px** minimum, increasing when helper text is visible.
|
||||||
- Large child-facing dialogs: title about **28–30 px**, body about **20 px**, button about **20 px**, **2 px** borders, **12–18 px** corner radii, and generous footer spacing.
|
- Large child-facing dialogs: title about **28–30 px**, body about **20 px**, button about **20 px**, **2 px** borders, **12–18 px** corner radii, and generous footer spacing.
|
||||||
|
- For short numeric settings such as a wait duration, keep the value directly editable, show its unit, and offer a large touch-size stepper. Optional quick picks should update the same value. Keep typed input, stepping, quick picks, and bounds synchronized; choose an increment that suits the setting.
|
||||||
- Stage generally uses dark surfaces with a restrained border. The dialog guide's stronger borders and rounder controls are for modal emphasis, not a requirement to put every editor widget inside a thick outline.
|
- Stage generally uses dark surfaces with a restrained border. The dialog guide's stronger borders and rounder controls are for modal emphasis, not a requirement to put every editor widget inside a thick outline.
|
||||||
|
|
||||||
For compact inspectors, shorten the hierarchy only after checking it at the intended window size. Prefer a clear label and value over shrinking type until it becomes difficult to read. Use container spacing and alignment rather than per-control position nudges.
|
For compact inspectors, shorten the hierarchy only after checking it at the intended window size. Prefer a clear label and value over shrinking type until it becomes difficult to read. Use container spacing and alignment rather than per-control position nudges.
|
||||||
@@ -158,6 +160,14 @@ Use an anchored chooser when a click lands on multiple real canvas targets and t
|
|||||||
- Keep the clicked art visible where possible, fit the popup to safe viewport margins, and cap the list height so longer candidate lists scroll. Keep pointer hover and keyboard focus behavior equivalent when they preview a candidate.
|
- Keep the clicked art visible where possible, fit the popup to safe viewport margins, and cap the list height so longer candidate lists scroll. Keep pointer hover and keyboard focus behavior equivalent when they preview a candidate.
|
||||||
- Define shell, row, selected, hover, focus, badge, spacing, and Cancel values as theme tokens. The Stage implementation uses `SandboxTheme.popups.anchored_chooser`; other workflows should reuse the visual contract through their own appropriate theme owner.
|
- Define shell, row, selected, hover, focus, badge, spacing, and Cancel values as theme tokens. The Stage implementation uses `SandboxTheme.popups.anchored_chooser`; other workflows should reuse the visual contract through their own appropriate theme owner.
|
||||||
|
|
||||||
|
### 4.7 Stage action planning and target capture
|
||||||
|
|
||||||
|
These are Stage-specific references, not a new inspector layout for the standalone editors. The [Phase 20b spec](../specs/phase_20b_action_plans_and_direct_authoring.md) owns the exact action behavior and component placement.
|
||||||
|
|
||||||
|
**Temporary target capture:** Keep one short, action-specific prompt and a visible **Cancel** together in a stable capture bar. Dim and block the underlying inspector while the stage is waiting for a target. Escape and right-click may act as shortcuts, but the visible Cancel remains available. Cancel discards the draft, restores the prior selection and focus, and leaves the plan and dirty state unchanged. Show a cursor marker and action-specific feedback: highlight only valid Set Down surfaces, keep Move feedback grounded at the actor's walking level, and preserve Throw's ballistic preview. Do not show a movement-looking trajectory while choosing a Pick Up prop.
|
||||||
|
|
||||||
|
**Action markers:** Use one readable icon-and-verb pill for each action. When actions run together, keep their pills separate and stack them so each remains identifiable. Anchor **Pick Up** at its prop, **Say** and **Wait** by the actor, and **Move** at its destination. Let pill color reinforce the action type while the label remains the source of meaning. Do not repeat the step number in the pill when its route flag already carries that number.
|
||||||
|
|
||||||
## 5. Editor flows and state maps
|
## 5. Editor flows and state maps
|
||||||
|
|
||||||
The following maps describe the current interaction architecture at a level useful for future visual work. They are not proposed additions to file formats.
|
The following maps describe the current interaction architecture at a level useful for future visual work. They are not proposed additions to file formats.
|
||||||
@@ -300,7 +310,10 @@ Do not add spinners or blocking overlays for synchronous work without evidence t
|
|||||||
- Use motion to show cause and effect: a brief selection flash, a panel entering, or a successful action cue. Keep it short and do not delay the next input.
|
- Use motion to show cause and effect: a brief selection flash, a panel entering, or a successful action cue. Keep it short and do not delay the next input.
|
||||||
- Do not animate every hover or value change. Motion should help the child understand an edit, not decorate idle controls.
|
- Do not animate every hover or value change. Motion should help the child understand an edit, not decorate idle controls.
|
||||||
- Keep persistent mode and selection state visible after any transition ends.
|
- Keep persistent mode and selection state visible after any transition ends.
|
||||||
|
- For a secondary chooser that slides out beside an inspector, align the panel tops and briefly dim the parent to show that the chooser is temporary. Keep a visible **Cancel**; Escape and an outside click should reverse the same transition. On close, restore the parent and return focus to the control that opened the chooser.
|
||||||
|
- For card reordering, keep bold up/down buttons stationary and animate the affected cards exchanging places after activation. Keep the selected card selected and visually in front, preserve scroll and focus, and ignore repeat input until the swap finishes.
|
||||||
- Respect a reduced-motion preference for nonessential transitions and flashes. Provide an equally clear static state.
|
- Respect a reduced-motion preference for nonessential transitions and flashes. Provide an equally clear static state.
|
||||||
|
- When reduced motion is requested, show the chooser or reordered cards directly in their final state without the transition.
|
||||||
- The current code has short visual effects such as the Prop canvas's new-point flash and Stage completion effects. A unified reduced-motion preference is not established by the referenced theme/specs; treat it as a future product-level decision.
|
- The current code has short visual effects such as the Prop canvas's new-point flash and Stage completion effects. A unified reduced-motion preference is not established by the referenced theme/specs; treat it as a future product-level decision.
|
||||||
|
|
||||||
## 7. Theme and implementation checklist
|
## 7. Theme and implementation checklist
|
||||||
@@ -404,5 +417,6 @@ To make this guide a stronger long-term design reference, add these pieces as th
|
|||||||
- [Prop canvas](../../scripts/editors/prop/prop_canvas.gd) — mode behavior, canvas gestures, selection handles, and context menus.
|
- [Prop canvas](../../scripts/editors/prop/prop_canvas.gd) — mode behavior, canvas gestures, selection handles, and context menus.
|
||||||
- [Stickman Editor controller](../../scripts/editors/stickman/stickman_editor.gd), [Stickman Editor scene](../../scenes/editors/stickman/stickman_editor.tscn), [BodyPartPanel](../../scripts/editors/stickman/body_part_panel.gd), and [Whole Stickman preview](../../scripts/editors/stickman/whole_stickman_preview.gd).
|
- [Stickman Editor controller](../../scripts/editors/stickman/stickman_editor.gd), [Stickman Editor scene](../../scenes/editors/stickman/stickman_editor.tscn), [BodyPartPanel](../../scripts/editors/stickman/body_part_panel.gd), and [Whole Stickman preview](../../scripts/editors/stickman/whole_stickman_preview.gd).
|
||||||
- [Stage dialog style helper](../../scripts/shared/stage_ui/stage_dialog_styler.gd) and [Stage capture bar](../../scripts/editors/stage/stage_use_target_capture_bar.gd).
|
- [Stage dialog style helper](../../scripts/shared/stage_ui/stage_dialog_styler.gd) and [Stage capture bar](../../scripts/editors/stage/stage_use_target_capture_bar.gd).
|
||||||
|
- [Phase 20b action plans and DIRECT authoring](../specs/phase_20b_action_plans_and_direct_authoring.md) — Stage-specific action pills, capture feedback, and plan editing.
|
||||||
- [Prop Editor UX specification](../specs/phase_9c_prop_editor_ux.md) — current approved Prop Editor mode, Attach preview, marker, and layout behavior.
|
- [Prop Editor UX specification](../specs/phase_9c_prop_editor_ux.md) — current approved Prop Editor mode, Attach preview, marker, and layout behavior.
|
||||||
|
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ Numbered steps and paired actions should fit the shared Stage inspector visual s
|
|||||||
## DIRECT mode action previews
|
## DIRECT mode action previews
|
||||||
|
|
||||||
- A selected character’s route is labeled with its authored movement type, such as **Walk** or **Run**. The destination marker identifies the named target, such as **Blue Door**. Do not use a generic “planned walk” label; show only movement types the editor supports.
|
- A selected character’s route is labeled with its authored movement type, such as **Walk** or **Run**. The destination marker identifies the named target, such as **Blue Door**. Do not use a generic “planned walk” label; show only movement types the editor supports.
|
||||||
- A **Say** step is represented on the stage by a single speech-bubble marker at the action’s starting point. It signals that speech will happen without displaying a bubble count or keeping multiple dialogue bubbles on the stage. Any step number identifies the action’s place in the plan, not the number of speech bubbles.
|
- A standalone **Say** step uses a compact speech-bubble marker in the plan overview. In Step Spotlight, show a yellow-bordered pill containing the speech glyph and **Say**, without a step number or leader. Place it just above the Say step’s predicted ground start point, with a small gap; when Say follows a Move, align it above that Move’s endpoint flag. Keep the dialogue text in the inspector. A focused **Wait** step uses a purple-bordered pill containing the hourglass glyph and **Wait**, without a step number or leader, just above its predicted ground start point. A focused Wait+Say step stacks Wait above Say. For a concurrent Move+Say step, show stacked Move and **Say** action pills near the first third of the grounded route, using the same small action glyphs and cyan/yellow colors as the inspector; do not also draw a separate speech marker for that Say. Say may accompany every other registered action type, while Say+Say, primary+primary, and any third action remain unavailable. In Step Spotlight, show each Together action that can share the actor’s space as two stacked, icon-bearing pills with its primary action above plain **Say**, using each action’s color; fit the pair as one group against the character name, inspector, and viewport. Keep Move+Say near the route’s first third, Wait and other physical actions near their predicted start, and Throw Prop beside the hands or upper torso. Keep Pick Up over its target prop and Say by the character so the target stays clear. The normal plan overview remains compact. These cues signal actions without displaying bubble counts or multiple dialogue bubbles.
|
||||||
- Tapping a numbered movement flag selects its existing plan step and reveals **Change place**; selecting alone never moves the destination, and flags are not draggable by default. **Change place** enters destination capture with a clear prompt and visible **Cancel**. The old flag stays faintly visible while the candidate route and flag follow the cursor. Choosing a new point or exact named prop commits the change; **Cancel** or **Esc** restores the original destination.
|
- Tapping a numbered movement flag selects its existing plan step and reveals the stacked **Edit action** and **Erase action** controls; selecting alone never moves the destination, and flags are not draggable by default. **Edit action** opens the destination editor, where choosing a new place or exact named prop enters capture with a clear prompt and visible **Cancel**. The old flag stays faintly visible while the candidate route and flag follow the cursor. Choosing a new point or exact named prop commits the change; **Cancel** or **Esc** restores the original destination.
|
||||||
## Action moments
|
## Action moments
|
||||||
|
|
||||||
Only moments relevant to the selected authored action are shown. “Starts” is omitted from Drop and Set Down labels because the start timing is implied.
|
Only moments relevant to the selected authored action are shown. “Starts” is omitted from Drop and Set Down labels because the start timing is implied.
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
@@ -24,6 +24,8 @@ Do not duplicate detailed decisions here. Add new decisions to the design brief
|
|||||||
|
|
||||||
### Phase 20b — Action plans and DIRECT authoring
|
### Phase 20b — Action plans and DIRECT authoring
|
||||||
|
|
||||||
|
**Status:** Implementation delivered; the user verified manual scenarios 1–7. Broader production-interaction and UI/UX-review acceptance evidence remains unrecorded. The branch remains unmerged. See the [Phase 20b implementation and verification spec](../specs/phase_20b_action_plans_and_direct_authoring.md) for the delivery record.
|
||||||
|
|
||||||
- Author each character's ordered action plan, including actions grouped to run together.
|
- Author each character's ordered action plan, including actions grouped to run together.
|
||||||
- Author movement destinations as either a free place or a specific named prop instance.
|
- Author movement destinations as either a free place or a specific named prop instance.
|
||||||
- Support selecting a route marker, deliberately changing its destination, and the agreed DIRECT preview labels and speech marker.
|
- Support selecting a route marker, deliberately changing its destination, and the agreed DIRECT preview labels and speech marker.
|
||||||
|
|||||||
@@ -137,9 +137,9 @@ Add `set_down_prop` to `ActionRegistry`, `ActionEditor`, stickman action popup,
|
|||||||
|
|
||||||
The interactor adds SET_DOWN_APPROACHING and SET_DOWN_REACHING (or equivalent explicit substates), with one shared nonmutating solver for authoring preview and PLAY validation. It reuses the queued held-prop preview prefix from Throw to determine the prop, grip, hand, and predicted actor pose. The prefix evaluator must also consume earlier Set Down actions as release actions and account for Drop/Throw; it may return `known=false` when a rule or earlier action makes the held prop uncertain. Do not move or reserve a live prop during preview. When unknown, show the neutral marker and **Prop depends on earlier actions**, and assess grounded approach/reach where possible without pretending to know exact occupancy. As with the existing Throw preview, cache physics shape checks in `_physics_process()` and draw the latest result in `_process()`; do not perform fresh direct-space queries from every pointer draw.
|
The interactor adds SET_DOWN_APPROACHING and SET_DOWN_REACHING (or equivalent explicit substates), with one shared nonmutating solver for authoring preview and PLAY validation. It reuses the queued held-prop preview prefix from Throw to determine the prop, grip, hand, and predicted actor pose. The prefix evaluator must also consume earlier Set Down actions as release actions and account for Drop/Throw; it may return `known=false` when a rule or earlier action makes the held prop uncertain. Do not move or reserve a live prop during preview. When unknown, show the neutral marker and **Prop depends on earlier actions**, and assess grounded approach/reach where possible without pretending to know exact occupancy. As with the existing Throw preview, cache physics shape checks in `_physics_process()` and draw the latest result in `_process()`; do not perform fresh direct-space queries from every pointer draw.
|
||||||
|
|
||||||
For a known prop, retain its current held orientation and authored/play scale. Treat `target_position` as the requested release origin, then check the prospective collision shape against terrain and released-profile actor/prop contacts; exclude the held prop's own RID but check the acting rig's torso/head and other solid parts when released actor bumps are On. If the shape overlaps terrain or a prop whose **Holds other props** setting is On, raise the prospective origin vertically just enough to clear the overlapping support geometry. Do not shift it sideways or select a named surface. Keep the requested point unchanged in the saved action. If the shape overlaps the acting character or a non-support prop, reject it with **No room to let go here**. Do not add an implicit owner-collision grace period or permit release inside the torso. An open-air point remains exactly where clicked. Compute the grip position from the resolved transform and asset anchor, then solve a grounded approach on terrain to either side and check wrist/IK reach. Do not teleport the actor or clamp the point to make it reachable. Preview the requested point and corrected release origin when they differ. Re-resolve at runtime because actors and props may have moved since authoring. If the route is blocked or the point remains occupied, keep the prop held, restore its hand pose, show **Too far to reach** or **No room to let go here**, finish the action safely, and let the child edit the target. If no prop is held, show a short cue on that actor and finish safely without creating or dropping a prop.
|
For a known prop, retain its current held orientation and authored/play scale. Treat `target_position` as the requested release origin, then check the prospective collision shape against terrain and released-profile actor/prop contacts; exclude the held prop's own RID but check the acting rig's torso/head and other solid parts when released actor bumps are On. If the shape overlaps terrain or a prop whose **Holds other props** setting is On, raise the prospective origin vertically just enough to clear the overlapping support geometry. Do not shift it sideways or select a named surface. Keep the requested point unchanged in the saved action. If the shape overlaps the acting character or a non-support prop, reject it with **No room to let go here**. An open-air point remains exactly where clicked. Compute the grip position from the resolved transform and asset anchor, then solve a grounded approach on terrain to either side and check wrist/IK reach. Do not teleport the actor or clamp the point to make it reachable. Preview the requested point and corrected release origin when they differ. Re-resolve at runtime because actors and props may have moved since authoring. If the route is blocked or the point remains occupied, keep the prop held, restore its hand pose, show **Too far to reach** or **No room to let go here**, finish the action safely, and let the child edit the target. If no prop is held, show a short cue on that actor and finish safely without creating or dropping a prop.
|
||||||
|
|
||||||
During the reach, move the held prop smoothly with the hand marker toward the resolved release transform. If the point is low, bend the torso and knees during the reach, then release the prop and ease the arm and body back to their resting pose. At release, use the resolved origin and apply `RELEASED` with zero launch velocity so gravity carries the prop onto the surface. The support prop's collision geometry and gravity determine where the object settles. While held, the prop has no collision layer or mask; released collision settings take effect at the release moment. A pause freezes the animation and prop state. Ordinary action cancellation before release keeps the prop held and restores the marker; ragdoll aborts Set Down and uses the existing forced-release path with the authored released profile. STOP restores authored placement. Preserve the existing grip attachment logic and scale conversion rather than assuming an unscaled local anchor.
|
During the reach, move the held prop smoothly with the hand marker toward the resolved release transform. If the point is low, bend the torso and knees during the reach, then release the prop and ease the arm and body back to their resting pose. At release, use the resolved origin and apply `RELEASED` with zero launch velocity so gravity carries the prop onto the surface. The support prop's collision geometry and gravity determine where the object settles. While held, the prop has no collision layer or mask; released collision settings take effect at the release moment. For a pickup, when the actor reserves its target, add an owner-specific contact exception between that target and the reserving rig's animated and ragdoll collision bodies. Keep it while `interaction_reserved_by` names that rig, regardless of distance or elapsed time; the owner's movement sweeps also skip only that target. On successful pickup, the `HELD` role clears the exception with the collision profile. On cancel or failure, release the reservation but retain an exit grace until the actor's collision shapes clear the prop by a 24 px query margin for two consecutive physics frames. For Set Down, add the same owner-specific exception after release and keep it until those shapes clear by that margin. Neither behavior changes authored collision flags or contact with the support, other props, or other stickmen; normal contacts resume after clearance. These protections are owner-specific and clearance-based, not inherited from the support; pickup protection lasts for the full reservation so it cannot expire while the actor is far away. Drop, Throw, and ragdoll forced release keep their authored contact behavior. A pause freezes the animation and prop state. Ordinary action cancellation before release keeps the prop held and restores the marker; STOP clears temporary exceptions and restores authored placement. Preserve the existing grip attachment logic and scale conversion rather than assuming an unscaled local anchor.
|
||||||
|
|
||||||
## Stage UI, selection, and theme
|
## Stage UI, selection, and theme
|
||||||
|
|
||||||
@@ -151,6 +151,6 @@ Use `SandboxTheme.control_theme()` on the card and popup. Read dimensions, fonts
|
|||||||
|
|
||||||
## Regression checklist
|
## Regression checklist
|
||||||
|
|
||||||
For future regression runs, use `tests/test_phase17a_prop_roles.gd` for role defaults/migration, queue and rule Set Down serialization, unknown-prop preview, released-vs-held transitions, and support contact, followed by Godot headless syntax validation. A small runtime scene can check that a support-only table catches a released pot while a stickman passes through, that switching **Can bump into other props** Off makes the pot fall through the table but still land on terrain, and that **Blocks stickmen** stops walking instead of letting the root tunnel through. Reopen saved scenes, copy a placement, select a fully occluded prop, and check correction of a bad Set Down target. Repeat PLAY after STOP and confirm identical authored arrangement, role settings, and usable stable IDs. Check pause/resume during holding and after release, plus ragdoll release.
|
For future regression runs, use `tests/test_phase17a_prop_roles.gd` for role defaults/migration, queue and rule Set Down serialization, unknown-prop preview, released-vs-held transitions, support contact, Set Down owner-collision grace, and reserved-pickup protection, followed by Godot headless syntax validation. A runtime Set Down followed immediately by Move should confirm that the releasing stickman can clear the prop without knocking it away, the temporary exception is removed after clearance, a different stickman can still contact it, and the prop still rests on its support. A reserved pickup should stay protected through a long approach, clear on successful pickup, and transition to exit grace on cancellation/failure. Also verify that switching **Can bump into other props** Off makes the pot fall through the table but still land on terrain, and that **Blocks stickmen** stops walking instead of letting the root tunnel through. Reopen saved scenes, copy a placement, select a fully occluded prop, and check correction of a bad Set Down target. Repeat PLAY after STOP and confirm identical authored arrangement, role settings, and usable stable IDs. Check pause/resume during holding and after release, plus ragdoll release.
|
||||||
|
|
||||||
The approved table/pot, open-air Set Down, invalid-target feedback, overlap chooser, card readability, old-scene replay, and movement-blocking behavior are useful visual/runtime regression scenarios.
|
The approved table/pot, open-air Set Down, invalid-target feedback, overlap chooser, card readability, old-scene replay, and movement-blocking behavior are useful visual/runtime regression scenarios.
|
||||||
|
|||||||
@@ -0,0 +1,226 @@
|
|||||||
|
# Phase 20b — Action plans and DIRECT authoring
|
||||||
|
|
||||||
|
> **Status:** Implementation delivered; the user verified manual scenarios 1–7. The broader acceptance matrix still has unrecorded production-interaction and UI/UX-review evidence. The branch remains unmerged.
|
||||||
|
> **Approval:** User approved the specifications in this conversation.
|
||||||
|
> **Branch:** `feature/phase-20-action-reactions` in `C:\Godot4\stickman\.worktrees\phase-20-action-reactions`.
|
||||||
|
> **Scope:** The [Phase 20 roadmap](../plans/phase_20_action_plans_and_reactions.md) defines 20b as ordered, optionally grouped character plans, explicit place/prop Move targets, DIRECT route authoring, and stable action identity. [Phase 20c–20e](../plans/phase_20_action_plans_and_reactions.md) retain reaction authoring/runtime and prop event handling.
|
||||||
|
|
||||||
|
## Sources and current boundary
|
||||||
|
|
||||||
|
Use the accepted [action/reaction design brief](../plans/action_reactions_design_brief.md), [Phase 20a identity contract](phase_20a_stage_identities_and_names.md), [Stage panel UI system](stage_panel_ui_system.md), [editor visual style guide](../guides/editor_visual_style_guide.md), and branch-local [Step Stack](../plans/action_reactions_mockups/phase_20b_step_stack.png) and [Add together](../plans/action_reactions_mockups/phase_20b_add_together_compatibility.png) mockups. The mockups show the selected direction; this spec settles data and interaction behavior where a static image cannot.
|
||||||
|
|
||||||
|
Today `.scene` v1.8 saves a flat `action_queue` per stickman. `StickmanActionRunner` runs one primary queue action at a time, with a replaceable speech overlay; its `int` action IDs are regenerated by `set_authored_queue()` and at PLAY start. `QueuePanel` and `ActionEditor` are separate popup workflows. `StageDirectorVisuals` draws and hits flat queue positions separately. `StickmanRig` and `PropBlock` now have persistent `stage_object_id` and scene-unique `stage_name`; `file_id` remains only the save-local rule remap. This spec replaces authored plan identity and scheduling without changing those Phase 20a identities or the existing generic rule system in 20b.
|
||||||
|
|
||||||
|
## Approved product decisions
|
||||||
|
|
||||||
|
1. The selected-character DIRECT inspector uses the **Step Stack**: numbered steps in order; all actions in a step begin together; the next step waits until every action in the current step has ended.
|
||||||
|
2. The fixed **Move**, **Say**, and **Wait** shortcuts always append a *new* step, even when a card is selected. **+ Add together** is the explicit way to group.
|
||||||
|
3. A 20b concurrent step contains one supported primary action plus at most one **Say**. Say can accompany every other registered action type, including Move, Wait, prop actions, Ragdoll, and Recover. Two primary actions, Say+Say, and any third action stay incompatible. The group picker shows only compatible choices; when the selected step is Say, it offers every other action type.
|
||||||
|
4. A named-prop Move keeps the exact `stage_object_id` and a world-aligned approach offset. It pursues that prop for a bounded time during this Move, reaches only when both current approach point and prop are within reach, and fails safely if the prop vanishes, route blocks, or time expires. Rotation of a thrown/spinning prop never rotates the saved offset.
|
||||||
|
5. In paused DIRECT, grouping and step reorder affect future steps only. Existing active-action replace/delete behavior remains. Completed/interrupted actions cannot be edited or moved, but their action rows still offer confirmed **Erase action** for the next run, as in [Phase 12](phase_12_live_director.md).
|
||||||
|
6. Phase 20b creates no reaction editor or reaction execution. It persists action IDs for future links and exposes completion outcomes so a later event can distinguish a reached endpoint from failure.
|
||||||
|
|
||||||
|
## Child-facing Step Stack
|
||||||
|
|
||||||
|
```text
|
||||||
|
Selected Milo in DIRECT stage route
|
||||||
|
┌───────────────────────────────────┐ Milo ── Walk ── 🚩 1 Blue Door
|
||||||
|
│ Milo │ 💬 1
|
||||||
|
│ [ Move ] [ Say ] [ Wait ] │
|
||||||
|
│ Plan [+ Add step] │
|
||||||
|
│ ┌ Step 1 Together ─────── ↑ ↓ ┐ │
|
||||||
|
│ │ Walk to Blue Door │ │
|
||||||
|
│ │ Say “Let's go!” │ │
|
||||||
|
│ │ [+ Add together] │ │
|
||||||
|
│ └────────────────────────────────┘ │
|
||||||
|
│ ┌ Step 2 ───────────────── ↑ ↓ ┐ │
|
||||||
|
│ │ Wait 2 seconds │ │
|
||||||
|
│ └────────────────────────────────┘ │
|
||||||
|
└───────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
The inspector is anchored on the right for **one selected character** in DIRECT. Its right edge aligns with the clock above it, using the shared 12 px viewport inset so the orange DIRECT frame remains visible. Its width is capped at 380 px and shrinks only when the safe viewport is narrower. It uses the selected character's current stage name and icon as its header. Clicking empty stage space dismisses it and clears selection. There is no Close button, the explicit exception already accepted in the design brief. DIRECT selection does not rename the character; the separate EDIT naming inspector retains its own controls. A character switch resets plan scroll and expanded action; an in-place edit preserves the anchor and scroll as far as possible. No character selected means no Director inspector.
|
||||||
|
|
||||||
|
`StageInspectorPanel` provides the shell, fixed header, safe rectangle, focus, and scroll behavior. Extend it with a caller-owned **pinned content slot** between header and scroll body for the three quick actions and plan heading/add control; include the slot in its height budget so only the plan list scrolls. Keep the existing `body()` API and other inspector behavior. Use `set_close_visible(false)` and explicit outside-click handling in the Stage owner; do not add a duplicate shell. `StagePanelChoiceGroup` suits exclusive Walk/Run and Prop/Place choices. `StagePanelToggleRow` and `StagePanelSwitchVisual` are not needed because 20b has no on/off setting. `StageUseTargetCaptureBar` should be generalized or reused for destination capture; keep its prompt and visible Cancel together below the top toolbar/mode pill. `StageDialogStyler` styles action deletion confirmations. Anchored prop and overlap choices use `popups.anchored_chooser` and the 20a **Objects here** behavior.
|
||||||
|
|
||||||
|
The scroll body shows **Plan**, **+ Add step**, and ordered **Step 1**, **Step 2**, etc. Numbers derive from order and update after reorder. Each step title is plain, stationary text in a focusable card. Clicking anywhere on a card, including its title or controls, selects that step; a child control still performs its own action. The card's DIRECT amber border marks selection. Tab focus on an unselected card is shown by a separate white inset outline; the selected card uses its amber border as the focus cue. Enter or Space selects the focused card. The title has no tooltip or hover style. Selecting a different step clears the previous action focus and closes its Action options. Selecting an action summary selects its owning step and opens only that action's **Action options** inline. Long Say summaries stay on one line and end with an ellipsis; hovering the Say row reveals the full utterance in its tooltip, and **Edit action** opens the full speech composer. A step with two actions says **Together**. Actions with editable settings offer vertically stacked, full-width **Edit action**, **Change action** when a different type is valid, and **Erase action** controls. Parameter-free actions such as Ragdoll, Recover, and Drop Prop omit **Edit action**. **Edit action** changes that action's settings; its type is fixed in the plan editor. **Change action** opens the existing slide-out action picker, omits the current type, and shows a **Replace: [current summary]** context line. A type choice opens its normal editor; changes apply only on **Done** (or **Done speech** for Say). Choosing a parameter-free type adds it immediately, or replaces the selected action immediately while preserving its ID, with no empty editor dialog. Cancel/Escape/outside click in the picker closes without changing the plan, and Cancel/Escape in the editor leaves the plan unchanged. The replacement keeps its stable action ID and remains selected. For a Together action, choices are filtered against the other action so the resulting pair stays valid; when no different type can fit, hide **Change action**. Move destination changes are made through **Edit action**, which opens the place/prop destination editor. In paused DIRECT, a completed or interrupted action's options retain **Erase action** with confirmation while **Edit action** is unavailable. There is no **Make someone react to this…** control until 20c. Bold solid up/down arrows reorder a step earlier or later inside 48 × 48 px targets; each has a descriptive tooltip and is disabled at the first/last position or when runtime state forbids reordering. Moving one step swaps only the two neighboring cards with a brief ~200 ms ease-out slide. The moved card remains selected and is drawn in front while they move; the same stable action ID preserves selection/spotlight through the list rebuild. Reorder buttons are disabled during the slide, and the prior scroll position and keyboard focus are restored afterward. Drag reorder is optional and cannot be the only route. Empty state: **Choose an action to start Milo’s plan.**
|
||||||
|
|
||||||
|
**+ Add step** opens a left-side **Choose an action** drawer with every supported action shown as a 48 px icon-and-label choice and a visible **Cancel** button pinned below the list. Its top aligns with the inspector, and it grows below the inspector to show all choices when the safe viewport allows. On shorter viewports, only the action list scrolls; Cancel stays visible and the drawer stays above the Stage status bar. Choosing an action with settings opens that action's editor; Say opens the speech composer. Parameter-free actions (Ragdoll, Recover, and Drop Prop) are added immediately after selection. The selected action type stays fixed in the new plan editor. A step is appended only after its complete draft is committed. **+ Add together** appears only when the selected step has a compatible action to add, and its picker offers only compatible choices: a one-action Say step offers every other action, while a different one-action step offers Say. The same two-action limit prevents Say+Say and primary-action pairs. Move setup asks **How should Milo move?** (Walk/Run) and **Where should Milo go?** (**Choose a prop**/**Choose a place**). The prop roster uses current stage names, a preview/highlight, and optional **Pick on stage**. Overlap picking reuses the 20a geometry-filtered chooser, including preview, Cancel, Escape, and no click-through. During plan place/prop capture, show one cursor-following instruction, a fixed **✕ Cancel** button, the cursor crosshair, and only the grounded route preview with a **Walk**/**Run** label; hide the duplicate prompt panel and generic diagonal trajectory. Place capture asks **Choose a place for Milo.**; prop capture asks **Choose the prop Milo will walk to.** Editing a target asks **Choose a new place or prop for Milo.** Capture is complete only after valid target selection and **Done** where a draft needs confirmation. **Cancel**/Escape discards the draft, creates no empty step, and causes no dirty mark. An invalid landing point says **Choose open ground for Milo.** For other target capture, prop/actor/area/waypoint selection shows only the cursor marker; direct Move To and rule Move previews stay horizontal at the actor's ground level. Throw retains its ballistic arc, and Set Down retains its prop/reach preview.
|
||||||
|
|
||||||
|
The existing speech composer creates exactly one Say action in the chosen step. Commit is atomic at **Done speech**; cancel does not create a step or replace the old Say. Existing bubble styling and content stay inside that action. **Erase action** asks **Erase this action?** via the shared confirmation card; Cancel preserves it. Removing the last action removes its step and renumbers later cards. A type replacement through **Change action** keeps its action ID because it explicitly replaces that selected action; later reaction cleanup rules belong to 20c.
|
||||||
|
|
||||||
|
### Stage preview and capture
|
||||||
|
|
||||||
|
- Keep the stage canvas quiet outside directing. In EDIT, hide authored action-plan routes, flags, Walk/Run badges, Say/Wait markers, and DIRECT actor badges. Keep placement feedback, the grid, selection outlines, and transform handles. When one or more named visible stickmen or props are selected, show a rounded, screen-sized badge for each selected object using its `stage_name`; use the EDIT cyan outline, position from the object's visual bounds, and prefer above the object. If a badge would collide with another badge, a transform handle, Stage chrome, an inspector, or the viewport edge, move it to the nearest clear adjacent position and add a short tether when displaced. Never omit a selected object's badge. Long names elide at the theme maximum width; the full name remains available through the single-object inspector or by selecting that object alone. Badges are read-only and input-transparent; Rename remains in the inspector. While **Objects here** previews a candidate, hide these persistent EDIT badges so the chooser's existing preview-name pill stays distinct.
|
||||||
|
- DIRECT uses **Step Spotlight** only when exactly one character is selected. With no actor selected or with a multi-selection, hide authored action-plan routes, flags, movement badges, and Say/Wait markers; keep the amber DIRECT frame and the existing direction hint. With one character selected, show that actor's stage name in an amber rounded, screen-sized badge centered above the head. Show the focused step's full route and its action markers; hide routes for other actors. If the plan has no steps, keep the name badge and show no route. On first selection, focus the first pending step, or the active/next pending step while paused. A character switch applies the same default.
|
||||||
|
- Movement steps outside the focus remain as faint numbered destination flags without route lines or action labels. These ghost flags keep their 44 px hit areas. Selecting a step card or ghost flag moves the focus without changing or dirtying the plan. A flag hit still resolves through the existing `action_id`, scrolls its step into view, and opens its Action options. Flags are not draggable; **Edit action** is the deliberate retarget entry and opens the destination editor.
|
||||||
|
- Draw the focused route with its authored **Walk** or **Run** label. Use a bright 4 px cyan dashed line with a 6 px dark contrast edge, 12 px dashes, and 7 px gaps. Place the rounded, bold action badge near the first third of the route, away from the center crossing. Keep the destination label separate: an endpoint linked to a prop shows that prop's current `stage_name`, such as **Blue Door**; a free destination uses only its numbered flag, without a generic **Place 2** label or an inferred nearby prop name.
|
||||||
|
- Round Move action badges have a dark surface, 2 px action-tinted border, bold 18–20 px light text, and generous padding. The actor-name pill uses a dark surface and 2 px DIRECT amber border, bold 20 px text, 12 px corners, and a 260 px maximum width; long names elide while the inspector retains the full stage name. Badges are visual only and do not intercept stage input.
|
||||||
|
- A focused Move+Say step shows two stacked action pills near the first third of the grounded route: the movement glyph and **Walk**/**Run** label above a speech glyph and **Say** label. Use the Move cyan and Say yellow action colors; this pair replaces the separate Say marker for that step. A focused standalone Say shows a yellow-bordered pill with a speech glyph and **Say**, without a step number or leader. A focused standalone Wait shows a purple-bordered pill with an hourglass glyph and **Wait**, also without a step number or leader; place it just above the action’s predicted ground start point with the same safe-viewport placement as Say. A focused Wait+Say step shows both pills stacked near that point, with Wait above Say. In Step Spotlight, show each primary-action+Say Together step as two stacked, icon-bearing pills with the primary action above plain **Say**; fit the pair as one group against the name badge, inspector, and safe viewport. Place Move+Say near the first third of the grounded route; Wait, Ragdoll, Recover, Drop Prop, Set Down Prop, and Use near the predicted start; Throw Prop beside the character’s hands or upper torso. Keep Pick Up over its target prop and place its Say cue by the character so the target stays clear. Keep dialogue text in the inspector. In the plan overview, paired Move+Say keeps its route stack and other Say pairings remain compact. Markers from nonfocused steps are hidden. When prior steps contain unpredictable physics, show a conditional/uncertain anchor using existing preview semantics rather than pretending an exact simulated future position.
|
||||||
|
- During retarget capture keep the old route/flag faint, even if selection is temporarily cleared. Draw a candidate route and flag with a validity state and relevant label at the pointer or exact picked prop. The old destination remains the authored value until a valid commit; Cancel/Escape restores its exact prior kind, ID, offset, and coordinate and preserves selection.
|
||||||
|
- Factor the route/marker layout into one preview projection used by both drawing and hit testing. Its entries carry `action_id`, `step_index`, world points, label, status, and hit shape. This prevents a drawn flag from selecting a different flat queue index after reorder.
|
||||||
|
|
||||||
|
Use `SandboxTheme` as the sole Stage visual source: `stage_panels` for shell/type/action/focus sizes, `mode_colors.direct` for selection, `popups.anchored_chooser` for rosters, `popups.confirmation` for deletion, and a small `director_plan` subtree for card/badge/route/flag/speech/old-target/candidate states. Theme both `SandboxTheme.DEFAULT_CONFIG` and `sandbox_theme.json`; use local stylebox overrides instead of mutating its cached `Theme`. Button targets are at least 44 × 44 logical pixels, preferably 48 px. Fit at wide and approximately 920×560 viewports below Stage chrome; the header and quick actions remain visible while eight or more steps scroll. Long stage names wrap or elide with full tooltip and do not cover actions. Focus/hover/selected/disabled/invalid states are visually distinct and described with text or icon as well as color. In-place picker growth keeps its anchor and only nudges within the safe viewport.
|
||||||
|
|
||||||
|
## Canonical document model and identity
|
||||||
|
|
||||||
|
One placed character owns an ordered `action_plan: Array[Dictionary]`. Each step is `{ "actions": Array[Dictionary] }`, with one or two nonempty actions; no persisted step ID or number. Each action has an opaque nonempty **string** `action_id` plus the action's canonical `type` and parameters. IDs are unique across authored plans in one `.scene`, independent of actor name, step/order, destination, and action type. They survive save/load, stage rename, edit, regroup, and step reorder. A duplicated *placed* character receives a new `stage_object_id` (20a) and fresh action IDs for all copied plan actions. Deletion retires IDs; a new action never reuses them in that scene. A replacement through Edit action keeps the selected ID; **+ Add step** or **+ Add together** allocates a new ID only on valid commit. Cancel never consumes a persisted ID or mutates the plan. Scene names are presentation values only and never link keys.
|
||||||
|
|
||||||
|
Use a scene-scoped `StageActionIdentity` (`RefCounted`, not autoload) to allocate/check IDs against real and missing character entries. A stable ID may be an opaque `action_<random/counter>` string; its textual shape is not part of the UI or event contract. Legacy v1.8 migration derives deterministic IDs from `stage_object_id` plus original flat index, with deterministic collision suffixes. A current-format file with duplicate/blank IDs is rejected before World clear, not silently repaired. A missing `.stk` placeholder preserves the entire plan and IDs in its original entry through save and asset repair.
|
||||||
|
|
||||||
|
### Target payloads
|
||||||
|
|
||||||
|
The canonical Move action uses one discriminated `destination` dictionary. Its position values are authored world coordinates, encoded with the existing `{x,y}` vector helper. The runtime `target: Vector2` used by present locomotion is derived, not a second authoritative serialized target.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"action_id": "action_opaque_17",
|
||||||
|
"type": "move_to",
|
||||||
|
"style": "walk",
|
||||||
|
"destination": {
|
||||||
|
"kind": "prop",
|
||||||
|
"target_prop_id": "stage_opaque_4",
|
||||||
|
"approach_offset": { "x": -42.0, "y": 0.0 },
|
||||||
|
"last_known_approach": { "x": 310.0, "y": 420.0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"action_id": "action_opaque_18",
|
||||||
|
"type": "move_to",
|
||||||
|
"style": "run",
|
||||||
|
"destination": { "kind": "place", "position": { "x": 510.0, "y": 420.0 } }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`target_prop_id` is the exact 20a `PropBlock.stage_object_id`, including missing-prop placeholders; `approach_offset` is a **world-aligned translation** from prop origin to the selected approach point. It does not rotate with the prop. `last_known_approach` is only an authored editor fallback for an unresolved/deleted prop link; PLAY motion does not rewrite it on save. It never turns the action into a free place or implies successful arrival. Prop rename changes displayed text but not this payload. A deleted target remains a repairable unresolved link labeled **Missing prop** and fails at PLAY if not retargeted. `kind: "place"` has no prop ID, even when its coordinate overlaps or is near a prop. Changing place commits a new destination dictionary on the same action ID. Validate finite vectors, known kinds, nonblank string prop IDs, and Walk/Run style; validate referenced prop IDs when present, while allowing an unresolved ID to preserve repairable authored intent. Never infer a prop link from coordinates. `ContentPaths.canonicalize()` remains on existing asset path fields; these identity and coordinate fields are not paths.
|
||||||
|
|
||||||
|
### Scene v1.9 boundary
|
||||||
|
|
||||||
|
`StageSceneIO.FILE_VERSION` becomes `"1.9"`. Current v1.9 character entries save `action_plan` and do not save a second authoritative `action_queue`. Add `encode_plan()`/`decode_plan()` or equivalent so IDs and destinations cannot be stripped by today's flat `_encode_flat_action()`/`_decode_flat_action()`. Preserve full speech payload normalization. Existing `event_rules`, their save-local `file_id` remap, background fields, and 20a stage identities/names stay intact. `StageSceneAdapter.collect()` writes the rig's canonical plan; `apply()` restores it after object spawn and identity assignment. Missing-character placeholders keep the canonical plan in `original_entry` so a save does not lose it.
|
||||||
|
|
||||||
|
For v1.0–v1.7, run the existing historical migrations, including the 20a identity/name pass, then migrate flat actions. For v1.8, retain its validated identities/names and migrate each valid flat `action_queue` entry to an ordered singleton step with a deterministic action ID; old `move_to.target` becomes a `place` destination. Existing malformed queue entries keep the present skip-and-warn behavior, while the current-format v1.9 shape is strictly validated. Preserve the precise old Sky/Plain and wall-tint version conditions: v1.8 must not receive older background defaults or wall rewrites. A migrated file saves as v1.9. `read_file()` migrates and validates the whole document before `StageSceneAdapter.apply()` clears World, including cross-actor action ID uniqueness, nonempty steps, compatibility, and destination shape.
|
||||||
|
|
||||||
|
The old `speak.keep_acting` overlay is a compatibility seam. Migration pairs a v1.8 overlay Say with its immediately following Move/Wait when that creates a compatible step, retaining order and approximate concurrent intent. Otherwise it makes a singleton Say with an explicit legacy-only nonblocking runtime flag to preserve old playback. The legacy flag is an exception to the new step barrier; new 20b authoring never creates it. Do not silently drop speech or reinterpret it as a prop/place target. Record paired and unpaired cases in migration tests. The new authored Say in a group remains active until its own bubble/line duration finishes, so its barrier is real.
|
||||||
|
|
||||||
|
## Runtime step execution
|
||||||
|
|
||||||
|
One runner owns the actor's canonical plan and an ephemeral execution cursor. At step start, snapshot both actions, mark both active, emit each `action_started` in plan order in the same physics tick, and start the primary track (Move/Wait) and optional Say track. The Say track's completion is the actual speech duration, not the instant its overlay is shown. Each action independently enters `PENDING`, `ACTIVE`, `SUCCEEDED`, `FAILED`, or `CANCELLED`; a step ends when all its actions have ended, then starts the next step on the next runner tick. Failure is an ended state and advances the plan; it is never reported as a reached endpoint. An empty plan completes immediately. STOP resets runtime status but does not change saved IDs or steps. Pausing freezes timers/pursuit and resumes them without consuming the bounded pursuit budget.
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
stateDiagram-v2
|
||||||
|
[*] --> Pending
|
||||||
|
Pending --> Active: step starts
|
||||||
|
Active --> Succeeded: action succeeds
|
||||||
|
Active --> Failed: missing target / blocked / timeout
|
||||||
|
Active --> Cancelled: edit, delete, or STOP
|
||||||
|
Succeeded --> [*]
|
||||||
|
Failed --> [*]
|
||||||
|
Cancelled --> [*]
|
||||||
|
```
|
||||||
|
|
||||||
|
Keep `StickmanRig` as the public façade. Add typed plan APIs and typed event signals while adapting existing flat/index callers deliberately; do not persist or regenerate the old session-only `int` IDs as link keys. `ActionRegistry` owns an explicit authored-step compatibility predicate, separate from `ReactiveRole`/`overlay_eligible`, which still govern existing generic rule injection. Current generic rules and reactive actions remain operational, but are not converted into reaction plans. For 20b, preserve their present priority behavior and do not design 20d interruption/resume here.
|
||||||
|
|
||||||
|
| Owner | Proposed typed contract and work |
|
||||||
|
| --- | --- |
|
||||||
|
| `StageActionPlan extends RefCounted` (`scripts/stage/stage_action_plan.gd`) | `static func validate_steps(steps: Array[Dictionary]) -> String`; `static func can_add_together(step: Dictionary, action_type: String) -> bool`; pure deep-copy edit/reorder helpers returning a new plan or error. It owns structure/compatibility, no nodes or UI. |
|
||||||
|
| `StageActionIdentity extends RefCounted` (`scripts/stage/stage_action_identity.gd`) | `func allocate(world: Node2D) -> String`; `func validate_scene_ids(objects: Array) -> String`; scan current scene and placeholders rather than maintaining a second mutable registry. |
|
||||||
|
| `StickmanRig extends Node2D` | `func get_action_plan() -> Array[Dictionary]`; `func set_action_plan(steps: Array[Dictionary]) -> bool`; `func find_action(action_id: String) -> Dictionary`; `signal planned_action_started(action_id: String, action: Dictionary, step_index: int)`; `signal planned_action_ended(action_id: String, outcome: StringName, step_index: int)`. Existing `action_started/action_finished`, `arrived`, `get_queue()` and queue mutation callers need a tested compatibility path during migration. |
|
||||||
|
| `StickmanActionRunner extends Node` | Execute current step with primary + Say tracks; track statuses by string action ID; expose `get_plan_view() -> Array[Dictionary]` with `step_index`, `action_id`, `action`, `status`; preserve `pause_simulation()`/`resume_simulation()` and active replace/delete semantics. A direct `get_queue_view()` can be a derived flat projection for legacy consumers during migration, never the persistence model. |
|
||||||
|
| `StickmanLocomotion extends Node` | Add a lightweight `retarget_walk(target: Vector2) -> bool` for the current active Move: update `_walk_target_feet`/`NavigationAgent2D.target_position` without resetting gait, facing, pause, or settle history. Report reached versus blocked explicitly. |
|
||||||
|
| `StageSceneIO extends RefCounted` / `StageSceneAdapter extends RefCounted` | v1.9 encode/decode/migrate/validate plan, actor IDs, prop links, and missing placeholders before live apply; preserve old rule remap and path canonicalization. |
|
||||||
|
| `StageActionQueueController extends RefCounted` and `StageDirectorController extends Node` | Coordinate atomic draft/commit by string action ID, capture, step edits, pausable history guard, and plan UI intent. Convert delayed editor/capture references from index/session `int` to stable `String`; re-resolve against the live plan on commit. |
|
||||||
|
| `StageDirectorVisuals extends Node2D` | Produce one route/marker projection shared by draw and hit. Hit result uses `action_id: String`, not a stale index. Keep rule visuals independent. |
|
||||||
|
| `QueuePanel extends PopupPanel` / `ActionEditor extends PopupPanel` | Reuse action-type editing/composer behavior where it fits. The selected-character Step Stack becomes the primary DIRECT plan view; retire or adapt the flat queue popup without a second conflicting authoring source. Dialogs need their own focus/capture layout and should not be forced into `StageInspectorPanel`. |
|
||||||
|
|
||||||
|
Suggested event flow:
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
UI[Step Stack / flag hit] --> Intent[StageActionQueueController by action_id]
|
||||||
|
Intent --> Draft[Editor or destination capture]
|
||||||
|
Draft -->|Done and valid| Plan[StageActionPlan commit]
|
||||||
|
Draft -->|Cancel| UI
|
||||||
|
Plan --> Rig[StickmanRig plan facade]
|
||||||
|
Rig --> Draw[StageDirectorVisuals projection]
|
||||||
|
Rig --> IO[StageSceneAdapter -> StageSceneIO v1.9]
|
||||||
|
Rig --> Runner[StickmanActionRunner]
|
||||||
|
Runner -->|started / ended with outcome| Stage[SandboxStage listeners]
|
||||||
|
```
|
||||||
|
|
||||||
|
All UI and visual pointers re-resolve action ID at commit/hit; index is only a derived display position. Selection and opening Action options are read-only. `queue_changed`/plan-changed refresh happens after one valid transaction; mark the Stage document dirty exactly once per commit. Cancel, invalid input, selection, and hover never mark dirty.
|
||||||
|
|
||||||
|
### Bounded pursuit for named props
|
||||||
|
|
||||||
|
At this Move's start, resolve `target_prop_id` to the exact live `PropBlock`, including a missing placeholder check. Project `prop.global_position + approach_offset` onto a reachable terrain approach point, retaining the offset in world axes even while the rigid body spins. While the Move is active, sample the prop's translation before locomotion's movement tick and retarget only after both a meaningful target shift and a minimum interval (initial tuning: at least 16 world units **and** 0.1 seconds since the last retarget) so a rolling ball does not restart the walk animation or repath every tiny physics move. The implementation may tune thresholds from rendered/behavior checks but must retain a finite budget (initial candidate: 12 seconds of unpaused active pursuit). A settled prop simply leaves the latest destination in place; if it moves again before arrival, retarget while budget remains.
|
||||||
|
|
||||||
|
Success requires the actor to finish arrival at the **current** ground-projected approach point *and* the live prop to be within the interaction reach used for an ordinary grounded actor/prop approach. Arrival at a stale point, or directly under an airborne out-of-reach prop, is not success: continue waiting/retargeting until reachable or timeout. A vanished/unresolvable prop, blocked/unreachable path, invalid ground projection, or expired budget ends the Move as `FAILED`, advances the step when its other action ends, and emits no successful endpoint moment. The failure may show brief child-facing feedback and an action status, without a blocking popup during PLAY. Freeze the budget during pause; STOP cancels it. Ensure `StickmanRig.arrived`/legacy waypoint rules do not receive a false intermediate arrival from a retargeted prop Move; later action-specific endpoint events must derive from `planned_action_ended(..., SUCCEEDED)` for that exact ID. A free-place Move keeps the existing finite walk target and arrival behavior.
|
||||||
|
|
||||||
|
This Move is finite pursuit of *one prop for one destination action*. It ends when reached or failed. The future 20c **Follow** action is a different authored action with its own explicit stop condition and continues to track after catch-up; do not turn every prop-linked Move into an indefinite Follow.
|
||||||
|
|
||||||
|
### Paused DIRECT invariants
|
||||||
|
|
||||||
|
Step reorder and Add together are allowed only on wholly future steps. A step containing any `ACTIVE`, `SUCCEEDED`, `FAILED`, `CANCELLED`, or legacy interrupted action cannot be regrouped or reordered; disable those structural controls with a concise reason. Completed/interrupted action **contents** cannot be edited, retargeted, or moved during this run, but their rows retain **Erase action** with the normal confirmation, matching Phase 12. That deletion removes the authored action for the next run while leaving consumed runtime history and already-emitted outcomes untouched; if it empties a step, remove that step from the saved plan without replaying or renumbering the live execution cursor. Preserve the existing ability to replace/delete the active action while paused: cancel that action's live track, keep the unaffected concurrent action/status in the same step, re-resolve by stable ID, then run the replacement or finish the step as appropriate. Editing a pending action preserves its ID and cannot alter an already-started Say event. Future-step edits rebuild only future runtime snapshots. Resume uses the modified future plan; STOP/PLAY starts from the authored beginning.
|
||||||
|
|
||||||
|
## Acceptance and verification plan
|
||||||
|
|
||||||
|
The roadmap requires automated behavior/persistence assertions, production-path interaction, and rendered UIUX review against the style guide/mockups. The checks below define the acceptance scope; completion status is recorded above.
|
||||||
|
|
||||||
|
### 1. Automated behavior and persistence
|
||||||
|
|
||||||
|
1. Validate singleton steps and Say paired with every other registered action type; reject primary+primary, Say+Say, a third action, empty steps, duplicate/blank action IDs, malformed destination variants, nonfinite vectors, and unknown style. Confirm **+ Add together** appears on a standalone Say step and offers all other action types, while every other singleton offers Say. Confirm the picker omits choices that would create an invalid pair. Confirm all edit/reorder/regroup/retarget operations retain IDs, duplicate actor regenerates every copied action ID, and invalid/cancel creates no saved mutation.
|
||||||
|
2. Load v1.0–v1.8 fixtures; assert Phase 20a IDs/names, background/wall migrations, deterministic legacy action IDs, fixed Move targets becoming places, and current `.scene` v1.9 save/reopen preserving every action, speech payload, prop target ID/offset, and existing generic rules. Reject malformed current v1.9 plans before the live World is cleared. Save/reload missing actor and missing/deleted prop references without silently turning them into coordinates.
|
||||||
|
3. Run a small repeated step timing scenario: a plan with `Step 1 = Walk 180 units + Say 3 seconds`, `Step 2 = Wait 0.5 seconds`. Record physics timestamps for both Step 1 starts, Walk end, Say end, and Wait start. Both starts occur in the same runner tick; Wait starts only after `max(Walk end, Say end)`. Repeat with Wait+Say and Recover+Say, STOP/PLAY, and pause/resume. A failed Move still lets its Say finish before the next step.
|
||||||
|
4. Run a repeatable moving-prop scenario on simple Ground: actor Move targets a named rigid ball with a fixed world-left offset; move and spin the ball during the action. Confirm destination updates with translation but not rotation, gait does not restart on retarget, and success occurs only after the actor reaches the latest approach and the ball is within reach. Repeat with an airborne ball over the actor (no early success), a removed target, a blocking prop/path, timeout, and pause (budget frozen). Assert no reached-endpoint event on failure or stale intermediate arrival.
|
||||||
|
5. Check existing generic rule/queue callers and old `keep_acting` migration cases. A new grouped Say remains active to its real end. Existing rule `file_id` remaps, prop Use/Pick Up IDs, and `ContentPaths` behavior survive.
|
||||||
|
|
||||||
|
### 2. Production-path interaction
|
||||||
|
|
||||||
|
In the real Sandbox Stage, verify EDIT with no selection has no plan markers; selecting a stickman and a prop individually shows one cyan stage-name badge each; mixed multi-selection shows every selected named object badge without overlap or input interception; and the **Objects here** candidate preview suppresses persistent badges. Keep each selected object's badge anchor stable through translate/rotate/scale, release, camera pan, and zoom. Reposition only if that anchor becomes obstructed by the actor, another badge, a transform handle, Stage chrome, an inspector, or the safe viewport; keep unaffected multi-selection badges anchored. Plan routes and action markers stay hidden throughout EDIT. In DIRECT, verify an empty stage with no selection has no plan markers, and selecting exactly one actor restores Step Spotlight. Place the actor-name badge at least 24 screen pixels above the actual visible head shape, including headwear; when the top safe area prevents that placement, move the badge beside the head with a short tether and keep it inside the safe viewport. Select an empty-plan Milo, see the empty message and fixed quick actions, then dismiss on empty stage and reselect. Add Move by Walk/Run and exact prop/place selection; add Say to the selected step via **+ Add together**, then append Wait with its quick action. Select an action in Step 2, then click Step 1's plain title; verify the old action options close and its amber highlight clears. Verify that clicking blank card space and each child control selects its owning card while preserving that control's action. Hover over a step title and verify the text remains stationary with no tooltip. Tab to a card, verify the white inset focus outline, and use Enter/Space to select it. Verify **↑**/**↓** buttons reorder future steps, preserve action IDs, and remain disabled at boundaries or when runtime state forbids reordering. Observe Step 1 **Together** and Step 2 Wait, play and observe concurrent Walk+Say with the barrier before Wait. On a standalone Say step, open **+ Add together** and verify the drawer offers every other registered action; on any other singleton, verify it offers Say. Confirm the picker never offers Say+Say or primary+primary and the two-action card cap stays enforced. Use the reorder arrows and verify numbering, routes, action IDs, and saved order.
|
||||||
|
|
||||||
|
Select Ragdoll, Recover, or Drop Prop from the add/change picker and verify each commits immediately without opening an editor; replacement keeps the action ID, and parameter-free cards have no **Edit action** button.
|
||||||
|
|
||||||
|
Place two instances of the same prop asset, select one by current distinct stage name/visual preview, rename it in EDIT, and verify the Move card/flag update while the saved target ID stays fixed. Place a free destination beside that prop and verify it remains **Place N**. In DIRECT, select a multi-step character and verify only the focused route is bright, other actors' routes are hidden, and other movement steps retain faint numbered flags; click a step card and a ghost flag to switch focus without dirtying the scene. Check the rounded name/action badges, long-name elision, route contrast over sky/building/grass, and that marker labels stay away from route crossings. Tap one numbered flag: the correct existing action opens with no dirty mark or move. Open **Edit action**, inspect the old faint and candidate routes while retargeting, Cancel/Escape, then retarget to the other prop and to a free place; verify the same action ID and saved destination variant each time. Open **Change action** on a standalone Move, verify the slide-in picker lists other types, then Cancel and confirm the plan stays clean. Choose Wait, Cancel its editor, and confirm the Move and ID remain; repeat and commit, then verify Wait replaced Move under the same ID. In a Move+Say Together step, verify changing Move offers all other primary actions except Move, while Say has no **Change action** control; in Wait+Say, changing Wait offers all other primary actions except Wait. Check that Pick Up stays anchored to its prop while Say stays by the actor, and that Recover+Say pills stack without overlap. Check invalid terrain, overlap chooser Cancel, keyboard-only target selection, and speech composer Cancel. Pause during a grouped step: active replace/delete works; grouping/reorder offers only future steps. After one action completes or is interrupted, verify its options offer confirmed Erase but not Edit action; delete it, resume without replaying history, then Reset and confirm the deletion affects the next run.
|
||||||
|
|
||||||
|
### 3. Rendered captures and UIUX review
|
||||||
|
|
||||||
|
Capture the actual GUI states reached by those interactions, not an isolated screenshot generator: EDIT empty selection, selected actor/prop names, mixed multi-selection labels, badge position during a real drag, and overlap chooser preview; DIRECT empty selection, focused Step 1, clear name-to-head gap, and top-edge tether fallback; the Choose an action picker with scrolling and a pinned Cancel button; the Together picker for a standalone Say showing every other action and for another singleton offering Say, without compatibility helper copy; Walk+Say stacked action pills and a later Wait; a prop action+Say with Pick Up over its prop and Say by the actor; Recover+Say with distinct stacked action pills; exact prop roster/preview and 20a overlap chooser; free place near a prop; selected flag/options with stacked Edit, Change, and Erase controls; the Change action drawer for a standalone action and for a Together pair with only compatible replacement choices; Cancel from the drawer/editor and a committed replacement preserving the action ID; Move retarget old/candidate/invalid/Cancel through Edit action; focused standalone Say and Wait pills, stacked Wait+Say pills, and compact overview markers; paused active/future controls; and playback start/barrier frames. Include wide and approximately 920×560 viewports with a long character name and eight or more steps, visible header/quick buttons, body scrolling, bold 48×48 px reorder arrows, an animated adjacent-card swap with the moved card in front, persistent selected-card/action identity, preserved scroll/focus, plain stationary step titles with no tooltip, blank-card and child-control selection, keyboard focus outline, and safe capture bar placement. Compare against the branch-local mockups and `docs/guides/editor_visual_style_guide.md`; record any intentional deviation. An automated assertion, log line, or image file alone is not proof that the production interaction and visual state were reached.
|
||||||
|
|
||||||
|
## Implementation and verification record
|
||||||
|
|
||||||
|
### Delivered
|
||||||
|
|
||||||
|
- **Plan data and identity:** Scene v1.9 stores ordered `action_plan` steps with stable string `action_id` values. Move destinations explicitly identify a free `place` or a prop by its stable stage object ID and world-aligned approach offset. Legacy flat queues are migrated to plans.
|
||||||
|
- **Step execution:** A step may contain one primary action and one Say. They start together; the next step waits until both finish. The runner records per-action outcomes, and a failed Move does not count as reaching its endpoint. Named-prop pursuit follows translation without rotating the saved offset, pauses its time budget with the simulation, and fails on a missing target, blocked or unreachable route, or expired pursuit budget.
|
||||||
|
- **DIRECT authoring:** The inspector provides the ordered Step Stack, quick actions, compatible Add together choices, action editing/replacement, cancellation, and step reordering. Selection follows the same action through reorder; route spotlight and on-stage action markers follow the focused step.
|
||||||
|
- **Target and prop feedback:** Stage target capture uses a visible Cancel and action-specific preview. Pickup selection uses friendly prop names and eligible-target feedback; Set Down highlights only valid support surfaces. Prop interaction safety protects an intended pickup target from its approaching actor and gives the releasing actor collision grace after Set Down.
|
||||||
|
|
||||||
|
### Verification evidence
|
||||||
|
|
||||||
|
- The automated action-plan suite recorded **45 checks, 0 failures** in [the final log](../../tests/phase20b_action_plan_test_final.log). Its checks cover plan validation and serialization, stable IDs, grouped-action timing/barriers, pause behavior, moving-prop retargeting, and missing-target failure. The test source is [test_phase20b_action_plan.gd](../../tests/test_phase20b_action_plan.gd).
|
||||||
|
- Focused production-GUI runs recorded passing results for selected slices, including grouped authoring, action drawer, step spotlight/reorder, flag selection, and Move editing. Examples include [grouping](../../tests/phase20b_grouping_success_check.log), [Step Spotlight](../../tests/phase20b_step_spotlight_final.log), and [action drawer](../../tests/phase20b_action_drawer_full_height.log). These are targeted slice results, not a single run of every item in the broader GUI checklist above.
|
||||||
|
- The user reported completing and passing the following seven manual scenarios:
|
||||||
|
1. **Airborne target:** pursuing a prop above the actor does not count as arrival before it is reachable.
|
||||||
|
2. **Blocked route:** a blocked Move does not pass through the obstacle or report success, and eventually fails.
|
||||||
|
3. **Timeout and missing target:** both cases fail without an arrival result or a stalled plan.
|
||||||
|
4. **Pause during pursuit:** pausing longer than the pursuit limit does not consume the budget; pursuit resumes toward the prop's current position. Fixture: [Test 4](../../content/stages/phase20b_test4_pause_during_pursuit.scene).
|
||||||
|
5. **Save, reload, rename, and delete:** a prop Move retains its identity through rename and remains repairable after deletion; a nearby free destination remains a place target. Fixture: [Test 5](../../content/stages/phase20b_test5_target_identity.scene).
|
||||||
|
6. **DIRECT editing and focus:** Move+Say grouping, adding Wait, selection/focus changes, reorder identity, and Change Action cancellation behave as expected. Fixture: [Test 6](../../content/stages/phase20b_test6_direct_editing_focus.scene).
|
||||||
|
7. **Target picking and cancel:** Escape cancels place, Pick Up, and Set Down capture without committing the draft; the inspector and target feedback recover. Fixture: [Test 7](../../content/stages/phase20b_test7_target_picking_cancel.scene).
|
||||||
|
|
||||||
|
### Remaining boundary
|
||||||
|
|
||||||
|
The user-verified seven-case matrix and the cited automated/GUI slices do not establish that every detailed item in the broad acceptance matrix was independently exercised and captured. In particular, the complete production-interaction matrix and a recorded UI/UX review remain unrecorded as a single sign-off. Phase 20b does not include event-specific reaction authoring or reaction runtime; those remain in Phases 20c–20e.
|
||||||
|
|
||||||
|
## Decisions and trade-offs
|
||||||
|
|
||||||
|
- **Nested steps and string IDs:** A true step array makes order and barrier semantics explicit. Persistent opaque strings cost more migration and adaptation than flat session indices but keep later event links stable under edits and saves. Step numbers remain derived, avoiding unnecessary step identity.
|
||||||
|
- **Explicit destination kind:** The discriminated payload prevents proximity inference and keeps prop rename separate from identity. A cached last-known approach supports repairable missing targets; it never acts as an implicit fallback success location.
|
||||||
|
- **Finite live pursuit:** Retargeting by world-aligned offset supports moving/spinning props without creating a perpetual Follow. Throttling avoids gait resets/repath churn; a bounded budget means a continually moving prop eventually fails, so the plan cannot stall forever.
|
||||||
|
- **One primary plus one Say:** A user update broadened the rule to every currently registered primary action type. The explicit pair preserves the runner's existing primary/speech split, prevents ambiguous primary+primary and Say+Say steps, and still defers a general parallel action scheduler until later phases need evidence for one.
|
||||||
|
- **Shared Stage shell, specialized plan body:** Extend `StageInspectorPanel` for pinned quick actions and use shared theme/capture/dialog patterns. The plan card and route preview remain domain-specific; modal action editing keeps its own focus model.
|
||||||
|
- **Legacy behavior:** Migrating flat queues is deterministic, while old nonblocking `keep_acting` may need a narrow compatibility flag. It must be visibly tested and must not leak into newly authored grouped steps.
|
||||||
|
|
||||||
|
> Historical note: The user approved this spec before implementation. The implementation and verification record above documents the current delivery and evidence status.
|
||||||
+67
-3
@@ -100,7 +100,7 @@
|
|||||||
"dialogs": {
|
"dialogs": {
|
||||||
"queue_size": [680, 520],
|
"queue_size": [680, 520],
|
||||||
"rule_size": [720, 560],
|
"rule_size": [720, 560],
|
||||||
"action_size": [560, 390],
|
"action_size": [560, 460],
|
||||||
"confirm_size": [560, 300],
|
"confirm_size": [560, 300],
|
||||||
"font_size": 22,
|
"font_size": 22,
|
||||||
"message_font_size": 20
|
"message_font_size": 20
|
||||||
@@ -289,6 +289,7 @@
|
|||||||
"stage_panels": {
|
"stage_panels": {
|
||||||
"shell": {
|
"shell": {
|
||||||
"preferred_width": 380,
|
"preferred_width": 380,
|
||||||
|
"max_width": 380,
|
||||||
"edge_inset": 12,
|
"edge_inset": 12,
|
||||||
"padding": 12,
|
"padding": 12,
|
||||||
"header_gap": 8,
|
"header_gap": 8,
|
||||||
@@ -380,13 +381,74 @@
|
|||||||
"completed_path_color": "#959EAD",
|
"completed_path_color": "#959EAD",
|
||||||
"rule_connector_color": "#AAB2C0",
|
"rule_connector_color": "#AAB2C0",
|
||||||
"rule_action_color": "#7E57C2",
|
"rule_action_color": "#7E57C2",
|
||||||
|
"director_plan": {
|
||||||
|
"route_color": "#8BD9FF",
|
||||||
|
"run_color": "#FFB300",
|
||||||
|
"say_color": "#FFD84D",
|
||||||
|
"wait_color": "#B69CFF",
|
||||||
|
"completed_color": "#959EAD",
|
||||||
|
"failed_color": "#F05B57",
|
||||||
|
"candidate_valid_color": "#4DE666",
|
||||||
|
"candidate_invalid_color": "#FF626B",
|
||||||
|
"flag_size_px": 44,
|
||||||
|
"flag_number_size_px": 18,
|
||||||
|
"label_bg_color": "#101720E8",
|
||||||
|
"label_border_alpha": 0.8,
|
||||||
|
"spotlight_route_width_px": 4,
|
||||||
|
"spotlight_route_shadow_width_px": 6,
|
||||||
|
"spotlight_dash_length_px": 12,
|
||||||
|
"spotlight_dash_gap_px": 7,
|
||||||
|
"spotlight_route_alpha": 0.95,
|
||||||
|
"unfocused_step_alpha": 0.24,
|
||||||
|
"action_badge_font_size_px": 18,
|
||||||
|
"action_badge_padding_px": [10, 6],
|
||||||
|
"action_badge_radius_px": 11,
|
||||||
|
"action_badge_border_width_px": 2,
|
||||||
|
"action_badge_icon_slot_width_px": 22,
|
||||||
|
"action_badge_icon_text_gap_px": 6,
|
||||||
|
"action_badge_icon_scale": 0.72,
|
||||||
|
"action_badge_stack_gap_px": 4,
|
||||||
|
"action_badge_route_gap_px": 6,
|
||||||
|
"actor_name_font_size_px": 20,
|
||||||
|
"actor_name_max_width_px": 260,
|
||||||
|
"actor_name_padding_px": [12, 7],
|
||||||
|
"actor_name_radius_px": 12,
|
||||||
|
"actor_name_border_width_px": 2,
|
||||||
|
"actor_name_offset_px": 26,
|
||||||
|
"route_badge_fraction": 0.32,
|
||||||
|
"actor_name_border_color": "#FFB300",
|
||||||
|
"action_badge_text_color": "#F5F7FA",
|
||||||
|
"route_shadow_color": "#101720D9",
|
||||||
|
"action_row_move_surface": "#17313D",
|
||||||
|
"action_row_say_surface": "#2C281C",
|
||||||
|
"action_row_wait_surface": "#29243A",
|
||||||
|
"action_row_other_surface": "#202632",
|
||||||
|
"action_row_icon_surface": "#252B38",
|
||||||
|
"action_row_text_color": "#F5F7FA",
|
||||||
|
"action_row_duration_color": "#AAB2C0",
|
||||||
|
"action_row_options_color": "#8E9AAA",
|
||||||
|
"action_row_font_size_px": 18,
|
||||||
|
"action_row_duration_font_size_px": 14,
|
||||||
|
"action_row_icon_font_size_px": 20,
|
||||||
|
"action_row_height_px": 48,
|
||||||
|
"action_row_icon_size_px": 32,
|
||||||
|
"action_row_rail_width_px": 4,
|
||||||
|
"action_row_options_width_px": 24,
|
||||||
|
"action_row_options_font_size_px": 18,
|
||||||
|
"action_row_radius_px": 8,
|
||||||
|
"action_row_selected_border_width_px": 2
|
||||||
|
},
|
||||||
"valid": { "color": "#4DE66680" },
|
"valid": { "color": "#4DE66680" },
|
||||||
"same_type": { "color": "#FFFFFF26" },
|
"same_type": { "color": "#FFFFFF26" },
|
||||||
"invalid": { "color": "#FF4D4D80" },
|
"invalid": { "color": "#FF4D4D80" },
|
||||||
"set_down": {
|
"set_down": {
|
||||||
"unknown_color": "#C5CAD4",
|
"unknown_color": "#C5CAD4",
|
||||||
"reach_color": "#FFB300",
|
"reach_color": "#FFB300",
|
||||||
"ghost_alpha": 0.36
|
"ghost_alpha": 0.36,
|
||||||
|
"surface_line_width_px": 5,
|
||||||
|
"surface_hover_line_width_px": 7,
|
||||||
|
"surface_alpha": 0.75,
|
||||||
|
"surface_hover_alpha": 0.95
|
||||||
},
|
},
|
||||||
"use_preview": {
|
"use_preview": {
|
||||||
"valid_color": "#42D887",
|
"valid_color": "#42D887",
|
||||||
@@ -405,7 +467,9 @@
|
|||||||
"candidate_name_pill_corner_radius": 8.0,
|
"candidate_name_pill_corner_radius": 8.0,
|
||||||
"candidate_name_pill_border_width": 3.0,
|
"candidate_name_pill_border_width": 3.0,
|
||||||
"candidate_name_pill_padding_x": 12.0,
|
"candidate_name_pill_padding_x": 12.0,
|
||||||
"candidate_name_pill_padding_y": 8.0
|
"candidate_name_pill_padding_y": 8.0,
|
||||||
|
"selected_name_pill_font_size_px": 20.0,
|
||||||
|
"selected_name_pill_max_width_px": 260.0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"widgets": {
|
"widgets": {
|
||||||
|
|||||||
@@ -5,11 +5,18 @@ extends Node
|
|||||||
## locomotion and signals requests back to the facade.
|
## locomotion and signals requests back to the facade.
|
||||||
|
|
||||||
const ACTION_REGISTRY := preload("res://scripts/stage/action_registry.gd")
|
const ACTION_REGISTRY := preload("res://scripts/stage/action_registry.gd")
|
||||||
|
const STAGE_ACTION_PLAN := preload("res://scripts/stage/stage_action_plan.gd")
|
||||||
|
const STAGE_ACTION_IDENTITY := preload("res://scripts/stage/stage_action_identity.gd")
|
||||||
|
const MISSING_PROP_PLACEHOLDER := preload("res://scripts/props/missing_prop_placeholder.gd")
|
||||||
|
const PROP_INTERACTION_REACH: float = 110.0
|
||||||
|
const PROP_PURSUIT_MIN_SHIFT: float = 16.0
|
||||||
|
const PROP_PURSUIT_RETARGET_INTERVAL: float = 0.1
|
||||||
|
const PROP_PURSUIT_BUDGET: float = 12.0
|
||||||
const SPEECH_BUBBLE_SCRIPT := preload("res://scripts/speech/stickman_speech_bubble.gd")
|
const SPEECH_BUBBLE_SCRIPT := preload("res://scripts/speech/stickman_speech_bubble.gd")
|
||||||
const SPEECH_PAYLOAD := preload("res://scripts/speech/speech_payload.gd")
|
const SPEECH_PAYLOAD := preload("res://scripts/speech/speech_payload.gd")
|
||||||
|
|
||||||
enum RunnerState { IDLE, EXECUTING }
|
enum RunnerState { IDLE, EXECUTING }
|
||||||
enum ActionPhase { NONE, WALKING, SPEAKING, WAITING, RAGDOLLING, RECOVERING, PROP_INTERACTION }
|
enum ActionPhase { NONE, WALKING, SPEAKING, WAITING, RAGDOLLING, RECOVERING, PROP_INTERACTION, GROUP_BARRIER, PURSUIT_WAIT }
|
||||||
enum QueueStatus { NOT_STARTED, COMPLETED, INTERRUPTED, ACTIVE, PENDING }
|
enum QueueStatus { NOT_STARTED, COMPLETED, INTERRUPTED, ACTIVE, PENDING }
|
||||||
|
|
||||||
signal action_started(action: Dictionary, index: int)
|
signal action_started(action: Dictionary, index: int)
|
||||||
@@ -20,8 +27,12 @@ signal speech_finished
|
|||||||
signal ragdoll_requested(enabled: bool)
|
signal ragdoll_requested(enabled: bool)
|
||||||
signal recovery_requested
|
signal recovery_requested
|
||||||
signal active_action_cancelled(action: Dictionary)
|
signal active_action_cancelled(action: Dictionary)
|
||||||
|
signal planned_action_started(action_id: String, action: Dictionary, step_index: int)
|
||||||
|
signal planned_action_ended(action_id: String, outcome: StringName, step_index: int)
|
||||||
|
signal plan_changed
|
||||||
|
|
||||||
var _authored_queue: Array[Dictionary] = []
|
var _authored_queue: Array[Dictionary] = []
|
||||||
|
var _authored_steps: Array[Dictionary] = []
|
||||||
var action_queue: Array[Dictionary]:
|
var action_queue: Array[Dictionary]:
|
||||||
get:
|
get:
|
||||||
return _authored_queue.duplicate(true)
|
return _authored_queue.duplicate(true)
|
||||||
@@ -43,7 +54,26 @@ var _speech_bubble: Node2D = null
|
|||||||
var _speech_preview_suppressed: bool = false
|
var _speech_preview_suppressed: bool = false
|
||||||
var _action_ids: Array[int] = []
|
var _action_ids: Array[int] = []
|
||||||
var _next_action_id: int = 1
|
var _next_action_id: int = 1
|
||||||
|
var _stable_to_numeric_ids: Dictionary = {}
|
||||||
|
var _stable_status: Dictionary = {}
|
||||||
var _current_action_id: int = -1
|
var _current_action_id: int = -1
|
||||||
|
var _current_stable_action_id: String = ""
|
||||||
|
var _current_step_index: int = -1
|
||||||
|
var _active_step_entry: Dictionary = {}
|
||||||
|
var _group_say_action_id: String = ""
|
||||||
|
var _group_say_numeric_id: int = -1
|
||||||
|
var _group_say_step_index: int = -1
|
||||||
|
var _group_say_action: Dictionary = {}
|
||||||
|
var _group_say_barrier: bool = false
|
||||||
|
var _group_primary_done: bool = false
|
||||||
|
var _parallel_active_numeric_ids: Dictionary = {}
|
||||||
|
var _pursuit_action_id: String = ""
|
||||||
|
var _pursuit_prop_id: String = ""
|
||||||
|
var _pursuit_offset: Vector2 = Vector2.ZERO
|
||||||
|
var _pursuit_last_prop_position: Vector2 = Vector2.ZERO
|
||||||
|
var _pursuit_approach: Vector2 = Vector2.INF
|
||||||
|
var _pursuit_elapsed: float = 0.0
|
||||||
|
var _pursuit_retarget_elapsed: float = 0.0
|
||||||
var _completed_ids: Dictionary = {}
|
var _completed_ids: Dictionary = {}
|
||||||
var _interrupted_ids: Dictionary = {}
|
var _interrupted_ids: Dictionary = {}
|
||||||
var _paused: bool = false
|
var _paused: bool = false
|
||||||
@@ -70,8 +100,14 @@ func tick(delta: float, rig_state: int, ragdoll_at_rest: bool) -> void:
|
|||||||
_advance_to_next_action()
|
_advance_to_next_action()
|
||||||
ActionPhase.WALKING:
|
ActionPhase.WALKING:
|
||||||
if _locomotion != null:
|
if _locomotion != null:
|
||||||
if _locomotion.consume_walk_failed() or _locomotion.consume_walk_completed():
|
if _locomotion.consume_walk_failed():
|
||||||
_finish_action()
|
_end_prop_pursuit()
|
||||||
|
_finish_action(&"failed")
|
||||||
|
elif _locomotion.consume_walk_completed():
|
||||||
|
if _pursuit_action_id == _current_stable_action_id:
|
||||||
|
_check_prop_pursuit_arrival()
|
||||||
|
else:
|
||||||
|
_finish_action(&"succeeded")
|
||||||
ActionPhase.SPEAKING:
|
ActionPhase.SPEAKING:
|
||||||
if _primary_speech.is_empty():
|
if _primary_speech.is_empty():
|
||||||
_finish_action()
|
_finish_action()
|
||||||
@@ -79,6 +115,11 @@ func tick(delta: float, rig_state: int, ragdoll_at_rest: bool) -> void:
|
|||||||
_phase_timer -= delta
|
_phase_timer -= delta
|
||||||
if _phase_timer <= 0.0:
|
if _phase_timer <= 0.0:
|
||||||
_finish_action()
|
_finish_action()
|
||||||
|
ActionPhase.GROUP_BARRIER:
|
||||||
|
if not _group_say_barrier or _group_say_action_id.is_empty():
|
||||||
|
_complete_active_step()
|
||||||
|
ActionPhase.PURSUIT_WAIT:
|
||||||
|
pass
|
||||||
ActionPhase.RAGDOLLING:
|
ActionPhase.RAGDOLLING:
|
||||||
if ragdoll_at_rest:
|
if ragdoll_at_rest:
|
||||||
_finish_action()
|
_finish_action()
|
||||||
@@ -91,6 +132,48 @@ func tick(delta: float, rig_state: int, ragdoll_at_rest: bool) -> void:
|
|||||||
_finish_action()
|
_finish_action()
|
||||||
|
|
||||||
|
|
||||||
|
func pre_movement(delta: float) -> void:
|
||||||
|
if _paused or _pursuit_action_id.is_empty() or _action_phase not in [ActionPhase.WALKING, ActionPhase.PURSUIT_WAIT]:
|
||||||
|
return
|
||||||
|
_pursuit_elapsed += delta
|
||||||
|
_pursuit_retarget_elapsed += delta
|
||||||
|
if _pursuit_elapsed >= PROP_PURSUIT_BUDGET:
|
||||||
|
if _locomotion != null:
|
||||||
|
_locomotion.cancel_walk(false)
|
||||||
|
_end_prop_pursuit()
|
||||||
|
_finish_action(&"failed")
|
||||||
|
return
|
||||||
|
var prop: PropBlock = _resolve_pursuit_prop(_pursuit_prop_id)
|
||||||
|
if prop == null:
|
||||||
|
if _locomotion != null:
|
||||||
|
_locomotion.cancel_walk(false)
|
||||||
|
_end_prop_pursuit()
|
||||||
|
_finish_action(&"failed")
|
||||||
|
return
|
||||||
|
var prop_position: Vector2 = prop.global_position
|
||||||
|
if prop_position.distance_to(_pursuit_last_prop_position) < PROP_PURSUIT_MIN_SHIFT or _pursuit_retarget_elapsed < PROP_PURSUIT_RETARGET_INTERVAL:
|
||||||
|
return
|
||||||
|
var projected: Vector2 = _locomotion.project_target_to_navigation(prop_position + _pursuit_offset) if _locomotion != null else Vector2.INF
|
||||||
|
var move_style: String = ACTION_REGISTRY.checked_style(String(_current_run_item.get("action", {}).get("style", ACTION_REGISTRY.WALK)))
|
||||||
|
var retargeted: bool = false
|
||||||
|
if projected.is_finite() and _locomotion != null:
|
||||||
|
retargeted = _locomotion.retarget_walk(projected) if _locomotion.is_walking() else _locomotion.move_to(projected, move_style)
|
||||||
|
if not projected.is_finite() or not retargeted:
|
||||||
|
if _locomotion != null:
|
||||||
|
_locomotion.cancel_walk(false)
|
||||||
|
_end_prop_pursuit()
|
||||||
|
_finish_action(&"failed")
|
||||||
|
return
|
||||||
|
_pursuit_last_prop_position = prop_position
|
||||||
|
_pursuit_approach = projected
|
||||||
|
_pursuit_retarget_elapsed = 0.0
|
||||||
|
_action_phase = ActionPhase.WALKING
|
||||||
|
|
||||||
|
|
||||||
|
func is_prop_pursuit_active() -> bool:
|
||||||
|
return not _pursuit_action_id.is_empty()
|
||||||
|
|
||||||
|
|
||||||
func speak(text: String, duration: float) -> void:
|
func speak(text: String, duration: float) -> void:
|
||||||
speak_action({"type": "speak", "text": text, "duration": maxf(duration, 0.0)})
|
speak_action({"type": "speak", "text": text, "duration": maxf(duration, 0.0)})
|
||||||
|
|
||||||
@@ -134,111 +217,286 @@ func sync_facing(profile: int) -> void:
|
|||||||
func set_authored_queue(actions: Array[Dictionary]) -> bool:
|
func set_authored_queue(actions: Array[Dictionary]) -> bool:
|
||||||
if _session_started:
|
if _session_started:
|
||||||
return false
|
return false
|
||||||
_authored_queue = actions.duplicate(true)
|
var steps: Array[Dictionary] = []
|
||||||
_action_ids.clear()
|
for source_action: Dictionary in actions:
|
||||||
for _action: Dictionary in _authored_queue:
|
var action: Dictionary = source_action.duplicate(true)
|
||||||
_action_ids.append(_allocate_action_id())
|
action["action_id"] = _allocate_stable_action_id()
|
||||||
|
if ACTION_REGISTRY.is_move_action(action) and action.get("target", null) is Vector2:
|
||||||
|
action["destination"] = {"kind": "place", "position": action["target"]}
|
||||||
|
action.erase("target")
|
||||||
|
steps.append({"actions": [action]})
|
||||||
|
_authored_steps = steps
|
||||||
|
_sync_legacy_queue()
|
||||||
queue_changed.emit()
|
queue_changed.emit()
|
||||||
|
plan_changed.emit()
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
func get_action_plan() -> Array[Dictionary]:
|
||||||
|
return _authored_steps.duplicate(true)
|
||||||
|
|
||||||
|
|
||||||
|
func set_action_plan(steps: Array[Dictionary]) -> bool:
|
||||||
|
if _session_started or not STAGE_ACTION_PLAN.validate_steps(steps).is_empty():
|
||||||
|
return false
|
||||||
|
_authored_steps = steps.duplicate(true)
|
||||||
|
_sync_legacy_queue()
|
||||||
|
queue_changed.emit()
|
||||||
|
plan_changed.emit()
|
||||||
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
func find_action(action_id: String) -> Dictionary:
|
||||||
|
return STAGE_ACTION_PLAN.find_action(_authored_steps, action_id)
|
||||||
|
|
||||||
|
|
||||||
|
func get_plan_view() -> Array[Dictionary]:
|
||||||
|
var result: Array[Dictionary] = []
|
||||||
|
for step_index: int in _authored_steps.size():
|
||||||
|
var actions_value: Variant = _authored_steps[step_index].get("actions", [])
|
||||||
|
if not actions_value is Array:
|
||||||
|
continue
|
||||||
|
for raw_action: Variant in actions_value:
|
||||||
|
if not raw_action is Dictionary:
|
||||||
|
continue
|
||||||
|
var action: Dictionary = raw_action as Dictionary
|
||||||
|
var action_id: String = String(action.get("action_id", ""))
|
||||||
|
result.append({
|
||||||
|
"step_index": step_index,
|
||||||
|
"action_id": action_id,
|
||||||
|
"action": action.duplicate(true),
|
||||||
|
"status": _status_for_stable_id(action_id),
|
||||||
|
"numeric_id": _numeric_for_stable_id(action_id),
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
func add_plan_step(action: Dictionary) -> String:
|
||||||
|
if _session_started and not _paused:
|
||||||
|
return ""
|
||||||
|
var created: Dictionary = _prepare_new_plan_action(action)
|
||||||
|
var next: Array[Dictionary] = STAGE_ACTION_PLAN.append_step(_authored_steps, created)
|
||||||
|
return String(created.get("action_id", "")) if _commit_plan_edit(next) else ""
|
||||||
|
|
||||||
|
|
||||||
|
func add_plan_action_together(step_index: int, action: Dictionary) -> String:
|
||||||
|
if _session_started and not _paused:
|
||||||
|
return ""
|
||||||
|
if _session_started and _paused and not _plan_step_is_future(step_index):
|
||||||
|
return ""
|
||||||
|
var created: Dictionary = _prepare_new_plan_action(action)
|
||||||
|
var next: Array[Dictionary] = STAGE_ACTION_PLAN.append_together(_authored_steps, step_index, created)
|
||||||
|
return String(created.get("action_id", "")) if _commit_plan_edit(next) else ""
|
||||||
|
|
||||||
|
|
||||||
|
func replace_plan_action(action_id: String, action: Dictionary) -> bool:
|
||||||
|
if _session_started and not _paused:
|
||||||
|
return false
|
||||||
|
var status: StringName = _status_for_stable_id(action_id)
|
||||||
|
if _session_started and _paused and status in [&"succeeded", &"failed", &"cancelled"]:
|
||||||
|
return false
|
||||||
|
var next: Array[Dictionary] = STAGE_ACTION_PLAN.replace_action(_authored_steps, action_id, action)
|
||||||
|
if next.is_empty() and not _authored_steps.is_empty():
|
||||||
|
return false
|
||||||
|
if _session_started and _paused and status == &"active":
|
||||||
|
_cancel_stable_action(action_id)
|
||||||
|
_stable_status[action_id] = &"pending"
|
||||||
|
return _commit_plan_edit(next)
|
||||||
|
|
||||||
|
|
||||||
|
func remove_plan_action(action_id: String) -> bool:
|
||||||
|
if _session_started and not _paused:
|
||||||
|
return false
|
||||||
|
var location: Dictionary = find_action(action_id)
|
||||||
|
if location.is_empty():
|
||||||
|
return false
|
||||||
|
if _status_for_stable_id(action_id) == &"active":
|
||||||
|
_cancel_stable_action(action_id)
|
||||||
|
var next: Array[Dictionary] = STAGE_ACTION_PLAN.remove_action(_authored_steps, action_id)
|
||||||
|
_stable_status.erase(action_id)
|
||||||
|
return _commit_plan_edit(next, true)
|
||||||
|
|
||||||
|
|
||||||
|
func move_plan_step(from_index: int, to_index: int) -> bool:
|
||||||
|
if _session_started and not _paused:
|
||||||
|
return false
|
||||||
|
if _session_started and _paused and (not _plan_step_is_future(from_index) or not _plan_step_is_future(to_index)):
|
||||||
|
return false
|
||||||
|
var next: Array[Dictionary] = STAGE_ACTION_PLAN.move_step(_authored_steps, from_index, to_index)
|
||||||
|
return _commit_plan_edit(next) if from_index != to_index else true
|
||||||
|
|
||||||
|
|
||||||
|
func can_add_plan_action_together(step_index: int, action_type: String) -> bool:
|
||||||
|
if _session_started and _paused and not _plan_step_is_future(step_index):
|
||||||
|
return false
|
||||||
|
if _session_started and not _paused:
|
||||||
|
return false
|
||||||
|
return step_index >= 0 and step_index < _authored_steps.size() and STAGE_ACTION_PLAN.can_add_together(_authored_steps[step_index], action_type)
|
||||||
|
|
||||||
|
|
||||||
|
func can_reorder_plan_step(step_index: int) -> bool:
|
||||||
|
if step_index < 0 or step_index >= _authored_steps.size():
|
||||||
|
return false
|
||||||
|
if _session_started and not _paused:
|
||||||
|
return false
|
||||||
|
return not _session_started or _plan_step_is_future(step_index)
|
||||||
|
|
||||||
|
|
||||||
|
func _prepare_new_plan_action(source_action: Dictionary) -> Dictionary:
|
||||||
|
var action: Dictionary = source_action.duplicate(true)
|
||||||
|
action["action_id"] = _allocate_stable_action_id()
|
||||||
|
if ACTION_REGISTRY.is_move_action(action) and not action.has("destination") and action.get("target", null) is Vector2:
|
||||||
|
action["destination"] = {"kind": "place", "position": action["target"]}
|
||||||
|
action.erase("target")
|
||||||
|
return action
|
||||||
|
|
||||||
|
|
||||||
|
func _commit_plan_edit(next: Array[Dictionary], allow_empty: bool = false) -> bool:
|
||||||
|
if next.is_empty() and not allow_empty:
|
||||||
|
return false
|
||||||
|
if not STAGE_ACTION_PLAN.validate_steps(next).is_empty():
|
||||||
|
return false
|
||||||
|
_authored_steps = next.duplicate(true)
|
||||||
|
_sync_legacy_queue()
|
||||||
|
if _session_started:
|
||||||
|
_rebuild_pending_runtime_queue()
|
||||||
|
queue_changed.emit()
|
||||||
|
plan_changed.emit()
|
||||||
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
func _sync_legacy_queue() -> void:
|
||||||
|
_authored_queue = STAGE_ACTION_PLAN.flatten(_authored_steps)
|
||||||
|
_action_ids.clear()
|
||||||
|
for action: Dictionary in _authored_queue:
|
||||||
|
var stable_id: String = String(action.get("action_id", ""))
|
||||||
|
if not _stable_to_numeric_ids.has(stable_id):
|
||||||
|
_stable_to_numeric_ids[stable_id] = _allocate_action_id()
|
||||||
|
_action_ids.append(int(_stable_to_numeric_ids[stable_id]))
|
||||||
|
|
||||||
|
|
||||||
|
func _allocate_stable_action_id() -> String:
|
||||||
|
var identity := STAGE_ACTION_IDENTITY.new() as StageActionIdentity
|
||||||
|
var world: Node2D = _rig.get_parent() as Node2D if _rig != null else null
|
||||||
|
return identity.allocate(world)
|
||||||
|
|
||||||
|
|
||||||
|
func _numeric_for_stable_id(action_id: String) -> int:
|
||||||
|
if not _stable_to_numeric_ids.has(action_id):
|
||||||
|
_stable_to_numeric_ids[action_id] = _allocate_action_id()
|
||||||
|
return int(_stable_to_numeric_ids[action_id])
|
||||||
|
|
||||||
|
|
||||||
|
func _status_for_stable_id(action_id: String) -> StringName:
|
||||||
|
if _stable_status.has(action_id):
|
||||||
|
return StringName(String(_stable_status[action_id]))
|
||||||
|
return &"pending" if _session_started else &"not_started"
|
||||||
|
|
||||||
|
|
||||||
|
func _plan_step_is_future(step_index: int) -> bool:
|
||||||
|
if step_index < 0 or step_index >= _authored_steps.size():
|
||||||
|
return false
|
||||||
|
var actions: Array = _authored_steps[step_index].get("actions", [])
|
||||||
|
for raw_action: Variant in actions:
|
||||||
|
if not raw_action is Dictionary:
|
||||||
|
return false
|
||||||
|
if _status_for_stable_id(String((raw_action as Dictionary).get("action_id", ""))) != &"pending":
|
||||||
|
return false
|
||||||
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
func _cancel_stable_action(action_id: String) -> void:
|
||||||
|
if action_id == _current_stable_action_id:
|
||||||
|
_cancel_current_primary(true)
|
||||||
|
_stable_status[action_id] = &"cancelled"
|
||||||
|
elif action_id == _group_say_action_id:
|
||||||
|
_overlay_speech.clear()
|
||||||
|
_parallel_active_numeric_ids.erase(_group_say_numeric_id)
|
||||||
|
_stable_status[action_id] = &"cancelled"
|
||||||
|
planned_action_ended.emit(action_id, &"cancelled", _group_say_step_index)
|
||||||
|
_group_say_action_id = ""
|
||||||
|
_group_say_numeric_id = -1
|
||||||
|
_group_say_action.clear()
|
||||||
|
if _group_say_barrier:
|
||||||
|
_group_say_barrier = false
|
||||||
|
|
||||||
|
|
||||||
func queue_action(action: Dictionary) -> void:
|
func queue_action(action: Dictionary) -> void:
|
||||||
insert_action(action_queue.size(), action)
|
insert_action(action_queue.size(), action)
|
||||||
|
|
||||||
|
|
||||||
func clear_queue() -> void:
|
func clear_queue() -> void:
|
||||||
_authored_queue.clear()
|
|
||||||
_action_ids.clear()
|
|
||||||
if not _current_run_item.is_empty():
|
if not _current_run_item.is_empty():
|
||||||
_cancel_current_primary(true)
|
_cancel_current_primary(true)
|
||||||
_current_action_id = -1
|
_current_action_id = -1
|
||||||
|
_current_stable_action_id = ""
|
||||||
|
_group_say_action_id = ""
|
||||||
|
_group_say_action.clear()
|
||||||
|
_overlay_speech.clear()
|
||||||
|
_authored_steps.clear()
|
||||||
|
_sync_legacy_queue()
|
||||||
_run_queue.clear()
|
_run_queue.clear()
|
||||||
_run_cursor = 0
|
_run_cursor = 0
|
||||||
if _session_started:
|
if _session_started:
|
||||||
_runner_state = RunnerState.IDLE
|
_runner_state = RunnerState.IDLE
|
||||||
queue_changed.emit()
|
queue_changed.emit()
|
||||||
|
plan_changed.emit()
|
||||||
|
|
||||||
|
|
||||||
func get_queue() -> Array[Dictionary]:
|
func get_queue() -> Array[Dictionary]:
|
||||||
return action_queue.duplicate(true)
|
return _authored_queue.duplicate(true)
|
||||||
|
|
||||||
|
|
||||||
func remove_action(index: int) -> void:
|
func remove_action(index: int) -> void:
|
||||||
if index < 0 or index >= action_queue.size():
|
if index < 0 or index >= _action_ids.size():
|
||||||
push_warning("StickmanActionRunner: remove_action index %d out of range." % index)
|
push_warning("StickmanActionRunner: remove_action index %d out of range." % index)
|
||||||
return
|
return
|
||||||
var action_id: int = _action_ids[index] if index < _action_ids.size() else -1
|
var stable_id: String = _stable_for_numeric_id(_action_ids[index])
|
||||||
var status: int = _status_for_action_id(action_id)
|
if not stable_id.is_empty():
|
||||||
if _session_started and _paused and status == QueueStatus.ACTIVE:
|
remove_plan_action(stable_id)
|
||||||
_cancel_current_primary(true)
|
|
||||||
_current_action_id = -1
|
|
||||||
_runner_state = RunnerState.IDLE
|
|
||||||
_authored_queue.remove_at(index)
|
|
||||||
if index < _action_ids.size():
|
|
||||||
_action_ids.remove_at(index)
|
|
||||||
_rebuild_pending_runtime_queue()
|
|
||||||
queue_changed.emit()
|
|
||||||
|
|
||||||
|
|
||||||
func insert_action(index: int, action: Dictionary) -> void:
|
func insert_action(index: int, action: Dictionary) -> void:
|
||||||
|
if _session_started and not _paused:
|
||||||
|
return
|
||||||
var target: int = clampi(index, 0, _authored_queue.size())
|
var target: int = clampi(index, 0, _authored_queue.size())
|
||||||
if _session_started and _paused:
|
var step_target: int = _step_boundary_for_flat_index(target)
|
||||||
if target <= _paused_history_floor():
|
if _session_started and _paused and not _plan_step_is_future(step_target):
|
||||||
return
|
return
|
||||||
var action_id: int = _allocate_action_id()
|
var created: Dictionary = _prepare_new_plan_action(action)
|
||||||
_authored_queue.insert(target, action.duplicate(true))
|
var next: Array[Dictionary] = _authored_steps.duplicate(true)
|
||||||
_action_ids.insert(target, action_id)
|
next.insert(clampi(step_target, 0, next.size()), {"actions": [created]})
|
||||||
if _session_started and _paused:
|
_commit_plan_edit(next)
|
||||||
_rebuild_pending_runtime_queue()
|
|
||||||
queue_changed.emit()
|
|
||||||
|
|
||||||
|
|
||||||
func replace_action(index: int, action: Dictionary) -> bool:
|
func replace_action(index: int, action: Dictionary) -> bool:
|
||||||
if index < 0 or index >= _authored_queue.size():
|
if index < 0 or index >= _authored_queue.size():
|
||||||
return false
|
return false
|
||||||
var action_id: int = _action_ids[index]
|
var stable_id: String = String(_authored_queue[index].get("action_id", ""))
|
||||||
var status: int = _status_for_action_id(action_id)
|
var replacement: Dictionary = action.duplicate(true)
|
||||||
if _session_started and _paused and (status == QueueStatus.COMPLETED or status == QueueStatus.INTERRUPTED):
|
if ACTION_REGISTRY.is_move_action(replacement) and replacement.get("target", null) is Vector2:
|
||||||
return false
|
replacement["destination"] = {"kind": "place", "position": replacement["target"]}
|
||||||
if _session_started and _paused and status == QueueStatus.ACTIVE:
|
replacement.erase("target")
|
||||||
_cancel_current_primary(true)
|
return replace_plan_action(stable_id, replacement)
|
||||||
_current_action_id = -1
|
|
||||||
_runner_state = RunnerState.IDLE
|
|
||||||
_authored_queue[index] = action.duplicate(true)
|
|
||||||
if _session_started and _paused:
|
|
||||||
_completed_ids.erase(action_id)
|
|
||||||
_interrupted_ids.erase(action_id)
|
|
||||||
_rebuild_pending_runtime_queue()
|
|
||||||
queue_changed.emit()
|
|
||||||
return true
|
|
||||||
|
|
||||||
|
|
||||||
func move_action(from_index: int, to_index: int) -> bool:
|
func move_action(from_index: int, to_index: int) -> bool:
|
||||||
if from_index < 0 or from_index >= _authored_queue.size() or to_index < 0 or to_index >= _authored_queue.size():
|
if from_index < 0 or from_index >= _authored_queue.size() or to_index < 0 or to_index >= _authored_queue.size():
|
||||||
return false
|
return false
|
||||||
if _session_started and _paused:
|
var source_id: String = String(_authored_queue[from_index].get("action_id", ""))
|
||||||
var id: int = _action_ids[from_index]
|
var target_id: String = String(_authored_queue[to_index].get("action_id", ""))
|
||||||
if _status_for_action_id(id) != QueueStatus.PENDING:
|
var source: Dictionary = find_action(source_id)
|
||||||
return false
|
var target: Dictionary = find_action(target_id)
|
||||||
if to_index <= _paused_history_floor():
|
if source.is_empty() or target.is_empty():
|
||||||
return false
|
return false
|
||||||
if from_index == to_index:
|
return move_plan_step(int(source["step_index"]), int(target["step_index"]))
|
||||||
return true
|
|
||||||
var action: Dictionary = _authored_queue.pop_at(from_index)
|
|
||||||
var action_id: int = _action_ids.pop_at(from_index)
|
|
||||||
_authored_queue.insert(to_index, action)
|
|
||||||
_action_ids.insert(to_index, action_id)
|
|
||||||
if _session_started and _paused:
|
|
||||||
_rebuild_pending_runtime_queue()
|
|
||||||
queue_changed.emit()
|
|
||||||
return true
|
|
||||||
|
|
||||||
|
|
||||||
func get_queue_view() -> Array[Dictionary]:
|
func get_queue_view() -> Array[Dictionary]:
|
||||||
var result: Array[Dictionary] = []
|
var result: Array[Dictionary] = []
|
||||||
for index: int in _authored_queue.size():
|
for index: int in _authored_queue.size():
|
||||||
var action_id: int = _action_ids[index] if index < _action_ids.size() else -1
|
var action_id: int = _action_ids[index] if index < _action_ids.size() else -1
|
||||||
result.append({"action": _authored_queue[index].duplicate(true), "authored_index": index, "status": _status_for_action_id(action_id), "action_id": action_id})
|
result.append({"action": _authored_queue[index].duplicate(true), "authored_index": index, "status": _status_for_action_id(action_id), "action_id": action_id, "stable_action_id": String(_authored_queue[index].get("action_id", "")), "step_index": int(_authored_queue[index].get("step_index", -1))})
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@@ -266,7 +524,10 @@ func clear_pause_state() -> void:
|
|||||||
_paused = false
|
_paused = false
|
||||||
_completed_ids.clear()
|
_completed_ids.clear()
|
||||||
_interrupted_ids.clear()
|
_interrupted_ids.clear()
|
||||||
|
_stable_status.clear()
|
||||||
|
_parallel_active_numeric_ids.clear()
|
||||||
_current_action_id = -1
|
_current_action_id = -1
|
||||||
|
_current_stable_action_id = ""
|
||||||
_session_started = false
|
_session_started = false
|
||||||
|
|
||||||
|
|
||||||
@@ -360,10 +621,17 @@ func stop_queue() -> void:
|
|||||||
_action_phase = ActionPhase.NONE
|
_action_phase = ActionPhase.NONE
|
||||||
_current_index = -1
|
_current_index = -1
|
||||||
_current_action_id = -1
|
_current_action_id = -1
|
||||||
|
_current_stable_action_id = ""
|
||||||
|
_current_step_index = -1
|
||||||
|
_active_step_entry.clear()
|
||||||
|
_group_say_action_id = ""
|
||||||
|
_group_say_action.clear()
|
||||||
|
_parallel_active_numeric_ids.clear()
|
||||||
_paused = false
|
_paused = false
|
||||||
_session_started = false
|
_session_started = false
|
||||||
_completed_ids.clear()
|
_completed_ids.clear()
|
||||||
_interrupted_ids.clear()
|
_interrupted_ids.clear()
|
||||||
|
_stable_status.clear()
|
||||||
|
|
||||||
|
|
||||||
func is_queue_running() -> bool:
|
func is_queue_running() -> bool:
|
||||||
@@ -381,8 +649,12 @@ func _advance_to_next_action() -> void:
|
|||||||
_current_index = -1
|
_current_index = -1
|
||||||
queue_finished.emit()
|
queue_finished.emit()
|
||||||
return
|
return
|
||||||
_current_run_item = _run_queue[_run_cursor]
|
var next_item: Dictionary = _run_queue[_run_cursor]
|
||||||
_run_cursor += 1
|
_run_cursor += 1
|
||||||
|
if next_item.has("actions"):
|
||||||
|
_start_plan_step(next_item)
|
||||||
|
return
|
||||||
|
_current_run_item = next_item
|
||||||
_current_index = int(_current_run_item.get("queue_index", -1))
|
_current_index = int(_current_run_item.get("queue_index", -1))
|
||||||
_current_action_id = int(_current_run_item.get("action_id", -1))
|
_current_action_id = int(_current_run_item.get("action_id", -1))
|
||||||
_current_index = _index_for_action_id(_current_action_id) if _current_action_id >= 0 else -1
|
_current_index = _index_for_action_id(_current_action_id) if _current_action_id >= 0 else -1
|
||||||
@@ -418,6 +690,121 @@ func _advance_to_next_action() -> void:
|
|||||||
_begin_action(action, legacy_speed_override)
|
_begin_action(action, legacy_speed_override)
|
||||||
|
|
||||||
|
|
||||||
|
func _start_plan_step(step_entry: Dictionary) -> void:
|
||||||
|
_active_step_entry = step_entry.duplicate(true)
|
||||||
|
_current_step_index = int(step_entry.get("step_index", -1))
|
||||||
|
_group_primary_done = false
|
||||||
|
_group_say_barrier = false
|
||||||
|
_group_say_action_id = ""
|
||||||
|
_group_say_numeric_id = -1
|
||||||
|
_group_say_action.clear()
|
||||||
|
var raw_actions: Array = step_entry.get("actions", [])
|
||||||
|
var primary_action: Dictionary = {}
|
||||||
|
var primary_id: String = ""
|
||||||
|
var primary_numeric_id: int = -1
|
||||||
|
var speech_started: bool = false
|
||||||
|
for action_index: int in raw_actions.size():
|
||||||
|
var raw_action: Variant = raw_actions[action_index]
|
||||||
|
if not raw_action is Dictionary:
|
||||||
|
continue
|
||||||
|
var authored_action: Dictionary = raw_action as Dictionary
|
||||||
|
var action_id: String = String(authored_action.get("action_id", ""))
|
||||||
|
var numeric_id: int = _numeric_for_stable_id(action_id)
|
||||||
|
var runtime_action: Dictionary = _runtime_action_for_plan(authored_action)
|
||||||
|
_stable_status[action_id] = &"active"
|
||||||
|
_parallel_active_numeric_ids[numeric_id] = true
|
||||||
|
var flat_index: int = _flat_index_for_action(action_id)
|
||||||
|
planned_action_started.emit(action_id, runtime_action.duplicate(true), _current_step_index)
|
||||||
|
action_started.emit(runtime_action.duplicate(true), flat_index)
|
||||||
|
if String(authored_action.get("type", "")) == "speak" and raw_actions.size() == 2:
|
||||||
|
speech_started = true
|
||||||
|
speak_overlay_action(runtime_action)
|
||||||
|
if bool(authored_action.get("legacy_nonblocking", false)):
|
||||||
|
_stable_status[action_id] = &"succeeded"
|
||||||
|
_completed_ids[numeric_id] = true
|
||||||
|
_parallel_active_numeric_ids.erase(numeric_id)
|
||||||
|
planned_action_ended.emit(action_id, &"succeeded", _current_step_index)
|
||||||
|
action_finished.emit(runtime_action.duplicate(true), flat_index)
|
||||||
|
else:
|
||||||
|
_group_say_action_id = action_id
|
||||||
|
_group_say_numeric_id = numeric_id
|
||||||
|
_group_say_step_index = _current_step_index
|
||||||
|
_group_say_action = runtime_action.duplicate(true)
|
||||||
|
_group_say_barrier = true
|
||||||
|
elif primary_action.is_empty():
|
||||||
|
primary_action = runtime_action
|
||||||
|
primary_id = action_id
|
||||||
|
primary_numeric_id = numeric_id
|
||||||
|
if primary_action.is_empty():
|
||||||
|
_complete_active_step()
|
||||||
|
return
|
||||||
|
_current_run_item = {
|
||||||
|
"action": primary_action.duplicate(true),
|
||||||
|
"queue_index": _flat_index_for_action(primary_id),
|
||||||
|
"action_id": primary_numeric_id,
|
||||||
|
"stable_action_id": primary_id,
|
||||||
|
"step_index": _current_step_index,
|
||||||
|
"reactive": false,
|
||||||
|
}
|
||||||
|
_current_action_id = primary_numeric_id
|
||||||
|
_current_stable_action_id = primary_id
|
||||||
|
_current_index = int(_current_run_item.get("queue_index", -1))
|
||||||
|
var action: Dictionary = primary_action.duplicate(true)
|
||||||
|
if ACTION_REGISTRY.is_move_action(action):
|
||||||
|
action["type"] = ACTION_REGISTRY.MOVE_TO
|
||||||
|
var style: String = ACTION_REGISTRY.checked_style(action.get("style", null))
|
||||||
|
action["style"] = style if not style.is_empty() else ACTION_REGISTRY.WALK
|
||||||
|
_begin_action(action)
|
||||||
|
if not speech_started and String(primary_action.get("type", "")) == "speak":
|
||||||
|
# Singleton Say is executed by the primary speech state, not an overlay.
|
||||||
|
_group_say_action_id = ""
|
||||||
|
|
||||||
|
|
||||||
|
func _runtime_action_for_plan(action: Dictionary) -> Dictionary:
|
||||||
|
var runtime_action: Dictionary = action.duplicate(true)
|
||||||
|
if ACTION_REGISTRY.is_move_action(runtime_action):
|
||||||
|
var destination_value: Variant = runtime_action.get("destination", {})
|
||||||
|
if destination_value is Dictionary:
|
||||||
|
var destination: Dictionary = destination_value
|
||||||
|
var point_value: Variant = destination.get("position", destination.get("last_known_approach", Vector2.ZERO))
|
||||||
|
runtime_action["target"] = point_value
|
||||||
|
return runtime_action
|
||||||
|
|
||||||
|
|
||||||
|
func _complete_active_step() -> void:
|
||||||
|
_active_step_entry.clear()
|
||||||
|
_current_step_index = -1
|
||||||
|
_group_primary_done = false
|
||||||
|
_group_say_barrier = false
|
||||||
|
_action_phase = ActionPhase.NONE
|
||||||
|
|
||||||
|
|
||||||
|
func _flat_index_for_action(action_id: String) -> int:
|
||||||
|
for index: int in _authored_queue.size():
|
||||||
|
if String(_authored_queue[index].get("action_id", "")) == action_id:
|
||||||
|
return index
|
||||||
|
return -1
|
||||||
|
|
||||||
|
|
||||||
|
func _stable_for_numeric_id(numeric_id: int) -> String:
|
||||||
|
for stable_id: Variant in _stable_to_numeric_ids:
|
||||||
|
if int(_stable_to_numeric_ids[stable_id]) == numeric_id:
|
||||||
|
return String(stable_id)
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
func _step_boundary_for_flat_index(flat_index: int) -> int:
|
||||||
|
var cursor: int = 0
|
||||||
|
for step_index: int in _authored_steps.size():
|
||||||
|
var actions: Array = _authored_steps[step_index].get("actions", [])
|
||||||
|
if flat_index <= cursor:
|
||||||
|
return step_index
|
||||||
|
if flat_index < cursor + actions.size():
|
||||||
|
return step_index + 1
|
||||||
|
cursor += actions.size()
|
||||||
|
return _authored_steps.size()
|
||||||
|
|
||||||
|
|
||||||
func _begin_action(action: Dictionary, legacy_speed_override: float = -1.0) -> void:
|
func _begin_action(action: Dictionary, legacy_speed_override: float = -1.0) -> void:
|
||||||
match String(action.get("type", "")):
|
match String(action.get("type", "")):
|
||||||
"move_to":
|
"move_to":
|
||||||
@@ -425,8 +812,15 @@ func _begin_action(action: Dictionary, legacy_speed_override: float = -1.0) -> v
|
|||||||
var style: String = ACTION_REGISTRY.checked_style(action.get("style", null))
|
var style: String = ACTION_REGISTRY.checked_style(action.get("style", null))
|
||||||
if style.is_empty():
|
if style.is_empty():
|
||||||
style = ACTION_REGISTRY.WALK
|
style = ACTION_REGISTRY.WALK
|
||||||
if _locomotion == null or not _locomotion.move_to(action.get("target", Vector2.ZERO), style, legacy_speed_override):
|
var destination_value: Variant = action.get("destination", {})
|
||||||
_finish_action()
|
var move_started: bool = false
|
||||||
|
if destination_value is Dictionary and String((destination_value as Dictionary).get("kind", "")) == "prop":
|
||||||
|
move_started = _start_prop_pursuit(action, destination_value as Dictionary, style, legacy_speed_override)
|
||||||
|
elif _locomotion != null:
|
||||||
|
move_started = _locomotion.move_to(action.get("target", Vector2.ZERO), style, legacy_speed_override)
|
||||||
|
if not move_started:
|
||||||
|
_end_prop_pursuit()
|
||||||
|
_finish_action(&"failed")
|
||||||
"speak":
|
"speak":
|
||||||
if bool(action.get("keep_acting", false)):
|
if bool(action.get("keep_acting", false)):
|
||||||
speak_overlay_action(action)
|
speak_overlay_action(action)
|
||||||
@@ -445,34 +839,142 @@ func _begin_action(action: Dictionary, legacy_speed_override: float = -1.0) -> v
|
|||||||
recovery_requested.emit()
|
recovery_requested.emit()
|
||||||
"pick_up_prop", "drop_prop", "throw_prop", "set_down_prop", "use_prop":
|
"pick_up_prop", "drop_prop", "throw_prop", "set_down_prop", "use_prop":
|
||||||
if _rig == null or not _rig.start_prop_action(action):
|
if _rig == null or not _rig.start_prop_action(action):
|
||||||
_finish_action()
|
_finish_action(&"failed")
|
||||||
else:
|
else:
|
||||||
_prop_action_finished = false
|
_prop_action_finished = false
|
||||||
_action_phase = ActionPhase.PROP_INTERACTION
|
_action_phase = ActionPhase.PROP_INTERACTION
|
||||||
_:
|
_:
|
||||||
push_warning("StickmanActionRunner: unknown action type '%s'; skipped." % String(action.get("type", "")))
|
push_warning("StickmanActionRunner: unknown action type '%s'; skipped." % String(action.get("type", "")))
|
||||||
_finish_action()
|
_finish_action(&"failed")
|
||||||
|
|
||||||
|
|
||||||
func _finish_action() -> void:
|
func _start_prop_pursuit(action: Dictionary, destination: Dictionary, style: String, speed_override: float) -> bool:
|
||||||
|
var prop_id_value: Variant = destination.get("target_prop_id", null)
|
||||||
|
var offset_value: Variant = destination.get("approach_offset", null)
|
||||||
|
if not prop_id_value is String or not offset_value is Vector2 or not (offset_value as Vector2).is_finite():
|
||||||
|
return false
|
||||||
|
var prop: PropBlock = _resolve_pursuit_prop(String(prop_id_value))
|
||||||
|
if prop == null or _locomotion == null:
|
||||||
|
return false
|
||||||
|
var approach: Vector2 = prop.global_position + (offset_value as Vector2)
|
||||||
|
var projected: Vector2 = _locomotion.project_target_to_navigation(approach)
|
||||||
|
if not projected.is_finite():
|
||||||
|
return false
|
||||||
|
_pursuit_action_id = String(action.get("action_id", _current_stable_action_id))
|
||||||
|
_pursuit_prop_id = String(prop_id_value)
|
||||||
|
_pursuit_offset = offset_value as Vector2
|
||||||
|
_pursuit_last_prop_position = prop.global_position
|
||||||
|
_pursuit_approach = projected
|
||||||
|
_pursuit_elapsed = 0.0
|
||||||
|
_pursuit_retarget_elapsed = 0.0
|
||||||
|
return _locomotion.move_to(projected, style, speed_override)
|
||||||
|
|
||||||
|
|
||||||
|
func _resolve_pursuit_prop(prop_id: String) -> PropBlock:
|
||||||
|
if prop_id.is_empty() or _rig == null or not is_instance_valid(_rig):
|
||||||
|
return null
|
||||||
|
var world: Node = _rig.get_parent()
|
||||||
|
if world == null:
|
||||||
|
return null
|
||||||
|
for child: Node in world.get_children():
|
||||||
|
if child is PropBlock and not child.is_queued_for_deletion() and String((child as PropBlock).stage_object_id) == prop_id:
|
||||||
|
return child as PropBlock
|
||||||
|
if child.get_script() == MISSING_PROP_PLACEHOLDER and String(child.get("stage_object_id")) == prop_id:
|
||||||
|
return null
|
||||||
|
return null
|
||||||
|
|
||||||
|
|
||||||
|
func _check_prop_pursuit_arrival() -> void:
|
||||||
|
var prop: PropBlock = _resolve_pursuit_prop(_pursuit_prop_id)
|
||||||
|
if prop == null or _locomotion == null or _rig == null:
|
||||||
|
_end_prop_pursuit()
|
||||||
|
_finish_action(&"failed")
|
||||||
|
return
|
||||||
|
var projected: Vector2 = _locomotion.project_target_to_navigation(prop.global_position + _pursuit_offset)
|
||||||
|
if not projected.is_finite():
|
||||||
|
_end_prop_pursuit()
|
||||||
|
_finish_action(&"failed")
|
||||||
|
return
|
||||||
|
var actor_feet: Vector2 = _rig.global_position - _locomotion.get_foot_offset()
|
||||||
|
if actor_feet.distance_to(projected) <= 28.0 and actor_feet.distance_to(prop.global_position) <= PROP_INTERACTION_REACH:
|
||||||
|
_end_prop_pursuit()
|
||||||
|
_finish_action(&"succeeded")
|
||||||
|
return
|
||||||
|
if actor_feet.distance_to(projected) > 28.0:
|
||||||
|
var move_style: String = ACTION_REGISTRY.checked_style(String(_current_run_item.get("action", {}).get("style", ACTION_REGISTRY.WALK)))
|
||||||
|
var restarted: bool = _locomotion.retarget_walk(projected) if _locomotion.is_walking() else _locomotion.move_to(projected, move_style)
|
||||||
|
if restarted:
|
||||||
|
_pursuit_approach = projected
|
||||||
|
_pursuit_last_prop_position = prop.global_position
|
||||||
|
_pursuit_retarget_elapsed = 0.0
|
||||||
|
_action_phase = ActionPhase.WALKING
|
||||||
|
return
|
||||||
|
_end_prop_pursuit()
|
||||||
|
_finish_action(&"failed")
|
||||||
|
return
|
||||||
|
_locomotion.cancel_walk(false)
|
||||||
|
_pursuit_approach = projected
|
||||||
|
_pursuit_last_prop_position = prop.global_position
|
||||||
|
_pursuit_retarget_elapsed = 0.0
|
||||||
|
_action_phase = ActionPhase.PURSUIT_WAIT
|
||||||
|
|
||||||
|
|
||||||
|
func _end_prop_pursuit() -> void:
|
||||||
|
_pursuit_action_id = ""
|
||||||
|
_pursuit_prop_id = ""
|
||||||
|
_pursuit_offset = Vector2.ZERO
|
||||||
|
_pursuit_last_prop_position = Vector2.ZERO
|
||||||
|
_pursuit_approach = Vector2.INF
|
||||||
|
_pursuit_elapsed = 0.0
|
||||||
|
_pursuit_retarget_elapsed = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
func _finish_action(outcome: StringName = &"succeeded") -> void:
|
||||||
var finished: Dictionary = _current_run_item.get("action", {})
|
var finished: Dictionary = _current_run_item.get("action", {})
|
||||||
var index: int = int(_current_run_item.get("queue_index", -1))
|
var index: int = int(_current_run_item.get("queue_index", -1))
|
||||||
var action_id: int = int(_current_run_item.get("action_id", -1))
|
var action_id: int = int(_current_run_item.get("action_id", -1))
|
||||||
|
var stable_id: String = String(_current_run_item.get("stable_action_id", _current_stable_action_id))
|
||||||
|
if stable_id == _pursuit_action_id:
|
||||||
|
_end_prop_pursuit()
|
||||||
if action_id >= 0:
|
if action_id >= 0:
|
||||||
_completed_ids[action_id] = true
|
if outcome == &"cancelled":
|
||||||
index = _index_for_action_id(action_id) if action_id >= 0 else -1
|
_interrupted_ids[action_id] = true
|
||||||
|
else:
|
||||||
|
_completed_ids[action_id] = true
|
||||||
|
if not stable_id.is_empty():
|
||||||
|
_stable_status[stable_id] = outcome
|
||||||
|
_parallel_active_numeric_ids.erase(action_id)
|
||||||
|
planned_action_ended.emit(stable_id, outcome, int(_current_run_item.get("step_index", _current_step_index)))
|
||||||
|
index = _flat_index_for_action(stable_id) if not stable_id.is_empty() else (_index_for_action_id(action_id) if action_id >= 0 else -1)
|
||||||
_action_phase = ActionPhase.NONE
|
_action_phase = ActionPhase.NONE
|
||||||
|
if not finished.is_empty():
|
||||||
|
action_finished.emit(finished, index)
|
||||||
_current_run_item.clear()
|
_current_run_item.clear()
|
||||||
_current_index = -1
|
_current_index = -1
|
||||||
_current_action_id = -1
|
_current_action_id = -1
|
||||||
if not finished.is_empty():
|
_current_stable_action_id = ""
|
||||||
action_finished.emit(finished, index)
|
if not _active_step_entry.is_empty():
|
||||||
|
_group_primary_done = true
|
||||||
|
if _group_say_barrier and not _group_say_action_id.is_empty():
|
||||||
|
_action_phase = ActionPhase.GROUP_BARRIER
|
||||||
|
else:
|
||||||
|
_complete_active_step()
|
||||||
|
|
||||||
|
|
||||||
func _cancel_current_primary(notify: bool = false) -> void:
|
func _cancel_current_primary(notify: bool = false) -> void:
|
||||||
|
var stable_id: String = String(_current_run_item.get("stable_action_id", _current_stable_action_id))
|
||||||
|
var step_index: int = int(_current_run_item.get("step_index", _current_step_index))
|
||||||
|
var numeric_id: int = int(_current_run_item.get("action_id", _current_action_id))
|
||||||
|
if stable_id == _pursuit_action_id:
|
||||||
|
_end_prop_pursuit()
|
||||||
if notify and not _current_run_item.is_empty():
|
if notify and not _current_run_item.is_empty():
|
||||||
var action: Dictionary = _current_run_item.get("action", {})
|
var action: Dictionary = _current_run_item.get("action", {})
|
||||||
active_action_cancelled.emit(action.duplicate(true))
|
active_action_cancelled.emit(action.duplicate(true))
|
||||||
|
if not stable_id.is_empty():
|
||||||
|
_stable_status[stable_id] = &"cancelled"
|
||||||
|
_parallel_active_numeric_ids.erase(numeric_id)
|
||||||
|
_interrupted_ids[numeric_id] = true
|
||||||
|
planned_action_ended.emit(stable_id, &"cancelled", step_index)
|
||||||
if _locomotion != null:
|
if _locomotion != null:
|
||||||
_locomotion.cancel_walk(not _is_blocked())
|
_locomotion.cancel_walk(not _is_blocked())
|
||||||
if _rig != null:
|
if _rig != null:
|
||||||
@@ -484,6 +986,7 @@ func _cancel_current_primary(notify: bool = false) -> void:
|
|||||||
_current_run_item.clear()
|
_current_run_item.clear()
|
||||||
_current_index = -1
|
_current_index = -1
|
||||||
_current_action_id = -1
|
_current_action_id = -1
|
||||||
|
_current_stable_action_id = ""
|
||||||
if _overlay_speech.is_empty() and _speech_bubble != null and is_instance_valid(_speech_bubble):
|
if _overlay_speech.is_empty() and _speech_bubble != null and is_instance_valid(_speech_bubble):
|
||||||
_speech_bubble.hide_bubble()
|
_speech_bubble.hide_bubble()
|
||||||
|
|
||||||
@@ -502,13 +1005,25 @@ func _start_session_runtime() -> void:
|
|||||||
_session_started = true
|
_session_started = true
|
||||||
_completed_ids.clear()
|
_completed_ids.clear()
|
||||||
_interrupted_ids.clear()
|
_interrupted_ids.clear()
|
||||||
_action_ids.clear()
|
_stable_status.clear()
|
||||||
for _action: Dictionary in _authored_queue:
|
_parallel_active_numeric_ids.clear()
|
||||||
_action_ids.append(_allocate_action_id())
|
for action: Dictionary in _authored_queue:
|
||||||
|
_stable_status[String(action.get("action_id", ""))] = &"pending"
|
||||||
|
|
||||||
|
|
||||||
func _runtime_item(action_id: int, action: Dictionary, index: int) -> Dictionary:
|
func _runtime_step_item(step_index: int, step: Dictionary) -> Dictionary:
|
||||||
return {"action": action.duplicate(true), "queue_index": index, "action_id": action_id, "reactive": false}
|
var actions: Array[Dictionary] = []
|
||||||
|
var stable_ids: Array[String] = []
|
||||||
|
var numeric_ids: Array[int] = []
|
||||||
|
for raw_action: Variant in step.get("actions", []):
|
||||||
|
if not raw_action is Dictionary:
|
||||||
|
continue
|
||||||
|
var action: Dictionary = raw_action as Dictionary
|
||||||
|
var stable_id: String = String(action.get("action_id", ""))
|
||||||
|
actions.append(action.duplicate(true))
|
||||||
|
stable_ids.append(stable_id)
|
||||||
|
numeric_ids.append(_numeric_for_stable_id(stable_id))
|
||||||
|
return {"step_index": step_index, "actions": actions, "stable_ids": stable_ids, "numeric_ids": numeric_ids, "reactive": false}
|
||||||
|
|
||||||
|
|
||||||
func _rebuild_pending_runtime_queue() -> void:
|
func _rebuild_pending_runtime_queue() -> void:
|
||||||
@@ -518,11 +1033,19 @@ func _rebuild_pending_runtime_queue() -> void:
|
|||||||
var runtime_item: Dictionary = _run_queue[runtime_index]
|
var runtime_item: Dictionary = _run_queue[runtime_index]
|
||||||
if bool(runtime_item.get("reactive", false)):
|
if bool(runtime_item.get("reactive", false)):
|
||||||
retained_reactive.append(runtime_item.duplicate(true))
|
retained_reactive.append(runtime_item.duplicate(true))
|
||||||
for index: int in _authored_queue.size():
|
for step_index: int in _authored_steps.size():
|
||||||
var action_id: int = _action_ids[index]
|
var step: Dictionary = _authored_steps[step_index]
|
||||||
var status: int = _status_for_action_id(action_id)
|
var all_pending: bool = true
|
||||||
if status == QueueStatus.PENDING or status == QueueStatus.NOT_STARTED:
|
for raw_action: Variant in step.get("actions", []):
|
||||||
rebuilt.append(_runtime_item(action_id, _authored_queue[index], index))
|
if not raw_action is Dictionary:
|
||||||
|
all_pending = false
|
||||||
|
break
|
||||||
|
var status: StringName = _status_for_stable_id(String((raw_action as Dictionary).get("action_id", "")))
|
||||||
|
if status not in [&"pending", &"not_started"]:
|
||||||
|
all_pending = false
|
||||||
|
break
|
||||||
|
if all_pending:
|
||||||
|
rebuilt.append(_runtime_step_item(step_index, step))
|
||||||
_run_queue = retained_reactive + rebuilt
|
_run_queue = retained_reactive + rebuilt
|
||||||
_run_cursor = 0
|
_run_cursor = 0
|
||||||
if not _run_queue.is_empty() and _session_started:
|
if not _run_queue.is_empty() and _session_started:
|
||||||
@@ -545,15 +1068,14 @@ func _index_for_action_id(action_id: int) -> int:
|
|||||||
func _status_for_action_id(action_id: int) -> int:
|
func _status_for_action_id(action_id: int) -> int:
|
||||||
if action_id < 0:
|
if action_id < 0:
|
||||||
return QueueStatus.NOT_STARTED
|
return QueueStatus.NOT_STARTED
|
||||||
if _completed_ids.has(action_id):
|
var stable_id: String = _stable_for_numeric_id(action_id)
|
||||||
return QueueStatus.COMPLETED
|
var status: StringName = _status_for_stable_id(stable_id) if not stable_id.is_empty() else &"not_started"
|
||||||
if _interrupted_ids.has(action_id):
|
match status:
|
||||||
return QueueStatus.INTERRUPTED
|
&"succeeded", &"failed": return QueueStatus.COMPLETED
|
||||||
if action_id == _current_action_id:
|
&"cancelled": return QueueStatus.INTERRUPTED
|
||||||
return QueueStatus.ACTIVE
|
&"active": return QueueStatus.ACTIVE
|
||||||
if _session_started:
|
&"pending": return QueueStatus.PENDING
|
||||||
return QueueStatus.PENDING
|
_: return QueueStatus.NOT_STARTED
|
||||||
return QueueStatus.NOT_STARTED
|
|
||||||
|
|
||||||
|
|
||||||
func _is_blocked() -> bool:
|
func _is_blocked() -> bool:
|
||||||
@@ -565,6 +1087,7 @@ func _update_speech(delta: float) -> void:
|
|||||||
_overlay_speech["elapsed"] = float(_overlay_speech.get("elapsed", 0.0)) + delta
|
_overlay_speech["elapsed"] = float(_overlay_speech.get("elapsed", 0.0)) + delta
|
||||||
if float(_overlay_speech.get("elapsed", 0.0)) >= float(_overlay_speech.get("duration", 0.0)):
|
if float(_overlay_speech.get("elapsed", 0.0)) >= float(_overlay_speech.get("duration", 0.0)):
|
||||||
_overlay_speech.clear()
|
_overlay_speech.clear()
|
||||||
|
_finish_group_speech()
|
||||||
speech_finished.emit()
|
speech_finished.emit()
|
||||||
elif not _primary_speech.is_empty() and not _is_blocked():
|
elif not _primary_speech.is_empty() and not _is_blocked():
|
||||||
_primary_speech["elapsed"] = float(_primary_speech.get("elapsed", 0.0)) + delta
|
_primary_speech["elapsed"] = float(_primary_speech.get("elapsed", 0.0)) + delta
|
||||||
@@ -578,6 +1101,25 @@ func _update_speech(delta: float) -> void:
|
|||||||
_show_visible_speech()
|
_show_visible_speech()
|
||||||
|
|
||||||
|
|
||||||
|
func _finish_group_speech() -> void:
|
||||||
|
if _group_say_action_id.is_empty():
|
||||||
|
return
|
||||||
|
var action_id: String = _group_say_action_id
|
||||||
|
var numeric_id: int = _group_say_numeric_id
|
||||||
|
var step_index: int = _group_say_step_index
|
||||||
|
var action: Dictionary = _group_say_action.duplicate(true)
|
||||||
|
_stable_status[action_id] = &"succeeded"
|
||||||
|
_completed_ids[numeric_id] = true
|
||||||
|
_parallel_active_numeric_ids.erase(numeric_id)
|
||||||
|
planned_action_ended.emit(action_id, &"succeeded", step_index)
|
||||||
|
action_finished.emit(action, _flat_index_for_action(action_id))
|
||||||
|
_group_say_action_id = ""
|
||||||
|
_group_say_numeric_id = -1
|
||||||
|
_group_say_step_index = -1
|
||||||
|
_group_say_action.clear()
|
||||||
|
_group_say_barrier = false
|
||||||
|
|
||||||
|
|
||||||
func _show_visible_speech() -> void:
|
func _show_visible_speech() -> void:
|
||||||
if _rig == null:
|
if _rig == null:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ var collision_lengths: Dictionary = {}
|
|||||||
var collision_proxy_velocities: Dictionary = {}
|
var collision_proxy_velocities: Dictionary = {}
|
||||||
var _collision_proxy_positions: Dictionary = {}
|
var _collision_proxy_positions: Dictionary = {}
|
||||||
var _last_sweep_hit_tick: Dictionary = {}
|
var _last_sweep_hit_tick: Dictionary = {}
|
||||||
|
var _owner_collision_grace_props: Dictionary = {}
|
||||||
var _actor_prop_debug_last_sample_frame: int = -1
|
var _actor_prop_debug_last_sample_frame: int = -1
|
||||||
var _actor_prop_debug_last_hit_tick: Dictionary = {}
|
var _actor_prop_debug_last_hit_tick: Dictionary = {}
|
||||||
var _collision_visuals: Dictionary = {}
|
var _collision_visuals: Dictionary = {}
|
||||||
@@ -196,6 +197,7 @@ func setup_collision_bodies() -> void:
|
|||||||
collision_proxy_velocities.clear()
|
collision_proxy_velocities.clear()
|
||||||
_collision_proxy_positions.clear()
|
_collision_proxy_positions.clear()
|
||||||
_last_sweep_hit_tick.clear()
|
_last_sweep_hit_tick.clear()
|
||||||
|
_owner_collision_grace_props.clear()
|
||||||
_collision_visuals.clear()
|
_collision_visuals.clear()
|
||||||
reaction_bones.clear()
|
reaction_bones.clear()
|
||||||
if _rig == null or _rig._body_container == null or _rig._skeleton == null:
|
if _rig == null or _rig._body_container == null or _rig._skeleton == null:
|
||||||
@@ -470,6 +472,34 @@ func move_to(target: Vector2, style: String = ACTION_REGISTRY.WALK, speed_overri
|
|||||||
_walk_latch_probe_frames = 0
|
_walk_latch_probe_frames = 0
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
func project_target_to_navigation(target: Vector2) -> Vector2:
|
||||||
|
if _nav_agent == null or not target.is_finite():
|
||||||
|
return Vector2.INF
|
||||||
|
var navigation_map: RID = _nav_agent.get_navigation_map()
|
||||||
|
if not navigation_map.is_valid() or NavigationServer2D.map_get_iteration_id(navigation_map) == 0:
|
||||||
|
return Vector2.INF
|
||||||
|
var projected: Vector2 = NavigationServer2D.map_get_closest_point(navigation_map, target)
|
||||||
|
return projected if projected.is_finite() else Vector2.INF
|
||||||
|
|
||||||
|
|
||||||
|
func retarget_walk(target: Vector2) -> bool:
|
||||||
|
if _rig == null or _nav_agent == null or not target.is_finite() or (not _walking and not _settling):
|
||||||
|
return false
|
||||||
|
_walk_target_feet = target
|
||||||
|
_nav_agent.target_position = target
|
||||||
|
if _settling:
|
||||||
|
_settling = false
|
||||||
|
_walk_done = false
|
||||||
|
_arrival_emitted = false
|
||||||
|
_walk_settle_elapsed = 0.0
|
||||||
|
_walk_settle_start_pose.clear()
|
||||||
|
_walk_settle_end_pose.clear()
|
||||||
|
_walking = true
|
||||||
|
if _rig._anim_player != null and is_instance_valid(_rig._anim_player) and _rig._anim_player.has_animation(_active_animation_name):
|
||||||
|
_rig._anim_player.play(_active_animation_name)
|
||||||
|
return true
|
||||||
|
|
||||||
func cancel_walk(restore_idle_pose: bool = true) -> void:
|
func cancel_walk(restore_idle_pose: bool = true) -> void:
|
||||||
if _rig == null:
|
if _rig == null:
|
||||||
return
|
return
|
||||||
@@ -624,6 +654,15 @@ func _sweep_actor_blocking_props(motion: Vector2) -> Dictionary:
|
|||||||
for own_proxy: AnimatableBody2D in collision_bodies.values():
|
for own_proxy: AnimatableBody2D in collision_bodies.values():
|
||||||
if own_proxy != null and is_instance_valid(own_proxy):
|
if own_proxy != null and is_instance_valid(own_proxy):
|
||||||
excluded.append(own_proxy.get_rid())
|
excluded.append(own_proxy.get_rid())
|
||||||
|
for prop_id: Variant in _owner_collision_grace_props.keys():
|
||||||
|
var prop_ref: WeakRef = _owner_collision_grace_props.get(prop_id) as WeakRef
|
||||||
|
var grace_prop: PropBlock = prop_ref.get_ref() as PropBlock if prop_ref != null else null
|
||||||
|
if grace_prop == null or not is_instance_valid(grace_prop) or not grace_prop.is_owner_collision_grace_active_for(_rig):
|
||||||
|
_owner_collision_grace_props.erase(prop_id)
|
||||||
|
continue
|
||||||
|
var grace_prop_rid: RID = grace_prop.get_rid()
|
||||||
|
if grace_prop_rid.is_valid() and not excluded.has(grace_prop_rid):
|
||||||
|
excluded.append(grace_prop_rid)
|
||||||
var held: PropBlock = _rig.get_held_prop() if _rig.has_method("get_held_prop") else null
|
var held: PropBlock = _rig.get_held_prop() if _rig.has_method("get_held_prop") else null
|
||||||
if held != null and is_instance_valid(held):
|
if held != null and is_instance_valid(held):
|
||||||
excluded.append(held.get_rid())
|
excluded.append(held.get_rid())
|
||||||
@@ -779,6 +818,18 @@ func _sweep_actor_blocking_props(motion: Vector2) -> Dictionary:
|
|||||||
return {"fraction": safe_fraction}
|
return {"fraction": safe_fraction}
|
||||||
|
|
||||||
|
|
||||||
|
func register_owner_collision_grace_prop(prop: PropBlock) -> void:
|
||||||
|
if prop == null or not is_instance_valid(prop):
|
||||||
|
return
|
||||||
|
_owner_collision_grace_props[prop.get_instance_id()] = weakref(prop)
|
||||||
|
|
||||||
|
|
||||||
|
func unregister_owner_collision_grace_prop(prop: PropBlock) -> void:
|
||||||
|
if prop == null:
|
||||||
|
return
|
||||||
|
_owner_collision_grace_props.erase(prop.get_instance_id())
|
||||||
|
|
||||||
|
|
||||||
func _prop_from_rest_info(rest_info: Dictionary) -> PropBlock:
|
func _prop_from_rest_info(rest_info: Dictionary) -> PropBlock:
|
||||||
# PhysicsDirectSpaceState2D.get_rest_info() returns collider_id rather than
|
# PhysicsDirectSpaceState2D.get_rest_info() returns collider_id rather than
|
||||||
# the `collider` object key used by ray/shape intersection queries.
|
# the `collider` object key used by ray/shape intersection queries.
|
||||||
|
|||||||
@@ -955,6 +955,7 @@ func _begin_pickup(prop_id: String, requested_hand: String, action: Dictionary)
|
|||||||
_hand = int(picked["hand"])
|
_hand = int(picked["hand"])
|
||||||
_held_prop = prop
|
_held_prop = prop
|
||||||
_held_prop.interaction_reserved_by = _rig.get_instance_id()
|
_held_prop.interaction_reserved_by = _rig.get_instance_id()
|
||||||
|
_held_prop.begin_owner_collision_grace(_rig, true)
|
||||||
_active_action = action.duplicate(true)
|
_active_action = action.duplicate(true)
|
||||||
_approach_replans = 0
|
_approach_replans = 0
|
||||||
var marker := _hand_marker()
|
var marker := _hand_marker()
|
||||||
@@ -1028,7 +1029,7 @@ func _begin_set_down(action: Dictionary) -> bool:
|
|||||||
_rig.call("set_facing_profile", 0 if _set_down_facing_left else 1)
|
_rig.call("set_facing_profile", 0 if _set_down_facing_left else 1)
|
||||||
var foot_offset: Vector2 = _locomotion.call("get_foot_offset")
|
var foot_offset: Vector2 = _locomotion.call("get_foot_offset")
|
||||||
var target_feet := _set_down_approach_root - foot_offset
|
var target_feet := _set_down_approach_root - foot_offset
|
||||||
if not bool(_locomotion.call("move_to", target_feet, ACTION_REGISTRY.RUN)):
|
if not bool(_locomotion.call("move_to", target_feet, ACTION_REGISTRY.WALK)):
|
||||||
_active_action.clear()
|
_active_action.clear()
|
||||||
prop_event.emit("set_down_failed", _held_prop, "Too far to reach")
|
prop_event.emit("set_down_failed", _held_prop, "Too far to reach")
|
||||||
return false
|
return false
|
||||||
@@ -1930,12 +1931,18 @@ func _release_held(reason: String, throwing: bool, throw_velocity: Vector2 = Vec
|
|||||||
release_velocity = Vector2.ZERO
|
release_velocity = Vector2.ZERO
|
||||||
if not is_finite(release_angular):
|
if not is_finite(release_angular):
|
||||||
release_angular = 0.0
|
release_angular = 0.0
|
||||||
|
if reason == "scene_reset":
|
||||||
|
prop.clear_owner_collision_grace()
|
||||||
|
elif _rig != null and is_instance_valid(_rig) and prop.interaction_reserved_by == _rig.get_instance_id():
|
||||||
|
prop.release_owner_collision_grace(_rig)
|
||||||
prop.interaction_owner_id = 0
|
prop.interaction_owner_id = 0
|
||||||
prop.interaction_reserved_by = 0
|
prop.interaction_reserved_by = 0
|
||||||
var target_role := PropBlock.RuntimeRole.RELEASED
|
var target_role := PropBlock.RuntimeRole.RELEASED
|
||||||
if reason == "scene_reset":
|
if reason == "scene_reset":
|
||||||
target_role = PropBlock.RuntimeRole.START_PHYSICS if String(prop.stage_roles.get("start_motion", PROP_STAGE_ROLES.START_STILL)) == PROP_STAGE_ROLES.START_PHYSICS else PropBlock.RuntimeRole.START_STILL
|
target_role = PropBlock.RuntimeRole.START_PHYSICS if String(prop.stage_roles.get("start_motion", PROP_STAGE_ROLES.START_STILL)) == PROP_STAGE_ROLES.START_PHYSICS else PropBlock.RuntimeRole.START_STILL
|
||||||
prop.apply_runtime_role(target_role)
|
prop.apply_runtime_role(target_role)
|
||||||
|
if reason == "set_down" and _rig != null and is_instance_valid(_rig):
|
||||||
|
prop.begin_owner_collision_grace(_rig)
|
||||||
prop.sleeping = false
|
prop.sleeping = false
|
||||||
prop.linear_velocity = release_velocity
|
prop.linear_velocity = release_velocity
|
||||||
prop.angular_velocity = release_angular
|
prop.angular_velocity = release_angular
|
||||||
@@ -1983,6 +1990,7 @@ func _clear_reservation() -> void:
|
|||||||
if _held_prop != null and is_instance_valid(_held_prop):
|
if _held_prop != null and is_instance_valid(_held_prop):
|
||||||
if _held_prop.interaction_reserved_by == _rig.get_instance_id():
|
if _held_prop.interaction_reserved_by == _rig.get_instance_id():
|
||||||
_held_prop.interaction_reserved_by = 0
|
_held_prop.interaction_reserved_by = 0
|
||||||
|
_held_prop.release_owner_collision_grace(_rig)
|
||||||
_held_prop = null
|
_held_prop = null
|
||||||
_held_anchor.clear()
|
_held_anchor.clear()
|
||||||
_active_action.clear()
|
_active_action.clear()
|
||||||
|
|||||||
@@ -182,6 +182,9 @@ signal action_started(action: Dictionary, index: int)
|
|||||||
signal action_finished(action: Dictionary, index: int)
|
signal action_finished(action: Dictionary, index: int)
|
||||||
signal queue_finished # queue ran to completion (not on stop)
|
signal queue_finished # queue ran to completion (not on stop)
|
||||||
signal queue_changed # any queue mutation
|
signal queue_changed # any queue mutation
|
||||||
|
signal action_plan_changed
|
||||||
|
signal planned_action_started(action_id: String, action: Dictionary, step_index: int)
|
||||||
|
signal planned_action_ended(action_id: String, outcome: StringName, step_index: int)
|
||||||
signal speech_finished # bubble auto-hid after speak()
|
signal speech_finished # bubble auto-hid after speak()
|
||||||
signal prop_interaction_event(event_type: String, prop: PropBlock, reason: String)
|
signal prop_interaction_event(event_type: String, prop: PropBlock, reason: String)
|
||||||
signal use_completed(prop: PropBlock, spot_id: String, world_position: Vector2)
|
signal use_completed(prop: PropBlock, spot_id: String, world_position: Vector2)
|
||||||
@@ -215,6 +218,8 @@ var _limb_bones: Dictionary = {} # { String: { "upper": Bone2D, "lo
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
var _pending_action_queue: Array[Dictionary] = []
|
var _pending_action_queue: Array[Dictionary] = []
|
||||||
|
var _pending_action_plan: Array[Dictionary] = []
|
||||||
|
var _has_pending_action_plan: bool = false
|
||||||
var action_queue: Array[Dictionary]:
|
var action_queue: Array[Dictionary]:
|
||||||
get:
|
get:
|
||||||
return _action_runner_component.action_queue if _action_runner_component != null else _pending_action_queue
|
return _action_runner_component.action_queue if _action_runner_component != null else _pending_action_queue
|
||||||
@@ -262,7 +267,10 @@ func _ready() -> void:
|
|||||||
push_warning("StickmanRig: missing RigComponents/PropInteractor; prop interactions unavailable.")
|
push_warning("StickmanRig: missing RigComponents/PropInteractor; prop interactions unavailable.")
|
||||||
if _locomotion_component != null:
|
if _locomotion_component != null:
|
||||||
_locomotion_component.configure(self)
|
_locomotion_component.configure(self)
|
||||||
_locomotion_component.arrived.connect(func(target: Vector2) -> void: arrived.emit(target))
|
_locomotion_component.arrived.connect(func(target: Vector2) -> void:
|
||||||
|
if _action_runner_component == null or not _action_runner_component.is_prop_pursuit_active():
|
||||||
|
arrived.emit(target)
|
||||||
|
)
|
||||||
_locomotion_component.blocking_prop_sweep_hit.connect(_on_blocking_prop_sweep_hit)
|
_locomotion_component.blocking_prop_sweep_hit.connect(_on_blocking_prop_sweep_hit)
|
||||||
if _ragdoll_component != null:
|
if _ragdoll_component != null:
|
||||||
_ragdoll_component.configure(self, _locomotion_component)
|
_ragdoll_component.configure(self, _locomotion_component)
|
||||||
@@ -275,11 +283,17 @@ func _ready() -> void:
|
|||||||
_prop_interactor_component.connect("use_failed", _on_prop_use_failed)
|
_prop_interactor_component.connect("use_failed", _on_prop_use_failed)
|
||||||
if _action_runner_component != null:
|
if _action_runner_component != null:
|
||||||
_action_runner_component.configure(self, _locomotion_component, _prop_interactor_component)
|
_action_runner_component.configure(self, _locomotion_component, _prop_interactor_component)
|
||||||
_action_runner_component.action_queue = _pending_action_queue
|
if _has_pending_action_plan:
|
||||||
|
_action_runner_component.set_action_plan(_pending_action_plan)
|
||||||
|
else:
|
||||||
|
_action_runner_component.action_queue = _pending_action_queue
|
||||||
_action_runner_component.action_started.connect(func(action: Dictionary, index: int) -> void: action_started.emit(action, index))
|
_action_runner_component.action_started.connect(func(action: Dictionary, index: int) -> void: action_started.emit(action, index))
|
||||||
_action_runner_component.action_finished.connect(func(action: Dictionary, index: int) -> void: action_finished.emit(action, index))
|
_action_runner_component.action_finished.connect(func(action: Dictionary, index: int) -> void: action_finished.emit(action, index))
|
||||||
_action_runner_component.queue_finished.connect(func() -> void: queue_finished.emit())
|
_action_runner_component.queue_finished.connect(func() -> void: queue_finished.emit())
|
||||||
_action_runner_component.queue_changed.connect(func() -> void: queue_changed.emit())
|
_action_runner_component.queue_changed.connect(func() -> void: queue_changed.emit())
|
||||||
|
_action_runner_component.plan_changed.connect(func() -> void: action_plan_changed.emit())
|
||||||
|
_action_runner_component.planned_action_started.connect(func(action_id: String, action: Dictionary, step_index: int) -> void: planned_action_started.emit(action_id, action, step_index))
|
||||||
|
_action_runner_component.planned_action_ended.connect(func(action_id: String, outcome: StringName, step_index: int) -> void: planned_action_ended.emit(action_id, outcome, step_index))
|
||||||
_action_runner_component.speech_finished.connect(func() -> void: speech_finished.emit())
|
_action_runner_component.speech_finished.connect(func() -> void: speech_finished.emit())
|
||||||
_action_runner_component.ragdoll_requested.connect(func(enabled: bool) -> void: set_ragdoll(enabled))
|
_action_runner_component.ragdoll_requested.connect(func(enabled: bool) -> void: set_ragdoll(enabled))
|
||||||
_action_runner_component.recovery_requested.connect(func() -> void: request_recovery())
|
_action_runner_component.recovery_requested.connect(func() -> void: request_recovery())
|
||||||
@@ -336,6 +350,8 @@ func _physics_process(delta: float) -> void:
|
|||||||
_sample_ragdoll_velocity_baselines()
|
_sample_ragdoll_velocity_baselines()
|
||||||
if _ragdoll_component != null:
|
if _ragdoll_component != null:
|
||||||
_ragdoll_component.tick_pre_movement(delta, int(state), rest_timeout, auto_recover)
|
_ragdoll_component.tick_pre_movement(delta, int(state), rest_timeout, auto_recover)
|
||||||
|
if _action_runner_component != null:
|
||||||
|
_action_runner_component.pre_movement(delta)
|
||||||
if _locomotion_component != null:
|
if _locomotion_component != null:
|
||||||
_locomotion_component.tick_movement(delta, int(state))
|
_locomotion_component.tick_movement(delta, int(state))
|
||||||
if _prop_interactor_component != null:
|
if _prop_interactor_component != null:
|
||||||
@@ -947,6 +963,56 @@ func get_queue() -> Array[Dictionary]:
|
|||||||
return _action_runner_component.get_queue() if _action_runner_component != null else _pending_action_queue.duplicate(true)
|
return _action_runner_component.get_queue() if _action_runner_component != null else _pending_action_queue.duplicate(true)
|
||||||
|
|
||||||
|
|
||||||
|
func get_action_plan() -> Array[Dictionary]:
|
||||||
|
if _action_runner_component != null:
|
||||||
|
return _action_runner_component.get_action_plan()
|
||||||
|
return _pending_action_plan.duplicate(true)
|
||||||
|
|
||||||
|
|
||||||
|
func set_action_plan(steps: Array[Dictionary]) -> bool:
|
||||||
|
if _action_runner_component != null:
|
||||||
|
return _action_runner_component.set_action_plan(steps)
|
||||||
|
_pending_action_plan = steps.duplicate(true)
|
||||||
|
_has_pending_action_plan = true
|
||||||
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
func find_action(action_id: String) -> Dictionary:
|
||||||
|
return _action_runner_component.find_action(action_id) if _action_runner_component != null else {}
|
||||||
|
|
||||||
|
|
||||||
|
func get_plan_view() -> Array[Dictionary]:
|
||||||
|
return _action_runner_component.get_plan_view() if _action_runner_component != null else []
|
||||||
|
|
||||||
|
|
||||||
|
func add_action_step(action: Dictionary) -> String:
|
||||||
|
return _action_runner_component.add_plan_step(action) if _action_runner_component != null else ""
|
||||||
|
|
||||||
|
|
||||||
|
func add_action_together(step_index: int, action: Dictionary) -> String:
|
||||||
|
return _action_runner_component.add_plan_action_together(step_index, action) if _action_runner_component != null else ""
|
||||||
|
|
||||||
|
|
||||||
|
func replace_planned_action(action_id: String, action: Dictionary) -> bool:
|
||||||
|
return _action_runner_component.replace_plan_action(action_id, action) if _action_runner_component != null else false
|
||||||
|
|
||||||
|
|
||||||
|
func remove_planned_action(action_id: String) -> bool:
|
||||||
|
return _action_runner_component.remove_plan_action(action_id) if _action_runner_component != null else false
|
||||||
|
|
||||||
|
|
||||||
|
func move_plan_step(from_index: int, to_index: int) -> bool:
|
||||||
|
return _action_runner_component.move_plan_step(from_index, to_index) if _action_runner_component != null else false
|
||||||
|
|
||||||
|
|
||||||
|
func can_add_action_together(step_index: int, action_type: String) -> bool:
|
||||||
|
return _action_runner_component.can_add_plan_action_together(step_index, action_type) if _action_runner_component != null else false
|
||||||
|
|
||||||
|
|
||||||
|
func can_reorder_plan_step(step_index: int) -> bool:
|
||||||
|
return _action_runner_component.can_reorder_plan_step(step_index) if _action_runner_component != null else false
|
||||||
|
|
||||||
|
|
||||||
func remove_action(index: int) -> void:
|
func remove_action(index: int) -> void:
|
||||||
if _action_runner_component != null:
|
if _action_runner_component != null:
|
||||||
_action_runner_component.remove_action(index)
|
_action_runner_component.remove_action(index)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -37,6 +37,7 @@ var _row_font_size: int = 0
|
|||||||
var _title_font_size: int = 0
|
var _title_font_size: int = 0
|
||||||
var _title_font: Font = null
|
var _title_font: Font = null
|
||||||
var _use_target_summary_resolver: Callable = Callable()
|
var _use_target_summary_resolver: Callable = Callable()
|
||||||
|
var _prop_target_name_resolver: Callable = Callable()
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -62,6 +63,11 @@ func set_use_target_summary_resolver(resolver: Callable) -> void:
|
|||||||
refresh()
|
refresh()
|
||||||
|
|
||||||
|
|
||||||
|
func set_prop_target_name_resolver(resolver: Callable) -> void:
|
||||||
|
_prop_target_name_resolver = resolver
|
||||||
|
refresh()
|
||||||
|
|
||||||
|
|
||||||
func refresh() -> void:
|
func refresh() -> void:
|
||||||
if _list == null:
|
if _list == null:
|
||||||
return
|
return
|
||||||
@@ -151,7 +157,7 @@ func _make_row(index: int, action: Dictionary, status: int) -> PanelContainer:
|
|||||||
|
|
||||||
var summary := Label.new()
|
var summary := Label.new()
|
||||||
summary.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
summary.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
var action_summary: String = ACTION_REGISTRY.summarize(action)
|
var action_summary: String = ACTION_REGISTRY.summarize(action, _prop_target_name_resolver)
|
||||||
if String(action.get("type", "")) == "use_prop" and _use_target_summary_resolver.is_valid():
|
if String(action.get("type", "")) == "use_prop" and _use_target_summary_resolver.is_valid():
|
||||||
action_summary = String(_use_target_summary_resolver.call(
|
action_summary = String(_use_target_summary_resolver.call(
|
||||||
String(action.get("target_prop_id", "")),
|
String(action.get("target_prop_id", "")),
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -283,7 +283,7 @@ func set_down_target(position: Vector2) -> void:
|
|||||||
|
|
||||||
func show_action_editor() -> void:
|
func show_action_editor() -> void:
|
||||||
if _action_editor != null:
|
if _action_editor != null:
|
||||||
_action_editor.popup_centered()
|
_action_editor.resume_editor()
|
||||||
|
|
||||||
|
|
||||||
func request_action_target_capture() -> void:
|
func request_action_target_capture() -> void:
|
||||||
@@ -304,7 +304,7 @@ func request_action_target_capture() -> void:
|
|||||||
var pace: String = "run" if _action_editor.current_move_style() == ACTION_REGISTRY.RUN else "walk"
|
var pace: String = "run" if _action_editor.current_move_style() == ACTION_REGISTRY.RUN else "walk"
|
||||||
_emit_capture_request(&"position", "🚩 Click where they should %s (Esc or RMB to cancel)" % pace, Callable(self, "set_walk_target"), Callable(self, "cancel_target_capture"))
|
_emit_capture_request(&"position", "🚩 Click where they should %s (Esc or RMB to cancel)" % pace, Callable(self, "set_walk_target"), Callable(self, "cancel_target_capture"))
|
||||||
"pick_up_prop":
|
"pick_up_prop":
|
||||||
_emit_capture_request(&"prop", "🫴 Click the prop to pick up (Esc or RMB to cancel)", Callable(self, "accept_prop_target"), Callable(self, "cancel_target_capture"))
|
_emit_capture_request(&"pickup_prop", "Choose a prop to pick up", Callable(self, "accept_prop_target"), Callable(self, "cancel_target_capture"))
|
||||||
"use_prop":
|
"use_prop":
|
||||||
_emit_capture_request(&"use_prop", "Click a prop, then choose its Use spot", Callable(self, "set_use_target_from_capture"), Callable(self, "cancel_target_capture"))
|
_emit_capture_request(&"use_prop", "Click a prop, then choose its Use spot", Callable(self, "set_use_target_from_capture"), Callable(self, "cancel_target_capture"))
|
||||||
"throw_prop":
|
"throw_prop":
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,7 @@ signal reset_requested
|
|||||||
|
|
||||||
const TOP_BAR_HEIGHT: float = 64.0
|
const TOP_BAR_HEIGHT: float = 64.0
|
||||||
const STATUS_BAR_HEIGHT: float = 38.0
|
const STATUS_BAR_HEIGHT: float = 38.0
|
||||||
const COMPACT_TOP_BAR_WIDTH: float = 900.0
|
const COMPACT_TOP_BAR_WIDTH: float = 1100.0
|
||||||
|
|
||||||
var _stage_theme: SandboxTheme
|
var _stage_theme: SandboxTheme
|
||||||
var _current_mode: int = 0
|
var _current_mode: int = 0
|
||||||
@@ -39,6 +39,7 @@ var _accent_direct: Color = Color("#FFB300")
|
|||||||
var _accent_play: Color = Color("#33DD77")
|
var _accent_play: Color = Color("#33DD77")
|
||||||
var _status_pill_font_size: int = 16
|
var _status_pill_font_size: int = 16
|
||||||
var _tooltip_font_size: int = 18
|
var _tooltip_font_size: int = 18
|
||||||
|
var _direct_hint_requested: bool = false
|
||||||
|
|
||||||
var _mode_buttons: Dictionary = {}
|
var _mode_buttons: Dictionary = {}
|
||||||
var _palette_buttons: Dictionary = {}
|
var _palette_buttons: Dictionary = {}
|
||||||
@@ -58,6 +59,7 @@ var _pause_button: Button
|
|||||||
var _resume_button: Button
|
var _resume_button: Button
|
||||||
var _reset_button: Button
|
var _reset_button: Button
|
||||||
var _tooltip: Label
|
var _tooltip: Label
|
||||||
|
var _action_tooltip_avoid_rect: Rect2 = Rect2()
|
||||||
var _grid_check: CheckBox
|
var _grid_check: CheckBox
|
||||||
var _snap_check: CheckBox
|
var _snap_check: CheckBox
|
||||||
var _grid_size_spin: SpinBox
|
var _grid_size_spin: SpinBox
|
||||||
@@ -293,21 +295,76 @@ func set_action_tooltip(visible: bool, text_value: String = "") -> void:
|
|||||||
_tooltip.visible = visible
|
_tooltip.visible = visible
|
||||||
if not visible:
|
if not visible:
|
||||||
return
|
return
|
||||||
_tooltip.text = text_value
|
_tooltip.text = _capture_tooltip_text(text_value)
|
||||||
var style: StyleBox = _tooltip.get_theme_stylebox("normal")
|
var style: StyleBox = _tooltip.get_theme_stylebox("normal")
|
||||||
var extra: Vector2 = style.get_minimum_size() if style != null else Vector2.ZERO
|
var extra: Vector2 = style.get_minimum_size() if style != null else Vector2.ZERO
|
||||||
_tooltip.size = _tooltip.get_minimum_size() + extra
|
var required_size: Vector2 = _tooltip.get_minimum_size() + extra
|
||||||
|
var tooltip_width: float = clampf(required_size.x, 320.0, 420.0)
|
||||||
|
_tooltip.size = Vector2(tooltip_width, maxf(required_size.y, 50.0))
|
||||||
var mouse: Vector2 = get_viewport().get_mouse_position()
|
var mouse: Vector2 = get_viewport().get_mouse_position()
|
||||||
var size: Vector2 = _tooltip.size
|
var size: Vector2 = _tooltip.size
|
||||||
var position: Vector2 = mouse + Vector2(20.0, -20.0)
|
|
||||||
var viewport_size: Vector2 = get_viewport().get_visible_rect().size
|
var viewport_size: Vector2 = get_viewport().get_visible_rect().size
|
||||||
if position.x + size.x > viewport_size.x:
|
var avoid_rects: Array[Rect2] = []
|
||||||
position.x = mouse.x - size.x - 20.0
|
if _action_tooltip_avoid_rect.has_area():
|
||||||
if position.y + size.y > viewport_size.y:
|
avoid_rects.append(_action_tooltip_avoid_rect)
|
||||||
position.y = mouse.y - size.y - 20.0
|
if _mode_badge != null and _mode_badge.visible:
|
||||||
if position.y < 0.0:
|
avoid_rects.append(_mode_badge.get_global_rect().grow(6.0))
|
||||||
position.y = mouse.y + 20.0
|
if _timestamp_badge != null and _timestamp_badge.visible:
|
||||||
_tooltip.position = position
|
avoid_rects.append(_timestamp_badge.get_global_rect().grow(6.0))
|
||||||
|
if _palette_dock != null and _palette_dock.visible:
|
||||||
|
avoid_rects.append(_palette_dock.get_global_rect().grow(6.0))
|
||||||
|
_tooltip.position = _find_action_tooltip_position(mouse, size, viewport_size, avoid_rects)
|
||||||
|
|
||||||
|
|
||||||
|
func _find_action_tooltip_position(mouse: Vector2, size: Vector2, viewport_size: Vector2, avoid_rects: Array[Rect2]) -> Vector2:
|
||||||
|
var min_x: float = 8.0
|
||||||
|
var max_x: float = maxf(min_x, viewport_size.x - size.x - 8.0)
|
||||||
|
var min_y: float = TOP_BAR_HEIGHT + 8.0
|
||||||
|
var max_y: float = maxf(min_y, viewport_size.y - size.y - 8.0)
|
||||||
|
var candidates: Array[Vector2] = [
|
||||||
|
mouse + Vector2(20.0, -20.0),
|
||||||
|
mouse + Vector2(-size.x - 20.0, -20.0),
|
||||||
|
mouse + Vector2(20.0, 20.0),
|
||||||
|
mouse + Vector2(-size.x - 20.0, 20.0),
|
||||||
|
]
|
||||||
|
for avoid_rect: Rect2 in avoid_rects:
|
||||||
|
candidates.append(Vector2(avoid_rect.position.x - size.x - 12.0, avoid_rect.get_center().y - size.y * 0.5))
|
||||||
|
candidates.append(Vector2(avoid_rect.end.x + 12.0, avoid_rect.get_center().y - size.y * 0.5))
|
||||||
|
candidates.append(Vector2(avoid_rect.get_center().x - size.x * 0.5, avoid_rect.position.y - size.y - 12.0))
|
||||||
|
candidates.append(Vector2(avoid_rect.get_center().x - size.x * 0.5, avoid_rect.end.y + 12.0))
|
||||||
|
candidates.append(Vector2(min_x, min_y))
|
||||||
|
candidates.append(Vector2(max_x, min_y))
|
||||||
|
candidates.append(Vector2(min_x, max_y))
|
||||||
|
candidates.append(Vector2(max_x, max_y))
|
||||||
|
for candidate: Vector2 in candidates:
|
||||||
|
var position: Vector2 = Vector2(clampf(candidate.x, min_x, max_x), clampf(candidate.y, min_y, max_y))
|
||||||
|
var tooltip_rect: Rect2 = Rect2(position, size)
|
||||||
|
var overlaps: bool = false
|
||||||
|
for avoid_rect: Rect2 in avoid_rects:
|
||||||
|
if tooltip_rect.intersects(avoid_rect):
|
||||||
|
overlaps = true
|
||||||
|
break
|
||||||
|
if not overlaps:
|
||||||
|
return position
|
||||||
|
return Vector2(min_x, min_y)
|
||||||
|
|
||||||
|
|
||||||
|
func set_action_tooltip_avoid_rect(rect: Rect2) -> void:
|
||||||
|
_action_tooltip_avoid_rect = rect
|
||||||
|
|
||||||
|
|
||||||
|
func _capture_tooltip_text(text_value: String) -> String:
|
||||||
|
var task: String = text_value.strip_edges()
|
||||||
|
for old_copy: String in ["(Esc or RMB to cancel)", "(Esc or right-click to cancel)", "Esc cancels."]:
|
||||||
|
task = task.replace(old_copy, "").strip_edges()
|
||||||
|
while task.ends_with("\n"):
|
||||||
|
task = task.substr(0, task.length() - 1).strip_edges()
|
||||||
|
var cancel_hint: String = "Press Escape or right-click to cancel"
|
||||||
|
if task.is_empty():
|
||||||
|
return cancel_hint
|
||||||
|
if task.contains(cancel_hint):
|
||||||
|
return task
|
||||||
|
return "%s\n%s" % [task, cancel_hint]
|
||||||
|
|
||||||
|
|
||||||
func set_edit_controls_visible(visible: bool) -> void:
|
func set_edit_controls_visible(visible: bool) -> void:
|
||||||
@@ -326,8 +383,9 @@ func set_edit_controls_visible(visible: bool) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func set_direct_controls_visible(visible: bool) -> void:
|
func set_direct_controls_visible(visible: bool) -> void:
|
||||||
|
_direct_hint_requested = visible
|
||||||
if _direct_hint_label != null:
|
if _direct_hint_label != null:
|
||||||
_direct_hint_label.visible = visible
|
_direct_hint_label.visible = visible and get_viewport().get_visible_rect().size.x > COMPACT_TOP_BAR_WIDTH
|
||||||
|
|
||||||
|
|
||||||
func is_stage_frame_position(viewport_pos: Vector2) -> bool:
|
func is_stage_frame_position(viewport_pos: Vector2) -> bool:
|
||||||
@@ -506,6 +564,8 @@ func _apply_responsive_top_bar_layout() -> void:
|
|||||||
return
|
return
|
||||||
var viewport_width: float = get_viewport().get_visible_rect().size.x
|
var viewport_width: float = get_viewport().get_visible_rect().size.x
|
||||||
var compact: bool = viewport_width <= COMPACT_TOP_BAR_WIDTH
|
var compact: bool = viewport_width <= COMPACT_TOP_BAR_WIDTH
|
||||||
|
if _direct_hint_label != null:
|
||||||
|
_direct_hint_label.visible = _direct_hint_requested and not compact
|
||||||
if compact:
|
if compact:
|
||||||
_file_menu.custom_minimum_size = Vector2(64.0, 48.0)
|
_file_menu.custom_minimum_size = Vector2(64.0, 48.0)
|
||||||
_file_menu.add_theme_font_size_override("font_size", 18)
|
_file_menu.add_theme_font_size_override("font_size", 18)
|
||||||
@@ -656,7 +716,7 @@ func _build_timestamp_badge() -> void:
|
|||||||
_timestamp_badge.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
_timestamp_badge.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
_timestamp_badge.offset_left = -220.0
|
_timestamp_badge.offset_left = -220.0
|
||||||
_timestamp_badge.offset_top = TOP_BAR_HEIGHT + 62.0
|
_timestamp_badge.offset_top = TOP_BAR_HEIGHT + 62.0
|
||||||
_timestamp_badge.offset_right = -12.0
|
_timestamp_badge.offset_right = -_theme_number("stage_panels.shell.edge_inset", 12.0, 0.0, 48.0)
|
||||||
_timestamp_badge.offset_bottom = TOP_BAR_HEIGHT + 106.0
|
_timestamp_badge.offset_bottom = TOP_BAR_HEIGHT + 106.0
|
||||||
var style := StyleBoxFlat.new()
|
var style := StyleBoxFlat.new()
|
||||||
style.bg_color = _theme_color("chrome.timestamp_badge.bg_color", Color("#171B24F2"))
|
style.bg_color = _theme_color("chrome.timestamp_badge.bg_color", Color("#171B24F2"))
|
||||||
@@ -683,6 +743,8 @@ func _build_action_tooltip() -> void:
|
|||||||
_tooltip.name = "ActionTooltip"
|
_tooltip.name = "ActionTooltip"
|
||||||
_tooltip.visible = false
|
_tooltip.visible = false
|
||||||
_tooltip.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
_tooltip.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
_tooltip.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||||
|
_tooltip.max_lines_visible = 3
|
||||||
var style := StyleBoxFlat.new()
|
var style := StyleBoxFlat.new()
|
||||||
style.bg_color = Color(0.1, 0.1, 0.1, 0.9)
|
style.bg_color = Color(0.1, 0.1, 0.1, 0.9)
|
||||||
style.border_color = _accent_direct
|
style.border_color = _accent_direct
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ func build_ui(parent: Node, sandbox_theme: SandboxTheme, ui_font: Font, emoji_fo
|
|||||||
_action_popup.add_separator()
|
_action_popup.add_separator()
|
||||||
_action_popup.add_item("⚡ When...", int(action_ids.get("when", 5)))
|
_action_popup.add_item("⚡ When...", int(action_ids.get("when", 5)))
|
||||||
_action_popup.add_separator()
|
_action_popup.add_separator()
|
||||||
_action_popup.add_item("📋 Edit Queue…", int(action_ids.get("edit_queue", 7)))
|
_action_popup.add_item("📋 Step Stack…", int(action_ids.get("edit_queue", 7)))
|
||||||
_action_popup.add_item("⚡ Edit Rules…", int(action_ids.get("edit_rules", 8)))
|
_action_popup.add_item("⚡ Edit Rules…", int(action_ids.get("edit_rules", 8)))
|
||||||
_action_popup.id_pressed.connect(_on_action_popup_id_pressed)
|
_action_popup.id_pressed.connect(_on_action_popup_id_pressed)
|
||||||
_action_popup.about_to_popup.connect(_on_action_popup_about_to_popup)
|
_action_popup.about_to_popup.connect(_on_action_popup_about_to_popup)
|
||||||
@@ -308,7 +308,7 @@ func refresh_action_popup_items(rules: Array[Dictionary]) -> void:
|
|||||||
if _action_popup == null:
|
if _action_popup == null:
|
||||||
return
|
return
|
||||||
var valid: bool = context_rig != null and is_instance_valid(context_rig)
|
var valid: bool = context_rig != null and is_instance_valid(context_rig)
|
||||||
_disable_popup_item(_action_popup, 7, not valid or context_rig.get_queue().is_empty())
|
_disable_popup_item(_action_popup, 7, not valid)
|
||||||
_disable_popup_item(_action_popup, 8, not valid or not rig_has_rules(context_rig, rules))
|
_disable_popup_item(_action_popup, 8, not valid or not rig_has_rules(context_rig, rules))
|
||||||
|
|
||||||
|
|
||||||
@@ -316,7 +316,7 @@ func refresh_rig_context_items(rig: StickmanRig, popup: PopupMenu, rules: Array[
|
|||||||
if popup == null:
|
if popup == null:
|
||||||
return
|
return
|
||||||
var valid: bool = rig != null and is_instance_valid(rig)
|
var valid: bool = rig != null and is_instance_valid(rig)
|
||||||
_disable_popup_item(popup, 0, not valid or rig.get_queue().is_empty())
|
_disable_popup_item(popup, 0, not valid)
|
||||||
_disable_popup_item(popup, 1, not valid or not rig_has_rules(rig, rules))
|
_disable_popup_item(popup, 1, not valid or not rig_has_rules(rig, rules))
|
||||||
|
|
||||||
|
|
||||||
@@ -455,10 +455,13 @@ func update_action_overlay(
|
|||||||
if awaiting:
|
if awaiting:
|
||||||
var origin: Vector2 = action_origin(capture_kind, set_down_rig, throw_rig, throw_cache, _action_queue.panel_rig if _action_queue != null else null)
|
var origin: Vector2 = action_origin(capture_kind, set_down_rig, throw_rig, throw_cache, _action_queue.panel_rig if _action_queue != null else null)
|
||||||
var target: Vector2 = _camera.get_global_mouse_position() if _camera != null else Vector2.ZERO
|
var target: Vector2 = _camera.get_global_mouse_position() if _camera != null else Vector2.ZERO
|
||||||
|
var movement_target_capture: bool = capture_kind == "position" or pending_walk_target or (_rule_authoring != null and _rule_authoring.step == RULE_STEP_ACTION_POSITION)
|
||||||
if snap_enabled and (capture_kind in ["position", "throw", "set_down"] or (_rule_authoring != null and _rule_authoring.step == RULE_STEP_ACTION_POSITION)):
|
if snap_enabled and (capture_kind in ["position", "throw", "set_down"] or (_rule_authoring != null and _rule_authoring.step == RULE_STEP_ACTION_POSITION)):
|
||||||
if grid_size > 0.0:
|
if grid_size > 0.0:
|
||||||
target = Vector2(roundf(target.x / grid_size) * grid_size, roundf(target.y / grid_size) * grid_size)
|
target = Vector2(roundf(target.x / grid_size) * grid_size, roundf(target.y / grid_size) * grid_size)
|
||||||
if capture_kind == "set_down":
|
if capture_kind in ["plan_place", "plan_prop"]:
|
||||||
|
_placement_overlay.set_action_marker(target)
|
||||||
|
elif capture_kind == "set_down":
|
||||||
var known: bool = bool(set_down_cache.get("known", false))
|
var known: bool = bool(set_down_cache.get("known", false))
|
||||||
var valid: bool = bool(set_down_cache.get("valid", false))
|
var valid: bool = bool(set_down_cache.get("valid", false))
|
||||||
if known:
|
if known:
|
||||||
@@ -487,11 +490,15 @@ func update_action_overlay(
|
|||||||
throw_preview["start_position"], target, throw_preview["landing_position"], target_reachable,
|
throw_preview["start_position"], target, throw_preview["landing_position"], target_reachable,
|
||||||
trajectory_points, effective_target, collision_position, preview_planned, preview_uncertain
|
trajectory_points, effective_target, collision_position, preview_planned, preview_uncertain
|
||||||
)
|
)
|
||||||
|
elif movement_target_capture:
|
||||||
|
_placement_overlay.set_grounded_action_trajectory(origin, target, is_target_valid(target))
|
||||||
else:
|
else:
|
||||||
_placement_overlay.set_action_trajectory(origin, target, is_target_valid(target))
|
# Object/actor/rule target selection needs a cursor marker, not a
|
||||||
|
# movement-looking line from the actor to the hovered target.
|
||||||
|
_placement_overlay.set_action_marker(target)
|
||||||
elif direct_move_target.is_finite() and context_rig != null and is_instance_valid(context_rig):
|
elif direct_move_target.is_finite() and context_rig != null and is_instance_valid(context_rig):
|
||||||
var origin: Vector2 = context_rig.global_position - STICKMAN_LOCOMOTION.FOOT_OFFSET
|
var origin: Vector2 = context_rig.global_position - STICKMAN_LOCOMOTION.FOOT_OFFSET
|
||||||
_placement_overlay.set_action_trajectory(origin, direct_move_target, true)
|
_placement_overlay.set_grounded_action_trajectory(origin, direct_move_target, true)
|
||||||
else:
|
else:
|
||||||
_placement_overlay.clear_action()
|
_placement_overlay.clear_action()
|
||||||
if _chrome != null:
|
if _chrome != null:
|
||||||
|
|||||||
@@ -0,0 +1,287 @@
|
|||||||
|
class_name StageInspectorCaptureOverlay
|
||||||
|
extends Control
|
||||||
|
## Keeps an active world-target choice visible beside the inspector while
|
||||||
|
## dimming and blocking the inspector controls underneath it.
|
||||||
|
|
||||||
|
signal capture_action_requested(action_id: StringName)
|
||||||
|
|
||||||
|
const CAPTURE_STRIP_HEIGHT: float = 72.0
|
||||||
|
const CAPTURE_MULTI_ACTION_STRIP_HEIGHT: float = 124.0
|
||||||
|
const CAPTURE_BUTTON_HEIGHT: float = 48.0
|
||||||
|
const CAPTURE_CANCEL_WIDTH: float = 84.0
|
||||||
|
const CAPTURE_ACTION_WIDTH: float = 112.0
|
||||||
|
|
||||||
|
var _stage_theme: SandboxTheme
|
||||||
|
var _inspector: Control
|
||||||
|
var _inspector_scrim: Panel
|
||||||
|
var _capture_strip: PanelContainer
|
||||||
|
var _content_column: VBoxContainer
|
||||||
|
var _title_row: HBoxContainer
|
||||||
|
var _caption: Label
|
||||||
|
var _caption_base_font_size: int = 17
|
||||||
|
var _actions_row: HBoxContainer
|
||||||
|
var _action_buttons: Array[Button] = []
|
||||||
|
var _active_signature: String = ""
|
||||||
|
var _focus_before_capture: Control
|
||||||
|
|
||||||
|
|
||||||
|
func configure(stage_theme: SandboxTheme) -> void:
|
||||||
|
_stage_theme = stage_theme
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
name = "StageInspectorCaptureOverlay"
|
||||||
|
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||||
|
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
z_index = 120
|
||||||
|
visible = false
|
||||||
|
_build_controls()
|
||||||
|
get_viewport().size_changed.connect(_layout_capture_overlay)
|
||||||
|
|
||||||
|
|
||||||
|
func _process(_delta: float) -> void:
|
||||||
|
_layout_capture_overlay()
|
||||||
|
|
||||||
|
|
||||||
|
func show_capture(inspector: Control, prompt: String, actions: Array[Dictionary]) -> bool:
|
||||||
|
if inspector == null or not is_instance_valid(inspector) or not inspector.is_visible_in_tree():
|
||||||
|
hide_capture()
|
||||||
|
return false
|
||||||
|
var normalized_actions: Array[Dictionary] = actions.duplicate(true)
|
||||||
|
if normalized_actions.is_empty():
|
||||||
|
normalized_actions.append({"id": "cancel_capture", "label": "Cancel", "primary": true})
|
||||||
|
_set_stacked_actions(normalized_actions.size() > 1)
|
||||||
|
var action_signature: Array[String] = []
|
||||||
|
for action: Dictionary in normalized_actions:
|
||||||
|
action_signature.append("%s:%s" % [String(action.get("id", "")), String(action.get("label", ""))])
|
||||||
|
var signature: String = "%d|%s|%s" % [inspector.get_instance_id(), prompt, ";".join(action_signature)]
|
||||||
|
if _active_signature != signature:
|
||||||
|
if _active_signature.is_empty():
|
||||||
|
_focus_before_capture = get_viewport().gui_get_focus_owner()
|
||||||
|
_active_signature = signature
|
||||||
|
_inspector = inspector
|
||||||
|
_caption.text = prompt
|
||||||
|
_rebuild_actions(normalized_actions)
|
||||||
|
visible = true
|
||||||
|
if not _action_buttons.is_empty():
|
||||||
|
_action_buttons[_action_buttons.size() - 1].grab_focus()
|
||||||
|
_layout_capture_overlay()
|
||||||
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
func hide_capture() -> void:
|
||||||
|
if _active_signature.is_empty():
|
||||||
|
return
|
||||||
|
_active_signature = ""
|
||||||
|
_inspector = null
|
||||||
|
visible = false
|
||||||
|
for button: Button in _action_buttons:
|
||||||
|
button.queue_free()
|
||||||
|
_action_buttons.clear()
|
||||||
|
if _focus_before_capture != null and is_instance_valid(_focus_before_capture) and _focus_before_capture.is_visible_in_tree():
|
||||||
|
_focus_before_capture.grab_focus()
|
||||||
|
_focus_before_capture = null
|
||||||
|
|
||||||
|
|
||||||
|
func has_capture() -> bool:
|
||||||
|
return not _active_signature.is_empty()
|
||||||
|
|
||||||
|
|
||||||
|
func get_inspector_rect() -> Rect2:
|
||||||
|
if not has_capture() or _inspector == null or not is_instance_valid(_inspector):
|
||||||
|
return Rect2()
|
||||||
|
return _inspector.get_global_rect()
|
||||||
|
|
||||||
|
|
||||||
|
func _build_controls() -> void:
|
||||||
|
_inspector_scrim = Panel.new()
|
||||||
|
_inspector_scrim.name = "InspectorInputBlocker"
|
||||||
|
_inspector_scrim.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||||
|
_inspector_scrim.focus_mode = Control.FOCUS_NONE
|
||||||
|
_inspector_scrim.gui_input.connect(_on_capture_area_gui_input)
|
||||||
|
var scrim_style: StyleBoxFlat = StyleBoxFlat.new()
|
||||||
|
scrim_style.bg_color = Color(0.015, 0.02, 0.035, 0.56)
|
||||||
|
scrim_style.set_corner_radius_all(_integer("stage_panels.shell.corner_radius", 12, 8, 32))
|
||||||
|
_inspector_scrim.add_theme_stylebox_override("panel", scrim_style)
|
||||||
|
add_child(_inspector_scrim)
|
||||||
|
|
||||||
|
_capture_strip = PanelContainer.new()
|
||||||
|
_capture_strip.name = "CaptureCancelStrip"
|
||||||
|
_capture_strip.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||||
|
_capture_strip.gui_input.connect(_on_capture_area_gui_input)
|
||||||
|
_capture_strip.add_theme_stylebox_override("panel", _strip_style())
|
||||||
|
add_child(_capture_strip)
|
||||||
|
|
||||||
|
var margin: MarginContainer = MarginContainer.new()
|
||||||
|
margin.add_theme_constant_override("margin_left", 10)
|
||||||
|
margin.add_theme_constant_override("margin_right", 10)
|
||||||
|
margin.add_theme_constant_override("margin_top", 7)
|
||||||
|
margin.add_theme_constant_override("margin_bottom", 7)
|
||||||
|
margin.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
_capture_strip.add_child(margin)
|
||||||
|
|
||||||
|
_content_column = VBoxContainer.new()
|
||||||
|
_content_column.name = "CaptureContent"
|
||||||
|
_content_column.add_theme_constant_override("separation", 4)
|
||||||
|
_content_column.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
margin.add_child(_content_column)
|
||||||
|
|
||||||
|
_title_row = HBoxContainer.new()
|
||||||
|
_title_row.name = "CaptureTitleRow"
|
||||||
|
_title_row.add_theme_constant_override("separation", 8)
|
||||||
|
_title_row.alignment = BoxContainer.ALIGNMENT_CENTER
|
||||||
|
_title_row.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
_title_row.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
_content_column.add_child(_title_row)
|
||||||
|
|
||||||
|
var marker: Label = Label.new()
|
||||||
|
marker.text = "⊕"
|
||||||
|
marker.add_theme_font_size_override("font_size", 25)
|
||||||
|
marker.add_theme_color_override("font_color", Color("#22C6FF"))
|
||||||
|
marker.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
_title_row.add_child(marker)
|
||||||
|
|
||||||
|
_caption = Label.new()
|
||||||
|
_caption.name = "CapturePrompt"
|
||||||
|
_caption.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
_caption.text = "Choosing a target"
|
||||||
|
_caption.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||||
|
_caption.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
||||||
|
_caption.clip_text = true
|
||||||
|
_caption.custom_minimum_size.y = 48.0
|
||||||
|
_caption_base_font_size = _integer("stage_panels.type.body_size", 17, 14, 28)
|
||||||
|
_caption.add_theme_font_size_override("font_size", _caption_base_font_size)
|
||||||
|
_caption.add_theme_color_override("font_color", _color("stage_panels.type.text_color", Color("#F5F7FA")))
|
||||||
|
_caption.size_flags_horizontal = Control.SIZE_EXPAND_FILL | Control.SIZE_SHRINK_BEGIN
|
||||||
|
_caption.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||||
|
_caption.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
_title_row.add_child(_caption)
|
||||||
|
|
||||||
|
_actions_row = HBoxContainer.new()
|
||||||
|
_actions_row.name = "CaptureActions"
|
||||||
|
_actions_row.add_theme_constant_override("separation", 6)
|
||||||
|
_actions_row.alignment = BoxContainer.ALIGNMENT_END
|
||||||
|
_actions_row.size_flags_horizontal = Control.SIZE_SHRINK_END
|
||||||
|
_actions_row.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
_title_row.add_child(_actions_row)
|
||||||
|
|
||||||
|
|
||||||
|
func _set_stacked_actions(stacked: bool) -> void:
|
||||||
|
if _actions_row == null or _content_column == null or _title_row == null:
|
||||||
|
return
|
||||||
|
var target_parent: Node = _content_column if stacked else _title_row
|
||||||
|
if _actions_row.get_parent() != target_parent:
|
||||||
|
_actions_row.reparent(target_parent)
|
||||||
|
_actions_row.size_flags_horizontal = Control.SIZE_EXPAND_FILL if stacked else Control.SIZE_SHRINK_END
|
||||||
|
_actions_row.alignment = BoxContainer.ALIGNMENT_END
|
||||||
|
|
||||||
|
|
||||||
|
func _rebuild_actions(actions: Array[Dictionary]) -> void:
|
||||||
|
for button: Button in _action_buttons:
|
||||||
|
button.queue_free()
|
||||||
|
_action_buttons.clear()
|
||||||
|
for action: Dictionary in actions:
|
||||||
|
var action_id: StringName = StringName(String(action.get("id", "")))
|
||||||
|
if action_id.is_empty():
|
||||||
|
continue
|
||||||
|
var button: Button = Button.new()
|
||||||
|
button.name = "Capture_%s" % String(action_id)
|
||||||
|
button.text = String(action.get("label", "Cancel"))
|
||||||
|
button.tooltip_text = button.text
|
||||||
|
button.focus_mode = Control.FOCUS_ALL
|
||||||
|
button.custom_minimum_size = Vector2(CAPTURE_CANCEL_WIDTH if action_id == &"cancel_capture" else CAPTURE_ACTION_WIDTH, CAPTURE_BUTTON_HEIGHT)
|
||||||
|
button.add_theme_font_size_override("font_size", _integer("stage_panels.action.label_size", 16, 14, 24))
|
||||||
|
_style_action_button(button, action_id == &"cancel_capture")
|
||||||
|
button.pressed.connect(_on_action_pressed.bind(action_id))
|
||||||
|
_actions_row.add_child(button)
|
||||||
|
_action_buttons.append(button)
|
||||||
|
_trap_action_focus()
|
||||||
|
|
||||||
|
|
||||||
|
func _trap_action_focus() -> void:
|
||||||
|
for index: int in _action_buttons.size():
|
||||||
|
var button: Button = _action_buttons[index]
|
||||||
|
button.set_focus_neighbor(SIDE_TOP, button.get_path())
|
||||||
|
button.set_focus_neighbor(SIDE_BOTTOM, button.get_path())
|
||||||
|
button.set_focus_neighbor(SIDE_LEFT, _action_buttons[maxi(0, index - 1)].get_path())
|
||||||
|
button.set_focus_neighbor(SIDE_RIGHT, _action_buttons[mini(_action_buttons.size() - 1, index + 1)].get_path())
|
||||||
|
|
||||||
|
|
||||||
|
func _on_action_pressed(action_id: StringName) -> void:
|
||||||
|
capture_action_requested.emit(action_id)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_capture_area_gui_input(event: InputEvent) -> void:
|
||||||
|
if event is InputEventMouseButton:
|
||||||
|
var mouse_button: InputEventMouseButton = event as InputEventMouseButton
|
||||||
|
if mouse_button.pressed and mouse_button.button_index == MOUSE_BUTTON_RIGHT:
|
||||||
|
capture_action_requested.emit(&"cancel_capture")
|
||||||
|
accept_event()
|
||||||
|
|
||||||
|
|
||||||
|
func _layout_capture_overlay() -> void:
|
||||||
|
if not has_capture() or _inspector == null or not is_instance_valid(_inspector) or not _inspector.is_visible_in_tree():
|
||||||
|
hide_capture()
|
||||||
|
return
|
||||||
|
var viewport_rect: Rect2 = get_viewport().get_visible_rect()
|
||||||
|
var inspector_rect: Rect2 = _inspector.get_global_rect().intersection(viewport_rect)
|
||||||
|
if not inspector_rect.has_area():
|
||||||
|
hide_capture()
|
||||||
|
return
|
||||||
|
var caption_font_size: int = mini(_caption_base_font_size, 16) if inspector_rect.size.x < 340.0 else _caption_base_font_size
|
||||||
|
_caption.add_theme_font_size_override("font_size", caption_font_size)
|
||||||
|
_inspector_scrim.position = inspector_rect.position
|
||||||
|
_inspector_scrim.size = inspector_rect.size
|
||||||
|
_capture_strip.position = inspector_rect.position
|
||||||
|
var strip_height: float = CAPTURE_MULTI_ACTION_STRIP_HEIGHT if _actions_row.get_parent() == _content_column else CAPTURE_STRIP_HEIGHT
|
||||||
|
_capture_strip.size = Vector2(inspector_rect.size.x, strip_height)
|
||||||
|
_capture_strip.custom_minimum_size = Vector2(inspector_rect.size.x, strip_height)
|
||||||
|
|
||||||
|
|
||||||
|
func _strip_style() -> StyleBoxFlat:
|
||||||
|
var style: StyleBoxFlat = StyleBoxFlat.new()
|
||||||
|
style.bg_color = _color("stage_panels.shell.surface_color", Color("#202634"))
|
||||||
|
style.border_color = _color("mode_colors.direct", Color("#FFB300"))
|
||||||
|
style.set_border_width_all(2)
|
||||||
|
style.set_corner_radius_all(_integer("stage_panels.shell.corner_radius", 12, 8, 32))
|
||||||
|
style.content_margin_left = 8.0
|
||||||
|
style.content_margin_right = 8.0
|
||||||
|
style.content_margin_top = 4.0
|
||||||
|
style.content_margin_bottom = 4.0
|
||||||
|
return style
|
||||||
|
|
||||||
|
|
||||||
|
func _style_action_button(button: Button, is_cancel: bool) -> void:
|
||||||
|
var normal: Color = Color("#B83A43") if is_cancel else _color("stage_panels.action.surface_color", Color("#171B24"))
|
||||||
|
var hover: Color = Color("#CF4B54") if is_cancel else _color("stage_panels.action.hover_surface", Color("#303A4B"))
|
||||||
|
var pressed: Color = Color("#96323A") if is_cancel else _color("stage_panels.action.selected_surface", Color("#12394A"))
|
||||||
|
var border: Color = Color("#FF8790") if is_cancel else _color("stage_panels.choice.border_color", Color("#FFFFFF55"))
|
||||||
|
button.add_theme_stylebox_override("normal", _button_style(normal, border, 2))
|
||||||
|
button.add_theme_stylebox_override("hover", _button_style(hover, border.lightened(0.12), 2))
|
||||||
|
button.add_theme_stylebox_override("pressed", _button_style(pressed, border, 2))
|
||||||
|
button.add_theme_stylebox_override("focus", _button_style(normal, Color("#8BD9FF"), 3))
|
||||||
|
button.add_theme_color_override("font_color", Color("#FFFFFF"))
|
||||||
|
button.add_theme_color_override("font_hover_color", Color("#FFFFFF"))
|
||||||
|
button.add_theme_color_override("font_pressed_color", Color("#FFFFFF"))
|
||||||
|
button.add_theme_color_override("font_focus_color", Color("#FFFFFF"))
|
||||||
|
|
||||||
|
|
||||||
|
func _button_style(background: Color, border: Color, border_width: int) -> StyleBoxFlat:
|
||||||
|
var style: StyleBoxFlat = StyleBoxFlat.new()
|
||||||
|
style.bg_color = background
|
||||||
|
style.border_color = border
|
||||||
|
style.set_border_width_all(border_width)
|
||||||
|
style.set_corner_radius_all(_integer("stage_panels.shell.corner_radius", 10, 0, 32))
|
||||||
|
style.content_margin_left = 10.0
|
||||||
|
style.content_margin_right = 10.0
|
||||||
|
style.content_margin_top = 5.0
|
||||||
|
style.content_margin_bottom = 5.0
|
||||||
|
return style
|
||||||
|
|
||||||
|
|
||||||
|
func _color(path: String, fallback: Color) -> Color:
|
||||||
|
return _stage_theme.color(path, fallback) if _stage_theme != null else fallback
|
||||||
|
|
||||||
|
|
||||||
|
func _integer(path: String, fallback: int, minimum: int, maximum: int) -> int:
|
||||||
|
return _stage_theme.integer(path, fallback, minimum, maximum) if _stage_theme != null else fallback
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://71weltw84wr
|
||||||
@@ -37,6 +37,7 @@ var waypoint_context: PopupMenu
|
|||||||
var confirm_dialog: ConfirmationDialog
|
var confirm_dialog: ConfirmationDialog
|
||||||
var queue_panel: QueuePanel
|
var queue_panel: QueuePanel
|
||||||
var action_editor: ActionEditor
|
var action_editor: ActionEditor
|
||||||
|
var action_editor_backdrop: ColorRect
|
||||||
var speech_composer: Control
|
var speech_composer: Control
|
||||||
var speech_style_toolbar: Control
|
var speech_style_toolbar: Control
|
||||||
var speech_show_toolbar: Control
|
var speech_show_toolbar: Control
|
||||||
@@ -181,7 +182,7 @@ func build_context_and_editor_views(
|
|||||||
action_size: Vector2i
|
action_size: Vector2i
|
||||||
) -> void:
|
) -> void:
|
||||||
rig_context_popup = PopupMenu.new()
|
rig_context_popup = PopupMenu.new()
|
||||||
rig_context_popup.add_item("📋 Edit Queue…", 0)
|
rig_context_popup.add_item("📋 Step Stack…", 0)
|
||||||
rig_context_popup.add_item("⚡ Edit Rules…", 1)
|
rig_context_popup.add_item("⚡ Edit Rules…", 1)
|
||||||
parent.add_child(rig_context_popup)
|
parent.add_child(rig_context_popup)
|
||||||
|
|
||||||
@@ -202,11 +203,29 @@ func build_context_and_editor_views(
|
|||||||
queue_panel.apply_font(font, emoji_font, font_sizes)
|
queue_panel.apply_font(font, emoji_font, font_sizes)
|
||||||
queue_panel.min_size = queue_size
|
queue_panel.min_size = queue_size
|
||||||
|
|
||||||
|
action_editor_backdrop = ColorRect.new()
|
||||||
|
action_editor_backdrop.name = "ActionEditorBackdrop"
|
||||||
|
action_editor_backdrop.color = _sandbox_theme.color("popups.confirmation.backdrop_color", Color("#080D15B8")) if _sandbox_theme != null else Color("#080D15B8")
|
||||||
|
action_editor_backdrop.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||||
|
action_editor_backdrop.z_index = 100
|
||||||
|
action_editor_backdrop.z_as_relative = false
|
||||||
|
action_editor_backdrop.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||||
|
action_editor_backdrop.visible = false
|
||||||
|
parent.add_child(action_editor_backdrop)
|
||||||
|
|
||||||
action_editor = ACTION_EDITOR_SCENE.instantiate() as ActionEditor
|
action_editor = ACTION_EDITOR_SCENE.instantiate() as ActionEditor
|
||||||
parent.add_child(action_editor)
|
parent.add_child(action_editor)
|
||||||
action_editor.apply_font(font, emoji_font, font_sizes)
|
action_editor.apply_font(font, emoji_font, font_sizes)
|
||||||
action_editor.apply_theme(_sandbox_theme)
|
action_editor.apply_theme(_sandbox_theme)
|
||||||
action_editor.min_size = action_size
|
action_editor.set_preferred_size(action_size)
|
||||||
|
action_editor.about_to_popup.connect(func() -> void:
|
||||||
|
if is_instance_valid(action_editor_backdrop):
|
||||||
|
action_editor_backdrop.show()
|
||||||
|
)
|
||||||
|
action_editor.popup_hide.connect(func() -> void:
|
||||||
|
if is_instance_valid(action_editor_backdrop):
|
||||||
|
action_editor_backdrop.hide()
|
||||||
|
)
|
||||||
|
|
||||||
speech_composer = SPEECH_COMPOSER_SCENE.instantiate() as Control
|
speech_composer = SPEECH_COMPOSER_SCENE.instantiate() as Control
|
||||||
parent.add_child(speech_composer)
|
parent.add_child(speech_composer)
|
||||||
@@ -394,6 +413,16 @@ func show_objects_here(
|
|||||||
popup.window_input.connect(_on_objects_here_window_input.bind(popup))
|
popup.window_input.connect(_on_objects_here_window_input.bind(popup))
|
||||||
popup.position = position
|
popup.position = position
|
||||||
popup.popup()
|
popup.popup()
|
||||||
|
popup.size_changed.connect(_fit_objects_here_popup_after_resize.bind(
|
||||||
|
popup,
|
||||||
|
pointer_position,
|
||||||
|
viewport_size,
|
||||||
|
avoid_rects.duplicate(),
|
||||||
|
edge_inset,
|
||||||
|
safe_top,
|
||||||
|
safe_bottom
|
||||||
|
))
|
||||||
|
_fit_objects_here_popup_after_resize(popup, pointer_position, viewport_size, avoid_rects, edge_inset, safe_top, safe_bottom)
|
||||||
cancel.call_deferred("grab_focus")
|
cancel.call_deferred("grab_focus")
|
||||||
|
|
||||||
|
|
||||||
@@ -463,6 +492,31 @@ func _objects_here_popup_position(
|
|||||||
return best_position
|
return best_position
|
||||||
|
|
||||||
|
|
||||||
|
func _fit_objects_here_popup_after_resize(
|
||||||
|
popup: PopupPanel,
|
||||||
|
pointer_position: Vector2,
|
||||||
|
viewport_size: Vector2,
|
||||||
|
avoid_rects: Array[Rect2],
|
||||||
|
edge_inset: int,
|
||||||
|
safe_top: int,
|
||||||
|
safe_bottom: int
|
||||||
|
) -> void:
|
||||||
|
if popup == null or not is_instance_valid(popup) or not popup.visible:
|
||||||
|
return
|
||||||
|
var actual_size: Vector2i = popup.size
|
||||||
|
var safe_position: Vector2i = _objects_here_popup_position(
|
||||||
|
pointer_position,
|
||||||
|
viewport_size,
|
||||||
|
actual_size,
|
||||||
|
avoid_rects,
|
||||||
|
edge_inset,
|
||||||
|
safe_top,
|
||||||
|
safe_bottom
|
||||||
|
)
|
||||||
|
if popup.position != safe_position:
|
||||||
|
popup.position = safe_position
|
||||||
|
|
||||||
|
|
||||||
func _style_objects_here_candidate(button: Button, selected: bool) -> void:
|
func _style_objects_here_candidate(button: Button, selected: bool) -> void:
|
||||||
if button == null:
|
if button == null:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -120,8 +120,8 @@ func collect(
|
|||||||
entry["stage_name"] = rig.stage_name
|
entry["stage_name"] = rig.stage_name
|
||||||
var facing_profile: int = int(authored_state.get("facing_profile", rig.get_facing_profile()))
|
var facing_profile: int = int(authored_state.get("facing_profile", rig.get_facing_profile()))
|
||||||
entry["facing_profile"] = StickmanRig.FacingProfile.keys()[facing_profile]
|
entry["facing_profile"] = StickmanRig.FacingProfile.keys()[facing_profile]
|
||||||
var queue_result: Dictionary = STAGE_SCENE_IO.encode_queue(rig.get_queue())
|
var plan_result: Dictionary = STAGE_SCENE_IO.encode_plan(rig.get_action_plan())
|
||||||
entry["action_queue"] = queue_result["actions"]
|
entry["action_plan"] = plan_result["steps"]
|
||||||
if type == "stickman" and entry.has("stk_path"):
|
if type == "stickman" and entry.has("stk_path"):
|
||||||
entry["stk_path"] = CONTENT_PATHS.canonicalize(String(entry.get("stk_path", "")))
|
entry["stk_path"] = CONTENT_PATHS.canonicalize(String(entry.get("stk_path", "")))
|
||||||
elif type == "prop" and String(entry.get("asset_id", "")).ends_with(".prop"):
|
elif type == "prop" and String(entry.get("asset_id", "")).ends_with(".prop"):
|
||||||
@@ -284,18 +284,16 @@ func apply(data: Dictionary, world: Node2D, spawner: StageSpawner) -> Dictionary
|
|||||||
var facing_index: int = facing_names.find(String(entry.get("facing_profile", "FORWARD")))
|
var facing_index: int = facing_names.find(String(entry.get("facing_profile", "FORWARD")))
|
||||||
if facing_index >= 0:
|
if facing_index >= 0:
|
||||||
(node as StickmanRig).set_facing_profile(facing_index)
|
(node as StickmanRig).set_facing_profile(facing_index)
|
||||||
var raw_queue: Variant = entry.get("action_queue", [])
|
var raw_plan: Variant = entry.get("action_plan", [])
|
||||||
if raw_queue is Array:
|
if raw_plan is Array:
|
||||||
var queue: Dictionary = STAGE_SCENE_IO.decode_queue(raw_queue as Array)
|
var decoded_plan: Dictionary = STAGE_SCENE_IO.decode_plan(raw_plan as Array)
|
||||||
for warning: String in queue.get("warnings", []):
|
if bool(decoded_plan.get("ok", false)):
|
||||||
var character_name: String = String(entry.get("stk_path", "")).get_file()
|
if not (node as StickmanRig).set_action_plan(decoded_plan.get("steps", [])):
|
||||||
if character_name.is_empty():
|
warnings.append("%s: the action plan could not be restored." % String(entry.get("stage_name", file_id)))
|
||||||
character_name = file_id
|
else:
|
||||||
warnings.append("%s: %s Open this character's queue to review the skipped action." % [character_name, warning])
|
warnings.append("%s: %s" % [String(entry.get("stage_name", file_id)), String(decoded_plan.get("error", "Invalid action plan."))])
|
||||||
for action: Dictionary in queue["actions"]:
|
|
||||||
(node as StickmanRig).queue_action(action)
|
|
||||||
else:
|
else:
|
||||||
warnings.append("%s: invalid action queue. Open this character's queue and review its actions." % file_id)
|
warnings.append("%s: invalid action plan." % String(entry.get("stage_name", file_id)))
|
||||||
(node as StickmanRig).reset_collision_proxy_velocity_baselines()
|
(node as StickmanRig).reset_collision_proxy_velocity_baselines()
|
||||||
loaded_nodes.append(node)
|
loaded_nodes.append(node)
|
||||||
if node is TerrainBlock:
|
if node is TerrainBlock:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ extends RefCounted
|
|||||||
|
|
||||||
const STICKMAN_ACTION_RUNNER := preload("res://scripts/characters/stickman/stickman_action_runner.gd")
|
const STICKMAN_ACTION_RUNNER := preload("res://scripts/characters/stickman/stickman_action_runner.gd")
|
||||||
|
|
||||||
enum Kind { NONE, WAYPOINT, AREA, PROP, STICKMAN, POSITION, THROW_POSITION, SET_DOWN_POSITION, SPOT_ADD, SPOT_MOVE, USE_PROP, USE_SPOT }
|
enum Kind { NONE, WAYPOINT, AREA, PROP, STICKMAN, POSITION, THROW_POSITION, SET_DOWN_POSITION, PLAN_PLACE, PLAN_PROP, PICKUP_PROP, SPOT_ADD, SPOT_MOVE, USE_PROP, USE_SPOT }
|
||||||
|
|
||||||
var kind: int = Kind.NONE
|
var kind: int = Kind.NONE
|
||||||
var hint: String = ""
|
var hint: String = ""
|
||||||
@@ -31,6 +31,14 @@ var use_target_preview_prefix: Array[Dictionary] = []
|
|||||||
var use_target_prefix_known: bool = false
|
var use_target_prefix_known: bool = false
|
||||||
|
|
||||||
|
|
||||||
|
static func normalize_plan_destination(value: Variant) -> Dictionary:
|
||||||
|
if value is Vector2:
|
||||||
|
return {"kind": "place", "position": value}
|
||||||
|
if value is Dictionary:
|
||||||
|
return (value as Dictionary).duplicate(true)
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
func is_stage_custom_capture() -> bool:
|
func is_stage_custom_capture() -> bool:
|
||||||
return kind in [Kind.SPOT_ADD, Kind.SPOT_MOVE, Kind.USE_PROP, Kind.USE_SPOT]
|
return kind in [Kind.SPOT_ADD, Kind.SPOT_MOVE, Kind.USE_PROP, Kind.USE_SPOT]
|
||||||
|
|
||||||
@@ -152,10 +160,40 @@ func resolve_target(world_pos: Vector2, selection: StageSelection, director_visu
|
|||||||
var prop_hit: Node2D = selection.hit_test(world_pos)
|
var prop_hit: Node2D = selection.hit_test(world_pos)
|
||||||
if prop_hit is PropBlock:
|
if prop_hit is PropBlock:
|
||||||
value = prop_hit
|
value = prop_hit
|
||||||
|
Kind.PICKUP_PROP:
|
||||||
|
var pickup_hit: PropBlock = null
|
||||||
|
var ineligible_hit: PropBlock = null
|
||||||
|
for candidate: Node2D in selection.hit_test_all(world_pos):
|
||||||
|
if candidate is PropBlock and (candidate as PropBlock).can_be_picked_up():
|
||||||
|
pickup_hit = candidate as PropBlock
|
||||||
|
break
|
||||||
|
elif candidate is PropBlock and ineligible_hit == null:
|
||||||
|
ineligible_hit = candidate as PropBlock
|
||||||
|
if pickup_hit == null:
|
||||||
|
var reason: String = "Click a highlighted prop to pick it up."
|
||||||
|
if ineligible_hit != null:
|
||||||
|
reason = "This prop needs pickup enabled and a grip in Edit."
|
||||||
|
return {"valid": false, "value": null, "reason": reason}
|
||||||
|
value = pickup_hit
|
||||||
Kind.STICKMAN:
|
Kind.STICKMAN:
|
||||||
var stickman_hit: Node2D = selection.hit_test(world_pos)
|
var stickman_hit: Node2D = selection.hit_test(world_pos)
|
||||||
if stickman_hit is StickmanRig:
|
if stickman_hit is StickmanRig:
|
||||||
value = stickman_hit
|
value = stickman_hit
|
||||||
|
Kind.PLAN_PROP:
|
||||||
|
var plan_prop_hit: Node2D = selection.hit_test(world_pos)
|
||||||
|
if plan_prop_hit is PropBlock:
|
||||||
|
var prop: PropBlock = plan_prop_hit as PropBlock
|
||||||
|
var approach: Vector2 = world_pos
|
||||||
|
value = {
|
||||||
|
"kind": "prop",
|
||||||
|
"target_prop_id": prop.stage_object_id,
|
||||||
|
"approach_offset": approach - prop.global_position,
|
||||||
|
"last_known_approach": approach,
|
||||||
|
}
|
||||||
|
Kind.PLAN_PLACE:
|
||||||
|
var place_hit: Node2D = selection.hit_test(world_pos)
|
||||||
|
if place_hit == null or (not place_hit is PropBlock and not place_hit is StickmanRig and not place_hit is TriggerArea):
|
||||||
|
value = _snap_to_grid(world_pos, snap_enabled, grid_size)
|
||||||
Kind.POSITION, Kind.THROW_POSITION:
|
Kind.POSITION, Kind.THROW_POSITION:
|
||||||
value = _snap_to_grid(world_pos, snap_enabled, grid_size)
|
value = _snap_to_grid(world_pos, snap_enabled, grid_size)
|
||||||
Kind.SET_DOWN_POSITION:
|
Kind.SET_DOWN_POSITION:
|
||||||
|
|||||||
@@ -302,11 +302,16 @@ func _draw_pill(center: Vector2, text_value: String, accent: Color) -> void:
|
|||||||
if text_value.is_empty():
|
if text_value.is_empty():
|
||||||
return
|
return
|
||||||
var font: Font = ThemeDB.fallback_font
|
var font: Font = ThemeDB.fallback_font
|
||||||
var text_size: Vector2 = font.get_string_size(text_value, HORIZONTAL_ALIGNMENT_LEFT, -1, 16)
|
var lines: PackedStringArray = text_value.split("\n", false)
|
||||||
var rect := Rect2(center + Vector2(-text_size.x * 0.5 - _pill_padding, -13.0), Vector2(text_size.x + _pill_padding * 2.0, 26.0))
|
var text_width: float = 0.0
|
||||||
|
for line: String in lines:
|
||||||
|
text_width = maxf(text_width, font.get_string_size(line, HORIZONTAL_ALIGNMENT_LEFT, -1, 16).x)
|
||||||
|
var rect_size: Vector2 = Vector2(text_width + _pill_padding * 2.0, maxf(26.0, float(lines.size()) * 18.0 + 8.0))
|
||||||
|
var rect := Rect2(center - rect_size * 0.5, rect_size)
|
||||||
draw_rect(rect, Color("#171B24"), true)
|
draw_rect(rect, Color("#171B24"), true)
|
||||||
draw_rect(rect, accent, false, 2.0)
|
draw_rect(rect, accent, false, 2.0)
|
||||||
draw_string(font, rect.position + Vector2(10.0, 18.0), text_value, HORIZONTAL_ALIGNMENT_LEFT, -1, 16, Color.WHITE)
|
for index: int in lines.size():
|
||||||
|
draw_string(font, rect.position + Vector2(10.0, 17.0 + index * 18.0), lines[index], HORIZONTAL_ALIGNMENT_LEFT, -1, 16, Color.WHITE)
|
||||||
|
|
||||||
|
|
||||||
func _draw_reach_marker(center: Vector2, glyph: String, accent: Color) -> void:
|
func _draw_reach_marker(center: Vector2, glyph: String, accent: Color) -> void:
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ signal change_prop_requested
|
|||||||
signal capture_action_requested(action_id: StringName)
|
signal capture_action_requested(action_id: StringName)
|
||||||
|
|
||||||
const MAX_BAR_WIDTH: float = 800.0
|
const MAX_BAR_WIDTH: float = 800.0
|
||||||
|
const PLAN_CAPTURE_MAX_WIDTH: float = 440.0
|
||||||
const SCENERY_CAPTURE_MAX_WIDTH: float = 900.0
|
const SCENERY_CAPTURE_MAX_WIDTH: float = 900.0
|
||||||
const VIEWPORT_WIDTH_RATIO: float = 0.68
|
const VIEWPORT_WIDTH_RATIO: float = 0.68
|
||||||
const HORIZONTAL_LAYOUT_MIN_WIDTH: float = 760.0
|
const HORIZONTAL_LAYOUT_MIN_WIDTH: float = 760.0
|
||||||
@@ -53,6 +54,8 @@ var _safe_left: float = 0.0
|
|||||||
var _safe_right: float = 0.0
|
var _safe_right: float = 0.0
|
||||||
var _scenery_edit_active: bool = false
|
var _scenery_edit_active: bool = false
|
||||||
var _scenery_capture_active: bool = false
|
var _scenery_capture_active: bool = false
|
||||||
|
var _plan_capture_active: bool = false
|
||||||
|
var _plan_target_cancel_only: bool = false
|
||||||
|
|
||||||
|
|
||||||
func configure(stage_theme: SandboxTheme, top_bar_height: float) -> void:
|
func configure(stage_theme: SandboxTheme, top_bar_height: float) -> void:
|
||||||
@@ -73,6 +76,9 @@ func _ready() -> void:
|
|||||||
func set_capture_state(prop_selected: bool, prop_has_use_spots: bool = true) -> void:
|
func set_capture_state(prop_selected: bool, prop_has_use_spots: bool = true) -> void:
|
||||||
if _prompt == null:
|
if _prompt == null:
|
||||||
return
|
return
|
||||||
|
_plan_capture_active = false
|
||||||
|
_plan_target_cancel_only = false
|
||||||
|
_prompt.visible = true
|
||||||
_show_standard_capture_layout()
|
_show_standard_capture_layout()
|
||||||
_clear_custom_actions()
|
_clear_custom_actions()
|
||||||
if not prop_selected:
|
if not prop_selected:
|
||||||
@@ -88,10 +94,20 @@ func set_capture_state(prop_selected: bool, prop_has_use_spots: bool = true) ->
|
|||||||
|
|
||||||
|
|
||||||
func set_capture_actions(prompt: String, actions: Array[Dictionary]) -> void:
|
func set_capture_actions(prompt: String, actions: Array[Dictionary]) -> void:
|
||||||
|
_plan_capture_active = true
|
||||||
|
_plan_target_cancel_only = true
|
||||||
|
_set_capture_actions(prompt, actions, false)
|
||||||
|
|
||||||
|
|
||||||
|
func set_target_capture_actions(prompt: String, actions: Array[Dictionary]) -> void:
|
||||||
|
_plan_capture_active = false
|
||||||
|
_plan_target_cancel_only = false
|
||||||
_set_capture_actions(prompt, actions, false)
|
_set_capture_actions(prompt, actions, false)
|
||||||
|
|
||||||
|
|
||||||
func set_scenery_capture_actions(prompt: String, actions: Array[Dictionary]) -> void:
|
func set_scenery_capture_actions(prompt: String, actions: Array[Dictionary]) -> void:
|
||||||
|
_plan_capture_active = false
|
||||||
|
_plan_target_cancel_only = false
|
||||||
_set_capture_actions(prompt, actions, true)
|
_set_capture_actions(prompt, actions, true)
|
||||||
|
|
||||||
|
|
||||||
@@ -100,6 +116,7 @@ func _set_capture_actions(prompt: String, actions: Array[Dictionary], scenery_ca
|
|||||||
return
|
return
|
||||||
_show_standard_capture_layout()
|
_show_standard_capture_layout()
|
||||||
_prompt.text = prompt
|
_prompt.text = prompt
|
||||||
|
_prompt.visible = not _plan_target_cancel_only
|
||||||
_change_prop_button.visible = false
|
_change_prop_button.visible = false
|
||||||
_cancel_button.visible = false
|
_cancel_button.visible = false
|
||||||
_clear_custom_actions()
|
_clear_custom_actions()
|
||||||
@@ -160,6 +177,9 @@ func set_scenery_edit_state(selected_count: int) -> void:
|
|||||||
return
|
return
|
||||||
_scenery_capture_active = false
|
_scenery_capture_active = false
|
||||||
_scenery_edit_active = true
|
_scenery_edit_active = true
|
||||||
|
_plan_capture_active = false
|
||||||
|
_plan_target_cancel_only = false
|
||||||
|
_prompt.visible = true
|
||||||
_clear_custom_actions()
|
_clear_custom_actions()
|
||||||
if _active_layout.get_parent() == self:
|
if _active_layout.get_parent() == self:
|
||||||
_active_layout.visible = false
|
_active_layout.visible = false
|
||||||
@@ -198,6 +218,9 @@ func clear_horizontal_safe_bounds() -> void:
|
|||||||
|
|
||||||
func hide_capture() -> void:
|
func hide_capture() -> void:
|
||||||
visible = false
|
visible = false
|
||||||
|
_plan_capture_active = false
|
||||||
|
_plan_target_cancel_only = false
|
||||||
|
_prompt.visible = true
|
||||||
_show_standard_capture_layout()
|
_show_standard_capture_layout()
|
||||||
|
|
||||||
|
|
||||||
@@ -245,7 +268,10 @@ func apply_theme() -> void:
|
|||||||
if body_font != null:
|
if body_font != null:
|
||||||
button.add_theme_font_override("font", body_font)
|
button.add_theme_font_override("font", body_font)
|
||||||
button.add_theme_font_size_override("font_size", body_size)
|
button.add_theme_font_size_override("font_size", body_size)
|
||||||
_style_button(button, button.name.ends_with("Keep") or button.name.ends_with("Done"))
|
if _plan_target_cancel_only:
|
||||||
|
_style_plan_target_cancel_button(button)
|
||||||
|
else:
|
||||||
|
_style_button(button, button.name.ends_with("Keep") or button.name.ends_with("Done"))
|
||||||
var button_height: float = maxf(DEFAULT_BUTTON_HEIGHT, float(_integer("stage_panels.action.min_target_size", 56, 48, 96)))
|
var button_height: float = maxf(DEFAULT_BUTTON_HEIGHT, float(_integer("stage_panels.action.min_target_size", 56, 48, 96)))
|
||||||
_change_prop_button.custom_minimum_size.y = button_height
|
_change_prop_button.custom_minimum_size.y = button_height
|
||||||
_cancel_button.custom_minimum_size.y = button_height
|
_cancel_button.custom_minimum_size.y = button_height
|
||||||
@@ -628,6 +654,23 @@ func _style_button(button: Button, prominent: bool) -> void:
|
|||||||
button.add_theme_color_override("font_focus_color", text_color)
|
button.add_theme_color_override("font_focus_color", text_color)
|
||||||
|
|
||||||
|
|
||||||
|
func _style_plan_target_cancel_button(button: Button) -> void:
|
||||||
|
var accent: Color = _color("mode_colors.direct", Color("#FFB300"))
|
||||||
|
var surface: Color = _color("stage_panels.action.surface_color", Color("#171B24"))
|
||||||
|
var hover: Color = _color("stage_panels.action.hover_surface", Color("#303A4B"))
|
||||||
|
var pressed: Color = _color("stage_panels.action.selected_surface", Color("#12394A"))
|
||||||
|
var text_color: Color = _color("stage_panels.type.text_color", Color("#F5F7FA"))
|
||||||
|
button.add_theme_stylebox_override("normal", _button_style(surface, accent, 2))
|
||||||
|
button.add_theme_stylebox_override("hover", _button_style(hover, accent.lightened(0.1), 2))
|
||||||
|
button.add_theme_stylebox_override("pressed", _button_style(pressed, accent, 2))
|
||||||
|
button.add_theme_stylebox_override("hover_pressed", _button_style(hover, accent.lightened(0.1), 2))
|
||||||
|
button.add_theme_stylebox_override("focus", _button_style(surface, accent, 3))
|
||||||
|
button.add_theme_color_override("font_color", text_color)
|
||||||
|
button.add_theme_color_override("font_hover_color", text_color)
|
||||||
|
button.add_theme_color_override("font_pressed_color", text_color)
|
||||||
|
button.add_theme_color_override("font_focus_color", text_color)
|
||||||
|
|
||||||
|
|
||||||
func _button_style(background: Color, border: Color, border_width: int) -> StyleBoxFlat:
|
func _button_style(background: Color, border: Color, border_width: int) -> StyleBoxFlat:
|
||||||
var style: StyleBoxFlat = StyleBoxFlat.new()
|
var style: StyleBoxFlat = StyleBoxFlat.new()
|
||||||
style.bg_color = background
|
style.bg_color = background
|
||||||
@@ -651,6 +694,9 @@ func _layout_capture_bar() -> void:
|
|||||||
if _scenery_capture_active:
|
if _scenery_capture_active:
|
||||||
_layout_scenery_capture_bar(viewport_size)
|
_layout_scenery_capture_bar(viewport_size)
|
||||||
return
|
return
|
||||||
|
if _plan_target_cancel_only:
|
||||||
|
_layout_plan_target_cancel_button(viewport_size)
|
||||||
|
return
|
||||||
var inset: float = float(_integer("stage_panels.shell.edge_inset", 16, 12, 48))
|
var inset: float = float(_integer("stage_panels.shell.edge_inset", 16, 12, 48))
|
||||||
var safe_left: float = inset
|
var safe_left: float = inset
|
||||||
var safe_right: float = viewport_size.x - inset
|
var safe_right: float = viewport_size.x - inset
|
||||||
@@ -658,25 +704,59 @@ func _layout_capture_bar() -> void:
|
|||||||
safe_left = clampf(_safe_left, inset, maxf(inset, viewport_size.x - inset))
|
safe_left = clampf(_safe_left, inset, maxf(inset, viewport_size.x - inset))
|
||||||
safe_right = clampf(_safe_right, safe_left + 1.0, maxf(safe_left + 1.0, viewport_size.x - inset))
|
safe_right = clampf(_safe_right, safe_left + 1.0, maxf(safe_left + 1.0, viewport_size.x - inset))
|
||||||
var available_width: float = maxf(1.0, safe_right - safe_left)
|
var available_width: float = maxf(1.0, safe_right - safe_left)
|
||||||
var width: float = minf(MAX_BAR_WIDTH, minf(viewport_size.x * VIEWPORT_WIDTH_RATIO, available_width))
|
var maximum_width: float = PLAN_CAPTURE_MAX_WIDTH if _plan_capture_active else MAX_BAR_WIDTH
|
||||||
|
var width: float = minf(maximum_width, minf(viewport_size.x * VIEWPORT_WIDTH_RATIO, available_width))
|
||||||
var narrow_compact: bool = width < NARROW_COMPACT_WIDTH
|
var narrow_compact: bool = width < NARROW_COMPACT_WIDTH
|
||||||
custom_minimum_size.x = width
|
custom_minimum_size.x = width
|
||||||
|
if _plan_capture_active:
|
||||||
|
custom_minimum_size.y = 0.0
|
||||||
size.x = width
|
size.x = width
|
||||||
clip_contents = true
|
clip_contents = true
|
||||||
_prompt.add_theme_font_size_override("font_size", 18 if narrow_compact else clampi(_integer("stage_panels.type.title_size", 24, 18, 36) + 4, 24, 34))
|
_prompt.add_theme_font_size_override("font_size", 19 if _plan_capture_active else (18 if narrow_compact else clampi(_integer("stage_panels.type.title_size", 24, 18, 36) + 4, 24, 34)))
|
||||||
_prompt.max_lines_visible = 2 if narrow_compact else 3
|
_prompt.max_lines_visible = 2 if _plan_capture_active or narrow_compact else 3
|
||||||
_set_compact_panel_style(narrow_compact)
|
_set_compact_panel_style(narrow_compact)
|
||||||
|
if _plan_capture_active:
|
||||||
|
_set_plan_capture_panel_style()
|
||||||
var left: float = safe_left + (available_width - width) * 0.5 if not _has_horizontal_safe_bounds else safe_left
|
var left: float = safe_left + (available_width - width) * 0.5 if not _has_horizontal_safe_bounds else safe_left
|
||||||
position = Vector2(left, _top_bar_height + 56.0)
|
position = Vector2(left, _top_bar_height + 56.0)
|
||||||
var many_actions: bool = _custom_action_buttons.size() > 3
|
var many_actions: bool = _custom_action_buttons.size() > 3
|
||||||
var stack_actions: bool = width < ACTION_ROW_MIN_WIDTH or (many_actions and width < 620.0)
|
var stack_actions: bool = false if _plan_capture_active else (width < ACTION_ROW_MIN_WIDTH or (many_actions and width < 620.0))
|
||||||
var wrapped: bool = (_has_horizontal_safe_bounds and width < HORIZONTAL_LAYOUT_MIN_WIDTH and width >= ACTION_ROW_MIN_WIDTH) or (many_actions and not stack_actions)
|
var wrapped: bool = false if _plan_capture_active else ((_has_horizontal_safe_bounds and width < HORIZONTAL_LAYOUT_MIN_WIDTH and width >= ACTION_ROW_MIN_WIDTH) or (many_actions and not stack_actions))
|
||||||
_set_layout(width < HORIZONTAL_LAYOUT_MIN_WIDTH or wrapped, stack_actions, wrapped)
|
var compact_layout: bool = false if _plan_capture_active else (width < HORIZONTAL_LAYOUT_MIN_WIDTH or wrapped)
|
||||||
|
_set_layout(compact_layout, stack_actions, wrapped)
|
||||||
_fit_custom_action_widths(width, wrapped)
|
_fit_custom_action_widths(width, wrapped)
|
||||||
_apply_compact_action_labels(narrow_compact)
|
_apply_compact_action_labels(narrow_compact)
|
||||||
call_deferred("_fit_height_to_content")
|
call_deferred("_fit_height_to_content")
|
||||||
|
|
||||||
|
|
||||||
|
func _layout_plan_target_cancel_button(viewport_size: Vector2) -> void:
|
||||||
|
if _custom_action_buttons.is_empty():
|
||||||
|
return
|
||||||
|
var inset: float = float(_integer("stage_panels.shell.edge_inset", 16, 12, 48))
|
||||||
|
var safe_left: float = inset
|
||||||
|
var safe_right: float = viewport_size.x - inset
|
||||||
|
if _has_horizontal_safe_bounds:
|
||||||
|
safe_left = clampf(_safe_left, inset, maxf(inset, viewport_size.x - inset))
|
||||||
|
safe_right = clampf(_safe_right, safe_left + 1.0, maxf(safe_left + 1.0, viewport_size.x - inset))
|
||||||
|
var button: Button = _custom_action_buttons[0]
|
||||||
|
var button_height: float = maxf(DEFAULT_BUTTON_HEIGHT, float(_integer("stage_panels.action.min_target_size", 56, 48, 96)))
|
||||||
|
var available_width: float = maxf(1.0, safe_right - safe_left)
|
||||||
|
var button_width: float = minf(148.0, available_width)
|
||||||
|
button.custom_minimum_size = Vector2(button_width, button_height)
|
||||||
|
button.size_flags_horizontal = Control.SIZE_SHRINK_BEGIN
|
||||||
|
button.add_theme_font_size_override("font_size", 19)
|
||||||
|
_prompt.visible = false
|
||||||
|
_set_layout(false, false)
|
||||||
|
_actions_row.alignment = BoxContainer.ALIGNMENT_BEGIN
|
||||||
|
_actions_row.add_theme_constant_override("separation", 0)
|
||||||
|
custom_minimum_size = Vector2(button_width, 0.0)
|
||||||
|
size = Vector2(button_width, button_height)
|
||||||
|
position = Vector2(safe_left, _top_bar_height + 56.0)
|
||||||
|
clip_contents = false
|
||||||
|
_set_plan_capture_panel_style()
|
||||||
|
call_deferred("_fit_height_to_content")
|
||||||
|
|
||||||
|
|
||||||
func _layout_scenery_edit_capture_bar(viewport_size: Vector2) -> void:
|
func _layout_scenery_edit_capture_bar(viewport_size: Vector2) -> void:
|
||||||
var inset: float = float(_integer("stage_panels.shell.edge_inset", 16, 12, 48))
|
var inset: float = float(_integer("stage_panels.shell.edge_inset", 16, 12, 48))
|
||||||
var safe_left: float = inset
|
var safe_left: float = inset
|
||||||
@@ -871,14 +951,19 @@ func _fit_custom_action_widths(width: float, wrapped: bool) -> void:
|
|||||||
var button_width: float = ACTION_BUTTON_WIDTH
|
var button_width: float = ACTION_BUTTON_WIDTH
|
||||||
var body_size: int = clampi(_integer("stage_panels.type.body_size", 20, 16, 32) + 2, 20, 30)
|
var body_size: int = clampi(_integer("stage_panels.type.body_size", 20, 16, 32) + 2, 20, 30)
|
||||||
var action_font_size: int = maxi(18, body_size - (4 if wrapped else 0))
|
var action_font_size: int = maxi(18, body_size - (4 if wrapped else 0))
|
||||||
|
if _plan_capture_active:
|
||||||
|
button_width = 124.0
|
||||||
|
action_font_size = 18
|
||||||
if width < NARROW_COMPACT_WIDTH:
|
if width < NARROW_COMPACT_WIDTH:
|
||||||
button_width = 0.0
|
button_width = 124.0 if _plan_capture_active else 0.0
|
||||||
action_font_size = 16
|
action_font_size = 16
|
||||||
if wrapped and not _custom_action_buttons.is_empty():
|
if wrapped and not _custom_action_buttons.is_empty():
|
||||||
var gaps: float = float(maxi(0, _custom_action_buttons.size() - 1) * 12)
|
var gaps: float = float(maxi(0, _custom_action_buttons.size() - 1) * 12)
|
||||||
button_width = minf(ACTION_BUTTON_WIDTH, maxf(144.0, (width - 44.0 - gaps) / float(_custom_action_buttons.size())))
|
button_width = minf(ACTION_BUTTON_WIDTH, maxf(144.0, (width - 44.0 - gaps) / float(_custom_action_buttons.size())))
|
||||||
for button: Button in _custom_action_buttons:
|
for button: Button in _custom_action_buttons:
|
||||||
button.custom_minimum_size.x = button_width
|
button.custom_minimum_size.x = button_width
|
||||||
|
if _plan_capture_active:
|
||||||
|
button.custom_minimum_size.y = 48.0
|
||||||
button.add_theme_font_size_override("font_size", action_font_size)
|
button.add_theme_font_size_override("font_size", action_font_size)
|
||||||
button.size_flags_horizontal = Control.SIZE_EXPAND_FILL if width < NARROW_COMPACT_WIDTH else Control.SIZE_FILL
|
button.size_flags_horizontal = Control.SIZE_EXPAND_FILL if width < NARROW_COMPACT_WIDTH else Control.SIZE_FILL
|
||||||
|
|
||||||
@@ -918,9 +1003,32 @@ func _set_compact_panel_style(compact: bool) -> void:
|
|||||||
panel_style.content_margin_bottom = 8.0 if compact else 14.0
|
panel_style.content_margin_bottom = 8.0 if compact else 14.0
|
||||||
|
|
||||||
|
|
||||||
|
func _set_plan_capture_panel_style() -> void:
|
||||||
|
if _plan_target_cancel_only:
|
||||||
|
var cancel_style: StyleBoxFlat = StyleBoxFlat.new()
|
||||||
|
cancel_style.bg_color = Color(0.0, 0.0, 0.0, 0.0)
|
||||||
|
cancel_style.set_border_width_all(0)
|
||||||
|
cancel_style.content_margin_left = 0.0
|
||||||
|
cancel_style.content_margin_right = 0.0
|
||||||
|
cancel_style.content_margin_top = 0.0
|
||||||
|
cancel_style.content_margin_bottom = 0.0
|
||||||
|
add_theme_stylebox_override("panel", cancel_style)
|
||||||
|
return
|
||||||
|
var panel_style: StyleBoxFlat = get_theme_stylebox("panel") as StyleBoxFlat
|
||||||
|
if panel_style == null:
|
||||||
|
return
|
||||||
|
panel_style.border_width_left = 4
|
||||||
|
panel_style.content_margin_left = 10.0
|
||||||
|
panel_style.content_margin_right = 10.0
|
||||||
|
panel_style.content_margin_top = 8.0
|
||||||
|
panel_style.content_margin_bottom = 8.0
|
||||||
|
|
||||||
|
|
||||||
func _fit_height_to_content() -> void:
|
func _fit_height_to_content() -> void:
|
||||||
if not is_inside_tree() or not visible:
|
if not is_inside_tree() or not visible:
|
||||||
return
|
return
|
||||||
|
if _plan_capture_active:
|
||||||
|
custom_minimum_size.y = 0.0
|
||||||
var target_height: float = _active_layout.get_combined_minimum_size().y
|
var target_height: float = _active_layout.get_combined_minimum_size().y
|
||||||
var panel_style: StyleBox = get_theme_stylebox("panel")
|
var panel_style: StyleBox = get_theme_stylebox("panel")
|
||||||
if panel_style != null:
|
if panel_style != null:
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ const MAX_CONTACTS_REPORTED := 32
|
|||||||
const DEFAULT_WOBBLE_DURATION: float = 0.48
|
const DEFAULT_WOBBLE_DURATION: float = 0.48
|
||||||
const DEFAULT_WOBBLE_ANGLE_DEGREES: float = 7.0
|
const DEFAULT_WOBBLE_ANGLE_DEGREES: float = 7.0
|
||||||
const DEFAULT_WOBBLE_OFFSET_LOCAL: float = 4.0
|
const DEFAULT_WOBBLE_OFFSET_LOCAL: float = 4.0
|
||||||
|
const OWNER_COLLISION_GRACE_CLEAR_MARGIN: float = 24.0
|
||||||
|
const OWNER_COLLISION_GRACE_CLEAR_FRAMES: int = 2
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Exported properties
|
# Exported properties
|
||||||
@@ -129,6 +131,15 @@ var _wobble_center: Vector2 = Vector2.ZERO
|
|||||||
var _wobble_baselines: Dictionary = {}
|
var _wobble_baselines: Dictionary = {}
|
||||||
var _last_physics_velocity: Vector2 = Vector2.ZERO
|
var _last_physics_velocity: Vector2 = Vector2.ZERO
|
||||||
var _has_physics_velocity_sample: bool = false
|
var _has_physics_velocity_sample: bool = false
|
||||||
|
var _owner_collision_grace_actor_id: int = 0
|
||||||
|
var _owner_collision_grace_actor_ref: WeakRef
|
||||||
|
var _owner_collision_grace_locomotion_ref: WeakRef
|
||||||
|
var _owner_collision_grace_body_refs: Array[WeakRef] = []
|
||||||
|
var _owner_collision_grace_role: RuntimeRole = RuntimeRole.EDIT
|
||||||
|
var _owner_collision_grace_while_reserved: bool = false
|
||||||
|
var _owner_collision_grace_clear_frames: int = 0
|
||||||
|
var _owner_collision_grace_started_frame: int = -1
|
||||||
|
var _owner_collision_grace_last_sample_frame: int = -1
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Signals
|
# Signals
|
||||||
@@ -178,12 +189,14 @@ func _process(delta: float) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _physics_process(_delta: float) -> void:
|
func _physics_process(_delta: float) -> void:
|
||||||
|
_update_owner_collision_grace()
|
||||||
if not freeze and runtime_role in [RuntimeRole.START_PHYSICS, RuntimeRole.RELEASED]:
|
if not freeze and runtime_role in [RuntimeRole.START_PHYSICS, RuntimeRole.RELEASED]:
|
||||||
_last_physics_velocity = linear_velocity
|
_last_physics_velocity = linear_velocity
|
||||||
_has_physics_velocity_sample = _last_physics_velocity.is_finite()
|
_has_physics_velocity_sample = _last_physics_velocity.is_finite()
|
||||||
|
|
||||||
|
|
||||||
func _exit_tree() -> void:
|
func _exit_tree() -> void:
|
||||||
|
clear_owner_collision_grace()
|
||||||
cancel_wobble()
|
cancel_wobble()
|
||||||
|
|
||||||
|
|
||||||
@@ -320,6 +333,8 @@ func apply_stage_depth() -> void:
|
|||||||
|
|
||||||
func apply_runtime_role(role: RuntimeRole) -> void:
|
func apply_runtime_role(role: RuntimeRole) -> void:
|
||||||
runtime_role = role
|
runtime_role = role
|
||||||
|
if _owner_collision_grace_actor_id != 0 and (role != _owner_collision_grace_role or not is_actor_blocking()):
|
||||||
|
clear_owner_collision_grace()
|
||||||
match role:
|
match role:
|
||||||
RuntimeRole.EDIT:
|
RuntimeRole.EDIT:
|
||||||
freeze_mode = RigidBody2D.FREEZE_MODE_KINEMATIC
|
freeze_mode = RigidBody2D.FREEZE_MODE_KINEMATIC
|
||||||
@@ -369,6 +384,146 @@ func is_actor_blocking() -> bool:
|
|||||||
return bool(stage_roles.get("blocks_stickmen", false))
|
return bool(stage_roles.get("blocks_stickmen", false))
|
||||||
|
|
||||||
|
|
||||||
|
## Temporarily ignores contacts with one stickman. Pickup reservations can keep
|
||||||
|
## protection active until the reservation ends; Set Down uses exit clearance.
|
||||||
|
## The prop's authored role and contacts with supports or other stickmen remain.
|
||||||
|
func begin_owner_collision_grace(actor_rig: Node2D, while_reserved: bool = false) -> void:
|
||||||
|
clear_owner_collision_grace()
|
||||||
|
if actor_rig == null or not is_instance_valid(actor_rig) or not is_actor_blocking():
|
||||||
|
return
|
||||||
|
_owner_collision_grace_actor_id = actor_rig.get_instance_id()
|
||||||
|
_owner_collision_grace_actor_ref = weakref(actor_rig)
|
||||||
|
_owner_collision_grace_role = runtime_role
|
||||||
|
_owner_collision_grace_while_reserved = while_reserved
|
||||||
|
_owner_collision_grace_clear_frames = 0
|
||||||
|
_owner_collision_grace_started_frame = Engine.get_physics_frames()
|
||||||
|
_owner_collision_grace_last_sample_frame = -1
|
||||||
|
for body: PhysicsBody2D in _actor_collision_bodies(actor_rig):
|
||||||
|
body.add_collision_exception_with(self)
|
||||||
|
add_collision_exception_with(body)
|
||||||
|
_owner_collision_grace_body_refs.append(weakref(body))
|
||||||
|
if actor_rig.has_method("get_locomotion"):
|
||||||
|
var locomotion: Node = actor_rig.call("get_locomotion") as Node
|
||||||
|
if locomotion != null and is_instance_valid(locomotion) and locomotion.has_method("register_owner_collision_grace_prop"):
|
||||||
|
locomotion.call("register_owner_collision_grace_prop", self)
|
||||||
|
_owner_collision_grace_locomotion_ref = weakref(locomotion)
|
||||||
|
|
||||||
|
|
||||||
|
func release_owner_collision_grace(actor_rig: Node2D) -> void:
|
||||||
|
if not is_owner_collision_grace_active_for(actor_rig):
|
||||||
|
return
|
||||||
|
_owner_collision_grace_while_reserved = false
|
||||||
|
_owner_collision_grace_clear_frames = 0
|
||||||
|
_owner_collision_grace_started_frame = Engine.get_physics_frames()
|
||||||
|
_owner_collision_grace_last_sample_frame = -1
|
||||||
|
|
||||||
|
|
||||||
|
func is_owner_collision_grace_active_for(actor: Node) -> bool:
|
||||||
|
return (
|
||||||
|
actor != null
|
||||||
|
and is_instance_valid(actor)
|
||||||
|
and _owner_collision_grace_actor_id != 0
|
||||||
|
and actor.get_instance_id() == _owner_collision_grace_actor_id
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
func clear_owner_collision_grace() -> void:
|
||||||
|
for body_ref: WeakRef in _owner_collision_grace_body_refs:
|
||||||
|
var body: PhysicsBody2D = body_ref.get_ref() as PhysicsBody2D
|
||||||
|
if body != null and is_instance_valid(body):
|
||||||
|
body.remove_collision_exception_with(self)
|
||||||
|
remove_collision_exception_with(body)
|
||||||
|
_owner_collision_grace_body_refs.clear()
|
||||||
|
var locomotion: Node = _owner_collision_grace_locomotion_ref.get_ref() as Node if _owner_collision_grace_locomotion_ref != null else null
|
||||||
|
if locomotion != null and is_instance_valid(locomotion) and locomotion.has_method("unregister_owner_collision_grace_prop"):
|
||||||
|
locomotion.call("unregister_owner_collision_grace_prop", self)
|
||||||
|
_owner_collision_grace_locomotion_ref = null
|
||||||
|
_owner_collision_grace_actor_ref = null
|
||||||
|
_owner_collision_grace_actor_id = 0
|
||||||
|
_owner_collision_grace_role = RuntimeRole.EDIT
|
||||||
|
_owner_collision_grace_while_reserved = false
|
||||||
|
_owner_collision_grace_clear_frames = 0
|
||||||
|
_owner_collision_grace_started_frame = -1
|
||||||
|
_owner_collision_grace_last_sample_frame = -1
|
||||||
|
|
||||||
|
|
||||||
|
func _update_owner_collision_grace() -> void:
|
||||||
|
if _owner_collision_grace_actor_id == 0:
|
||||||
|
return
|
||||||
|
var actor: Node2D = _owner_collision_grace_actor_ref.get_ref() as Node2D if _owner_collision_grace_actor_ref != null else null
|
||||||
|
if actor == null or not is_instance_valid(actor) or runtime_role != _owner_collision_grace_role or not is_actor_blocking():
|
||||||
|
clear_owner_collision_grace()
|
||||||
|
return
|
||||||
|
if _owner_collision_grace_while_reserved:
|
||||||
|
return
|
||||||
|
var physics_frame: int = Engine.get_physics_frames()
|
||||||
|
if physics_frame <= _owner_collision_grace_started_frame or physics_frame == _owner_collision_grace_last_sample_frame:
|
||||||
|
return
|
||||||
|
_owner_collision_grace_last_sample_frame = physics_frame
|
||||||
|
if _actor_collision_shapes_overlap(actor):
|
||||||
|
_owner_collision_grace_clear_frames = 0
|
||||||
|
return
|
||||||
|
_owner_collision_grace_clear_frames += 1
|
||||||
|
if _owner_collision_grace_clear_frames >= OWNER_COLLISION_GRACE_CLEAR_FRAMES:
|
||||||
|
clear_owner_collision_grace()
|
||||||
|
|
||||||
|
|
||||||
|
func _actor_collision_shapes_overlap(actor_rig: Node2D) -> bool:
|
||||||
|
if not is_inside_tree() or get_world_2d() == null or collision_layer == 0:
|
||||||
|
return false
|
||||||
|
var space_state: PhysicsDirectSpaceState2D = get_world_2d().direct_space_state
|
||||||
|
if space_state == null:
|
||||||
|
return true
|
||||||
|
var active_shape_count: int = 0
|
||||||
|
for body: PhysicsBody2D in _actor_collision_bodies(actor_rig):
|
||||||
|
if body.collision_layer == 0:
|
||||||
|
continue
|
||||||
|
for child: Node in body.get_children():
|
||||||
|
var collision_shape: CollisionShape2D = child as CollisionShape2D
|
||||||
|
if collision_shape == null or collision_shape.disabled or collision_shape.shape == null:
|
||||||
|
continue
|
||||||
|
active_shape_count += 1
|
||||||
|
var query := PhysicsShapeQueryParameters2D.new()
|
||||||
|
query.shape = collision_shape.shape
|
||||||
|
query.transform = collision_shape.global_transform
|
||||||
|
query.collision_mask = collision_layer
|
||||||
|
query.margin = OWNER_COLLISION_GRACE_CLEAR_MARGIN
|
||||||
|
query.exclude = [body.get_rid()]
|
||||||
|
for hit: Dictionary in space_state.intersect_shape(query, 16):
|
||||||
|
if hit.get("collider") == self:
|
||||||
|
return true
|
||||||
|
return active_shape_count == 0
|
||||||
|
|
||||||
|
|
||||||
|
func _actor_collision_bodies(actor_rig: Node2D) -> Array[PhysicsBody2D]:
|
||||||
|
var result: Array[PhysicsBody2D] = []
|
||||||
|
var seen: Dictionary = {}
|
||||||
|
if actor_rig == null or not is_instance_valid(actor_rig):
|
||||||
|
return result
|
||||||
|
if actor_rig.has_method("get_collision_bodies"):
|
||||||
|
var collision_bodies: Variant = actor_rig.call("get_collision_bodies")
|
||||||
|
if collision_bodies is Dictionary:
|
||||||
|
for raw_body: Variant in (collision_bodies as Dictionary).values():
|
||||||
|
_append_actor_collision_body(raw_body, result, seen)
|
||||||
|
if actor_rig.has_method("get_ragdoll_bodies"):
|
||||||
|
var ragdoll_bodies: Variant = actor_rig.call("get_ragdoll_bodies")
|
||||||
|
if ragdoll_bodies is Array:
|
||||||
|
for raw_body: Variant in ragdoll_bodies as Array:
|
||||||
|
_append_actor_collision_body(raw_body, result, seen)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
func _append_actor_collision_body(raw_body: Variant, bodies: Array[PhysicsBody2D], seen: Dictionary) -> void:
|
||||||
|
var body: PhysicsBody2D = raw_body as PhysicsBody2D
|
||||||
|
if body == null or not is_instance_valid(body):
|
||||||
|
return
|
||||||
|
var body_id: int = body.get_instance_id()
|
||||||
|
if seen.has(body_id):
|
||||||
|
return
|
||||||
|
seen[body_id] = true
|
||||||
|
bodies.append(body)
|
||||||
|
|
||||||
|
|
||||||
func can_receive_prop_contact() -> bool:
|
func can_receive_prop_contact() -> bool:
|
||||||
if runtime_role == RuntimeRole.HELD or runtime_role == RuntimeRole.EDIT:
|
if runtime_role == RuntimeRole.HELD or runtime_role == RuntimeRole.EDIT:
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -0,0 +1,198 @@
|
|||||||
|
class_name StageActionSummaryGlyph
|
||||||
|
extends Control
|
||||||
|
## Small, screen-sized glyphs for the Stage action-plan summary rows.
|
||||||
|
|
||||||
|
var _kind: String = "move"
|
||||||
|
var _tint: Color = Color("#8BD9FF")
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
focus_mode = Control.FOCUS_NONE
|
||||||
|
|
||||||
|
|
||||||
|
func configure(kind: String, tint: Color) -> void:
|
||||||
|
_kind = kind
|
||||||
|
_tint = tint
|
||||||
|
queue_redraw()
|
||||||
|
|
||||||
|
|
||||||
|
func _draw() -> void:
|
||||||
|
draw_in_canvas(self, _kind, Vector2.ZERO, 1.0, _tint)
|
||||||
|
|
||||||
|
|
||||||
|
## Draws the same vector glyph into another CanvasItem's active draw callback.
|
||||||
|
## `origin` is the top-left of the 28 x 30 glyph design space.
|
||||||
|
static func draw_in_canvas(canvas: CanvasItem, kind: String, origin: Vector2, scale_factor: float, tint: Color) -> void:
|
||||||
|
if canvas == null or scale_factor <= 0.0:
|
||||||
|
return
|
||||||
|
match kind:
|
||||||
|
"move":
|
||||||
|
_draw_move(canvas, origin, scale_factor, tint)
|
||||||
|
"speak":
|
||||||
|
_draw_speech(canvas, origin, scale_factor, tint)
|
||||||
|
"wait":
|
||||||
|
_draw_wait(canvas, origin, scale_factor, tint)
|
||||||
|
"ragdoll":
|
||||||
|
_draw_ragdoll(canvas, origin, scale_factor, tint)
|
||||||
|
"recover":
|
||||||
|
_draw_recover(canvas, origin, scale_factor, tint)
|
||||||
|
"drop_prop":
|
||||||
|
_draw_drop_prop(canvas, origin, scale_factor, tint)
|
||||||
|
"throw_prop":
|
||||||
|
_draw_throw_prop(canvas, origin, scale_factor, tint)
|
||||||
|
"set_down_prop":
|
||||||
|
_draw_set_down_prop(canvas, origin, scale_factor, tint)
|
||||||
|
"use_prop":
|
||||||
|
_draw_use_prop(canvas, origin, scale_factor, tint)
|
||||||
|
|
||||||
|
|
||||||
|
static func _draw_move(canvas: CanvasItem, origin: Vector2, scale_factor: float, tint: Color) -> void:
|
||||||
|
var route := PackedVector2Array([
|
||||||
|
origin + Vector2(4.0, 24.0) * scale_factor,
|
||||||
|
origin + Vector2(8.0, 15.0) * scale_factor,
|
||||||
|
origin + Vector2(13.0, 19.0) * scale_factor,
|
||||||
|
origin + Vector2(24.0, 7.0) * scale_factor,
|
||||||
|
])
|
||||||
|
canvas.draw_polyline(route, tint, 2.8 * scale_factor, true)
|
||||||
|
canvas.draw_circle(origin + Vector2(4.0, 24.0) * scale_factor, 2.5 * scale_factor, tint, true, -1.0, true)
|
||||||
|
var arrow_head := PackedVector2Array([
|
||||||
|
origin + Vector2(17.0, 7.0) * scale_factor,
|
||||||
|
origin + Vector2(25.0, 6.0) * scale_factor,
|
||||||
|
origin + Vector2(24.0, 14.0) * scale_factor,
|
||||||
|
])
|
||||||
|
canvas.draw_polyline(arrow_head, tint, 2.8 * scale_factor, true)
|
||||||
|
|
||||||
|
|
||||||
|
static func _draw_speech(canvas: CanvasItem, origin: Vector2, scale_factor: float, tint: Color) -> void:
|
||||||
|
var outline := PackedVector2Array([
|
||||||
|
origin + Vector2(5.0, 5.0) * scale_factor,
|
||||||
|
origin + Vector2(22.0, 5.0) * scale_factor,
|
||||||
|
origin + Vector2(26.0, 9.0) * scale_factor,
|
||||||
|
origin + Vector2(26.0, 18.0) * scale_factor,
|
||||||
|
origin + Vector2(22.0, 22.0) * scale_factor,
|
||||||
|
origin + Vector2(15.0, 22.0) * scale_factor,
|
||||||
|
origin + Vector2(8.0, 28.0) * scale_factor,
|
||||||
|
origin + Vector2(8.0, 22.0) * scale_factor,
|
||||||
|
origin + Vector2(5.0, 22.0) * scale_factor,
|
||||||
|
origin + Vector2(2.0, 19.0) * scale_factor,
|
||||||
|
origin + Vector2(2.0, 8.0) * scale_factor,
|
||||||
|
origin + Vector2(5.0, 5.0) * scale_factor,
|
||||||
|
])
|
||||||
|
canvas.draw_polyline(outline, tint, 2.2 * scale_factor, true)
|
||||||
|
|
||||||
|
|
||||||
|
static func _draw_wait(canvas: CanvasItem, origin: Vector2, scale_factor: float, tint: Color) -> void:
|
||||||
|
var outline := PackedVector2Array([
|
||||||
|
origin + Vector2(6.0, 5.0) * scale_factor,
|
||||||
|
origin + Vector2(24.0, 5.0) * scale_factor,
|
||||||
|
origin + Vector2(22.0, 9.0) * scale_factor,
|
||||||
|
origin + Vector2(17.0, 14.0) * scale_factor,
|
||||||
|
origin + Vector2(22.0, 19.0) * scale_factor,
|
||||||
|
origin + Vector2(24.0, 23.0) * scale_factor,
|
||||||
|
origin + Vector2(6.0, 23.0) * scale_factor,
|
||||||
|
origin + Vector2(8.0, 19.0) * scale_factor,
|
||||||
|
origin + Vector2(13.0, 14.0) * scale_factor,
|
||||||
|
origin + Vector2(8.0, 9.0) * scale_factor,
|
||||||
|
origin + Vector2(6.0, 5.0) * scale_factor,
|
||||||
|
])
|
||||||
|
canvas.draw_polyline(outline, tint, 2.2 * scale_factor, true)
|
||||||
|
canvas.draw_line(origin + Vector2(9.0, 8.0) * scale_factor, origin + Vector2(21.0, 8.0) * scale_factor, tint, 2.0 * scale_factor, true)
|
||||||
|
canvas.draw_line(origin + Vector2(9.0, 20.0) * scale_factor, origin + Vector2(21.0, 20.0) * scale_factor, tint, 2.0 * scale_factor, true)
|
||||||
|
|
||||||
|
|
||||||
|
static func _draw_ragdoll(canvas: CanvasItem, origin: Vector2, scale_factor: float, tint: Color) -> void:
|
||||||
|
var center: Vector2 = origin + Vector2(14.0, 15.0) * scale_factor
|
||||||
|
var points := PackedVector2Array([
|
||||||
|
center + Vector2(0.0, -13.0) * scale_factor,
|
||||||
|
center + Vector2(3.0, -5.0) * scale_factor,
|
||||||
|
center + Vector2(10.0, -10.0) * scale_factor,
|
||||||
|
center + Vector2(7.0, -2.0) * scale_factor,
|
||||||
|
center + Vector2(14.0, 1.0) * scale_factor,
|
||||||
|
center + Vector2(6.0, 4.0) * scale_factor,
|
||||||
|
center + Vector2(10.0, 11.0) * scale_factor,
|
||||||
|
center + Vector2(2.0, 7.0) * scale_factor,
|
||||||
|
center + Vector2(-2.0, 14.0) * scale_factor,
|
||||||
|
center + Vector2(-5.0, 6.0) * scale_factor,
|
||||||
|
center + Vector2(-12.0, 10.0) * scale_factor,
|
||||||
|
center + Vector2(-8.0, 2.0) * scale_factor,
|
||||||
|
center + Vector2(-14.0, -2.0) * scale_factor,
|
||||||
|
center + Vector2(-6.0, -5.0) * scale_factor,
|
||||||
|
center + Vector2(-10.0, -12.0) * scale_factor,
|
||||||
|
center + Vector2(-2.0, -7.0) * scale_factor,
|
||||||
|
])
|
||||||
|
canvas.draw_colored_polygon(points, tint)
|
||||||
|
|
||||||
|
|
||||||
|
static func _draw_recover(canvas: CanvasItem, origin: Vector2, scale_factor: float, tint: Color) -> void:
|
||||||
|
var center: Vector2 = origin + Vector2(14.0, 15.0) * scale_factor
|
||||||
|
var arc := PackedVector2Array()
|
||||||
|
for index: int in 16:
|
||||||
|
var angle: float = deg_to_rad(-55.0 + float(index) / 15.0 * 285.0)
|
||||||
|
arc.append(center + Vector2(cos(angle), sin(angle)) * 10.0 * scale_factor)
|
||||||
|
canvas.draw_polyline(arc, tint, 2.4 * scale_factor, true)
|
||||||
|
var end_angle: float = deg_to_rad(230.0)
|
||||||
|
var tip: Vector2 = center + Vector2(cos(end_angle), sin(end_angle)) * 10.0 * scale_factor
|
||||||
|
var tangent: Vector2 = Vector2(-sin(end_angle), cos(end_angle))
|
||||||
|
var base: Vector2 = tip - tangent * 7.0 * scale_factor
|
||||||
|
var wing: Vector2 = Vector2(-tangent.y, tangent.x) * 4.0 * scale_factor
|
||||||
|
canvas.draw_colored_polygon(PackedVector2Array([
|
||||||
|
tip,
|
||||||
|
base + wing,
|
||||||
|
base - wing,
|
||||||
|
]), tint)
|
||||||
|
|
||||||
|
|
||||||
|
static func _draw_drop_prop(canvas: CanvasItem, origin: Vector2, scale_factor: float, tint: Color) -> void:
|
||||||
|
canvas.draw_rect(Rect2(origin + Vector2(4.0, 3.0) * scale_factor, Vector2(20.0, 9.0) * scale_factor), tint, false, 2.2 * scale_factor, true)
|
||||||
|
canvas.draw_line(origin + Vector2(14.0, 13.0) * scale_factor, origin + Vector2(14.0, 23.0) * scale_factor, tint, 2.5 * scale_factor, true)
|
||||||
|
canvas.draw_line(origin + Vector2(14.0, 23.0) * scale_factor, origin + Vector2(8.0, 18.0) * scale_factor, tint, 2.5 * scale_factor, true)
|
||||||
|
canvas.draw_line(origin + Vector2(14.0, 23.0) * scale_factor, origin + Vector2(20.0, 18.0) * scale_factor, tint, 2.5 * scale_factor, true)
|
||||||
|
canvas.draw_line(origin + Vector2(4.0, 28.0) * scale_factor, origin + Vector2(24.0, 28.0) * scale_factor, tint, 2.0 * scale_factor, true)
|
||||||
|
|
||||||
|
|
||||||
|
static func _draw_throw_prop(canvas: CanvasItem, origin: Vector2, scale_factor: float, tint: Color) -> void:
|
||||||
|
var bow := PackedVector2Array([
|
||||||
|
origin + Vector2(17.0, 3.0) * scale_factor,
|
||||||
|
origin + Vector2(11.0, 5.0) * scale_factor,
|
||||||
|
origin + Vector2(6.0, 9.0) * scale_factor,
|
||||||
|
origin + Vector2(4.0, 15.0) * scale_factor,
|
||||||
|
origin + Vector2(6.0, 21.0) * scale_factor,
|
||||||
|
origin + Vector2(11.0, 25.0) * scale_factor,
|
||||||
|
origin + Vector2(17.0, 27.0) * scale_factor,
|
||||||
|
])
|
||||||
|
canvas.draw_polyline(bow, tint, 2.4 * scale_factor, true)
|
||||||
|
canvas.draw_line(origin + Vector2(17.0, 3.0) * scale_factor, origin + Vector2(17.0, 27.0) * scale_factor, tint, 1.6 * scale_factor, true)
|
||||||
|
canvas.draw_line(origin + Vector2(2.0, 15.0) * scale_factor, origin + Vector2(26.0, 15.0) * scale_factor, tint, 2.6 * scale_factor, true)
|
||||||
|
canvas.draw_polyline(PackedVector2Array([
|
||||||
|
origin + Vector2(20.0, 9.0) * scale_factor,
|
||||||
|
origin + Vector2(27.0, 15.0) * scale_factor,
|
||||||
|
origin + Vector2(20.0, 21.0) * scale_factor,
|
||||||
|
]), tint, 2.6 * scale_factor, true)
|
||||||
|
|
||||||
|
|
||||||
|
static func _draw_set_down_prop(canvas: CanvasItem, origin: Vector2, scale_factor: float, tint: Color) -> void:
|
||||||
|
canvas.draw_line(origin + Vector2(14.0, 3.0) * scale_factor, origin + Vector2(14.0, 12.0) * scale_factor, tint, 2.4 * scale_factor, true)
|
||||||
|
canvas.draw_polyline(PackedVector2Array([
|
||||||
|
origin + Vector2(9.0, 8.0) * scale_factor,
|
||||||
|
origin + Vector2(14.0, 13.0) * scale_factor,
|
||||||
|
origin + Vector2(19.0, 8.0) * scale_factor,
|
||||||
|
]), tint, 2.4 * scale_factor, true)
|
||||||
|
canvas.draw_rect(Rect2(origin + Vector2(6.0, 14.0) * scale_factor, Vector2(16.0, 10.0) * scale_factor), tint, false, 2.2 * scale_factor, true)
|
||||||
|
canvas.draw_line(origin + Vector2(3.0, 27.0) * scale_factor, origin + Vector2(25.0, 27.0) * scale_factor, tint, 2.0 * scale_factor, true)
|
||||||
|
|
||||||
|
|
||||||
|
static func _draw_use_prop(canvas: CanvasItem, origin: Vector2, scale_factor: float, tint: Color) -> void:
|
||||||
|
canvas.draw_rect(Rect2(origin + Vector2(3.0, 12.0) * scale_factor, Vector2(16.0, 13.0) * scale_factor), tint, false, 2.2 * scale_factor, true)
|
||||||
|
var spark := PackedVector2Array([
|
||||||
|
origin + Vector2(22.0, 3.0) * scale_factor,
|
||||||
|
origin + Vector2(24.0, 9.0) * scale_factor,
|
||||||
|
origin + Vector2(28.0, 11.0) * scale_factor,
|
||||||
|
origin + Vector2(23.0, 13.0) * scale_factor,
|
||||||
|
origin + Vector2(21.0, 18.0) * scale_factor,
|
||||||
|
origin + Vector2(19.0, 13.0) * scale_factor,
|
||||||
|
origin + Vector2(15.0, 11.0) * scale_factor,
|
||||||
|
origin + Vector2(20.0, 9.0) * scale_factor,
|
||||||
|
origin + Vector2(22.0, 3.0) * scale_factor,
|
||||||
|
])
|
||||||
|
canvas.draw_polyline(spark, tint, 2.0 * scale_factor, true)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://jv06t4nihqrb
|
||||||
@@ -18,6 +18,7 @@ var _rename_button: Button
|
|||||||
var _close_button: Button
|
var _close_button: Button
|
||||||
var _scroll: ScrollContainer
|
var _scroll: ScrollContainer
|
||||||
var _body: VBoxContainer
|
var _body: VBoxContainer
|
||||||
|
var _pinned: VBoxContainer
|
||||||
var _collapsible: bool = false
|
var _collapsible: bool = false
|
||||||
var _collapsed: bool = false
|
var _collapsed: bool = false
|
||||||
var _close_visible: bool = true
|
var _close_visible: bool = true
|
||||||
@@ -167,6 +168,10 @@ func body() -> VBoxContainer:
|
|||||||
return _body
|
return _body
|
||||||
|
|
||||||
|
|
||||||
|
func pinned_content() -> VBoxContainer:
|
||||||
|
return _pinned
|
||||||
|
|
||||||
|
|
||||||
func set_safe_rect(rect: Rect2) -> void:
|
func set_safe_rect(rect: Rect2) -> void:
|
||||||
_safe_rect = rect
|
_safe_rect = rect
|
||||||
request_fit()
|
request_fit()
|
||||||
@@ -184,6 +189,22 @@ func reset_scroll() -> void:
|
|||||||
_scroll.scroll_vertical = 0
|
_scroll.scroll_vertical = 0
|
||||||
|
|
||||||
|
|
||||||
|
func get_body_scroll_vertical() -> int:
|
||||||
|
return _scroll.scroll_vertical if _scroll != null else 0
|
||||||
|
|
||||||
|
|
||||||
|
func set_body_scroll_vertical(value: int) -> void:
|
||||||
|
if _scroll != null:
|
||||||
|
_scroll.scroll_vertical = maxi(0, value)
|
||||||
|
|
||||||
|
|
||||||
|
func scroll_to_control(control: Control) -> void:
|
||||||
|
if _scroll == null or control == null or not is_instance_valid(control):
|
||||||
|
return
|
||||||
|
var content_y: float = control.global_position.y - _scroll.get_global_rect().position.y + _scroll.scroll_vertical
|
||||||
|
_scroll.scroll_vertical = maxi(0, int(roundf(content_y)))
|
||||||
|
|
||||||
|
|
||||||
func focus_first_control() -> void:
|
func focus_first_control() -> void:
|
||||||
if _body == null:
|
if _body == null:
|
||||||
return
|
return
|
||||||
@@ -274,10 +295,10 @@ func _build_shell() -> void:
|
|||||||
_header.add_child(_icon)
|
_header.add_child(_icon)
|
||||||
_title = Label.new()
|
_title = Label.new()
|
||||||
_title.name = "InspectorTitle"
|
_title.name = "InspectorTitle"
|
||||||
_title.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
||||||
_title.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
_title.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||||
_title.max_lines_visible = 2
|
_title.max_lines_visible = 2
|
||||||
_title.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
_title.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
||||||
|
_title.size_flags_horizontal = Control.SIZE_EXPAND_FILL | Control.SIZE_SHRINK_END
|
||||||
_title.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
_title.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
_title.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
_title.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||||
_header.add_child(_title)
|
_header.add_child(_title)
|
||||||
@@ -303,6 +324,10 @@ func _build_shell() -> void:
|
|||||||
_close_button.focus_mode = Control.FOCUS_ALL
|
_close_button.focus_mode = Control.FOCUS_ALL
|
||||||
_close_button.pressed.connect(_on_close_button_pressed)
|
_close_button.pressed.connect(_on_close_button_pressed)
|
||||||
_header.add_child(_close_button)
|
_header.add_child(_close_button)
|
||||||
|
_pinned = VBoxContainer.new()
|
||||||
|
_pinned.name = "InspectorPinnedContent"
|
||||||
|
_pinned.add_theme_constant_override("separation", 8)
|
||||||
|
_layout.add_child(_pinned)
|
||||||
|
|
||||||
_scroll = ScrollContainer.new()
|
_scroll = ScrollContainer.new()
|
||||||
_scroll.name = "InspectorBodyScroll"
|
_scroll.name = "InspectorBodyScroll"
|
||||||
@@ -326,7 +351,8 @@ func _fit_to_content() -> void:
|
|||||||
rect = get_viewport_rect()
|
rect = get_viewport_rect()
|
||||||
var inset := float(_integer("stage_panels.shell.edge_inset", 12, 0, 48))
|
var inset := float(_integer("stage_panels.shell.edge_inset", 12, 0, 48))
|
||||||
var preferred_width := float(_integer("stage_panels.shell.preferred_width", 380, 220, 720))
|
var preferred_width := float(_integer("stage_panels.shell.preferred_width", 380, 220, 720))
|
||||||
var card_width := minf(preferred_width, maxf(1.0, rect.size.x - inset * 2.0))
|
var max_width := float(_integer("stage_panels.shell.max_width", 380, 220, 720))
|
||||||
|
var card_width := minf(minf(preferred_width, max_width), maxf(1.0, rect.size.x - inset * 2.0))
|
||||||
custom_minimum_size.x = card_width
|
custom_minimum_size.x = card_width
|
||||||
size.x = card_width
|
size.x = card_width
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
@@ -338,7 +364,9 @@ func _fit_to_content() -> void:
|
|||||||
rect = _safe_rect
|
rect = _safe_rect
|
||||||
if rect.size.x <= 0.0 or rect.size.y <= 0.0:
|
if rect.size.x <= 0.0 or rect.size.y <= 0.0:
|
||||||
rect = get_viewport_rect()
|
rect = get_viewport_rect()
|
||||||
card_width = minf(preferred_width, maxf(1.0, rect.size.x - inset * 2.0))
|
preferred_width = float(_integer("stage_panels.shell.preferred_width", 380, 220, 720))
|
||||||
|
max_width = float(_integer("stage_panels.shell.max_width", 380, 220, 720))
|
||||||
|
card_width = minf(minf(preferred_width, max_width), maxf(1.0, rect.size.x - inset * 2.0))
|
||||||
custom_minimum_size.x = card_width
|
custom_minimum_size.x = card_width
|
||||||
size.x = card_width
|
size.x = card_width
|
||||||
var padding := float(_integer("stage_panels.shell.padding", 12, 4, 28))
|
var padding := float(_integer("stage_panels.shell.padding", 12, 4, 28))
|
||||||
@@ -346,7 +374,9 @@ func _fit_to_content() -> void:
|
|||||||
var header_height := maxf(44.0, _header.get_combined_minimum_size().y)
|
var header_height := maxf(44.0, _header.get_combined_minimum_size().y)
|
||||||
var body_height := _body.get_combined_minimum_size().y
|
var body_height := _body.get_combined_minimum_size().y
|
||||||
var show_body: bool = not _collapsed and _body_visible
|
var show_body: bool = not _collapsed and _body_visible
|
||||||
var fixed_height := header_height + (gap if show_body else 0.0) + padding * 2.0
|
var pinned_visible: bool = _pinned.visible and _pinned.get_child_count() > 0
|
||||||
|
var pinned_height: float = _pinned.get_combined_minimum_size().y if pinned_visible else 0.0
|
||||||
|
var fixed_height := header_height + (gap if pinned_visible else 0.0) + pinned_height + (gap if show_body else 0.0) + padding * 2.0
|
||||||
var available_height := maxf(72.0, rect.size.y - inset * 2.0)
|
var available_height := maxf(72.0, rect.size.y - inset * 2.0)
|
||||||
var natural_height := fixed_height + (body_height if show_body else 0.0)
|
var natural_height := fixed_height + (body_height if show_body else 0.0)
|
||||||
var card_height := minf(natural_height, available_height)
|
var card_height := minf(natural_height, available_height)
|
||||||
@@ -355,8 +385,12 @@ func _fit_to_content() -> void:
|
|||||||
# previous full-content minimum can clamp the new height until another layout.
|
# previous full-content minimum can clamp the new height until another layout.
|
||||||
_scroll.custom_minimum_size.y = scroll_height
|
_scroll.custom_minimum_size.y = scroll_height
|
||||||
_scroll.update_minimum_size()
|
_scroll.update_minimum_size()
|
||||||
position = Vector2(rect.position.x + rect.size.x - inset - card_width, rect.position.y + inset)
|
|
||||||
size = Vector2(card_width, card_height)
|
size = Vector2(card_width, card_height)
|
||||||
|
# Containers can raise the actual width to fit their children. Anchor from that
|
||||||
|
# final width so a content minimum cannot consume the right-edge gutter.
|
||||||
|
var left_limit := rect.position.x + inset
|
||||||
|
var right_limit := rect.position.x + rect.size.x - inset - size.x
|
||||||
|
position = Vector2(clampf(right_limit, left_limit, maxf(left_limit, right_limit)), rect.position.y + inset)
|
||||||
_fit_pending = false
|
_fit_pending = false
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ enum ReactiveRole { SEQUENTIAL, OVERLAY, TAKEOVER }
|
|||||||
const MOVE_TO: String = "move_to"
|
const MOVE_TO: String = "move_to"
|
||||||
const WALK: String = "walk"
|
const WALK: String = "walk"
|
||||||
const RUN: String = "run"
|
const RUN: String = "run"
|
||||||
|
const WAIT: String = "wait"
|
||||||
|
|
||||||
const ACTION_TEMPLATES := {
|
const ACTION_TEMPLATES := {
|
||||||
MOVE_TO: {
|
MOVE_TO: {
|
||||||
@@ -54,7 +55,7 @@ const ACTION_TEMPLATES := {
|
|||||||
},
|
},
|
||||||
"pick_up_prop": {
|
"pick_up_prop": {
|
||||||
"label": "Pick Up Prop",
|
"label": "Pick Up Prop",
|
||||||
"icon": "🫴",
|
"icon": "✋",
|
||||||
"params": [
|
"params": [
|
||||||
{ "key": "target_prop_id", "type": "prop", "required": true },
|
{ "key": "target_prop_id", "type": "prop", "required": true },
|
||||||
{ "key": "hand", "type": "choice", "default": "auto", "choices": ["auto", "left", "right"] },
|
{ "key": "hand", "type": "choice", "default": "auto", "choices": ["auto", "left", "right"] },
|
||||||
@@ -108,6 +109,12 @@ static func has_type(type: String) -> bool:
|
|||||||
return ACTION_TEMPLATES.has(type)
|
return ACTION_TEMPLATES.has(type)
|
||||||
|
|
||||||
|
|
||||||
|
static func has_editable_parameters(type: String) -> bool:
|
||||||
|
var template: Dictionary = ACTION_TEMPLATES.get(canonical_type(type), {})
|
||||||
|
var params: Variant = template.get("params", [])
|
||||||
|
return params is Array and not (params as Array).is_empty()
|
||||||
|
|
||||||
|
|
||||||
static func canonical_type(type: String) -> String:
|
static func canonical_type(type: String) -> String:
|
||||||
return MOVE_TO if type == "walk_to" else type
|
return MOVE_TO if type == "walk_to" else type
|
||||||
|
|
||||||
@@ -126,6 +133,19 @@ static func is_move_action(action: Dictionary) -> bool:
|
|||||||
return type == MOVE_TO or type == "walk_to"
|
return type == MOVE_TO or type == "walk_to"
|
||||||
|
|
||||||
|
|
||||||
|
static func can_add_authored_action_together(existing_actions: Array[Dictionary], candidate_type: String) -> bool:
|
||||||
|
var normalized_candidate: String = canonical_type(candidate_type)
|
||||||
|
if existing_actions.size() != 1 or not has_type(normalized_candidate):
|
||||||
|
return false
|
||||||
|
var existing_type: String = canonical_type(String(existing_actions[0].get("type", "")))
|
||||||
|
if not has_type(existing_type):
|
||||||
|
return false
|
||||||
|
# The runner supports one primary action with one speech overlay. Keep the
|
||||||
|
# pair explicit: Say may accompany any registered primary action, but two
|
||||||
|
# primary actions or two Say actions still need separate steps.
|
||||||
|
return (normalized_candidate == "speak" and existing_type != "speak") or (existing_type == "speak" and normalized_candidate != "speak")
|
||||||
|
|
||||||
|
|
||||||
static func label(type: String) -> String:
|
static func label(type: String) -> String:
|
||||||
var tpl: Dictionary = ACTION_TEMPLATES.get(type, {})
|
var tpl: Dictionary = ACTION_TEMPLATES.get(type, {})
|
||||||
return String(tpl.get("label", type))
|
return String(tpl.get("label", type))
|
||||||
@@ -219,7 +239,7 @@ static func from_rule_action(rule_action: Dictionary) -> Dictionary:
|
|||||||
|
|
||||||
## Human-readable one-line summary for both flat queue actions and rule-action
|
## Human-readable one-line summary for both flat queue actions and rule-action
|
||||||
## shapes (the get() fallbacks tolerate either key layout).
|
## shapes (the get() fallbacks tolerate either key layout).
|
||||||
static func summarize(action: Dictionary) -> String:
|
static func summarize(action: Dictionary, prop_name_resolver: Callable = Callable()) -> String:
|
||||||
var type := canonical_type(String(action.get("type", "")))
|
var type := canonical_type(String(action.get("type", "")))
|
||||||
var params: Dictionary = action.get("params", {})
|
var params: Dictionary = action.get("params", {})
|
||||||
match type:
|
match type:
|
||||||
@@ -243,7 +263,12 @@ static func summarize(action: Dictionary) -> String:
|
|||||||
"recover":
|
"recover":
|
||||||
return "Recover"
|
return "Recover"
|
||||||
"pick_up_prop":
|
"pick_up_prop":
|
||||||
return "Pick Up Prop (%s)" % String(action.get("target_prop_id", params.get("target_prop_id", "")))
|
var prop_id: String = String(action.get("target_prop_id", params.get("target_prop_id", "")))
|
||||||
|
if prop_name_resolver.is_valid() and not prop_id.is_empty():
|
||||||
|
var prop_name: String = String(prop_name_resolver.call(prop_id)).strip_edges()
|
||||||
|
if not prop_name.is_empty():
|
||||||
|
return "Pick Up Prop · %s" % prop_name
|
||||||
|
return "Pick Up Prop"
|
||||||
"drop_prop":
|
"drop_prop":
|
||||||
return "Drop Prop"
|
return "Drop Prop"
|
||||||
"throw_prop":
|
"throw_prop":
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ const DEFAULT_CONFIG: Dictionary = {
|
|||||||
"mode_colors": {"edit": "#22C6FF", "direct": "#FFB300", "play": "#33DD77", "guide": "#22C6FF"},
|
"mode_colors": {"edit": "#22C6FF", "direct": "#FFB300", "play": "#33DD77", "guide": "#22C6FF"},
|
||||||
"effects": {"impact_wobble": {"duration": 0.48, "maximum_angle_degrees": 7.0, "sideways_offset": 4.0}},
|
"effects": {"impact_wobble": {"duration": 0.48, "maximum_angle_degrees": 7.0, "sideways_offset": 4.0}},
|
||||||
"grid": {"snap_size": 15.0},
|
"grid": {"snap_size": 15.0},
|
||||||
"chrome": {"style_defaults": {}, "top_bar": {"height": 64}, "status_bar": {"height": 38}, "mode_switcher": {"segment_min_width": 124}, "mode_frame": {"border_width": 3}, "mode_badge": {"corner_radius": 12, "padding": 10}, "timestamp_badge": {"corner_radius": 10, "padding": 8, "bg_color": "#171B24F2"}, "tooltip": {"bg_color": "#101010E6", "border_width": 1}, "dialogs": {"queue_size":[680,520], "rule_size":[720,560], "action_size":[560,390], "confirm_size":[560,300], "font_size":22, "message_font_size":20}},
|
"chrome": {"style_defaults": {}, "top_bar": {"height": 64}, "status_bar": {"height": 38}, "mode_switcher": {"segment_min_width": 124}, "mode_frame": {"border_width": 3}, "mode_badge": {"corner_radius": 12, "padding": 10}, "timestamp_badge": {"corner_radius": 10, "padding": 8, "bg_color": "#171B24F2"}, "tooltip": {"bg_color": "#101010E6", "border_width": 1}, "dialogs": {"queue_size":[680,520], "rule_size":[720,560], "action_size":[560,460], "confirm_size":[560,300], "font_size":22, "message_font_size":20}},
|
||||||
"popups": {"style_defaults": {"bg_color": "#202633FA", "border_color": "#FFFFFF33", "corner_radius": 12, "padding": 12}, "action_menu": {"font_size": 24}, "dialog": {"surface_color_size":[560,640], "surface_color_preview_size":[420,140], "surface_color_picker_min_size":[320,340], "action_min_target_size":48}, "asset_selector": {"backdrop_alpha": 0.55, "cell_size":[190,220], "thumbnail_size":[156,156], "surface_preview_size":[420,132], "look_cue_size":[80,42], "setup_gap":8, "setup_title_size":30, "setup_heading_size":26, "setup_choice_font_size":22, "setup_choice_height":68, "setup_choice_corner_radius":22, "setup_choice_border_width":2, "tab_font_size":22, "tab_height":60, "filter_chip_font_size":20, "filter_chip_height":48, "filter_chip_gap":8, "setup_button_font_size":20, "button_border_width":2, "footer_gap":16, "surface_corner_radius":14, "look_corner_radius":8, "corner_radius":16, "compact_swatch_size":42, "color_group_gap":8, "action_color":"#087DBA", "separator_color":"#AAB2C0A0"}},
|
"popups": {"style_defaults": {"bg_color": "#202633FA", "border_color": "#FFFFFF33", "corner_radius": 12, "padding": 12}, "action_menu": {"font_size": 24}, "dialog": {"surface_color_size":[560,640], "surface_color_preview_size":[420,140], "surface_color_picker_min_size":[320,340], "action_min_target_size":48}, "asset_selector": {"backdrop_alpha": 0.55, "cell_size":[190,220], "thumbnail_size":[156,156], "surface_preview_size":[420,132], "look_cue_size":[80,42], "setup_gap":8, "setup_title_size":30, "setup_heading_size":26, "setup_choice_font_size":22, "setup_choice_height":68, "setup_choice_corner_radius":22, "setup_choice_border_width":2, "tab_font_size":22, "tab_height":60, "filter_chip_font_size":20, "filter_chip_height":48, "filter_chip_gap":8, "setup_button_font_size":20, "button_border_width":2, "footer_gap":16, "surface_corner_radius":14, "look_corner_radius":8, "corner_radius":16, "compact_swatch_size":42, "color_group_gap":8, "action_color":"#087DBA", "separator_color":"#AAB2C0A0"}},
|
||||||
"palette": {"style_defaults": {}, "dock_width": 116, "card_size": [96, 94], "icon_size": 30, "drag_threshold": 8, "selected_border_width": 3},
|
"palette": {"style_defaults": {}, "dock_width": 116, "card_size": [96, 94], "icon_size": 30, "drag_threshold": 8, "selected_border_width": 3},
|
||||||
"stage_panels": {
|
"stage_panels": {
|
||||||
"shell": {"preferred_width": 380, "edge_inset": 12, "padding": 12, "header_gap": 8, "section_gap": 12, "corner_radius": 10, "surface_color": "#252B38FA", "border_color": "#FFFFFF33"},
|
"shell": {"preferred_width": 380, "max_width": 380, "edge_inset": 12, "padding": 12, "header_gap": 8, "section_gap": 12, "corner_radius": 10, "surface_color": "#252B38FA", "border_color": "#FFFFFF33"},
|
||||||
"type": {"title_size": 24, "section_size": 20, "body_size": 20, "helper_size": 16, "text_color": "#F5F7FA", "muted_text_color": "#AAB2C0"},
|
"type": {"title_size": 24, "section_size": 20, "body_size": 20, "helper_size": 16, "text_color": "#F5F7FA", "muted_text_color": "#AAB2C0"},
|
||||||
"choice": {"minimum_height": 56, "row_gap": 6, "neutral_surface": "#171B24", "hover_surface": "#303A4B", "selected_surface": "#12394A", "disabled_surface": "#252B38", "border_color": "#FFFFFF33"},
|
"choice": {"minimum_height": 56, "row_gap": 6, "neutral_surface": "#171B24", "hover_surface": "#303A4B", "selected_surface": "#12394A", "disabled_surface": "#252B38", "border_color": "#FFFFFF33"},
|
||||||
"toggle": {"minimum_height": 64, "help_minimum_height": 72, "row_padding": 12, "switch_width": 64, "switch_height": 34, "knob_size": 26, "neutral_surface": "#202633", "hover_surface": "#2B3442", "selected_surface": "#173443", "disabled_surface": "#252B38", "border_color": "#FFFFFF33", "switch_on_color": "#22C6FF", "switch_off_color": "#4A5362", "switch_disabled_color": "#3B414D", "knob_color": "#F5F7FA"},
|
"toggle": {"minimum_height": 64, "help_minimum_height": 72, "row_padding": 12, "switch_width": 64, "switch_height": 34, "knob_size": 26, "neutral_surface": "#202633", "hover_surface": "#2B3442", "selected_surface": "#173443", "disabled_surface": "#252B38", "border_color": "#FFFFFF33", "switch_on_color": "#22C6FF", "switch_off_color": "#4A5362", "switch_disabled_color": "#3B414D", "knob_color": "#F5F7FA"},
|
||||||
@@ -55,7 +55,7 @@ const DEFAULT_CONFIG: Dictionary = {
|
|||||||
"spots": {"row_gap": 8, "pin_visual_size": 30, "pin_hit_size": 44, "pin_outline_width": 2, "focus_ring_width": 3, "name_pill_padding": 10, "pin_surface_color": "#F4F7FB", "pin_outline_color": "#171B24", "completion_duration": 0.6}
|
"spots": {"row_gap": 8, "pin_visual_size": 30, "pin_hit_size": 44, "pin_outline_width": 2, "focus_ring_width": 3, "name_pill_padding": 10, "pin_surface_color": "#F4F7FB", "pin_outline_color": "#171B24", "completion_duration": 0.6}
|
||||||
},
|
},
|
||||||
"stage_surface_colors": {"section_gap": 8, "swatch_gap": 8, "swatch_size": 48, "swatch_border": "#FFFFFFB8", "swatch_focus_border": "#FFFFFF", "swatch_corner_radius": 8, "swatch_border_width": 2, "swatch_check_size": 24, "selected_border_width": 4, "focus_border_width": 3},
|
"stage_surface_colors": {"section_gap": 8, "swatch_gap": 8, "swatch_size": 48, "swatch_border": "#FFFFFFB8", "swatch_focus_border": "#FFFFFF", "swatch_corner_radius": 8, "swatch_border_width": 2, "swatch_check_size": 24, "selected_border_width": 4, "focus_border_width": 3},
|
||||||
"overlays": {"style_defaults": {"line_width": 2, "dash_length": 8, "dash_gap": 5}, "terrain_guide": {"color": "#22C6FF"}, "completed_path_alpha": 0.20, "completed_path_color": "#959EAD", "rule_connector_color": "#AAB2C0", "rule_action_color": "#7E57C2", "valid": {"color": "#4DE66680"}, "same_type": {"color": "#FFFFFF26"}, "invalid": {"color": "#FF4D4D80"}, "set_down": {"unknown_color": "#C5CAD4", "reach_color": "#FFB300", "ghost_alpha": 0.36}, "use_preview": {"valid_color": "#42D887", "invalid_color": "#F06464", "uncertain_color": "#FFB300", "neutral_color": "#C5CAD4", "completion_duration": 0.6}},
|
"overlays": {"style_defaults": {"line_width": 2, "dash_length": 8, "dash_gap": 5}, "terrain_guide": {"color": "#22C6FF"}, "completed_path_alpha": 0.20, "completed_path_color": "#959EAD", "rule_connector_color": "#AAB2C0", "rule_action_color": "#7E57C2", "director_plan": {"route_color": "#8BD9FF", "run_color": "#FFB300", "say_color": "#FFD84D", "wait_color": "#B69CFF", "completed_color": "#959EAD", "failed_color": "#F05B57", "candidate_valid_color": "#4DE666", "candidate_invalid_color": "#FF626B", "flag_size_px": 44, "flag_number_size_px": 18, "label_bg_color": "#101720E8", "label_border_alpha": 0.8, "spotlight_route_width_px": 4, "spotlight_route_shadow_width_px": 6, "spotlight_dash_length_px": 12, "spotlight_dash_gap_px": 7, "spotlight_route_alpha": 0.95, "unfocused_step_alpha": 0.24, "action_badge_font_size_px": 18, "action_badge_padding_px": [10, 6], "action_badge_radius_px": 11, "action_badge_border_width_px": 2, "action_badge_icon_slot_width_px": 22, "action_badge_icon_text_gap_px": 6, "action_badge_icon_scale": 0.72, "action_badge_stack_gap_px": 4, "action_badge_route_gap_px": 6, "actor_name_font_size_px": 20, "actor_name_max_width_px": 260, "actor_name_padding_px": [12, 7], "actor_name_radius_px": 12, "actor_name_border_width_px": 2, "actor_name_offset_px": 26, "route_badge_fraction": 0.32, "actor_name_border_color": "#FFB300", "action_badge_text_color": "#F5F7FA", "route_shadow_color": "#101720D9", "action_row_move_surface": "#17313D", "action_row_say_surface": "#2C281C", "action_row_wait_surface": "#29243A", "action_row_other_surface": "#202632", "action_row_icon_surface": "#252B38", "action_row_text_color": "#F5F7FA", "action_row_duration_color": "#AAB2C0", "action_row_options_color": "#8E9AAA", "action_row_font_size_px": 18, "action_row_duration_font_size_px": 14, "action_row_icon_font_size_px": 20, "action_row_height_px": 48, "action_row_icon_size_px": 32, "action_row_rail_width_px": 4, "action_row_options_width_px": 24, "action_row_options_font_size_px": 18, "action_row_radius_px": 8, "action_row_selected_border_width_px": 2}, "valid": {"color": "#4DE66680"}, "same_type": {"color": "#FFFFFF26"}, "invalid": {"color": "#FF4D4D80"}, "set_down": {"unknown_color": "#C5CAD4", "reach_color": "#FFB300", "ghost_alpha": 0.36, "surface_line_width_px": 5, "surface_hover_line_width_px": 7, "surface_alpha": 0.75, "surface_hover_alpha": 0.95}, "use_preview": {"valid_color": "#42D887", "invalid_color": "#F06464", "uncertain_color": "#FFB300", "neutral_color": "#C5CAD4", "completion_duration": 0.6}},
|
||||||
"widgets": {"swatches": ["#FFFFFF", "#111111", "#22C6FF", "#FFB300", "#33DD77", "#FF4D4D"], "size_presets": [{"id":"small", "label":"Small", "value":20}, {"id":"medium", "label":"Medium", "value":28}, {"id":"huge", "label":"HUGE", "value":40}], "emoji": ["😀", "😂", "😍", "😮", "😢", "😡", "👍", "❤️"]},
|
"widgets": {"swatches": ["#FFFFFF", "#111111", "#22C6FF", "#FFB300", "#33DD77", "#FF4D4D"], "size_presets": [{"id":"small", "label":"Small", "value":20}, {"id":"medium", "label":"Medium", "value":28}, {"id":"huge", "label":"HUGE", "value":40}], "emoji": ["😀", "😂", "😍", "😮", "😢", "😡", "👍", "❤️"]},
|
||||||
"speech": {"toolbar": {"surface":"#1C2431F7", "border":"#9EADBF", "selection_halo":"#FFD84D", "gap":10, "max_width":480, "min_hit_height":48}, "ui": {"panel_width": 440, "button_min_height": 44, "heading_size": 24}, "layout": {"max_width": 420, "stack_gap": 12, "screen_margin": 18, "bubble_padding": 18}, "animation": {"letter_interval": 0.045, "word_interval": 0.20, "pop_duration": 0.24}, "styles": {"talk": {"fill":"#FFFDF6", "outline":"#202020", "tail":"talk"}, "shout": {"fill":"#FFD642", "outline":"#D92F26", "tail":"shout"}, "think": {"fill":"#E9F5FF", "outline":"#37698B", "tail":"think"}, "whisper": {"fill":"#F2F2F2", "outline":"#6D7885", "tail":"whisper"}, "sfx": {"fill":"#FFDD39", "outline":"#D92F26", "tail":"none"}}, "text_colors": [{"name":"Ink","color":"#202020"},{"name":"Midnight","color":"#111827"},{"name":"Slate","color":"#475569"},{"name":"Snow","color":"#FFFFFF"},{"name":"Cloud","color":"#CBD5E1"},{"name":"Sky","color":"#2196F3"},{"name":"Ocean","color":"#0077B6"},{"name":"Teal","color":"#00897B"},{"name":"Leaf","color":"#2E7D32"},{"name":"Lime","color":"#8BC34A"},{"name":"Sunshine","color":"#FFC107"},{"name":"Orange","color":"#F57C00"},{"name":"Sunset red","color":"#E53935"},{"name":"Rose","color":"#D81B60"},{"name":"Violet","color":"#7E57C2"},{"name":"Brown","color":"#795548"}], "preview_ghost":"#FFFFFF99", "connector":"#FFFFFFB0"}
|
"speech": {"toolbar": {"surface":"#1C2431F7", "border":"#9EADBF", "selection_halo":"#FFD84D", "gap":10, "max_width":480, "min_hit_height":48}, "ui": {"panel_width": 440, "button_min_height": 44, "heading_size": 24}, "layout": {"max_width": 420, "stack_gap": 12, "screen_margin": 18, "bubble_padding": 18}, "animation": {"letter_interval": 0.045, "word_interval": 0.20, "pop_duration": 0.24}, "styles": {"talk": {"fill":"#FFFDF6", "outline":"#202020", "tail":"talk"}, "shout": {"fill":"#FFD642", "outline":"#D92F26", "tail":"shout"}, "think": {"fill":"#E9F5FF", "outline":"#37698B", "tail":"think"}, "whisper": {"fill":"#F2F2F2", "outline":"#6D7885", "tail":"whisper"}, "sfx": {"fill":"#FFDD39", "outline":"#D92F26", "tail":"none"}}, "text_colors": [{"name":"Ink","color":"#202020"},{"name":"Midnight","color":"#111827"},{"name":"Slate","color":"#475569"},{"name":"Snow","color":"#FFFFFF"},{"name":"Cloud","color":"#CBD5E1"},{"name":"Sky","color":"#2196F3"},{"name":"Ocean","color":"#0077B6"},{"name":"Teal","color":"#00897B"},{"name":"Leaf","color":"#2E7D32"},{"name":"Lime","color":"#8BC34A"},{"name":"Sunshine","color":"#FFC107"},{"name":"Orange","color":"#F57C00"},{"name":"Sunset red","color":"#E53935"},{"name":"Rose","color":"#D81B60"},{"name":"Violet","color":"#7E57C2"},{"name":"Brown","color":"#795548"}], "preview_ghost":"#FFFFFF99", "connector":"#FFFFFFB0"}
|
||||||
}
|
}
|
||||||
@@ -230,6 +230,8 @@ func _apply_phase19_defaults() -> void:
|
|||||||
"candidate_name_pill_border_width": 3.0,
|
"candidate_name_pill_border_width": 3.0,
|
||||||
"candidate_name_pill_padding_x": 12.0,
|
"candidate_name_pill_padding_x": 12.0,
|
||||||
"candidate_name_pill_padding_y": 8.0,
|
"candidate_name_pill_padding_y": 8.0,
|
||||||
|
"selected_name_pill_font_size_px": 20.0,
|
||||||
|
"selected_name_pill_max_width_px": 260.0,
|
||||||
}
|
}
|
||||||
for key: String in defaults:
|
for key: String in defaults:
|
||||||
if not gizmos.has(key):
|
if not gizmos.has(key):
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
class_name StageActionIdentity
|
||||||
|
extends RefCounted
|
||||||
|
## Scene-scoped action ID allocation for later event links.
|
||||||
|
|
||||||
|
static var _fallback_counter: int = 1
|
||||||
|
|
||||||
|
|
||||||
|
func allocate(world: Node2D) -> String:
|
||||||
|
var used: Dictionary = _collect_ids(world)
|
||||||
|
var candidate: String = ""
|
||||||
|
for _attempt: int in 16:
|
||||||
|
var unique_number: int = ResourceUID.create_id()
|
||||||
|
candidate = "action_%s" % String.num_int64(unique_number, 16)
|
||||||
|
if not used.has(candidate):
|
||||||
|
return candidate
|
||||||
|
while used.has(candidate) or candidate.is_empty():
|
||||||
|
candidate = "action_%d_%d" % [Time.get_ticks_usec(), _fallback_counter]
|
||||||
|
_fallback_counter += 1
|
||||||
|
return candidate
|
||||||
|
|
||||||
|
|
||||||
|
func validate_scene_ids(objects: Array) -> String:
|
||||||
|
var seen: Dictionary = {}
|
||||||
|
for raw_object: Variant in objects:
|
||||||
|
if not raw_object is Dictionary:
|
||||||
|
continue
|
||||||
|
var object: Dictionary = raw_object
|
||||||
|
if String(object.get("type", "")) != "stickman":
|
||||||
|
continue
|
||||||
|
var plan_value: Variant = object.get("action_plan", [])
|
||||||
|
if not plan_value is Array:
|
||||||
|
continue
|
||||||
|
for raw_step: Variant in plan_value:
|
||||||
|
if not raw_step is Dictionary:
|
||||||
|
continue
|
||||||
|
var actions_value: Variant = (raw_step as Dictionary).get("actions", [])
|
||||||
|
if not actions_value is Array:
|
||||||
|
continue
|
||||||
|
for raw_action: Variant in actions_value:
|
||||||
|
if not raw_action is Dictionary:
|
||||||
|
continue
|
||||||
|
var action_id: String = String((raw_action as Dictionary).get("action_id", ""))
|
||||||
|
if action_id.strip_edges().is_empty() or seen.has(action_id):
|
||||||
|
return "Action IDs must be unique and non-empty across the scene."
|
||||||
|
seen[action_id] = true
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
func _collect_ids(world: Node2D) -> Dictionary:
|
||||||
|
var used: Dictionary = {}
|
||||||
|
if world == null or not is_instance_valid(world):
|
||||||
|
return used
|
||||||
|
for child: Node in world.get_children():
|
||||||
|
if child is StickmanRig:
|
||||||
|
_collect_plan_ids((child as StickmanRig).get_action_plan(), used)
|
||||||
|
elif child.has_method("get"):
|
||||||
|
var original_value: Variant = child.get("original_entry")
|
||||||
|
if original_value is Dictionary:
|
||||||
|
_collect_entry_ids(original_value as Dictionary, used)
|
||||||
|
return used
|
||||||
|
|
||||||
|
|
||||||
|
func _collect_entry_ids(entry: Dictionary, used: Dictionary) -> void:
|
||||||
|
var plan_value: Variant = entry.get("action_plan", [])
|
||||||
|
if not plan_value is Array:
|
||||||
|
return
|
||||||
|
var plan: Array[Dictionary] = []
|
||||||
|
for raw_step: Variant in plan_value:
|
||||||
|
if raw_step is Dictionary:
|
||||||
|
plan.append(raw_step as Dictionary)
|
||||||
|
_collect_plan_ids(plan, used)
|
||||||
|
|
||||||
|
|
||||||
|
func _collect_plan_ids(plan: Array[Dictionary], used: Dictionary) -> void:
|
||||||
|
for step: Dictionary in plan:
|
||||||
|
var actions_value: Variant = step.get("actions", [])
|
||||||
|
if not actions_value is Array:
|
||||||
|
continue
|
||||||
|
for raw_action: Variant in actions_value:
|
||||||
|
if raw_action is Dictionary:
|
||||||
|
var action_id: String = String((raw_action as Dictionary).get("action_id", ""))
|
||||||
|
if not action_id.is_empty():
|
||||||
|
used[action_id] = true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dum44yvr5v1k0
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
class_name StageActionPlan
|
||||||
|
extends RefCounted
|
||||||
|
## Pure helpers for ordered authored action steps.
|
||||||
|
|
||||||
|
const ACTION_REGISTRY := preload("res://scripts/stage/action_registry.gd")
|
||||||
|
|
||||||
|
|
||||||
|
static func validate_steps(steps: Array[Dictionary]) -> String:
|
||||||
|
var seen_ids: Dictionary = {}
|
||||||
|
for step_index: int in steps.size():
|
||||||
|
var actions_value: Variant = steps[step_index].get("actions", null)
|
||||||
|
if not actions_value is Array or (actions_value as Array).is_empty():
|
||||||
|
return "Step %d must contain an action." % (step_index + 1)
|
||||||
|
var actions: Array = actions_value
|
||||||
|
if actions.size() > 2:
|
||||||
|
return "Step %d has too many actions." % (step_index + 1)
|
||||||
|
var typed_actions: Array[Dictionary] = []
|
||||||
|
for raw_action: Variant in actions:
|
||||||
|
if not raw_action is Dictionary:
|
||||||
|
return "Step %d contains an invalid action." % (step_index + 1)
|
||||||
|
var action: Dictionary = raw_action
|
||||||
|
var action_id: Variant = action.get("action_id", null)
|
||||||
|
if not action_id is String or String(action_id).strip_edges().is_empty():
|
||||||
|
return "Actions must have non-empty string IDs."
|
||||||
|
if seen_ids.has(String(action_id)):
|
||||||
|
return "Action IDs must be unique."
|
||||||
|
seen_ids[String(action_id)] = true
|
||||||
|
var action_type: String = ACTION_REGISTRY.canonical_type(String(action.get("type", "")))
|
||||||
|
if not ACTION_REGISTRY.has_type(action_type):
|
||||||
|
return "Step %d contains an unknown action." % (step_index + 1)
|
||||||
|
typed_actions.append(action)
|
||||||
|
if typed_actions.size() == 2:
|
||||||
|
if not can_add_together({"actions": [typed_actions[0]]}, String(typed_actions[1].get("type", ""))):
|
||||||
|
return "Step %d contains actions that cannot run together." % (step_index + 1)
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
static func can_add_together(step: Dictionary, action_type: String) -> bool:
|
||||||
|
var actions_value: Variant = step.get("actions", [])
|
||||||
|
if not actions_value is Array:
|
||||||
|
return false
|
||||||
|
var existing_actions: Array[Dictionary] = []
|
||||||
|
for raw_action: Variant in actions_value:
|
||||||
|
if not raw_action is Dictionary:
|
||||||
|
return false
|
||||||
|
existing_actions.append(raw_action as Dictionary)
|
||||||
|
return ACTION_REGISTRY.can_add_authored_action_together(existing_actions, action_type)
|
||||||
|
|
||||||
|
|
||||||
|
static func append_step(steps: Array[Dictionary], action: Dictionary) -> Array[Dictionary]:
|
||||||
|
var result: Array[Dictionary] = steps.duplicate(true)
|
||||||
|
result.append({"actions": [action.duplicate(true)]})
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
static func append_together(steps: Array[Dictionary], step_index: int, action: Dictionary) -> Array[Dictionary]:
|
||||||
|
var result: Array[Dictionary] = steps.duplicate(true)
|
||||||
|
if step_index < 0 or step_index >= result.size() or not can_add_together(result[step_index], String(action.get("type", ""))):
|
||||||
|
return []
|
||||||
|
var actions: Array = (result[step_index].get("actions", []) as Array).duplicate(true)
|
||||||
|
actions.append(action.duplicate(true))
|
||||||
|
result[step_index]["actions"] = actions
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
static func replace_action(steps: Array[Dictionary], action_id: String, replacement: Dictionary) -> Array[Dictionary]:
|
||||||
|
var result: Array[Dictionary] = steps.duplicate(true)
|
||||||
|
var location: Dictionary = find_action(result, action_id)
|
||||||
|
if location.is_empty():
|
||||||
|
return []
|
||||||
|
var step_index: int = int(location["step_index"])
|
||||||
|
var action_index: int = int(location["action_index"])
|
||||||
|
var actions: Array = (result[step_index].get("actions", []) as Array).duplicate(true)
|
||||||
|
var updated: Dictionary = replacement.duplicate(true)
|
||||||
|
updated["action_id"] = action_id
|
||||||
|
actions[action_index] = updated
|
||||||
|
if actions.size() == 2 and not validate_steps([{"actions": actions}]).is_empty():
|
||||||
|
return []
|
||||||
|
result[step_index]["actions"] = actions
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
static func flatten(steps: Array[Dictionary]) -> Array[Dictionary]:
|
||||||
|
var result: Array[Dictionary] = []
|
||||||
|
for step_index: int in steps.size():
|
||||||
|
var raw_actions: Variant = steps[step_index].get("actions", [])
|
||||||
|
if not raw_actions is Array:
|
||||||
|
continue
|
||||||
|
for raw_action: Variant in raw_actions:
|
||||||
|
if not raw_action is Dictionary:
|
||||||
|
continue
|
||||||
|
var action: Dictionary = (raw_action as Dictionary).duplicate(true)
|
||||||
|
action["step_index"] = step_index
|
||||||
|
if ACTION_REGISTRY.is_move_action(action):
|
||||||
|
var destination_value: Variant = action.get("destination", null)
|
||||||
|
if destination_value is Dictionary:
|
||||||
|
var destination: Dictionary = destination_value
|
||||||
|
if String(destination.get("kind", "")) == "place":
|
||||||
|
action["target"] = _data_to_vector(destination.get("position", {}))
|
||||||
|
else:
|
||||||
|
action["target"] = _data_to_vector(destination.get("last_known_approach", {}))
|
||||||
|
result.append(action)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
static func find_action(steps: Array[Dictionary], action_id: String) -> Dictionary:
|
||||||
|
if action_id.is_empty():
|
||||||
|
return {}
|
||||||
|
for step_index: int in steps.size():
|
||||||
|
var raw_actions: Variant = steps[step_index].get("actions", [])
|
||||||
|
if not raw_actions is Array:
|
||||||
|
continue
|
||||||
|
for action_index: int in (raw_actions as Array).size():
|
||||||
|
var raw_action: Variant = (raw_actions as Array)[action_index]
|
||||||
|
if raw_action is Dictionary and String((raw_action as Dictionary).get("action_id", "")) == action_id:
|
||||||
|
return {"step_index": step_index, "action_index": action_index, "action": (raw_action as Dictionary).duplicate(true)}
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
static func move_step(steps: Array[Dictionary], from_index: int, to_index: int) -> Array[Dictionary]:
|
||||||
|
var result: Array[Dictionary] = steps.duplicate(true)
|
||||||
|
if from_index < 0 or from_index >= result.size() or to_index < 0 or to_index >= result.size():
|
||||||
|
return result
|
||||||
|
var step: Dictionary = result.pop_at(from_index)
|
||||||
|
result.insert(to_index, step)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
static func remove_action(steps: Array[Dictionary], action_id: String) -> Array[Dictionary]:
|
||||||
|
var result: Array[Dictionary] = steps.duplicate(true)
|
||||||
|
for step_index: int in range(result.size() - 1, -1, -1):
|
||||||
|
var actions_value: Variant = result[step_index].get("actions", [])
|
||||||
|
if not actions_value is Array:
|
||||||
|
continue
|
||||||
|
var actions: Array = actions_value
|
||||||
|
for action_index: int in range(actions.size() - 1, -1, -1):
|
||||||
|
var raw_action: Variant = actions[action_index]
|
||||||
|
if raw_action is Dictionary and String((raw_action as Dictionary).get("action_id", "")) == action_id:
|
||||||
|
actions.remove_at(action_index)
|
||||||
|
if actions.is_empty():
|
||||||
|
result.remove_at(step_index)
|
||||||
|
else:
|
||||||
|
result[step_index]["actions"] = actions
|
||||||
|
return result
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
static func _data_to_vector(value: Variant) -> Vector2:
|
||||||
|
if not value is Dictionary:
|
||||||
|
return Vector2.ZERO
|
||||||
|
var data: Dictionary = value
|
||||||
|
var x_value: Variant = data.get("x", null)
|
||||||
|
var y_value: Variant = data.get("y", null)
|
||||||
|
if not (x_value is float or x_value is int) or not (y_value is float or y_value is int):
|
||||||
|
return Vector2.ZERO
|
||||||
|
var point := Vector2(float(x_value), float(y_value))
|
||||||
|
return point if point.is_finite() else Vector2.ZERO
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dq1q3dyink3av
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -48,6 +48,7 @@ const ROTATE_HANDLE_OFFSET_PX := 24.0
|
|||||||
const ROTATE_HANDLE_HIT_HALF_SIZE_PX := 22.0
|
const ROTATE_HANDLE_HIT_HALF_SIZE_PX := 22.0
|
||||||
const ROTATE_ICON_RADIUS_PX := 8.0
|
const ROTATE_ICON_RADIUS_PX := 8.0
|
||||||
const ROTATE_HANDLE_SAFE_TOP_PX := 112.0
|
const ROTATE_HANDLE_SAFE_TOP_PX := 112.0
|
||||||
|
const NAME_BADGE_OVERLAP_TOLERANCE_PX2 := 128.0
|
||||||
const SCALE_CROSS_SIZE_PX := 5.0
|
const SCALE_CROSS_SIZE_PX := 5.0
|
||||||
const SCALE_HIT_RADIUS_PX := 12.0
|
const SCALE_HIT_RADIUS_PX := 12.0
|
||||||
const SCENERY_SCALE_HIT_HALF_SIZE_PX := 22.0
|
const SCENERY_SCALE_HIT_HALF_SIZE_PX := 22.0
|
||||||
@@ -82,6 +83,12 @@ var _candidate_preview_name_corner_radius: float = 8.0
|
|||||||
var _candidate_preview_name_border_width: float = 3.0
|
var _candidate_preview_name_border_width: float = 3.0
|
||||||
var _candidate_preview_name_padding: Vector2 = Vector2(12.0, 8.0)
|
var _candidate_preview_name_padding: Vector2 = Vector2(12.0, 8.0)
|
||||||
var _candidate_preview_name_style: StyleBoxFlat = StyleBoxFlat.new()
|
var _candidate_preview_name_style: StyleBoxFlat = StyleBoxFlat.new()
|
||||||
|
var _selected_name_pill_font_size_px: float = 20.0
|
||||||
|
var _selected_name_pill_max_width_px: float = 260.0
|
||||||
|
var _selected_name_pill_style: StyleBoxFlat = StyleBoxFlat.new()
|
||||||
|
var _selected_name_badge_obstacles: Array[Rect2] = []
|
||||||
|
var _last_selected_name_badge_layouts: Array[Dictionary] = []
|
||||||
|
var _selected_name_badge_slots: Dictionary = {}
|
||||||
var _dragging: Handle = Handle.NONE
|
var _dragging: Handle = Handle.NONE
|
||||||
var _drag_last: Vector2 = Vector2.ZERO
|
var _drag_last: Vector2 = Vector2.ZERO
|
||||||
var _drag_anchor: Node2D = null
|
var _drag_anchor: Node2D = null
|
||||||
@@ -102,6 +109,7 @@ var _scale_changed: bool = false
|
|||||||
|
|
||||||
func set_targets(nodes: Array[Node2D]) -> void:
|
func set_targets(nodes: Array[Node2D]) -> void:
|
||||||
_targets = nodes.duplicate()
|
_targets = nodes.duplicate()
|
||||||
|
_sync_selected_name_badge_slots()
|
||||||
queue_redraw()
|
queue_redraw()
|
||||||
|
|
||||||
|
|
||||||
@@ -120,6 +128,13 @@ func set_candidate_preview_obstacles(obstacles: Array[Rect2]) -> void:
|
|||||||
queue_redraw()
|
queue_redraw()
|
||||||
|
|
||||||
|
|
||||||
|
func set_selected_name_badge_obstacles(obstacles: Array[Rect2]) -> void:
|
||||||
|
if _selected_name_badge_obstacles == obstacles:
|
||||||
|
return
|
||||||
|
_selected_name_badge_obstacles = obstacles.duplicate()
|
||||||
|
queue_redraw()
|
||||||
|
|
||||||
|
|
||||||
func set_enabled(enabled: bool) -> void:
|
func set_enabled(enabled: bool) -> void:
|
||||||
_enabled = enabled
|
_enabled = enabled
|
||||||
visible = enabled
|
visible = enabled
|
||||||
@@ -152,6 +167,8 @@ func apply_theme(stage_theme: SandboxTheme) -> void:
|
|||||||
stage_theme.number("overlays.gizmos.candidate_name_pill_padding_x", 12.0, 4.0, 32.0),
|
stage_theme.number("overlays.gizmos.candidate_name_pill_padding_x", 12.0, 4.0, 32.0),
|
||||||
stage_theme.number("overlays.gizmos.candidate_name_pill_padding_y", 8.0, 2.0, 24.0)
|
stage_theme.number("overlays.gizmos.candidate_name_pill_padding_y", 8.0, 2.0, 24.0)
|
||||||
)
|
)
|
||||||
|
_selected_name_pill_font_size_px = stage_theme.number("overlays.gizmos.selected_name_pill_font_size_px", 20.0, 16.0, 30.0)
|
||||||
|
_selected_name_pill_max_width_px = stage_theme.number("overlays.gizmos.selected_name_pill_max_width_px", 260.0, 140.0, 420.0)
|
||||||
_outline_extra_width = stage_theme.number("overlays.gizmos.backing_extra_width", 3.0, 1.0, 8.0)
|
_outline_extra_width = stage_theme.number("overlays.gizmos.backing_extra_width", 3.0, 1.0, 8.0)
|
||||||
queue_redraw()
|
queue_redraw()
|
||||||
|
|
||||||
@@ -232,6 +249,7 @@ func begin_translate_drag(node: Node2D, world_pos: Vector2) -> void:
|
|||||||
_drag_anchor = node
|
_drag_anchor = node
|
||||||
if not _targets.has(node):
|
if not _targets.has(node):
|
||||||
_targets = [node]
|
_targets = [node]
|
||||||
|
_sync_selected_name_badge_slots()
|
||||||
_dragging = Handle.TRANSLATE
|
_dragging = Handle.TRANSLATE
|
||||||
_drag_last = world_pos
|
_drag_last = world_pos
|
||||||
_translate_drag_origin = world_pos
|
_translate_drag_origin = world_pos
|
||||||
@@ -313,6 +331,10 @@ func _draw() -> void:
|
|||||||
for node: Node2D in _targets:
|
for node: Node2D in _targets:
|
||||||
if node != null and is_instance_valid(node):
|
if node != null and is_instance_valid(node):
|
||||||
_draw_halo_rect(_target_bounds(node), _selection_core_color, SELECTION_WIDTH / zoom, _selection_backing_color)
|
_draw_halo_rect(_target_bounds(node), _selection_core_color, SELECTION_WIDTH / zoom, _selection_backing_color)
|
||||||
|
if _candidate_preview == null:
|
||||||
|
_draw_selected_name_badges(zoom)
|
||||||
|
else:
|
||||||
|
_last_selected_name_badge_layouts.clear()
|
||||||
# A clear rectangle signals selection; the compact handle keeps rotation available.
|
# A clear rectangle signals selection; the compact handle keeps rotation available.
|
||||||
if _transform_handles_visible and _targets.size() == 1 and is_instance_valid(_targets[0]):
|
if _transform_handles_visible and _targets.size() == 1 and is_instance_valid(_targets[0]):
|
||||||
var rect: Rect2 = _target_bounds(_targets[0])
|
var rect: Rect2 = _target_bounds(_targets[0])
|
||||||
@@ -453,6 +475,227 @@ func _draw_candidate_preview_name(node: Node2D, zoom: float) -> void:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
func _draw_selected_name_badges(zoom: float) -> void:
|
||||||
|
_last_selected_name_badge_layouts.clear()
|
||||||
|
_sync_selected_name_badge_slots()
|
||||||
|
if _targets.is_empty():
|
||||||
|
return
|
||||||
|
var font: Font = ThemeDB.fallback_font
|
||||||
|
if font == null:
|
||||||
|
return
|
||||||
|
var viewport: Viewport = get_viewport()
|
||||||
|
var viewport_size: Vector2 = viewport.get_visible_rect().size
|
||||||
|
var canvas_transform: Transform2D = viewport.get_canvas_transform()
|
||||||
|
var inverse_canvas_transform: Transform2D = canvas_transform.affine_inverse()
|
||||||
|
var safe_rect: Rect2 = Rect2(
|
||||||
|
Vector2(8.0, 72.0),
|
||||||
|
Vector2(maxf(0.0, viewport_size.x - 16.0), maxf(0.0, viewport_size.y - 112.0))
|
||||||
|
)
|
||||||
|
var entries: Array[Dictionary] = []
|
||||||
|
var selected_object_bounds: Array[Rect2] = []
|
||||||
|
for node: Node2D in _targets:
|
||||||
|
if node == null or not is_instance_valid(node) or not node.is_visible_in_tree():
|
||||||
|
continue
|
||||||
|
var full_name: String = _stage_name_for_node(node)
|
||||||
|
if full_name.is_empty():
|
||||||
|
continue
|
||||||
|
var font_size: int = maxi(1, roundi(_selected_name_pill_font_size_px / zoom))
|
||||||
|
var padding_world: Vector2 = _candidate_preview_name_padding / zoom
|
||||||
|
var max_text_width_world: float = maxf(32.0, (_selected_name_pill_max_width_px - _candidate_preview_name_padding.x * 2.0) / zoom)
|
||||||
|
var display_name: String = _elide_selected_name(full_name, font, font_size, max_text_width_world)
|
||||||
|
var text_size: Vector2 = font.get_string_size(display_name, HORIZONTAL_ALIGNMENT_LEFT, -1.0, font_size)
|
||||||
|
var badge_world_size: Vector2 = Vector2(text_size.x, font.get_height(font_size)) + padding_world * 2.0
|
||||||
|
var bounds_screen: Rect2 = _world_rect_to_screen_rect(_target_bounds(node), canvas_transform)
|
||||||
|
selected_object_bounds.append(bounds_screen)
|
||||||
|
entries.append({
|
||||||
|
"node": node,
|
||||||
|
"stage_name": full_name,
|
||||||
|
"display_name": display_name,
|
||||||
|
"font_size": font_size,
|
||||||
|
"text_size": text_size,
|
||||||
|
"badge_world_size": badge_world_size,
|
||||||
|
"badge_screen_size": badge_world_size * zoom,
|
||||||
|
"bounds_screen": bounds_screen,
|
||||||
|
})
|
||||||
|
if entries.is_empty():
|
||||||
|
return
|
||||||
|
|
||||||
|
var occupied_badges: Array[Rect2] = []
|
||||||
|
for entry_index: int in entries.size():
|
||||||
|
var entry: Dictionary = entries[entry_index]
|
||||||
|
var node: Node2D = entry.get("node") as Node2D
|
||||||
|
var object_bounds: Rect2 = entry.get("bounds_screen", Rect2())
|
||||||
|
var badge_size: Vector2 = entry.get("badge_screen_size", Vector2.ZERO)
|
||||||
|
var object_center: Vector2 = object_bounds.get_center()
|
||||||
|
var gap: float = 8.0
|
||||||
|
var preferred: Rect2 = Rect2(Vector2(object_center.x - badge_size.x * 0.5, object_bounds.position.y - badge_size.y - gap), badge_size)
|
||||||
|
var candidates: Array[Rect2] = [
|
||||||
|
preferred,
|
||||||
|
Rect2(Vector2(object_bounds.position.x - badge_size.x - gap, object_center.y - badge_size.y * 0.5), badge_size),
|
||||||
|
Rect2(Vector2(object_bounds.end.x + gap, object_center.y - badge_size.y * 0.5), badge_size),
|
||||||
|
Rect2(Vector2(object_center.x - badge_size.x * 0.5, object_bounds.end.y + gap), badge_size),
|
||||||
|
Rect2(Vector2(object_bounds.position.x - badge_size.x - gap, object_bounds.position.y - badge_size.y - gap), badge_size),
|
||||||
|
Rect2(Vector2(object_bounds.end.x + gap, object_bounds.position.y - badge_size.y - gap), badge_size),
|
||||||
|
Rect2(Vector2(object_bounds.position.x - badge_size.x - gap, object_bounds.end.y - badge_size.y), badge_size),
|
||||||
|
Rect2(Vector2(object_bounds.end.x + gap, object_bounds.end.y - badge_size.y), badge_size),
|
||||||
|
]
|
||||||
|
var badge_id: int = node.get_instance_id()
|
||||||
|
var current_slot: int = int(_selected_name_badge_slots.get(badge_id, -1))
|
||||||
|
var best_slot: int = current_slot
|
||||||
|
var best_rect: Rect2 = _place_selected_name_badge(candidates[current_slot], badge_size, safe_rect) if current_slot >= 0 and current_slot < candidates.size() else Rect2()
|
||||||
|
var current_obstruction: float = _selected_name_badge_obstruction(
|
||||||
|
best_rect,
|
||||||
|
object_bounds,
|
||||||
|
entry_index,
|
||||||
|
selected_object_bounds,
|
||||||
|
occupied_badges,
|
||||||
|
node,
|
||||||
|
canvas_transform
|
||||||
|
) if current_slot >= 0 and current_slot < candidates.size() else INF
|
||||||
|
if current_obstruction > 0.01:
|
||||||
|
var best_score: float = INF
|
||||||
|
for candidate_index: int in candidates.size():
|
||||||
|
var placed: Rect2 = _place_selected_name_badge(candidates[candidate_index], badge_size, safe_rect)
|
||||||
|
var obstruction: float = _selected_name_badge_obstruction(
|
||||||
|
placed,
|
||||||
|
object_bounds,
|
||||||
|
entry_index,
|
||||||
|
selected_object_bounds,
|
||||||
|
occupied_badges,
|
||||||
|
node,
|
||||||
|
canvas_transform
|
||||||
|
)
|
||||||
|
var score: float = placed.position.distance_to(preferred.position) * 0.02 + obstruction
|
||||||
|
if score < best_score:
|
||||||
|
best_score = score
|
||||||
|
best_rect = placed
|
||||||
|
best_slot = candidate_index
|
||||||
|
_selected_name_badge_slots[badge_id] = best_slot
|
||||||
|
occupied_badges.append(best_rect)
|
||||||
|
entry["screen_rect"] = best_rect
|
||||||
|
entry["anchor_slot"] = best_slot
|
||||||
|
entry["tethered"] = best_rect.get_center().distance_to(preferred.get_center()) > 24.0
|
||||||
|
_last_selected_name_badge_layouts.append(entry)
|
||||||
|
|
||||||
|
for entry: Dictionary in _last_selected_name_badge_layouts:
|
||||||
|
var screen_rect: Rect2 = entry.get("screen_rect", Rect2())
|
||||||
|
var target_rect: Rect2 = entry.get("bounds_screen", Rect2())
|
||||||
|
if bool(entry.get("tethered", false)):
|
||||||
|
var target_point: Vector2 = _closest_point_on_rect(target_rect, screen_rect.get_center())
|
||||||
|
var badge_point: Vector2 = _closest_point_on_rect(screen_rect, target_point)
|
||||||
|
var tether_from: Vector2 = to_local(inverse_canvas_transform * target_point)
|
||||||
|
var tether_to: Vector2 = to_local(inverse_canvas_transform * badge_point)
|
||||||
|
draw_line(tether_from, tether_to, _candidate_preview_name_background, 4.0 / zoom, true)
|
||||||
|
draw_line(tether_from, tether_to, Color(_candidate_preview_color, 0.9), 1.5 / zoom, true)
|
||||||
|
entry["tether_from_screen"] = target_point
|
||||||
|
entry["tether_to_screen"] = badge_point
|
||||||
|
var local_position: Vector2 = to_local(inverse_canvas_transform * screen_rect.position)
|
||||||
|
var world_size: Vector2 = entry.get("badge_world_size", Vector2.ZERO)
|
||||||
|
var local_rect: Rect2 = Rect2(local_position, world_size)
|
||||||
|
_selected_name_pill_style.bg_color = _candidate_preview_name_background
|
||||||
|
_selected_name_pill_style.border_color = _candidate_preview_color
|
||||||
|
_selected_name_pill_style.set_corner_radius_all(maxi(1, roundi(_candidate_preview_name_corner_radius / zoom)))
|
||||||
|
_selected_name_pill_style.set_border_width_all(maxi(1, roundi(_candidate_preview_name_border_width / zoom)))
|
||||||
|
draw_style_box(_selected_name_pill_style, local_rect)
|
||||||
|
var font_size: int = int(entry.get("font_size", 20))
|
||||||
|
var text: String = String(entry.get("display_name", ""))
|
||||||
|
var baseline: float = local_rect.position.y + (local_rect.size.y - font.get_height(font_size)) * 0.5 + font.get_ascent(font_size)
|
||||||
|
draw_string(
|
||||||
|
font,
|
||||||
|
Vector2(local_rect.position.x + _candidate_preview_name_padding.x / zoom, baseline),
|
||||||
|
text,
|
||||||
|
HORIZONTAL_ALIGNMENT_LEFT,
|
||||||
|
-1.0,
|
||||||
|
font_size,
|
||||||
|
Color.WHITE
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
func _stage_name_for_node(node: Node2D) -> String:
|
||||||
|
if node == null or not is_instance_valid(node):
|
||||||
|
return ""
|
||||||
|
if node is PropBlockScript or node is StickmanRigScript or node.get_script() == MissingPropScript or node.get_script() == MissingStickmanScript:
|
||||||
|
return String(node.get("stage_name")).strip_edges()
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
func _sync_selected_name_badge_slots() -> void:
|
||||||
|
var selected_ids: Dictionary = {}
|
||||||
|
for node: Node2D in _targets:
|
||||||
|
if node != null and is_instance_valid(node):
|
||||||
|
selected_ids[node.get_instance_id()] = true
|
||||||
|
for id: Variant in _selected_name_badge_slots.keys():
|
||||||
|
if not selected_ids.has(id):
|
||||||
|
_selected_name_badge_slots.erase(id)
|
||||||
|
|
||||||
|
|
||||||
|
func _place_selected_name_badge(candidate: Rect2, badge_size: Vector2, safe_rect: Rect2) -> Rect2:
|
||||||
|
var safe_max: Vector2 = Vector2(
|
||||||
|
maxf(safe_rect.position.x, safe_rect.end.x - badge_size.x),
|
||||||
|
maxf(safe_rect.position.y, safe_rect.end.y - badge_size.y)
|
||||||
|
)
|
||||||
|
var clamped_position: Vector2 = Vector2(
|
||||||
|
clampf(candidate.position.x, safe_rect.position.x, safe_max.x),
|
||||||
|
clampf(candidate.position.y, safe_rect.position.y, safe_max.y)
|
||||||
|
)
|
||||||
|
return Rect2(clamped_position, badge_size)
|
||||||
|
|
||||||
|
|
||||||
|
func _selected_name_badge_obstruction(
|
||||||
|
badge_rect: Rect2,
|
||||||
|
object_bounds: Rect2,
|
||||||
|
entry_index: int,
|
||||||
|
selected_object_bounds: Array[Rect2],
|
||||||
|
occupied_badges: Array[Rect2],
|
||||||
|
node: Node2D,
|
||||||
|
canvas_transform: Transform2D
|
||||||
|
) -> float:
|
||||||
|
var obstruction: float = _selected_name_badge_overlap_penalty(badge_rect, object_bounds, 12000.0)
|
||||||
|
for other_index: int in selected_object_bounds.size():
|
||||||
|
if other_index != entry_index:
|
||||||
|
obstruction += _selected_name_badge_overlap_penalty(badge_rect, selected_object_bounds[other_index], 8000.0)
|
||||||
|
for obstacle: Rect2 in _selected_name_badge_obstacles:
|
||||||
|
obstruction += _selected_name_badge_overlap_penalty(badge_rect, obstacle, 12000.0)
|
||||||
|
for obstacle: Rect2 in _candidate_preview_obstacles:
|
||||||
|
obstruction += _selected_name_badge_overlap_penalty(badge_rect, obstacle, 12000.0)
|
||||||
|
for occupied: Rect2 in occupied_badges:
|
||||||
|
obstruction += _selected_name_badge_overlap_penalty(badge_rect, occupied, 24000.0)
|
||||||
|
if _transform_handles_visible and _targets.size() == 1:
|
||||||
|
var rotate_screen: Vector2 = canvas_transform * _rotate_handle_position(_target_bounds(node))
|
||||||
|
var rotate_rect: Rect2 = Rect2(rotate_screen - Vector2(24.0, 24.0), Vector2(48.0, 48.0))
|
||||||
|
obstruction += _selected_name_badge_overlap_penalty(badge_rect, rotate_rect, 16000.0)
|
||||||
|
if node is PropBlockScript:
|
||||||
|
for corner: Vector2 in _corners(_target_bounds(node)):
|
||||||
|
var corner_screen: Vector2 = canvas_transform * corner
|
||||||
|
var scale_rect: Rect2 = Rect2(corner_screen - Vector2(12.0, 12.0), Vector2(24.0, 24.0))
|
||||||
|
obstruction += _selected_name_badge_overlap_penalty(badge_rect, scale_rect, 16000.0)
|
||||||
|
return obstruction
|
||||||
|
|
||||||
|
|
||||||
|
func _selected_name_badge_overlap_penalty(badge_rect: Rect2, obstacle_rect: Rect2, weight: float) -> float:
|
||||||
|
var overlap_area: float = badge_rect.intersection(obstacle_rect).get_area()
|
||||||
|
return maxf(0.0, overlap_area - NAME_BADGE_OVERLAP_TOLERANCE_PX2) * weight
|
||||||
|
|
||||||
|
|
||||||
|
func _elide_selected_name(value: String, font: Font, font_size: int, max_width: float) -> String:
|
||||||
|
if font.get_string_size(value, HORIZONTAL_ALIGNMENT_LEFT, -1.0, font_size).x <= max_width:
|
||||||
|
return value
|
||||||
|
var end_index: int = value.length()
|
||||||
|
while end_index > 1:
|
||||||
|
end_index -= 1
|
||||||
|
var candidate: String = value.substr(0, end_index) + "…"
|
||||||
|
if font.get_string_size(candidate, HORIZONTAL_ALIGNMENT_LEFT, -1.0, font_size).x <= max_width:
|
||||||
|
return candidate
|
||||||
|
return "…"
|
||||||
|
|
||||||
|
|
||||||
|
func _closest_point_on_rect(rect: Rect2, point: Vector2) -> Vector2:
|
||||||
|
return Vector2(
|
||||||
|
clampf(point.x, rect.position.x, rect.end.x),
|
||||||
|
clampf(point.y, rect.position.y, rect.end.y)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
func _world_rect_to_screen_rect(world_rect: Rect2, canvas_transform: Transform2D) -> Rect2:
|
func _world_rect_to_screen_rect(world_rect: Rect2, canvas_transform: Transform2D) -> Rect2:
|
||||||
var points: Array[Vector2] = [
|
var points: Array[Vector2] = [
|
||||||
world_rect.position,
|
world_rect.position,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ extends Node2D
|
|||||||
## Sits above the World and ghost holder, below the CanvasLayer UI.
|
## Sits above the World and ghost holder, below the CanvasLayer UI.
|
||||||
|
|
||||||
var camera: Camera2D = null
|
var camera: Camera2D = null
|
||||||
|
var surface_world: Node2D = null
|
||||||
|
|
||||||
## Terrain guide-line state.
|
## Terrain guide-line state.
|
||||||
var terrain_guide_visible: bool = false
|
var terrain_guide_visible: bool = false
|
||||||
@@ -21,6 +22,8 @@ var action_origin: Vector2 = Vector2.ZERO
|
|||||||
var action_target: Vector2 = Vector2.ZERO
|
var action_target: Vector2 = Vector2.ZERO
|
||||||
var action_curve_points: PackedVector2Array = PackedVector2Array()
|
var action_curve_points: PackedVector2Array = PackedVector2Array()
|
||||||
var action_valid: bool = true
|
var action_valid: bool = true
|
||||||
|
var action_show_trajectory: bool = true
|
||||||
|
var action_grounded_trajectory: bool = false
|
||||||
var action_requested_target: Vector2 = Vector2.ZERO
|
var action_requested_target: Vector2 = Vector2.ZERO
|
||||||
var action_show_requested_target: bool = false
|
var action_show_requested_target: bool = false
|
||||||
var action_effective_target: Vector2 = Vector2.ZERO
|
var action_effective_target: Vector2 = Vector2.ZERO
|
||||||
@@ -40,6 +43,10 @@ var invalid_color: Color = Color(1.0, 0.3, 0.3)
|
|||||||
var set_down_unknown_color: Color = Color(0.77, 0.81, 0.87, 0.9)
|
var set_down_unknown_color: Color = Color(0.77, 0.81, 0.87, 0.9)
|
||||||
var set_down_reach_color: Color = Color(1.0, 0.7, 0.1, 0.9)
|
var set_down_reach_color: Color = Color(1.0, 0.7, 0.1, 0.9)
|
||||||
var set_down_ghost_alpha: float = 0.36
|
var set_down_ghost_alpha: float = 0.36
|
||||||
|
var set_down_surface_color: Color = Color(0.13, 0.78, 1.0, 0.5)
|
||||||
|
var set_down_surface_hover_color: Color = Color(0.13, 0.86, 1.0, 0.95)
|
||||||
|
var set_down_surface_line_width_px: float = 5.0
|
||||||
|
var set_down_surface_hover_line_width_px: float = 7.0
|
||||||
var line_width_px: float = 2.0
|
var line_width_px: float = 2.0
|
||||||
var dash_length_px: float = 8.0
|
var dash_length_px: float = 8.0
|
||||||
var dash_gap_px: float = 5.0
|
var dash_gap_px: float = 5.0
|
||||||
@@ -48,6 +55,9 @@ const DASH_LENGTH_PX := 8.0
|
|||||||
const DASH_GAP_PX := 5.0
|
const DASH_GAP_PX := 5.0
|
||||||
const LINE_WIDTH_PX := 2.0
|
const LINE_WIDTH_PX := 2.0
|
||||||
const MARKER_RADIUS_PX := 10.0
|
const MARKER_RADIUS_PX := 10.0
|
||||||
|
const SET_DOWN_SUPPORT_NORMAL_Y := -0.82
|
||||||
|
const SET_DOWN_SUPPORT_MIN_EDGE_PX := 18.0
|
||||||
|
const SET_DOWN_SURFACE_HOVER_RADIUS_PX := 22.0
|
||||||
|
|
||||||
func apply_style(style: Dictionary) -> void:
|
func apply_style(style: Dictionary) -> void:
|
||||||
guide_line_color = Color.from_string(String((style.get("terrain_guide", {}) as Dictionary).get("color", "")), guide_line_color)
|
guide_line_color = Color.from_string(String((style.get("terrain_guide", {}) as Dictionary).get("color", "")), guide_line_color)
|
||||||
@@ -57,6 +67,12 @@ func apply_style(style: Dictionary) -> void:
|
|||||||
set_down_unknown_color = Color.from_string(String(set_down_style.get("unknown_color", "")), set_down_unknown_color)
|
set_down_unknown_color = Color.from_string(String(set_down_style.get("unknown_color", "")), set_down_unknown_color)
|
||||||
set_down_reach_color = Color.from_string(String(set_down_style.get("reach_color", "")), set_down_reach_color)
|
set_down_reach_color = Color.from_string(String(set_down_style.get("reach_color", "")), set_down_reach_color)
|
||||||
set_down_ghost_alpha = clampf(float(set_down_style.get("ghost_alpha", set_down_ghost_alpha)), 0.0, 1.0)
|
set_down_ghost_alpha = clampf(float(set_down_style.get("ghost_alpha", set_down_ghost_alpha)), 0.0, 1.0)
|
||||||
|
var set_down_surface_alpha: float = clampf(float(set_down_style.get("surface_alpha", 0.75)), 0.0, 1.0)
|
||||||
|
var set_down_surface_hover_alpha: float = clampf(float(set_down_style.get("surface_hover_alpha", 0.95)), 0.0, 1.0)
|
||||||
|
set_down_surface_color = Color(guide_line_color.r, guide_line_color.g, guide_line_color.b, set_down_surface_alpha)
|
||||||
|
set_down_surface_hover_color = Color(guide_line_color.r, guide_line_color.g, guide_line_color.b, set_down_surface_hover_alpha)
|
||||||
|
set_down_surface_line_width_px = maxf(1.0, float(set_down_style.get("surface_line_width_px", set_down_surface_line_width_px)))
|
||||||
|
set_down_surface_hover_line_width_px = maxf(set_down_surface_line_width_px, float(set_down_style.get("surface_hover_line_width_px", set_down_surface_hover_line_width_px)))
|
||||||
var defaults: Dictionary = style.get("style_defaults", {})
|
var defaults: Dictionary = style.get("style_defaults", {})
|
||||||
line_width_px = maxf(0.5, float(defaults.get("line_width", line_width_px)))
|
line_width_px = maxf(0.5, float(defaults.get("line_width", line_width_px)))
|
||||||
dash_length_px = maxf(1.0, float(defaults.get("dash_length", dash_length_px)))
|
dash_length_px = maxf(1.0, float(defaults.get("dash_length", dash_length_px)))
|
||||||
@@ -86,6 +102,8 @@ func set_action_trajectory(origin: Vector2, target: Vector2, valid: bool) -> voi
|
|||||||
action_target = target
|
action_target = target
|
||||||
action_curve_points.clear()
|
action_curve_points.clear()
|
||||||
action_valid = valid
|
action_valid = valid
|
||||||
|
action_show_trajectory = true
|
||||||
|
action_grounded_trajectory = false
|
||||||
action_show_requested_target = false
|
action_show_requested_target = false
|
||||||
action_show_collision = false
|
action_show_collision = false
|
||||||
action_preview_unavailable = false
|
action_preview_unavailable = false
|
||||||
@@ -95,12 +113,41 @@ func set_action_trajectory(origin: Vector2, target: Vector2, valid: bool) -> voi
|
|||||||
set_down_prop = null
|
set_down_prop = null
|
||||||
|
|
||||||
|
|
||||||
|
func set_grounded_action_trajectory(origin: Vector2, target: Vector2, valid: bool) -> void:
|
||||||
|
## Shows a flat walk/run route at the actor's ground level and keeps the
|
||||||
|
## cursor marker at its actual position.
|
||||||
|
set_action_trajectory(origin, target, valid)
|
||||||
|
action_grounded_trajectory = true
|
||||||
|
queue_redraw()
|
||||||
|
|
||||||
|
|
||||||
|
func set_action_marker(target: Vector2, valid: bool = true) -> void:
|
||||||
|
## Shows only the cursor marker when this capture already has a route preview.
|
||||||
|
action_visible = true
|
||||||
|
action_origin = target
|
||||||
|
action_target = target
|
||||||
|
action_curve_points.clear()
|
||||||
|
action_valid = valid
|
||||||
|
action_show_trajectory = false
|
||||||
|
action_grounded_trajectory = false
|
||||||
|
action_show_requested_target = false
|
||||||
|
action_show_collision = false
|
||||||
|
action_preview_unavailable = false
|
||||||
|
action_preview_planned = false
|
||||||
|
action_preview_uncertain = false
|
||||||
|
set_down_preview_visible = false
|
||||||
|
set_down_prop = null
|
||||||
|
queue_redraw()
|
||||||
|
|
||||||
|
|
||||||
func set_throw_trajectory(origin: Vector2, requested_target: Vector2, landing_target: Vector2, valid: bool, trajectory_points: PackedVector2Array = PackedVector2Array(), effective_target: Vector2 = Vector2.INF, collision_position: Vector2 = Vector2.INF, planned: bool = false, uncertain: bool = false) -> void:
|
func set_throw_trajectory(origin: Vector2, requested_target: Vector2, landing_target: Vector2, valid: bool, trajectory_points: PackedVector2Array = PackedVector2Array(), effective_target: Vector2 = Vector2.INF, collision_position: Vector2 = Vector2.INF, planned: bool = false, uncertain: bool = false) -> void:
|
||||||
action_visible = true
|
action_visible = true
|
||||||
action_origin = origin
|
action_origin = origin
|
||||||
action_target = landing_target
|
action_target = landing_target
|
||||||
action_curve_points = trajectory_points.duplicate()
|
action_curve_points = trajectory_points.duplicate()
|
||||||
action_valid = valid
|
action_valid = valid
|
||||||
|
action_show_trajectory = true
|
||||||
|
action_grounded_trajectory = false
|
||||||
action_requested_target = requested_target
|
action_requested_target = requested_target
|
||||||
action_show_requested_target = true
|
action_show_requested_target = true
|
||||||
action_effective_target = effective_target if effective_target.is_finite() else landing_target
|
action_effective_target = effective_target if effective_target.is_finite() else landing_target
|
||||||
@@ -118,6 +165,8 @@ func set_throw_preview_unavailable(requested_target: Vector2) -> void:
|
|||||||
action_origin = requested_target
|
action_origin = requested_target
|
||||||
action_target = requested_target
|
action_target = requested_target
|
||||||
action_curve_points.clear()
|
action_curve_points.clear()
|
||||||
|
action_show_trajectory = false
|
||||||
|
action_grounded_trajectory = false
|
||||||
action_valid = false
|
action_valid = false
|
||||||
action_requested_target = requested_target
|
action_requested_target = requested_target
|
||||||
action_show_requested_target = false
|
action_show_requested_target = false
|
||||||
@@ -133,6 +182,8 @@ func set_set_down_preview(origin: Vector2, target: Vector2, known: bool, valid:
|
|||||||
action_origin = origin
|
action_origin = origin
|
||||||
action_target = target
|
action_target = target
|
||||||
action_curve_points.clear()
|
action_curve_points.clear()
|
||||||
|
action_show_trajectory = false
|
||||||
|
action_grounded_trajectory = false
|
||||||
action_valid = valid
|
action_valid = valid
|
||||||
action_preview_unavailable = not known
|
action_preview_unavailable = not known
|
||||||
action_show_requested_target = false
|
action_show_requested_target = false
|
||||||
@@ -148,6 +199,8 @@ func set_set_down_preview(origin: Vector2, target: Vector2, known: bool, valid:
|
|||||||
func clear_action() -> void:
|
func clear_action() -> void:
|
||||||
action_visible = false
|
action_visible = false
|
||||||
action_curve_points.clear()
|
action_curve_points.clear()
|
||||||
|
action_show_trajectory = false
|
||||||
|
action_grounded_trajectory = false
|
||||||
action_show_requested_target = false
|
action_show_requested_target = false
|
||||||
action_show_collision = false
|
action_show_collision = false
|
||||||
action_preview_unavailable = false
|
action_preview_unavailable = false
|
||||||
@@ -176,10 +229,12 @@ func _draw() -> void:
|
|||||||
color = Color(0.35, 0.8, 1.0, 0.95)
|
color = Color(0.35, 0.8, 1.0, 0.95)
|
||||||
elif action_valid and action_preview_uncertain:
|
elif action_valid and action_preview_uncertain:
|
||||||
color = Color(0.8, 0.68, 1.0, 0.95)
|
color = Color(0.8, 0.68, 1.0, 0.95)
|
||||||
if action_curve_points.size() >= 2:
|
if action_show_trajectory:
|
||||||
draw_polyline(action_curve_points, color, line_width_px / _zoom(), true)
|
if action_curve_points.size() >= 2:
|
||||||
else:
|
draw_polyline(action_curve_points, color, line_width_px / _zoom(), true)
|
||||||
_draw_dashed(action_origin, action_target, color)
|
else:
|
||||||
|
var route_target: Vector2 = Vector2(action_target.x, action_origin.y) if action_grounded_trajectory else action_target
|
||||||
|
_draw_dashed(action_origin, route_target, color)
|
||||||
if action_show_requested_target:
|
if action_show_requested_target:
|
||||||
_draw_ghost_marker(action_effective_target, color)
|
_draw_ghost_marker(action_effective_target, color)
|
||||||
var request_color := Color(1.0, 0.85, 0.25, 0.9)
|
var request_color := Color(1.0, 0.85, 0.25, 0.9)
|
||||||
@@ -192,40 +247,178 @@ func _draw() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _draw_set_down_preview() -> void:
|
func _draw_set_down_preview() -> void:
|
||||||
var zoom := _zoom()
|
_draw_set_down_support_surfaces()
|
||||||
var color := valid_color if action_valid else invalid_color
|
|
||||||
if not set_down_preview_known:
|
|
||||||
color = set_down_unknown_color
|
func _draw_set_down_support_surfaces() -> void:
|
||||||
_draw_dashed(action_origin, set_down_approach if set_down_approach.is_finite() and set_down_approach != Vector2.ZERO else action_target, color)
|
if surface_world == null or not is_instance_valid(surface_world):
|
||||||
if set_down_preview_known and set_down_prop != null and is_instance_valid(set_down_prop):
|
return
|
||||||
var polygon_node := set_down_prop.get_node_or_null(NodePath("Polygon2D")) as Polygon2D
|
var support_surfaces: Array[Dictionary] = []
|
||||||
if polygon_node != null and polygon_node.polygon.size() >= 3:
|
var occluders: Array[Dictionary] = []
|
||||||
var local_transform: Transform2D = set_down_prop.global_transform.affine_inverse() * polygon_node.global_transform
|
for child: Node in surface_world.get_children():
|
||||||
var ghost_transform: Transform2D = set_down_transform * local_transform
|
if child is TerrainBlock:
|
||||||
var ghost_points := PackedVector2Array()
|
var terrain: TerrainBlock = child as TerrainBlock
|
||||||
for point: Vector2 in polygon_node.polygon:
|
if not terrain.is_visible_in_tree():
|
||||||
ghost_points.append(ghost_transform * point)
|
continue
|
||||||
var fill := set_down_prop.fill_color
|
var terrain_points: PackedVector2Array = _terrain_collision_world_points(terrain)
|
||||||
fill.a = set_down_ghost_alpha
|
if terrain_points.size() < 3:
|
||||||
draw_colored_polygon(ghost_points, fill)
|
continue
|
||||||
var outline_points := ghost_points.duplicate()
|
var terrain_entry: Dictionary = {"node": terrain, "points": terrain_points}
|
||||||
outline_points.append(ghost_points[0])
|
support_surfaces.append(terrain_entry)
|
||||||
draw_polyline(outline_points, color, line_width_px / zoom, true)
|
occluders.append(terrain_entry)
|
||||||
|
elif child is PropBlock:
|
||||||
|
var prop: PropBlock = child as PropBlock
|
||||||
|
if not prop.is_visible_in_tree():
|
||||||
|
continue
|
||||||
|
var prop_points: PackedVector2Array = _prop_collision_world_points(prop)
|
||||||
|
if prop_points.size() < 3:
|
||||||
|
continue
|
||||||
|
var prop_entry: Dictionary = {"node": prop, "points": prop_points}
|
||||||
|
occluders.append(prop_entry)
|
||||||
|
if prop.runtime_role != PropBlock.RuntimeRole.HELD and bool(prop.stage_roles.get("holds_other_props", false)):
|
||||||
|
support_surfaces.append(prop_entry)
|
||||||
|
var hovered_piece: Dictionary = {}
|
||||||
|
var hovered_distance_px: float = SET_DOWN_SURFACE_HOVER_RADIUS_PX
|
||||||
|
var zoom: float = _zoom()
|
||||||
|
for surface: Dictionary in support_surfaces:
|
||||||
|
var surface_owner: Node = surface.get("node") as Node
|
||||||
|
var points: PackedVector2Array = surface.get("points", PackedVector2Array())
|
||||||
|
for top_edge: PackedVector2Array in _top_facing_edges(points):
|
||||||
|
var visible_pieces: Array[PackedVector2Array] = _clip_surface_edge(top_edge[0], top_edge[1], surface_owner, occluders)
|
||||||
|
for piece: PackedVector2Array in visible_pieces:
|
||||||
|
var start: Vector2 = piece[0]
|
||||||
|
var finish: Vector2 = piece[1]
|
||||||
|
draw_line(start, finish, set_down_surface_color, set_down_surface_line_width_px / zoom, true)
|
||||||
|
var closest: Vector2 = _closest_point_on_segment(action_target, start, finish)
|
||||||
|
var distance_px: float = action_target.distance_to(closest) * zoom
|
||||||
|
if distance_px <= hovered_distance_px:
|
||||||
|
hovered_distance_px = distance_px
|
||||||
|
hovered_piece = {"start": start, "finish": finish, "point": closest}
|
||||||
|
if hovered_piece.is_empty():
|
||||||
|
return
|
||||||
|
var hover_start: Vector2 = hovered_piece.get("start", Vector2.ZERO)
|
||||||
|
var hover_finish: Vector2 = hovered_piece.get("finish", Vector2.ZERO)
|
||||||
|
var pin_position: Vector2 = hovered_piece.get("point", action_target)
|
||||||
|
draw_line(hover_start, hover_finish, set_down_surface_hover_color, set_down_surface_hover_line_width_px / zoom, true)
|
||||||
|
var pin_radius: float = 5.0 / zoom
|
||||||
|
var pin_center: Vector2 = pin_position - Vector2(0.0, 8.0 / zoom)
|
||||||
|
draw_line(pin_center + Vector2(0.0, pin_radius), pin_position, set_down_surface_hover_color, line_width_px / zoom, true)
|
||||||
|
draw_circle(pin_center, pin_radius * 0.55, Color(set_down_surface_hover_color.r, set_down_surface_hover_color.g, set_down_surface_hover_color.b, 0.28))
|
||||||
|
draw_arc(pin_center, pin_radius, 0.0, TAU, 20, set_down_surface_hover_color, line_width_px / zoom, true)
|
||||||
|
|
||||||
|
|
||||||
|
func _terrain_collision_world_points(terrain: TerrainBlock) -> PackedVector2Array:
|
||||||
|
var collision: CollisionPolygon2D = terrain.get_node_or_null(NodePath("CollisionPolygon2D")) as CollisionPolygon2D
|
||||||
|
if collision == null or collision.disabled or collision.polygon.size() < 3:
|
||||||
|
return PackedVector2Array()
|
||||||
|
return _to_world_points(collision, collision.polygon)
|
||||||
|
|
||||||
|
|
||||||
|
func _prop_collision_world_points(prop: PropBlock) -> PackedVector2Array:
|
||||||
|
var polygon_collision: CollisionPolygon2D = prop.get_node_or_null(NodePath("CollisionPolygon2D")) as CollisionPolygon2D
|
||||||
|
if polygon_collision != null and not polygon_collision.disabled and polygon_collision.polygon.size() >= 3:
|
||||||
|
return _to_world_points(polygon_collision, polygon_collision.polygon)
|
||||||
|
var circle_collision: CollisionShape2D = prop.get_node_or_null(NodePath("CollisionShape2D")) as CollisionShape2D
|
||||||
|
if circle_collision == null or circle_collision.disabled or not circle_collision.shape is CircleShape2D:
|
||||||
|
return PackedVector2Array()
|
||||||
|
var circle: CircleShape2D = circle_collision.shape as CircleShape2D
|
||||||
|
var points := PackedVector2Array()
|
||||||
|
for index: int in PropBlock.CIRCLE_SEGMENTS:
|
||||||
|
var angle: float = TAU * float(index) / float(PropBlock.CIRCLE_SEGMENTS)
|
||||||
|
points.append(circle_collision.to_global(Vector2(cos(angle), sin(angle)) * circle.radius))
|
||||||
|
return points
|
||||||
|
|
||||||
|
|
||||||
|
func _to_world_points(transform_node: Node2D, local_points: PackedVector2Array) -> PackedVector2Array:
|
||||||
|
var points := PackedVector2Array()
|
||||||
|
for point: Vector2 in local_points:
|
||||||
|
points.append(transform_node.to_global(point))
|
||||||
|
return points
|
||||||
|
|
||||||
|
|
||||||
|
func _top_facing_edges(points: PackedVector2Array) -> Array[PackedVector2Array]:
|
||||||
|
var edges: Array[PackedVector2Array] = []
|
||||||
|
if points.size() < 3:
|
||||||
|
return edges
|
||||||
|
for index: int in points.size():
|
||||||
|
var start: Vector2 = points[index]
|
||||||
|
var finish: Vector2 = points[(index + 1) % points.size()]
|
||||||
|
var direction: Vector2 = finish - start
|
||||||
|
var edge_length: float = direction.length()
|
||||||
|
if edge_length * _zoom() < SET_DOWN_SUPPORT_MIN_EDGE_PX:
|
||||||
|
continue
|
||||||
|
var normal: Vector2 = Vector2(-direction.y, direction.x).normalized()
|
||||||
|
var midpoint: Vector2 = (start + finish) * 0.5
|
||||||
|
var sample_offset: Vector2 = normal * 2.0
|
||||||
|
var plus_inside: bool = Geometry2D.is_point_in_polygon(midpoint + sample_offset, points)
|
||||||
|
var minus_inside: bool = Geometry2D.is_point_in_polygon(midpoint - sample_offset, points)
|
||||||
|
var outward: Vector2 = Vector2.ZERO
|
||||||
|
if plus_inside and not minus_inside:
|
||||||
|
outward = -normal
|
||||||
|
elif minus_inside and not plus_inside:
|
||||||
|
outward = normal
|
||||||
else:
|
else:
|
||||||
_draw_ghost_marker(action_target, color)
|
continue
|
||||||
else:
|
if outward.y > SET_DOWN_SUPPORT_NORMAL_Y:
|
||||||
_draw_ghost_marker(action_target, color)
|
continue
|
||||||
var release_origin := set_down_transform.origin
|
edges.append(PackedVector2Array([start, finish]))
|
||||||
var target_adjusted := set_down_preview_known and release_origin.distance_to(action_target) > 1.0
|
return edges
|
||||||
if target_adjusted:
|
|
||||||
_draw_dashed(action_target, release_origin, set_down_reach_color)
|
|
||||||
draw_arc(release_origin, 4.0 / zoom, 0.0, TAU, 16, set_down_reach_color, LINE_WIDTH_PX / zoom, true)
|
func _clip_surface_edge(start: Vector2, finish: Vector2, surface_owner: Node, occluders: Array[Dictionary]) -> Array[PackedVector2Array]:
|
||||||
var cross_radius := 9.0 / zoom
|
var pieces: Array[PackedVector2Array] = []
|
||||||
var target_color := set_down_reach_color if target_adjusted else color
|
var cuts: Array[float] = [0.0, 1.0]
|
||||||
draw_line(action_target + Vector2(-cross_radius, 0.0), action_target + Vector2(cross_radius, 0.0), target_color, line_width_px / zoom, true)
|
for occluder: Dictionary in occluders:
|
||||||
draw_line(action_target + Vector2(0.0, -cross_radius), action_target + Vector2(0.0, cross_radius), target_color, line_width_px / zoom, true)
|
if occluder.get("node") == surface_owner:
|
||||||
if set_down_grip.is_finite() and set_down_grip != Vector2.ZERO:
|
continue
|
||||||
draw_line(set_down_approach, set_down_grip, set_down_reach_color, line_width_px / zoom, true)
|
var polygon: PackedVector2Array = occluder.get("points", PackedVector2Array())
|
||||||
|
for index: int in polygon.size():
|
||||||
|
var intersection: float = _segment_intersection_factor(start, finish, polygon[index], polygon[(index + 1) % polygon.size()])
|
||||||
|
if intersection > 0.0001 and intersection < 0.9999:
|
||||||
|
cuts.append(intersection)
|
||||||
|
cuts.sort()
|
||||||
|
var unique_cuts: Array[float] = []
|
||||||
|
for cut: float in cuts:
|
||||||
|
if unique_cuts.is_empty() or absf(cut - unique_cuts.back()) > 0.0001:
|
||||||
|
unique_cuts.append(cut)
|
||||||
|
for index: int in range(unique_cuts.size() - 1):
|
||||||
|
var from_t: float = unique_cuts[index]
|
||||||
|
var to_t: float = unique_cuts[index + 1]
|
||||||
|
if to_t - from_t <= 0.0001:
|
||||||
|
continue
|
||||||
|
var midpoint: Vector2 = start.lerp(finish, (from_t + to_t) * 0.5)
|
||||||
|
var occluded: bool = false
|
||||||
|
for occluder: Dictionary in occluders:
|
||||||
|
if occluder.get("node") == surface_owner:
|
||||||
|
continue
|
||||||
|
var polygon: PackedVector2Array = occluder.get("points", PackedVector2Array())
|
||||||
|
if polygon.size() >= 3 and Geometry2D.is_point_in_polygon(midpoint, polygon):
|
||||||
|
occluded = true
|
||||||
|
break
|
||||||
|
if not occluded:
|
||||||
|
pieces.append(PackedVector2Array([start.lerp(finish, from_t), start.lerp(finish, to_t)]))
|
||||||
|
return pieces
|
||||||
|
|
||||||
|
|
||||||
|
func _segment_intersection_factor(start: Vector2, finish: Vector2, edge_start: Vector2, edge_finish: Vector2) -> float:
|
||||||
|
var direction: Vector2 = finish - start
|
||||||
|
var edge_direction: Vector2 = edge_finish - edge_start
|
||||||
|
var denominator: float = direction.cross(edge_direction)
|
||||||
|
if absf(denominator) <= 0.0001:
|
||||||
|
return -1.0
|
||||||
|
var offset: Vector2 = edge_start - start
|
||||||
|
var factor: float = offset.cross(edge_direction) / denominator
|
||||||
|
var edge_factor: float = offset.cross(direction) / denominator
|
||||||
|
return factor if factor >= 0.0 and factor <= 1.0 and edge_factor >= 0.0 and edge_factor <= 1.0 else -1.0
|
||||||
|
|
||||||
|
|
||||||
|
func _closest_point_on_segment(point: Vector2, start: Vector2, finish: Vector2) -> Vector2:
|
||||||
|
var segment: Vector2 = finish - start
|
||||||
|
var length_squared: float = segment.length_squared()
|
||||||
|
if length_squared <= 0.0001:
|
||||||
|
return start
|
||||||
|
var factor: float = clampf((point - start).dot(segment) / length_squared, 0.0, 1.0)
|
||||||
|
return start + segment * factor
|
||||||
|
|
||||||
|
|
||||||
func _draw_dashed(from: Vector2, to: Vector2, color: Color) -> void:
|
func _draw_dashed(from: Vector2, to: Vector2, color: Color) -> void:
|
||||||
|
|||||||
+293
-28
@@ -3,7 +3,7 @@ extends RefCounted
|
|||||||
## JSON boundary for Sandbox Stage documents. This class deliberately has no
|
## JSON boundary for Sandbox Stage documents. This class deliberately has no
|
||||||
## scene-tree dependencies, which makes rejected documents non-destructive.
|
## scene-tree dependencies, which makes rejected documents non-destructive.
|
||||||
|
|
||||||
const FILE_VERSION: String = "1.8"
|
const FILE_VERSION: String = "1.9"
|
||||||
const DEFAULT_PLAIN_COLOR: String = "#F5EFE0"
|
const DEFAULT_PLAIN_COLOR: String = "#F5EFE0"
|
||||||
const SURFACE_RENDERER := preload("res://scripts/stage/scenery/stage_surface_renderer.gd")
|
const SURFACE_RENDERER := preload("res://scripts/stage/scenery/stage_surface_renderer.gd")
|
||||||
const CONTENT_PATHS := preload("res://scripts/shared/content_paths.gd")
|
const CONTENT_PATHS := preload("res://scripts/shared/content_paths.gd")
|
||||||
@@ -13,6 +13,7 @@ const SPEECH_PAYLOAD := preload("res://scripts/speech/speech_payload.gd")
|
|||||||
const PROP_STAGE_ROLES := preload("res://scripts/props/prop_stage_roles.gd")
|
const PROP_STAGE_ROLES := preload("res://scripts/props/prop_stage_roles.gd")
|
||||||
const PROP_USE_SPOT_DATA := preload("res://scripts/props/prop_use_spot_data.gd")
|
const PROP_USE_SPOT_DATA := preload("res://scripts/props/prop_use_spot_data.gd")
|
||||||
const STAGE_OBJECT_IDENTITY := preload("res://scripts/stage/stage_object_identity.gd")
|
const STAGE_OBJECT_IDENTITY := preload("res://scripts/stage/stage_object_identity.gd")
|
||||||
|
const STAGE_ACTION_PLAN := preload("res://scripts/stage/stage_action_plan.gd")
|
||||||
const WALL_FINISHES: Array[String] = ["finish_wall_paint", "finish_wall_brick", "finish_wall_wood"]
|
const WALL_FINISHES: Array[String] = ["finish_wall_paint", "finish_wall_brick", "finish_wall_wood"]
|
||||||
const BACKGROUND_FINISHES: Array[String] = ["finish_background_grass", "finish_background_concrete", "finish_background_carpet"]
|
const BACKGROUND_FINISHES: Array[String] = ["finish_background_grass", "finish_background_concrete", "finish_background_carpet"]
|
||||||
const GROUND_FINISHES: Array[String] = ["finish_ground_paint", "finish_ground_brick", "finish_ground_wood", "finish_ground_grass", "finish_ground_dirt", "finish_ground_sidewalk", "finish_ground_asphalt", "finish_ground_legacy"]
|
const GROUND_FINISHES: Array[String] = ["finish_ground_paint", "finish_ground_brick", "finish_ground_wood", "finish_ground_grass", "finish_ground_dirt", "finish_ground_sidewalk", "finish_ground_asphalt", "finish_ground_legacy"]
|
||||||
@@ -69,6 +70,51 @@ static func decode_queue(entries: Array) -> Dictionary:
|
|||||||
out.append(decoded)
|
out.append(decoded)
|
||||||
return {"actions": out, "warnings": warnings}
|
return {"actions": out, "warnings": warnings}
|
||||||
|
|
||||||
|
|
||||||
|
static func encode_plan(steps: Array[Dictionary]) -> Dictionary:
|
||||||
|
var encoded_steps: Array[Dictionary] = []
|
||||||
|
var warnings: Array[String] = []
|
||||||
|
for step_index: int in steps.size():
|
||||||
|
var raw_actions: Variant = steps[step_index].get("actions", [])
|
||||||
|
if not raw_actions is Array or (raw_actions as Array).is_empty():
|
||||||
|
warnings.append("Skipped empty or malformed plan step %d." % (step_index + 1))
|
||||||
|
continue
|
||||||
|
var encoded_actions: Array[Dictionary] = []
|
||||||
|
for raw_action: Variant in raw_actions:
|
||||||
|
if not raw_action is Dictionary:
|
||||||
|
warnings.append("Skipped malformed action in step %d." % (step_index + 1))
|
||||||
|
continue
|
||||||
|
var encoded: Dictionary = _encode_plan_action(raw_action as Dictionary)
|
||||||
|
if encoded.is_empty():
|
||||||
|
warnings.append("Skipped invalid action in step %d." % (step_index + 1))
|
||||||
|
else:
|
||||||
|
encoded_actions.append(encoded)
|
||||||
|
if not encoded_actions.is_empty():
|
||||||
|
encoded_steps.append({"actions": encoded_actions})
|
||||||
|
return {"steps": encoded_steps, "warnings": warnings}
|
||||||
|
|
||||||
|
|
||||||
|
static func decode_plan(entries: Array) -> Dictionary:
|
||||||
|
var decoded_steps: Array[Dictionary] = []
|
||||||
|
var warnings: Array[String] = []
|
||||||
|
for step_index: int in entries.size():
|
||||||
|
var raw_step: Variant = entries[step_index]
|
||||||
|
if not raw_step is Dictionary:
|
||||||
|
return {"ok": false, "steps": [], "warnings": warnings, "error": "Plan step %d is malformed." % (step_index + 1)}
|
||||||
|
var raw_actions: Variant = (raw_step as Dictionary).get("actions", null)
|
||||||
|
if not raw_actions is Array or (raw_actions as Array).is_empty():
|
||||||
|
return {"ok": false, "steps": [], "warnings": warnings, "error": "Plan step %d must contain actions." % (step_index + 1)}
|
||||||
|
var decoded_actions: Array[Dictionary] = []
|
||||||
|
for raw_action: Variant in raw_actions:
|
||||||
|
if not raw_action is Dictionary:
|
||||||
|
return {"ok": false, "steps": [], "warnings": warnings, "error": "Plan step %d has a malformed action." % (step_index + 1)}
|
||||||
|
var decoded: Dictionary = _decode_plan_action(raw_action as Dictionary)
|
||||||
|
if decoded.is_empty():
|
||||||
|
return {"ok": false, "steps": [], "warnings": warnings, "error": "Plan step %d has an invalid action." % (step_index + 1)}
|
||||||
|
decoded_actions.append(decoded)
|
||||||
|
decoded_steps.append({"actions": decoded_actions})
|
||||||
|
return {"ok": true, "steps": decoded_steps, "warnings": warnings, "error": ""}
|
||||||
|
|
||||||
static func encode_rules(rules: Array[Dictionary], runtime_to_file: Dictionary) -> Dictionary:
|
static func encode_rules(rules: Array[Dictionary], runtime_to_file: Dictionary) -> Dictionary:
|
||||||
var out: Array[Dictionary] = []
|
var out: Array[Dictionary] = []
|
||||||
var warnings: Array[String] = []
|
var warnings: Array[String] = []
|
||||||
@@ -153,7 +199,13 @@ static func read_file(path: String) -> Dictionary:
|
|||||||
return {"ok": false, "data": {}, "error": "Scene is missing objects or event_rules arrays.", "warnings": []}
|
return {"ok": false, "data": {}, "error": "Scene is missing objects or event_rules arrays.", "warnings": []}
|
||||||
var validation: Dictionary = _validate_root(data)
|
var validation: Dictionary = _validate_root(data)
|
||||||
if not bool(validation.get("ok", false)): return {"ok": false, "data": {}, "error": String(validation.get("error", "Invalid scene data.")), "warnings": []}
|
if not bool(validation.get("ok", false)): return {"ok": false, "data": {}, "error": String(validation.get("error", "Invalid scene data.")), "warnings": []}
|
||||||
return {"ok": true, "data": data, "error": "", "warnings": []}
|
var warnings: Array[String] = []
|
||||||
|
var migration_warnings: Variant = data.get("_migration_warnings", [])
|
||||||
|
if migration_warnings is Array:
|
||||||
|
for warning: Variant in migration_warnings:
|
||||||
|
warnings.append(String(warning))
|
||||||
|
data.erase("_migration_warnings")
|
||||||
|
return {"ok": true, "data": data, "error": "", "warnings": warnings}
|
||||||
|
|
||||||
static func write_file_safe(path: String, data: Dictionary) -> Dictionary:
|
static func write_file_safe(path: String, data: Dictionary) -> Dictionary:
|
||||||
path = CONTENT_PATHS.canonicalize(path)
|
path = CONTENT_PATHS.canonicalize(path)
|
||||||
@@ -175,26 +227,16 @@ static func write_file_safe(path: String, data: Dictionary) -> Dictionary:
|
|||||||
static func _migrate_to_current(data: Dictionary) -> Dictionary:
|
static func _migrate_to_current(data: Dictionary) -> Dictionary:
|
||||||
var version := String(data.get("version", ""))
|
var version := String(data.get("version", ""))
|
||||||
if version == FILE_VERSION:
|
if version == FILE_VERSION:
|
||||||
var current: Dictionary = data.duplicate(true)
|
return data.duplicate(true)
|
||||||
for raw: Variant in current.get("objects", []):
|
if version not in ["1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8"]:
|
||||||
if raw is Dictionary and String((raw as Dictionary).get("type", "")) == "prop":
|
|
||||||
var prop_entry: Dictionary = raw
|
|
||||||
if not prop_entry.has("roles"):
|
|
||||||
prop_entry["roles"] = PROP_STAGE_ROLES.legacy_placement(true)
|
|
||||||
prop_entry["use_spots"] = prop_entry.get("use_spots", [])
|
|
||||||
prop_entry["next_use_spot_number"] = prop_entry.get("next_use_spot_number", 1)
|
|
||||||
if not prop_entry.has("wobble_on_impact"):
|
|
||||||
prop_entry["wobble_on_impact"] = false
|
|
||||||
_assign_legacy_depths(current.get("objects", []))
|
|
||||||
return current
|
|
||||||
if version not in ["1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7"]:
|
|
||||||
return {}
|
return {}
|
||||||
var migrated: Dictionary = data.duplicate(true)
|
var migrated: Dictionary = data.duplicate(true)
|
||||||
if version != "1.7":
|
if version != "1.8":
|
||||||
if version not in ["1.5", "1.6"]:
|
if version != "1.7":
|
||||||
migrated["sky_id"] = "sky_neutral"
|
if version not in ["1.5", "1.6"]:
|
||||||
migrated["background_kind"] = "sky"
|
migrated["sky_id"] = "sky_neutral"
|
||||||
migrated["plain_color"] = DEFAULT_PLAIN_COLOR
|
migrated["background_kind"] = "sky"
|
||||||
|
migrated["plain_color"] = DEFAULT_PLAIN_COLOR
|
||||||
for raw: Variant in migrated.get("objects", []):
|
for raw: Variant in migrated.get("objects", []):
|
||||||
if not raw is Dictionary:
|
if not raw is Dictionary:
|
||||||
continue
|
continue
|
||||||
@@ -202,22 +244,96 @@ static func _migrate_to_current(data: Dictionary) -> Dictionary:
|
|||||||
if String(object.get("type", "")) == "prop":
|
if String(object.get("type", "")) == "prop":
|
||||||
if version == "1.0":
|
if version == "1.0":
|
||||||
object["stage_object_id"] = String(object.get("file_id", ""))
|
object["stage_object_id"] = String(object.get("file_id", ""))
|
||||||
if not object.has("roles"):
|
_ensure_legacy_prop_fields(object)
|
||||||
object["roles"] = PROP_STAGE_ROLES.legacy_placement(true)
|
|
||||||
object["use_spots"] = object.get("use_spots", [])
|
|
||||||
object["next_use_spot_number"] = object.get("next_use_spot_number", 1)
|
|
||||||
if not object.has("wobble_on_impact"):
|
|
||||||
object["wobble_on_impact"] = false
|
|
||||||
if version not in ["1.5", "1.6", "1.7"] and String(object.get("type", "")) == "terrain" and String(object.get("asset_id", "")) == "ground":
|
if version not in ["1.5", "1.6", "1.7"] and String(object.get("type", "")) == "terrain" and String(object.get("asset_id", "")) == "ground":
|
||||||
object["finish_id"] = "finish_ground_legacy"
|
object["finish_id"] = "finish_ground_legacy"
|
||||||
if version not in ["1.6", "1.7"] and String(object.get("type", "")) == "wall_panel":
|
if version not in ["1.6", "1.7"] and String(object.get("type", "")) == "wall_panel":
|
||||||
_migrate_legacy_wall_tint(object)
|
_migrate_legacy_wall_tint(object)
|
||||||
migrated["version"] = FILE_VERSION
|
if version != "1.8":
|
||||||
|
_migrate_stage_object_identity(migrated.get("objects", []))
|
||||||
_assign_legacy_depths(migrated.get("objects", []))
|
_assign_legacy_depths(migrated.get("objects", []))
|
||||||
_migrate_stage_object_identity(migrated.get("objects", []))
|
_migrate_legacy_action_plans(migrated)
|
||||||
|
migrated["version"] = FILE_VERSION
|
||||||
return migrated
|
return migrated
|
||||||
|
|
||||||
|
|
||||||
|
static func _ensure_legacy_prop_fields(prop_entry: Dictionary) -> void:
|
||||||
|
if not prop_entry.has("roles"):
|
||||||
|
prop_entry["roles"] = PROP_STAGE_ROLES.legacy_placement(true)
|
||||||
|
prop_entry["use_spots"] = prop_entry.get("use_spots", [])
|
||||||
|
prop_entry["next_use_spot_number"] = prop_entry.get("next_use_spot_number", 1)
|
||||||
|
if not prop_entry.has("wobble_on_impact"):
|
||||||
|
prop_entry["wobble_on_impact"] = false
|
||||||
|
|
||||||
|
|
||||||
|
static func _migrate_legacy_action_plans(data: Dictionary) -> void:
|
||||||
|
var objects_value: Variant = data.get("objects", [])
|
||||||
|
if not objects_value is Array:
|
||||||
|
return
|
||||||
|
var warnings: Array[String] = []
|
||||||
|
for raw_object: Variant in objects_value:
|
||||||
|
if not raw_object is Dictionary:
|
||||||
|
continue
|
||||||
|
var object: Dictionary = raw_object
|
||||||
|
if String(object.get("type", "")) != "stickman":
|
||||||
|
continue
|
||||||
|
var raw_queue: Variant = object.get("action_queue", [])
|
||||||
|
var decoded: Dictionary = decode_queue(raw_queue as Array) if raw_queue is Array else {"actions": [], "warnings": ["Invalid action queue."]}
|
||||||
|
var queue: Array[Dictionary] = decoded.get("actions", [])
|
||||||
|
for warning: String in decoded.get("warnings", []):
|
||||||
|
warnings.append("%s: %s" % [String(object.get("stage_name", object.get("file_id", "Character"))), warning])
|
||||||
|
var plan: Array[Dictionary] = []
|
||||||
|
var queue_index: int = 0
|
||||||
|
while queue_index < queue.size():
|
||||||
|
var action: Dictionary = queue[queue_index].duplicate(true)
|
||||||
|
var action_id: String = _legacy_action_id(object, queue_index)
|
||||||
|
action["action_id"] = action_id
|
||||||
|
if ACTION_REGISTRY.is_move_action(action):
|
||||||
|
var target_value: Variant = action.get("target", null)
|
||||||
|
if target_value is Vector2:
|
||||||
|
action["destination"] = {"kind": "place", "position": target_value}
|
||||||
|
else:
|
||||||
|
warnings.append("%s: Invalid Move target was skipped." % String(object.get("stage_name", "Character")))
|
||||||
|
queue_index += 1
|
||||||
|
continue
|
||||||
|
action.erase("target")
|
||||||
|
var paired: bool = false
|
||||||
|
if String(action.get("type", "")) == "speak" and bool(action.get("keep_acting", false)) and queue_index + 1 < queue.size():
|
||||||
|
var next_action: Dictionary = queue[queue_index + 1]
|
||||||
|
if ACTION_REGISTRY.is_move_action(next_action) or String(next_action.get("type", "")) == "wait":
|
||||||
|
var primary: Dictionary = next_action.duplicate(true)
|
||||||
|
primary["action_id"] = _legacy_action_id(object, queue_index + 1)
|
||||||
|
if ACTION_REGISTRY.is_move_action(primary):
|
||||||
|
var primary_target: Variant = primary.get("target", null)
|
||||||
|
if primary_target is Vector2:
|
||||||
|
primary["destination"] = {"kind": "place", "position": primary_target}
|
||||||
|
primary.erase("target")
|
||||||
|
else:
|
||||||
|
primary.clear()
|
||||||
|
if not primary.is_empty():
|
||||||
|
action["legacy_nonblocking"] = true
|
||||||
|
plan.append({"actions": [action, primary]})
|
||||||
|
queue_index += 2
|
||||||
|
paired = true
|
||||||
|
if paired:
|
||||||
|
continue
|
||||||
|
if String(action.get("type", "")) == "speak" and bool(action.get("keep_acting", false)):
|
||||||
|
action["legacy_nonblocking"] = true
|
||||||
|
plan.append({"actions": [action]})
|
||||||
|
queue_index += 1
|
||||||
|
object["action_plan"] = (encode_plan(plan).get("steps", []) as Array).duplicate(true)
|
||||||
|
object.erase("action_queue")
|
||||||
|
if not warnings.is_empty():
|
||||||
|
data["_migration_warnings"] = warnings
|
||||||
|
|
||||||
|
|
||||||
|
static func _legacy_action_id(object: Dictionary, index: int) -> String:
|
||||||
|
var owner: String = String(object.get("stage_object_id", object.get("file_id", "actor"))).strip_edges()
|
||||||
|
if owner.is_empty():
|
||||||
|
owner = String(object.get("file_id", "actor"))
|
||||||
|
return "legacy_%s_action_%d" % [owner, index + 1]
|
||||||
|
|
||||||
|
|
||||||
static func _migrate_stage_object_identity(raw_objects: Variant) -> void:
|
static func _migrate_stage_object_identity(raw_objects: Variant) -> void:
|
||||||
if not raw_objects is Array:
|
if not raw_objects is Array:
|
||||||
return
|
return
|
||||||
@@ -324,6 +440,7 @@ static func _validate_root(data: Dictionary) -> Dictionary:
|
|||||||
var seen: Dictionary = {}
|
var seen: Dictionary = {}
|
||||||
var seen_stage_ids: Dictionary = {}
|
var seen_stage_ids: Dictionary = {}
|
||||||
var seen_stage_names: Dictionary = {}
|
var seen_stage_names: Dictionary = {}
|
||||||
|
var seen_action_ids: Dictionary = {}
|
||||||
for raw: Variant in data["objects"]:
|
for raw: Variant in data["objects"]:
|
||||||
if not raw is Dictionary: continue
|
if not raw is Dictionary: continue
|
||||||
var entry: Dictionary = raw
|
var entry: Dictionary = raw
|
||||||
@@ -331,6 +448,26 @@ static func _validate_root(data: Dictionary) -> Dictionary:
|
|||||||
if file_id.is_empty() or seen.has(file_id): return {"ok": false, "error": "Object file IDs must be unique and non-empty."}
|
if file_id.is_empty() or seen.has(file_id): return {"ok": false, "error": "Object file IDs must be unique and non-empty."}
|
||||||
seen[file_id] = true
|
seen[file_id] = true
|
||||||
var object_type: String = String(entry.get("type", ""))
|
var object_type: String = String(entry.get("type", ""))
|
||||||
|
if object_type == "stickman":
|
||||||
|
if entry.has("action_queue"):
|
||||||
|
return {"ok": false, "error": "Scene v1.9 stickmen must not contain an action_queue."}
|
||||||
|
var plan_value: Variant = entry.get("action_plan", null)
|
||||||
|
if not plan_value is Array:
|
||||||
|
return {"ok": false, "error": "Scene stickman action_plan must be an array."}
|
||||||
|
var decoded_plan: Dictionary = decode_plan(plan_value as Array)
|
||||||
|
if not bool(decoded_plan.get("ok", false)):
|
||||||
|
return {"ok": false, "error": String(decoded_plan.get("error", "Scene action plan is invalid."))}
|
||||||
|
var plan_steps: Array[Dictionary] = decoded_plan.get("steps", [])
|
||||||
|
var plan_error: String = STAGE_ACTION_PLAN.validate_steps(plan_steps)
|
||||||
|
if not plan_error.is_empty():
|
||||||
|
return {"ok": false, "error": plan_error}
|
||||||
|
for step: Dictionary in plan_steps:
|
||||||
|
var actions: Array = step.get("actions", [])
|
||||||
|
for action: Dictionary in actions:
|
||||||
|
var action_id: String = String(action.get("action_id", ""))
|
||||||
|
if seen_action_ids.has(action_id):
|
||||||
|
return {"ok": false, "error": "Action IDs must be unique across the scene."}
|
||||||
|
seen_action_ids[action_id] = true
|
||||||
if object_type in ["stickman", "prop"]:
|
if object_type in ["stickman", "prop"]:
|
||||||
var raw_stage_id: Variant = entry.get("stage_object_id", null)
|
var raw_stage_id: Variant = entry.get("stage_object_id", null)
|
||||||
if not raw_stage_id is String:
|
if not raw_stage_id is String:
|
||||||
@@ -519,6 +656,134 @@ static func _decode_flat_action(action: Dictionary) -> Dictionary:
|
|||||||
return {"type": type, "target_prop_id": prop_id, "target_spot_id": spot_id}
|
return {"type": type, "target_prop_id": prop_id, "target_spot_id": spot_id}
|
||||||
_: return {"type": type}
|
_: return {"type": type}
|
||||||
|
|
||||||
|
|
||||||
|
static func _encode_plan_action(action: Dictionary) -> Dictionary:
|
||||||
|
var action_id: Variant = action.get("action_id", null)
|
||||||
|
if not action_id is String or String(action_id).strip_edges().is_empty():
|
||||||
|
return {}
|
||||||
|
var type: String = ACTION_REGISTRY.canonical_type(String(action.get("type", "")))
|
||||||
|
if not ACTION_REGISTRY.has_type(type):
|
||||||
|
return {}
|
||||||
|
var encoded: Dictionary = {}
|
||||||
|
if type == ACTION_REGISTRY.MOVE_TO:
|
||||||
|
var style: String = ACTION_REGISTRY.checked_style(action.get("style", null))
|
||||||
|
var destination: Dictionary = _encode_plan_destination(action.get("destination", null))
|
||||||
|
if style.is_empty() or destination.is_empty():
|
||||||
|
return {}
|
||||||
|
encoded = {"type": type, "style": style, "destination": destination}
|
||||||
|
elif type == "speak":
|
||||||
|
encoded = _encode_speech(action)
|
||||||
|
elif type == "wait":
|
||||||
|
if not _finite_number(action.get("duration", null)) or float(action["duration"]) < 0.0:
|
||||||
|
return {}
|
||||||
|
encoded = {"type": type, "duration": float(action["duration"])}
|
||||||
|
else:
|
||||||
|
encoded = _encode_flat_action(action)
|
||||||
|
if encoded.is_empty():
|
||||||
|
return {}
|
||||||
|
encoded["action_id"] = String(action_id)
|
||||||
|
if bool(action.get("legacy_nonblocking", false)):
|
||||||
|
encoded["legacy_nonblocking"] = true
|
||||||
|
return encoded
|
||||||
|
|
||||||
|
|
||||||
|
static func _decode_plan_action(action: Dictionary) -> Dictionary:
|
||||||
|
var action_id: Variant = action.get("action_id", null)
|
||||||
|
if not action_id is String or String(action_id).strip_edges().is_empty():
|
||||||
|
return {}
|
||||||
|
var type: String = ACTION_REGISTRY.canonical_type(String(action.get("type", "")))
|
||||||
|
if not ACTION_REGISTRY.has_type(type):
|
||||||
|
return {}
|
||||||
|
if action.has("legacy_nonblocking") and (not action["legacy_nonblocking"] is bool or type != "speak"):
|
||||||
|
return {}
|
||||||
|
var decoded: Dictionary = {}
|
||||||
|
if type == ACTION_REGISTRY.MOVE_TO:
|
||||||
|
var style: String = ACTION_REGISTRY.checked_style(action.get("style", null))
|
||||||
|
var destination: Dictionary = _decode_plan_destination(action.get("destination", null))
|
||||||
|
if style.is_empty() or destination.is_empty():
|
||||||
|
return {}
|
||||||
|
decoded = {"type": type, "style": style, "destination": destination}
|
||||||
|
decoded["target"] = destination.get("position", destination.get("last_known_approach", Vector2.ZERO))
|
||||||
|
elif type == "speak":
|
||||||
|
decoded = _decode_speech(action)
|
||||||
|
elif type == "wait":
|
||||||
|
if not _finite_number(action.get("duration", null)) or float(action["duration"]) < 0.0:
|
||||||
|
return {}
|
||||||
|
decoded = {"type": type, "duration": float(action["duration"])}
|
||||||
|
else:
|
||||||
|
decoded = _decode_flat_action(action)
|
||||||
|
if decoded.is_empty():
|
||||||
|
return {}
|
||||||
|
decoded["action_id"] = String(action_id)
|
||||||
|
if bool(action.get("legacy_nonblocking", false)):
|
||||||
|
decoded["legacy_nonblocking"] = true
|
||||||
|
return decoded
|
||||||
|
|
||||||
|
|
||||||
|
static func _encode_plan_destination(value: Variant) -> Dictionary:
|
||||||
|
if not value is Dictionary:
|
||||||
|
return {}
|
||||||
|
var destination: Dictionary = value
|
||||||
|
var kind: String = String(destination.get("kind", ""))
|
||||||
|
if kind == "place":
|
||||||
|
for key: String in destination.keys():
|
||||||
|
if key not in ["kind", "position"]:
|
||||||
|
return {}
|
||||||
|
var position: Variant = _vector_variant_to_data(destination.get("position", null))
|
||||||
|
return {"kind": kind, "position": position} if position is Dictionary else {}
|
||||||
|
if kind == "prop":
|
||||||
|
for key: String in destination.keys():
|
||||||
|
if key not in ["kind", "target_prop_id", "approach_offset", "last_known_approach"]:
|
||||||
|
return {}
|
||||||
|
var prop_id_value: Variant = destination.get("target_prop_id", null)
|
||||||
|
if not prop_id_value is String or String(prop_id_value).strip_edges().is_empty():
|
||||||
|
return {}
|
||||||
|
var offset: Variant = _vector_variant_to_data(destination.get("approach_offset", null))
|
||||||
|
var last_known: Variant = _vector_variant_to_data(destination.get("last_known_approach", null))
|
||||||
|
if not offset is Dictionary or not last_known is Dictionary:
|
||||||
|
return {}
|
||||||
|
return {"kind": kind, "target_prop_id": String(prop_id_value), "approach_offset": offset, "last_known_approach": last_known}
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
static func _decode_plan_destination(value: Variant) -> Dictionary:
|
||||||
|
if not value is Dictionary:
|
||||||
|
return {}
|
||||||
|
var destination: Dictionary = value
|
||||||
|
var kind: String = String(destination.get("kind", ""))
|
||||||
|
if kind == "place":
|
||||||
|
for key: String in destination.keys():
|
||||||
|
if key not in ["kind", "position"]:
|
||||||
|
return {}
|
||||||
|
if not is_vector_data(destination.get("position", null)):
|
||||||
|
return {}
|
||||||
|
return {"kind": kind, "position": data_to_vector(destination["position"], Vector2.ZERO)}
|
||||||
|
if kind == "prop":
|
||||||
|
for key: String in destination.keys():
|
||||||
|
if key not in ["kind", "target_prop_id", "approach_offset", "last_known_approach"]:
|
||||||
|
return {}
|
||||||
|
var prop_id_value: Variant = destination.get("target_prop_id", null)
|
||||||
|
if not prop_id_value is String or String(prop_id_value).strip_edges().is_empty():
|
||||||
|
return {}
|
||||||
|
if not is_vector_data(destination.get("approach_offset", null)) or not is_vector_data(destination.get("last_known_approach", null)):
|
||||||
|
return {}
|
||||||
|
return {
|
||||||
|
"kind": kind,
|
||||||
|
"target_prop_id": String(prop_id_value),
|
||||||
|
"approach_offset": data_to_vector(destination["approach_offset"], Vector2.ZERO),
|
||||||
|
"last_known_approach": data_to_vector(destination["last_known_approach"], Vector2.ZERO),
|
||||||
|
}
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
static func _vector_variant_to_data(value: Variant) -> Variant:
|
||||||
|
if value is Vector2:
|
||||||
|
return vector_to_data(value as Vector2) if (value as Vector2).is_finite() else null
|
||||||
|
if is_vector_data(value):
|
||||||
|
var point: Vector2 = data_to_vector(value, Vector2.ZERO)
|
||||||
|
return vector_to_data(point)
|
||||||
|
return null
|
||||||
|
|
||||||
static func _map_ref(value: Variant, map: Dictionary) -> Variant:
|
static func _map_ref(value: Variant, map: Dictionary) -> Variant:
|
||||||
if int(value) == -1: return null
|
if int(value) == -1: return null
|
||||||
return map.get(int(value), null)
|
return map.get(int(value), null)
|
||||||
|
|||||||
@@ -0,0 +1,102 @@
|
|||||||
|
Godot Engine v4.7.1.stable.official.a13da4feb - https://godotengine.org
|
||||||
|
Vulkan 1.4.351 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 2060 SUPER
|
||||||
|
|
||||||
|
ERROR: Failed to read the root certificate store.
|
||||||
|
at: get_system_ca_certificates (platform/windows/os_windows.cpp:2582)
|
||||||
|
PHASE20B_GUI_CHECK PASS: production spawner creates the actor and named-prop fixtures
|
||||||
|
PHASE20B_GUI_CHECK PASS: fixture actors receive long and distinct stage names through production identity
|
||||||
|
PHASE20B_GUI_CHECK PASS: DIRECT mode button is present in the Stage chrome
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@36 viewport_position=(640.0, 32.0) screen_position=(640.0, 32.0) window=0 window_position=(0, 0) hovered=@Button@36
|
||||||
|
PHASE20B_GUI_CHECK PASS: pointer activation switches the production Stage to DIRECT
|
||||||
|
PHASE20B_GUI_CHECK PASS: viewport pointer selects the actor in DIRECT
|
||||||
|
PHASE20B_GUI_CHECK PASS: approved empty-plan prompt is visible and fits inside the Step Stack
|
||||||
|
PHASE20B_GUI_CHECK PASS: pinned Move, Say, and Wait quick actions are visible
|
||||||
|
PHASE20B_CAPTURE path=res://tests/phase20b_captures/action_drawer_full_height/wide_empty_step_stack.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: rendered capture wide_empty_step_stack is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: selected actor exposes the pinned Add step control
|
||||||
|
PHASE20B_GUI_HOVER target=AddActionStep viewport_position=(1192.0, 318.0) screen_position=(1192.0, 318.0) window=0 window_position=(0, 0) hovered=AddActionStep
|
||||||
|
PHASE20B_GUI_CHECK PASS: drawer visibly slides left from the inspector while fading in
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/action_drawer_full_height/action_drawer_opening.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture action_drawer_opening is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add step opens the production Choose an action drawer
|
||||||
|
PHASE20B_GUI_CHECK PASS: drawer keeps the scrollable action list and pinned Cancel visible
|
||||||
|
PHASE20B_GUI_CHECK PASS: drawer extends beyond the inspector while keeping Cancel pinned below the list
|
||||||
|
PHASE20B_GUI_CHECK PASS: tall drawer shows every action without scrolling
|
||||||
|
PHASE20B_GUI_CHECK PASS: drawer stays above the Stage status bar and safe bottom inset
|
||||||
|
PHASE20B_GUI_CHECK PASS: drawer top aligns with inspector and opens from its left edge
|
||||||
|
PHASE20B_GUI_CHECK PASS: scrim covers the inspector bounds only
|
||||||
|
PHASE20B_GUI_CHECK PASS: inspector scrim is a light 32 percent shade while the drawer stays opaque
|
||||||
|
PHASE20B_GUI_CHECK PASS: opening the drawer moves keyboard focus to the first action choice
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/action_drawer_full_height/action_drawer_open.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture action_drawer_open is saved at viewport size
|
||||||
|
PHASE20B_GUI_HOVER target=CancelTogether viewport_position=(752.0, 816.0) screen_position=(752.0, 816.0) window=0 window_position=(0, 0) hovered=CancelTogether
|
||||||
|
PHASE20B_GUI_CHECK PASS: Cancel reverses the drawer slide and fades the inspector scrim
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/action_drawer_full_height/action_drawer_canceling.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture action_drawer_canceling is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: Cancel slides the drawer and inspector scrim away
|
||||||
|
PHASE20B_GUI_CHECK PASS: Cancel returns keyboard focus to Add step
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/action_drawer_full_height/action_drawer_cancelled.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture action_drawer_cancelled is saved at viewport size
|
||||||
|
PHASE20B_GUI_HOVER target=AddActionStep viewport_position=(1192.0, 318.0) screen_position=(1192.0, 318.0) window=0 window_position=(0, 0) hovered=AddActionStep
|
||||||
|
PHASE20B_GUI_CHECK PASS: outside click starts the same reverse slide and fade
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/action_drawer_full_height/action_drawer_outside_closing.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture action_drawer_outside_closing is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: left click outside slides the drawer closed
|
||||||
|
PHASE20B_GUI_CHECK PASS: outside click is consumed without clearing the actor selection on stage
|
||||||
|
PHASE20B_GUI_CHECK PASS: outside click returns keyboard focus to Add step
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/action_drawer_full_height/action_drawer_outside_clicked.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture action_drawer_outside_clicked is saved at viewport size
|
||||||
|
PHASE20B_GUI_HOVER target=AddActionStep viewport_position=(1192.0, 318.0) screen_position=(1192.0, 318.0) window=0 window_position=(0, 0) hovered=AddActionStep
|
||||||
|
PHASE20B_GUI_CHECK PASS: clicking the dimmed inspector closes the drawer without reopening it
|
||||||
|
PHASE20B_GUI_CHECK PASS: inspector click is consumed while the drawer is open
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/action_drawer_full_height/action_drawer_inspector_clicked.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture action_drawer_inspector_clicked is saved at viewport size
|
||||||
|
PHASE20B_GUI_HOVER target=AddActionStep viewport_position=(1192.0, 318.0) screen_position=(1192.0, 318.0) window=0 window_position=(0, 0) hovered=AddActionStep
|
||||||
|
PHASE20B_GUI_CHECK PASS: Escape starts the same reverse slide and fade
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/action_drawer_full_height/action_drawer_escape_closing.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture action_drawer_escape_closing is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: Escape slides the drawer closed and removes the scrim
|
||||||
|
PHASE20B_GUI_CHECK PASS: Escape returns keyboard focus to Add step
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/action_drawer_full_height/action_drawer_escape_closed.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture action_drawer_escape_closed is saved at viewport size
|
||||||
|
PHASE20B_GUI_HOVER target=AddActionStep viewport_position=(1192.0, 318.0) screen_position=(1192.0, 318.0) window=0 window_position=(0, 0) hovered=AddActionStep
|
||||||
|
PHASE20B_GUI_CHECK PASS: drawer retains working action choices after each dismissal path
|
||||||
|
PHASE20B_GUI_HOVER target=PlanActionChoice_move_to viewport_position=(752.0, 254.0) screen_position=(752.0, 254.0) window=0 window_position=(0, 0) hovered=PlanActionChoice_move_to
|
||||||
|
PHASE20B_GUI_CHECK PASS: choosing an action waits for the drawer to close before opening its editor
|
||||||
|
PHASE20B_GUI_HOVER target=ActionEditorCancel viewport_position=(716.0, 634.0) screen_position=(716.0, 634.0) window=0 window_position=(360, 220) hovered=ActionEditorCancel
|
||||||
|
PHASE20B_GUI_CHECK PASS: canceling the opened action draft leaves the stage unchanged
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/action_drawer_full_height/action_drawer_action_selected.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture action_drawer_action_selected is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: Say-only fixture provides compatible Move and Wait choices for Add together
|
||||||
|
PHASE20B_GUI_CHECK PASS: Say step exposes its Add together control
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@1392 viewport_position=(1164.0, 521.0) screen_position=(1164.0, 521.0) window=0 window_position=(0, 0) hovered=@Button@1392
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together uses the same slide-out and fade as Add step
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/action_drawer_full_height/add_together_drawer_opening.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture add_together_drawer_opening is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together opens the shared drawer with its step title
|
||||||
|
PHASE20B_GUI_CHECK PASS: drawer preserves the source Say summary and duration context
|
||||||
|
PHASE20B_GUI_CHECK PASS: long source summary is limited to two lines and remains available in its tooltip
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together keeps only compatible Move and Wait choices
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together drawer aligns with the inspector and dims its shell
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together drawer gives focus to its first compatible choice
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/action_drawer_full_height/add_together_drawer_open.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture add_together_drawer_open is saved at viewport size
|
||||||
|
PHASE20B_GUI_HOVER target=CancelTogether viewport_position=(752.0, 539.0) screen_position=(752.0, 539.0) window=0 window_position=(0, 0) hovered=CancelTogether
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together Cancel slides the shared drawer and scrim back
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/action_drawer_full_height/add_together_drawer_canceling.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture add_together_drawer_canceling is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together Cancel slides in and restores focus to its trigger
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/action_drawer_full_height/add_together_drawer_cancelled.png size=(1280, 900) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture add_together_drawer_cancelled is saved at viewport size
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@1392 viewport_position=(1164.0, 521.0) screen_position=(1164.0, 521.0) window=0 window_position=(0, 0) hovered=@Button@1392
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together closes on outside click and restores focus
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together outside click is consumed by the drawer
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@1392 viewport_position=(1164.0, 521.0) screen_position=(1164.0, 521.0) window=0 window_position=(0, 0) hovered=@Button@1392
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together closes on Escape and restores focus
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@1392 viewport_position=(1164.0, 521.0) screen_position=(1164.0, 521.0) window=0 window_position=(0, 0) hovered=@Button@1392
|
||||||
|
PHASE20B_GUI_HOVER target=PlanActionChoice_move_to viewport_position=(752.0, 311.0) screen_position=(752.0, 311.0) window=0 window_position=(0, 0) hovered=PlanActionChoice_move_to
|
||||||
|
PHASE20B_GUI_CHECK PASS: compatible choice opens its editor for the same step after the drawer closes
|
||||||
|
PHASE20B_GUI_HOVER target=ActionEditorCancel viewport_position=(716.0, 634.0) screen_position=(716.0, 634.0) window=0 window_position=(360, 220) hovered=ActionEditorCancel
|
||||||
|
PHASE20B_GUI_CHECK PASS: Canceling a together action draft leaves the source plan unchanged
|
||||||
|
PHASE20B_ACTION_DRAWER rect=[P: (624.0, 184.0), S: (256.0, 666.0)] card=[P: (888.0, 184.0), S: (380.0, 284.0)] dimmer=[P: (888.0, 184.0), S: (380.0, 284.0)] focus=<Object#null>
|
||||||
|
PHASE20B_GUI_SLICE_RESULT scenario=action_drawer failures=0
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
Godot Engine v4.7.1.stable.official.a13da4feb - https://godotengine.org
|
||||||
|
|
||||||
|
ERROR: Failed to read the root certificate store.
|
||||||
|
at: get_system_ca_certificates (platform/windows/os_windows.cpp:2582)
|
||||||
|
PASS: PLAN_PLACE capture Vector2 normalizes to an explicit free-place destination
|
||||||
|
PASS: exact-prop capture dictionaries preserve the stable target ID and world offset
|
||||||
|
PASS: unsupported capture payloads do not author a destination
|
||||||
|
PASS: Move plus Say is a valid together step
|
||||||
|
PASS: Move plus Wait is rejected as an authored together step
|
||||||
|
PASS: Wait step offers Say as a compatible together action
|
||||||
|
PASS: full step rejects a third together action
|
||||||
|
PASS: step reorder preserves action identity
|
||||||
|
PASS: deleting one grouped action preserves the remaining step
|
||||||
|
PASS: scene-scoped allocator avoids IDs already present on a live actor
|
||||||
|
PASS: v1.8 migrates to v1.9
|
||||||
|
PASS: v1.8 migration removes the legacy authoritative queue
|
||||||
|
PASS: keep_acting Say pairs with its following Move
|
||||||
|
PASS: paired legacy Say retains nonblocking compatibility
|
||||||
|
PASS: legacy flat Move migrates to an explicit place target
|
||||||
|
PASS: keep_acting Say pairs with its following Wait
|
||||||
|
PASS: unpaired legacy Say retains its explicit compatibility flag
|
||||||
|
PASS: legacy action IDs are deterministic across repeated migration
|
||||||
|
PASS: v1.8 migration keeps its authored background values
|
||||||
|
PASS: malformed legacy actions keep skip-and-warn migration behavior
|
||||||
|
PASS: canonical plans encode without warnings
|
||||||
|
PASS: valid v1.9 grouped Move+Say and place actions validate
|
||||||
|
PASS: prop destination persists the exact stage object ID
|
||||||
|
PASS: prop destination persists its world-aligned offset
|
||||||
|
PASS: duplicate stable action IDs across actors are rejected
|
||||||
|
PASS: v1.9 rejects a second authoritative action_queue
|
||||||
|
PASS: v1.9 rejects incompatible grouped actions
|
||||||
|
PASS: v1.9 rejects a prop destination with a missing exact ID
|
||||||
|
PASS: v1.9 plan document writes and reads through the production IO path
|
||||||
|
PASS: round-trip preserves stable action IDs
|
||||||
|
PASS: round-trip decodes the prop offset as a Vector2
|
||||||
|
PASS: nearby free-place intent remains an explicit place after round-trip
|
||||||
|
PASS: runtime fixture accepts a grouped plan
|
||||||
|
PASS: group actions emit start together in plan order
|
||||||
|
PASS: grouped actions start on the same runtime tick
|
||||||
|
PASS: next step waits after primary Wait ends while grouped Say remains active
|
||||||
|
PASS: paused runtime freezes the Say barrier
|
||||||
|
PASS: completed Say releases the barrier before the next runner tick
|
||||||
|
PASS: next step starts only after every grouped action ends
|
||||||
|
PASS: pursuit fixture accepts an exact prop Move
|
||||||
|
PASS: prop Move starts toward its world-aligned approach offset
|
||||||
|
PASS: moving prop retargets after its shift using the fixed world offset
|
||||||
|
PASS: paused pursuit does not retarget or spend its time budget
|
||||||
|
PASS: pursuit resumes and retargets from the prop's translated position
|
||||||
|
PASS: vanished prop ends the active Move as failure, not arrival
|
||||||
|
PHASE 20B ACTION PLAN: 45 checks, 0 failures
|
||||||
@@ -0,0 +1,279 @@
|
|||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
const SANDBOX_STAGE: PackedScene = preload("res://scenes/stage/sandbox_stage.tscn")
|
||||||
|
const CAPTURE_DIR: String = "res://tests/phase20b_captures/capture_overlay_review"
|
||||||
|
|
||||||
|
var _stage: SandboxStage
|
||||||
|
var _failures: int = 0
|
||||||
|
|
||||||
|
|
||||||
|
func _initialize() -> void:
|
||||||
|
call_deferred("_run")
|
||||||
|
|
||||||
|
|
||||||
|
func _run() -> void:
|
||||||
|
var capture_width: int = int(OS.get_environment("PHASE20B_CAPTURE_WIDTH"))
|
||||||
|
root.size = Vector2i(capture_width if capture_width > 0 else 1280, 720)
|
||||||
|
root.gui_embed_subwindows = true
|
||||||
|
var make_dir_error: Error = DirAccess.make_dir_recursive_absolute(ProjectSettings.globalize_path(CAPTURE_DIR))
|
||||||
|
if make_dir_error != OK and make_dir_error != ERR_ALREADY_EXISTS:
|
||||||
|
_fail("could not create capture output directory")
|
||||||
|
quit(1)
|
||||||
|
return
|
||||||
|
_stage = SANDBOX_STAGE.instantiate() as SandboxStage
|
||||||
|
root.add_child(_stage)
|
||||||
|
await _wait_frames(8)
|
||||||
|
var recovery: ConfirmationDialog = _stage.find_child("AutosaveRecoveryDialog", true, false) as ConfirmationDialog
|
||||||
|
if recovery != null:
|
||||||
|
recovery.hide()
|
||||||
|
var spawner: StageSpawner = _stage.get("_spawner") as StageSpawner
|
||||||
|
var actor: StickmanRig = spawner.spawn_stickman_asset("res://content/stickmen/break.stk", Vector2(-120.0, -170.0))
|
||||||
|
var prop: PropBlock = spawner.spawn_prop_asset("crate", Vector2(150.0, 0.0))
|
||||||
|
_check(actor != null and prop != null, "production spawner creates capture fixtures")
|
||||||
|
if actor == null or prop == null:
|
||||||
|
await _finish()
|
||||||
|
return
|
||||||
|
_stage.call("_finalize_placed_node", actor)
|
||||||
|
_stage.call("_finalize_placed_node", prop)
|
||||||
|
var selection: StageSelection = _stage.get("_selection") as StageSelection
|
||||||
|
_stage.set_mode(SandboxStage.StageMode.DIRECT)
|
||||||
|
selection.select_only(actor)
|
||||||
|
_stage.call("_refresh_character_settings_card")
|
||||||
|
await _wait_frames(6)
|
||||||
|
var character_view: StageCharacterSettingsView = _stage.get("_character_settings_view") as StageCharacterSettingsView
|
||||||
|
var character_card: Control = character_view.get_card()
|
||||||
|
var quick_actions: Control = character_view.find_child("QuickActionButtons", true, false) as Control
|
||||||
|
var wait_button: Button = _find_button_with_text(quick_actions, "⏳ Wait")
|
||||||
|
_check(character_card != null and character_card.is_visible_in_tree() and wait_button != null, "selected character inspector and quick action controls are visible")
|
||||||
|
var visual_scenario: String = OS.get_environment("PHASE20B_CAPTURE_SCENARIO")
|
||||||
|
if visual_scenario.is_empty():
|
||||||
|
visual_scenario = "plan"
|
||||||
|
if visual_scenario == "set_down":
|
||||||
|
await _send_mouse_motion(Vector2(350.0, 520.0))
|
||||||
|
_stage.call("_begin_set_down_position_capture", actor, "Click where to let go", Callable(), Callable())
|
||||||
|
await _wait_frames(3)
|
||||||
|
var set_down_overlay: StageInspectorCaptureOverlay = _stage.get("_inspector_capture_overlay") as StageInspectorCaptureOverlay
|
||||||
|
_check(set_down_overlay.has_capture() and set_down_overlay.get_inspector_rect().is_equal_approx(character_card.get_global_rect()), "set-down capture attaches the strip to the selected character inspector")
|
||||||
|
var set_down_prompt: Label = set_down_overlay.find_child("CapturePrompt", true, false) as Label
|
||||||
|
var set_down_strip: Control = set_down_overlay.find_child("CaptureCancelStrip", true, false) as Control
|
||||||
|
var set_down_cancel: Button = _find_button_with_text(set_down_overlay, "Cancel")
|
||||||
|
_check(set_down_prompt != null and set_down_prompt.text == "Set down prop", "set-down capture caption only names the action")
|
||||||
|
_check(set_down_cancel != null and set_down_strip != null and set_down_cancel.get_global_rect().end.x <= set_down_strip.get_global_rect().end.x + 1.0, "set-down Cancel stays inside the inspector strip")
|
||||||
|
var set_down_tooltip: Control = _stage.find_child("ActionTooltip", true, false) as Control
|
||||||
|
_check(set_down_tooltip == null or not set_down_tooltip.visible, "set-down capture keeps instructions out of the inspector prompt")
|
||||||
|
await _save_capture("set_down_capture_attached_cancel")
|
||||||
|
await _send_escape()
|
||||||
|
_check(int(_stage.get("_capture_kind")) == SandboxStage.CaptureKind.NONE and not set_down_overlay.has_capture(), "Escape cancels set-down capture and removes the dim layer")
|
||||||
|
print("PHASE20B_CAPTURE_OVERLAY_RESULT failures=%d captures=%s" % [_failures, CAPTURE_DIR])
|
||||||
|
await _finish()
|
||||||
|
return
|
||||||
|
if visual_scenario == "use_spot":
|
||||||
|
_stage.set_mode(SandboxStage.StageMode.EDIT)
|
||||||
|
selection.select_only(prop)
|
||||||
|
_stage.call("_refresh_prop_settings_card")
|
||||||
|
await _wait_frames(3)
|
||||||
|
_stage.call("_begin_spot_edit", prop, "")
|
||||||
|
await _wait_frames(3)
|
||||||
|
var spot_overlay: StageInspectorCaptureOverlay = _stage.get("_inspector_capture_overlay") as StageInspectorCaptureOverlay
|
||||||
|
var prop_card: Control = (_stage.get("_prop_settings_view") as StagePropSettingsView).get_card()
|
||||||
|
_check(spot_overlay.has_capture() and spot_overlay.get_inspector_rect().is_equal_approx(prop_card.get_global_rect()), "Use-spot capture attaches the strip to the selected prop inspector")
|
||||||
|
var spot_instruction: String = String((_stage.get("_use_spot_overlay") as StageUseSpotOverlay).get("_instruction"))
|
||||||
|
_check(spot_instruction.contains("Press Escape or right-click to cancel"), "Use-spot cursor pill includes cancellation instructions")
|
||||||
|
_check(not (_stage.get("_chrome") as StageChrome).get_tooltip().visible, "Use-spot capture avoids a duplicate Stage tooltip")
|
||||||
|
await _save_capture("use_spot_capture_attached_cancel")
|
||||||
|
var spot_scrim: Control = spot_overlay.find_child("InspectorInputBlocker", true, false) as Control
|
||||||
|
if spot_scrim != null:
|
||||||
|
await _send_right_click(spot_scrim.get_global_rect().get_center())
|
||||||
|
await _wait_frames(3)
|
||||||
|
_check(not spot_overlay.has_capture() and not bool(_stage.get("_spot_edit_active")), "right-click cancels Use-spot placement")
|
||||||
|
print("PHASE20B_CAPTURE_OVERLAY_RESULT failures=%d captures=%s" % [_failures, CAPTURE_DIR])
|
||||||
|
await _finish()
|
||||||
|
return
|
||||||
|
if visual_scenario == "prop_target":
|
||||||
|
await _send_mouse_motion(Vector2(350.0, 520.0))
|
||||||
|
_stage.call("_begin_capture", SandboxStage.CaptureKind.PROP, "Choose a prop for break", Callable(), Callable())
|
||||||
|
await _wait_frames(3)
|
||||||
|
var prop_overlay: StageInspectorCaptureOverlay = _stage.get("_inspector_capture_overlay") as StageInspectorCaptureOverlay
|
||||||
|
_check(prop_overlay.has_capture() and prop_overlay.get_inspector_rect().is_equal_approx(character_card.get_global_rect()), "prop-target capture attaches Cancel to the character inspector")
|
||||||
|
_check_capture_tooltip_layout(prop_overlay, _stage.get("_chrome") as StageChrome)
|
||||||
|
await _save_capture("prop_target_capture_attached_cancel")
|
||||||
|
await _send_escape()
|
||||||
|
_check(int(_stage.get("_capture_kind")) == SandboxStage.CaptureKind.NONE and not prop_overlay.has_capture(), "Escape cancels prop-target capture")
|
||||||
|
print("PHASE20B_CAPTURE_OVERLAY_RESULT failures=%d captures=%s" % [_failures, CAPTURE_DIR])
|
||||||
|
await _finish()
|
||||||
|
return
|
||||||
|
if visual_scenario == "use_target":
|
||||||
|
var empty_preview_prefix: Array[Dictionary] = []
|
||||||
|
_stage.call("_begin_use_target_capture", "direct", actor, empty_preview_prefix, true)
|
||||||
|
_stage.call("_select_use_target_prop", prop, Vector2.ZERO)
|
||||||
|
await _wait_frames(3)
|
||||||
|
var use_overlay: StageInspectorCaptureOverlay = _stage.get("_inspector_capture_overlay") as StageInspectorCaptureOverlay
|
||||||
|
var use_prompt: Label = use_overlay.find_child("CapturePrompt", true, false) as Label
|
||||||
|
var use_strip: Control = use_overlay.find_child("CaptureCancelStrip", true, false) as Control
|
||||||
|
var use_actions: Control = use_overlay.find_child("CaptureActions", true, false) as Control
|
||||||
|
var use_cancel: Button = _find_button_with_text(use_overlay, "Cancel")
|
||||||
|
_check(use_prompt != null and use_prompt.text == "Use", "Use target capture keeps a short action caption")
|
||||||
|
_check(use_strip != null and use_strip.size.y >= 112.0 and use_actions != null and use_actions.get_global_rect().position.y >= use_prompt.get_global_rect().position.y, "multiple capture actions stack below the title")
|
||||||
|
_check(use_cancel != null and use_cancel.visible and use_cancel.custom_minimum_size.y >= 44.0 and use_cancel.get_global_rect().end.x <= use_strip.get_global_rect().end.x + 1.0, "stacked Cancel remains visible and touch-sized")
|
||||||
|
_check_capture_tooltip_layout(use_overlay, _stage.get("_chrome") as StageChrome)
|
||||||
|
await _save_capture("use_target_capture_stacked_actions")
|
||||||
|
_stage.call("_cancel_capture")
|
||||||
|
_check(not use_overlay.has_capture(), "Cancel closes the stacked Use-target capture")
|
||||||
|
print("PHASE20B_CAPTURE_OVERLAY_RESULT failures=%d captures=%s" % [_failures, CAPTURE_DIR])
|
||||||
|
await _finish()
|
||||||
|
return
|
||||||
|
|
||||||
|
await _send_mouse_motion(Vector2(350.0, 520.0))
|
||||||
|
_stage.call("_begin_capture", SandboxStage.CaptureKind.PLAN_PLACE, "Choose a place for break", Callable(), Callable())
|
||||||
|
await _wait_frames(3)
|
||||||
|
var overlay: StageInspectorCaptureOverlay = _stage.get("_inspector_capture_overlay") as StageInspectorCaptureOverlay
|
||||||
|
var cancel_button: Button = overlay.find_child("Capture_cancel_capture", true, false) as Button
|
||||||
|
_check(overlay.has_capture() and overlay.visible and not (_stage.get("_use_target_capture_bar") as StageUseTargetCaptureBar).visible, "place capture shows the attached inspector strip instead of a detached capture bar")
|
||||||
|
_check(overlay.get_inspector_rect().is_equal_approx(character_card.get_global_rect()), "capture dimmer aligns with the selected character inspector")
|
||||||
|
_check(cancel_button != null and cancel_button.visible and cancel_button.custom_minimum_size.y >= 44.0 and cancel_button.has_focus(), "Cancel is visible, touch-sized, and owns keyboard focus")
|
||||||
|
var tooltip: Control = _stage.find_child("ActionTooltip", true, false) as Control
|
||||||
|
var chrome: StageChrome = _stage.get("_chrome") as StageChrome
|
||||||
|
_check(tooltip != null and tooltip.visible and String(tooltip.get("text")).contains("Press Escape or right-click to cancel"), "cursor hint includes the full cancel shortcuts")
|
||||||
|
if tooltip != null and chrome != null:
|
||||||
|
_check(not tooltip.get_global_rect().intersects(overlay.get_inspector_rect()), "cursor hint avoids the active inspector")
|
||||||
|
_check(not tooltip.get_global_rect().intersects(chrome.get_timestamp_badge().get_global_rect()), "cursor hint avoids the timer badge")
|
||||||
|
await _save_capture("place_capture_attached_cancel")
|
||||||
|
|
||||||
|
if wait_button != null:
|
||||||
|
await _send_click(wait_button.get_global_rect().get_center())
|
||||||
|
_check(int(_stage.get("_capture_kind")) == SandboxStage.CaptureKind.PLAN_PLACE and not (_stage.get("_wait_dialog") as Window).visible, "dimmed inspector controls cannot be activated by clicking through the scrim")
|
||||||
|
if cancel_button != null:
|
||||||
|
await _send_click(cancel_button.get_global_rect().get_center())
|
||||||
|
await _wait_frames(2)
|
||||||
|
_check(int(_stage.get("_capture_kind")) == SandboxStage.CaptureKind.NONE and not overlay.has_capture(), "attached Cancel resolves through the production capture cancel path")
|
||||||
|
if visual_scenario == "plan":
|
||||||
|
print("PHASE20B_CAPTURE_OVERLAY_RESULT failures=%d captures=%s" % [_failures, CAPTURE_DIR])
|
||||||
|
await _finish()
|
||||||
|
return
|
||||||
|
|
||||||
|
_stage.call("_begin_set_down_position_capture", actor, "Click where to let go", Callable(), Callable())
|
||||||
|
await _wait_frames(2)
|
||||||
|
_check(overlay.has_capture(), "set-down target capture uses the same inspector cancel strip")
|
||||||
|
await _save_capture("set_down_capture_attached_cancel")
|
||||||
|
var escape: InputEventKey = InputEventKey.new()
|
||||||
|
escape.keycode = KEY_ESCAPE
|
||||||
|
escape.pressed = true
|
||||||
|
Input.parse_input_event(escape)
|
||||||
|
await _wait_frames(3)
|
||||||
|
_check(int(_stage.get("_capture_kind")) == SandboxStage.CaptureKind.NONE and not overlay.has_capture(), "Escape cancels set-down capture and removes the dim layer")
|
||||||
|
|
||||||
|
_stage.set_mode(SandboxStage.StageMode.EDIT)
|
||||||
|
selection.select_only(prop)
|
||||||
|
_stage.call("_refresh_prop_settings_card")
|
||||||
|
await _wait_frames(3)
|
||||||
|
_stage.call("_begin_spot_edit", prop, "")
|
||||||
|
await _wait_frames(3)
|
||||||
|
_check(overlay.has_capture() and overlay.get_inspector_rect().is_equal_approx((_stage.get("_prop_settings_view") as StagePropSettingsView).get_card().get_global_rect()), "Use-spot placement attaches Cancel to and dims the prop inspector")
|
||||||
|
await _save_capture("use_spot_capture_attached_cancel")
|
||||||
|
var scrim: Control = overlay.find_child("InspectorInputBlocker", true, false) as Control
|
||||||
|
if scrim != null:
|
||||||
|
await _send_right_click(scrim.get_global_rect().get_center())
|
||||||
|
await _wait_frames(3)
|
||||||
|
_check(not overlay.has_capture() and not bool(_stage.get("_spot_edit_active")), "right-clicking the dimmed inspector cancels spot placement")
|
||||||
|
|
||||||
|
print("PHASE20B_CAPTURE_OVERLAY_RESULT failures=%d captures=%s" % [_failures, CAPTURE_DIR])
|
||||||
|
await _finish()
|
||||||
|
|
||||||
|
|
||||||
|
func _find_button_with_text(root_node: Node, text: String) -> Button:
|
||||||
|
if root_node == null:
|
||||||
|
return null
|
||||||
|
for node: Node in root_node.find_children("*", "Button", true, false):
|
||||||
|
var button: Button = node as Button
|
||||||
|
if button != null and button.text == text:
|
||||||
|
return button
|
||||||
|
return null
|
||||||
|
|
||||||
|
|
||||||
|
func _check_capture_tooltip_layout(overlay: StageInspectorCaptureOverlay, chrome: StageChrome) -> void:
|
||||||
|
var tooltip: Control = _stage.find_child("ActionTooltip", true, false) as Control
|
||||||
|
_check(tooltip != null and tooltip.visible and String(tooltip.get("text")).contains("Press Escape or right-click to cancel"), "capture tooltip includes the Escape and right-click cancel hint")
|
||||||
|
if tooltip == null or chrome == null or overlay == null:
|
||||||
|
return
|
||||||
|
_check(not tooltip.get_global_rect().intersects(overlay.get_inspector_rect()), "capture tooltip avoids the active inspector")
|
||||||
|
_check(not tooltip.get_global_rect().intersects(chrome.get_timestamp_badge().get_global_rect()), "capture tooltip avoids the timer badge")
|
||||||
|
|
||||||
|
|
||||||
|
func _send_click(position: Vector2) -> void:
|
||||||
|
var motion: InputEventMouseMotion = InputEventMouseMotion.new()
|
||||||
|
motion.position = position
|
||||||
|
motion.global_position = position
|
||||||
|
Input.parse_input_event(motion)
|
||||||
|
await process_frame
|
||||||
|
var down: InputEventMouseButton = InputEventMouseButton.new()
|
||||||
|
down.button_index = MOUSE_BUTTON_LEFT
|
||||||
|
down.pressed = true
|
||||||
|
down.position = position
|
||||||
|
down.global_position = position
|
||||||
|
Input.parse_input_event(down)
|
||||||
|
await process_frame
|
||||||
|
var up: InputEventMouseButton = InputEventMouseButton.new()
|
||||||
|
up.button_index = MOUSE_BUTTON_LEFT
|
||||||
|
up.pressed = false
|
||||||
|
up.position = position
|
||||||
|
up.global_position = position
|
||||||
|
Input.parse_input_event(up)
|
||||||
|
await _wait_frames(2)
|
||||||
|
|
||||||
|
|
||||||
|
func _send_mouse_motion(position: Vector2) -> void:
|
||||||
|
var motion: InputEventMouseMotion = InputEventMouseMotion.new()
|
||||||
|
motion.position = position
|
||||||
|
motion.global_position = position
|
||||||
|
Input.parse_input_event(motion)
|
||||||
|
await _wait_frames(2)
|
||||||
|
|
||||||
|
|
||||||
|
func _send_right_click(position: Vector2) -> void:
|
||||||
|
var event: InputEventMouseButton = InputEventMouseButton.new()
|
||||||
|
event.button_index = MOUSE_BUTTON_RIGHT
|
||||||
|
event.pressed = true
|
||||||
|
event.position = position
|
||||||
|
event.global_position = position
|
||||||
|
Input.parse_input_event(event)
|
||||||
|
await _wait_frames(3)
|
||||||
|
|
||||||
|
|
||||||
|
func _send_escape() -> void:
|
||||||
|
var escape: InputEventKey = InputEventKey.new()
|
||||||
|
escape.keycode = KEY_ESCAPE
|
||||||
|
escape.pressed = true
|
||||||
|
Input.parse_input_event(escape)
|
||||||
|
await _wait_frames(3)
|
||||||
|
|
||||||
|
|
||||||
|
func _save_capture(file_name: String) -> void:
|
||||||
|
await RenderingServer.frame_post_draw
|
||||||
|
var image: Image = root.get_texture().get_image()
|
||||||
|
var error: Error = image.save_png(ProjectSettings.globalize_path(CAPTURE_DIR.path_join(file_name + ".png")))
|
||||||
|
_check(error == OK and image.get_size() == root.size, "rendered %s capture saves at viewport size" % file_name)
|
||||||
|
|
||||||
|
|
||||||
|
func _wait_frames(count: int) -> void:
|
||||||
|
for _index: int in count:
|
||||||
|
await process_frame
|
||||||
|
await RenderingServer.frame_post_draw
|
||||||
|
|
||||||
|
|
||||||
|
func _check(condition: bool, message: String) -> void:
|
||||||
|
if condition:
|
||||||
|
print("PHASE20B_CAPTURE_OVERLAY_CHECK PASS: %s" % message)
|
||||||
|
else:
|
||||||
|
_fail(message)
|
||||||
|
|
||||||
|
|
||||||
|
func _fail(message: String) -> void:
|
||||||
|
_failures += 1
|
||||||
|
push_error("PHASE20B_CAPTURE_OVERLAY_CHECK FAIL: %s" % message)
|
||||||
|
|
||||||
|
|
||||||
|
func _finish() -> void:
|
||||||
|
if _stage != null and is_instance_valid(_stage):
|
||||||
|
_stage.queue_free()
|
||||||
|
await process_frame
|
||||||
|
quit(1 if _failures > 0 else 0)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://w38bcl5nayq0
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
Godot Engine v4.7.1.stable.official.a13da4feb - https://godotengine.org
|
||||||
|
Vulkan 1.4.351 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 2060 SUPER
|
||||||
|
|
||||||
|
ERROR: Failed to read the root certificate store.
|
||||||
|
at: get_system_ca_certificates (platform/windows/os_windows.cpp:2582)
|
||||||
|
PHASE20B_GUI_CHECK PASS: production spawner creates the actor and named-prop fixtures
|
||||||
|
PHASE20B_GUI_CHECK PASS: fixture actors receive long and distinct stage names through production identity
|
||||||
|
PHASE20B_GUI_CHECK PASS: DIRECT mode button is present in the Stage chrome
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@36 viewport_position=(640.0, 32.0) screen_position=(640.0, 32.0) window=0 window_position=(0, 0) hovered=@Button@36
|
||||||
|
PHASE20B_GUI_CHECK PASS: pointer activation switches the production Stage to DIRECT
|
||||||
|
PHASE20B_GUI_CHECK PASS: viewport pointer selects the actor in DIRECT
|
||||||
|
PHASE20B_GUI_CHECK PASS: approved empty-plan prompt is visible and fits inside the Step Stack
|
||||||
|
PHASE20B_GUI_CHECK PASS: pinned Move, Say, and Wait quick actions are visible
|
||||||
|
PHASE20B_CAPTURE path=res://tests/phase20b_captures/implementation_style/wide_empty_step_stack.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: rendered capture wide_empty_step_stack is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: visual-only fixture supplies one committed Walk step for Add together authoring
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/implementation_style/phase20b_visual_fixture_move_step.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture phase20b_visual_fixture_move_step is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: fixture Move shows plain Step 1 text with no tooltip
|
||||||
|
PHASE20B_GUI_CHECK PASS: whole step card is keyboard-focusable
|
||||||
|
PHASE20B_GUI_CHECK PASS: Enter activates the focused step card
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@1388 viewport_position=(1164.0, 521.0) screen_position=(1164.0, 521.0) window=0 window_position=(0, 0) hovered=@Button@1388
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together chooser omits the compatibility helper copy
|
||||||
|
PHASE20B_GUI_SLICE together_popup rect=[P: (818.0, 418.4), S: (256.0, 228.0)] trigger=[P: (1082.0, 499.0), S: (164.0, 44.0)] custom=(256.0, 228.0) title=Add to Step 1 scroll=[P: (828.0, 428.4), S: (236.0, 208.0)] choices=1 cancel=(236.0, 48.0) focus=@Button@1389:<Button#225888444127>
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together interaction keeps the plan actor selected
|
||||||
|
PHASE20B_GUI_CHECK PASS: Move step offers one Say choice and a touch-sized visible Cancel
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together chooser repeats the source action while covering the Step Stack row
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together chooser names its step and stays inside the safe viewport
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together chooser stays visually attached to its trigger without covering the pinned actions
|
||||||
|
PHASE20B_GUI_CHECK PASS: keyboard focus moves to the compatible Say choice
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/implementation_style/phase20b_final_add_together_picker.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture phase20b_final_add_together_picker is saved at viewport size
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@1389 viewport_position=(946.0, 520.4) screen_position=(946.0, 520.4) window=0 window_position=(0, 0) hovered=@Button@1389
|
||||||
|
PHASE20B_GUI_CHECK PASS: visible Say choice opens the production speech composer
|
||||||
|
PHASE20B_GUI_CHECK PASS: speech draft exposes its live bubble preview
|
||||||
|
PHASE20B_GUI_CHECK PASS: speech draft exposes its labeled Done speech control
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@1317 viewport_position=(926.5724, 488.0) screen_position=(926.5724, 488.0) window=0 window_position=(0, 0) hovered=@Button@1317
|
||||||
|
PHASE20B_GUI_SPEECH_VALIDATION focus=0 events=[{ "message": "Each bubble needs text and must fit within 240 characters.", "bubble_index": 0 }] message_rect=[P: (644.0724, 194.0), S: (267.0, 56.0)]
|
||||||
|
PHASE20B_GUI_CHECK PASS: Done speech validation guides the author to the first empty bubble
|
||||||
|
PHASE20B_GUI_CHECK PASS: validation focus exposes the production Message control for the bubble
|
||||||
|
PHASE20B_GUI_CHECK PASS: production validation opens and focuses the bubble's Message editor
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/implementation_style/phase20b_final_grouped_say_message_dialog.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture phase20b_final_grouped_say_message_dialog is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: validation focus exposes the production Message control
|
||||||
|
PHASE20B_GUI_CHECK PASS: production validation opens and focuses the speech text editor
|
||||||
|
PHASE20B_GUI_CHECK PASS: Message text is entered through the focused production TextEdit
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/implementation_style/phase20b_final_grouped_say_composer.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture phase20b_final_grouped_say_composer is saved at viewport size
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@1232 viewport_position=(957.0724, 474.0) screen_position=(957.0724, 474.0) window=0 window_position=(0, 0) hovered=@Button@1232
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@1257 viewport_position=(1002.072, 424.0) screen_position=(1002.072, 424.0) window=0 window_position=(0, 0) hovered=@Button@1257
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@1317 viewport_position=(1012.572, 488.0) screen_position=(1012.572, 488.0) window=0 window_position=(0, 0) hovered=@Button@1317
|
||||||
|
PHASE20B_GUI_CHECK PASS: real Add together and Done speech interactions commit exactly one Say alongside the Move fixture
|
||||||
|
PHASE20B_GUI_CHECK PASS: committed grouped Say preserves the entered message
|
||||||
|
PHASE20B_GUI_CHECK PASS: Step Stack spells out the Say label and duration in the committed action summary
|
||||||
|
PHASE20B_GUI_CHECK PASS: Say row separates its spoken text and secondary duration like the mockup
|
||||||
|
PHASE20B_GUI_CHECK PASS: Say row uses the same 48 px twin-rail layout and options cue as Move
|
||||||
|
PHASE20B_GUI_CHECK PASS: Say row uses the matching warm tint from the approved mockup
|
||||||
|
PHASE20B_GUI_CHECK PASS: grouped Say marker projects once at the same starting point as Move
|
||||||
|
PHASE20B_GUI_CHECK PASS: transient validation status clears before the committed-plan capture
|
||||||
|
PHASE20B_SAY_MARKER center_world=(-344.0, -25.0) center_screen=(468.0, 547.5) sample=[P: (444.0, 527.5), S: (48.0, 40.0)] yellow_pixels=299
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/implementation_style/phase20b_final_walk_say_committed.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture phase20b_final_walk_say_committed is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: grouped Say marker is visibly rendered at the projected Step 1 start
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@184 viewport_position=(1199.5, 262.0) screen_position=(1199.5, 262.0) window=0 window_position=(0, 0) hovered=@Button@184
|
||||||
|
PHASE20B_WAIT_LAYOUT [[P: (360.0, 130.0), S: (560.0, 460.0)], [P: (2.0, 2.0), S: (556.0, 456.0)], (332.0, 204.0), 0.0, 0.0, 0.0, 0.0, [P: (24.0, 22.0), S: (512.0, 418.0)], (288.0, 166.0), [P: (24.0, 124.0), S: (512.0, 252.0)], (120.0, 0.0), (120.0, 68.0), [P: (424.0, 388.0), S: (112.0, 52.0)]]
|
||||||
|
PHASE20B_GUI_CHECK PASS: Wait dialog and Done footer remain inside the production popup and viewport
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/implementation_style/phase20b_wait_dialog_footer_visible.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture phase20b_wait_dialog_footer_visible is saved at viewport size
|
||||||
|
PHASE20B_GUI_HOVER target=ActionEditorDone viewport_position=(840.0, 544.0) screen_position=(840.0, 544.0) window=0 window_position=(360, 130) hovered=ActionEditorDone
|
||||||
|
PHASE20B_GUI_CHECK PASS: quick Wait appends a separate second step after the committed Walk+Say
|
||||||
|
PHASE20B_GUI_CHECK PASS: one-second Wait summary uses singular grammar
|
||||||
|
PHASE20B_GUI_CHECK PASS: Step 2 uses the same trailing action-options cue as Step 1
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/implementation_style/phase20b_final_walk_say_then_wait.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture phase20b_final_walk_say_then_wait is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: valid production commits mark the scene dirty
|
||||||
|
PHASE20B_GUI_SLICE_RESULT scenario=grouping failures=0
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
|||||||
|
uid://bhqgkkobko7o0
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
Godot Engine v4.7.1.stable.official.a13da4feb - https://godotengine.org
|
||||||
|
Vulkan 1.4.351 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 2060 SUPER
|
||||||
|
|
||||||
|
ERROR: Failed to read the root certificate store.
|
||||||
|
at: get_system_ca_certificates (platform/windows/os_windows.cpp:2582)
|
||||||
|
PHASE20B_GUI_CHECK PASS: production spawner creates the actor and named-prop fixtures
|
||||||
|
PHASE20B_GUI_CHECK PASS: fixture actors receive long and distinct stage names through production identity
|
||||||
|
PHASE20B_GUI_CHECK PASS: DIRECT mode button is present in the Stage chrome
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@36 viewport_position=(640.0, 32.0) screen_position=(640.0, 32.0) window=0 window_position=(0, 0) hovered=@Button@36
|
||||||
|
PHASE20B_GUI_CHECK PASS: pointer activation switches the production Stage to DIRECT
|
||||||
|
PHASE20B_GUI_CHECK PASS: viewport pointer selects the actor in DIRECT
|
||||||
|
PHASE20B_GUI_CHECK PASS: approved empty-plan prompt is visible and fits inside the Step Stack
|
||||||
|
PHASE20B_GUI_CHECK PASS: pinned Move, Say, and Wait quick actions are visible
|
||||||
|
PHASE20B_CAPTURE path=res://tests/phase20b_captures/implementation_style/wide_empty_step_stack.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: rendered capture wide_empty_step_stack is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: visual fixture seeds a grouped Walk+Say step followed by a Run step
|
||||||
|
PHASE20B_GUI_CHECK PASS: production spawner creates a second actor for Step Spotlight visibility checks
|
||||||
|
PHASE20B_GUI_CHECK PASS: second actor receives its distinct stage name through production identity
|
||||||
|
PHASE20B_GUI_CHECK PASS: second actor receives its own visual-only Run route
|
||||||
|
PHASE20B_GUI_CHECK PASS: DIRECT defaults Step Spotlight to the selected actor's first pending step
|
||||||
|
PHASE20B_GUI_CHECK PASS: theme loads the thicker, brighter route and contrast edge
|
||||||
|
PHASE20B_GUI_CHECK PASS: theme loads prominent rounded action badges and clear headwear clearance
|
||||||
|
PHASE20B_GUI_CHECK PASS: DIRECT Step Spotlight draws the selected actor's name badge
|
||||||
|
PHASE20B_GUI_CHECK PASS: DIRECT name badge stays above visible headwear with at least 24 screen pixels of clearance
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/implementation_style/phase20b_direct_name_badge_clearance.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture phase20b_direct_name_badge_clearance is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: unselected actors' hidden routes do not retain invisible hit targets
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/implementation_style/phase20b_step_spotlight_step1_walk_say.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture phase20b_step_spotlight_step1_walk_say is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: action summary and plain Step 1 title are selectable without a redundant tooltip
|
||||||
|
PHASE20B_GUI_CHECK PASS: hovering the plain step title does not shift or resize it
|
||||||
|
PHASE20B_GUI_CHECK PASS: clicking blank Step 2 card space selects it with the amber border
|
||||||
|
PHASE20B_GUI_HOVER target=@Button@1523 viewport_position=(1156.0, 628.0) screen_position=(1156.0, 628.0) window=0 window_position=(0, 0) hovered=@Button@1523
|
||||||
|
PHASE20B_GUI_CHECK PASS: Add together selects its parent step while opening the choice picker
|
||||||
|
PHASE20B_GUI_HOVER target=CancelTogether viewport_position=(938.0, 604.0) screen_position=(938.0, 604.0) window=0 window_position=(0, 0) hovered=CancelTogether
|
||||||
|
PHASE20B_GUI_HOVER target=ActionSummary_spotlight-milo-step-2 viewport_position=(1074.0, 575.0) screen_position=(1074.0, 575.0) window=0 window_position=(0, 0) hovered=ActionSummary_spotlight-milo-step-2
|
||||||
|
PHASE20B_GUI_CHECK PASS: selecting Step 2 action opens its options and amber action highlight
|
||||||
|
PHASE20B_GUI_HOVER target=StepHeading viewport_position=(977.5, 403.0) screen_position=(977.5, 403.0) window=0 window_position=(0, 0) hovered=StepHeading
|
||||||
|
PHASE20B_GUI_CHECK PASS: selecting Step 1 heading closes the previously expanded Step 2 action
|
||||||
|
PHASE20B_GUI_CHECK PASS: step selection clears the old action highlight and leaves the amber border on its card
|
||||||
|
PHASE20B_GUI_CHECK PASS: selected step title remains plain text without a tooltip
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/implementation_style/phase20b_step_spotlight_step1_heading_selected.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture phase20b_step_spotlight_step1_heading_selected is saved at viewport size
|
||||||
|
PHASE20B_GUI_HOVER target=StepHeading viewport_position=(1020.0, 587.0) screen_position=(1020.0, 587.0) window=0 window_position=(0, 0) hovered=StepHeading
|
||||||
|
PHASE20B_GUI_CHECK PASS: clicking the Step 2 heading switches the Step Spotlight
|
||||||
|
PHASE20B_GUI_CHECK PASS: faint prior-step flag keeps its action-ID hit target
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/implementation_style/phase20b_step_spotlight_step2_run_ghost_flag.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture phase20b_step_spotlight_step2_run_ghost_flag is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: clicking a ghost flag returns focus to its authored step
|
||||||
|
PHASE20B_GUI_CHECK PASS: switching Step Spotlight by card or flag does not dirty the scene
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/implementation_style/phase20b_step_spotlight_ghost_flag_focus.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture phase20b_step_spotlight_ghost_flag_focus is saved at viewport size
|
||||||
|
PHASE20B_GUI_CHECK PASS: DIRECT name badge moves beside a head near the top toolbar
|
||||||
|
PHASE20B_GUI_CHECK PASS: top-edge name badge stays inside the safe viewport
|
||||||
|
PHASE20B_CAPTURE_STABLE path=res://tests/phase20b_captures/implementation_style/phase20b_direct_name_badge_top_edge.png size=(1280, 720) error=0
|
||||||
|
PHASE20B_GUI_CHECK PASS: settled rendered capture phase20b_direct_name_badge_top_edge is saved at viewport size
|
||||||
|
PHASE20B_GUI_SLICE_RESULT scenario=step_spotlight failures=0
|
||||||
@@ -6,10 +6,12 @@ const STAGE_SCENE_IO := preload("res://scripts/stage/stage_scene_io.gd")
|
|||||||
const ACTION_REGISTRY := preload("res://scripts/stage/action_registry.gd")
|
const ACTION_REGISTRY := preload("res://scripts/stage/action_registry.gd")
|
||||||
const PROP_BLOCK_SCRIPT := preload("res://scripts/props/prop_block.gd")
|
const PROP_BLOCK_SCRIPT := preload("res://scripts/props/prop_block.gd")
|
||||||
const PROP_INTERACTOR_SCRIPT := preload("res://scripts/characters/stickman/stickman_prop_interactor.gd")
|
const PROP_INTERACTOR_SCRIPT := preload("res://scripts/characters/stickman/stickman_prop_interactor.gd")
|
||||||
|
const PROP_ANCHOR_DATA := preload("res://scripts/props/prop_anchor_data.gd")
|
||||||
const STICKMAN_RIG_SCENE := preload("res://scenes/characters/stickman/stickman_rig.tscn")
|
const STICKMAN_RIG_SCENE := preload("res://scenes/characters/stickman/stickman_rig.tscn")
|
||||||
|
|
||||||
var _checks: int = 0
|
var _checks: int = 0
|
||||||
var _failures: int = 0
|
var _failures: int = 0
|
||||||
|
var _pickup_test_prop: PropBlock = null
|
||||||
|
|
||||||
|
|
||||||
func _initialize() -> void:
|
func _initialize() -> void:
|
||||||
@@ -22,6 +24,8 @@ func _run() -> void:
|
|||||||
_test_set_down_serialization()
|
_test_set_down_serialization()
|
||||||
_test_unknown_preview()
|
_test_unknown_preview()
|
||||||
await _test_runtime_profiles()
|
await _test_runtime_profiles()
|
||||||
|
await _test_set_down_owner_collision_grace()
|
||||||
|
await _test_reserved_pickup_collision_protection()
|
||||||
await _test_start_still_support_contact()
|
await _test_start_still_support_contact()
|
||||||
await _test_set_down_clearance_and_release()
|
await _test_set_down_clearance_and_release()
|
||||||
await _test_set_down_preserves_pickup_orientation()
|
await _test_set_down_preserves_pickup_orientation()
|
||||||
@@ -140,6 +144,131 @@ func _test_runtime_profiles() -> void:
|
|||||||
await process_frame
|
await process_frame
|
||||||
|
|
||||||
|
|
||||||
|
func _test_set_down_owner_collision_grace() -> void:
|
||||||
|
var world := Node2D.new()
|
||||||
|
root.add_child(world)
|
||||||
|
var owner_rig := STICKMAN_RIG_SCENE.instantiate() as Node2D
|
||||||
|
world.add_child(owner_rig)
|
||||||
|
var other_rig := STICKMAN_RIG_SCENE.instantiate() as Node2D
|
||||||
|
other_rig.position = Vector2(1000.0, 0.0)
|
||||||
|
world.add_child(other_rig)
|
||||||
|
await physics_frame
|
||||||
|
var owner_bodies: Dictionary = owner_rig.call("get_collision_bodies")
|
||||||
|
var torso: AnimatableBody2D = owner_bodies.get("torso") as AnimatableBody2D
|
||||||
|
_expect(torso != null, "Set Down grace fixture has an animated torso collider")
|
||||||
|
if torso == null:
|
||||||
|
world.queue_free()
|
||||||
|
await process_frame
|
||||||
|
return
|
||||||
|
var prop: PropBlock = PROP_BLOCK_SCRIPT.new()
|
||||||
|
prop.polygon_points = PackedVector2Array([Vector2(-20.0, -20.0), Vector2(20.0, -20.0), Vector2(20.0, 20.0), Vector2(-20.0, 20.0)])
|
||||||
|
prop.gravity_scale = 0.0
|
||||||
|
world.add_child(prop)
|
||||||
|
await physics_frame
|
||||||
|
prop.global_position = torso.global_position
|
||||||
|
prop.set_stage_roles(PROP_STAGE_ROLES.new_placement(true))
|
||||||
|
prop.apply_runtime_role(PropBlock.RuntimeRole.HELD)
|
||||||
|
prop.interaction_owner_id = owner_rig.get_instance_id()
|
||||||
|
var interactor: Node = owner_rig.get_node(NodePath("RigComponents/PropInteractor"))
|
||||||
|
interactor.set("_held_prop", prop)
|
||||||
|
interactor.call("_release_held", "set_down", false, Vector2.ZERO, 0.0, true, false)
|
||||||
|
for _frame: int in 4:
|
||||||
|
await physics_frame
|
||||||
|
_expect(prop.runtime_role == PropBlock.RuntimeRole.RELEASED and prop.is_actor_blocking(), "Set Down grace preserves the prop's authored released collision role")
|
||||||
|
_expect(prop.is_owner_collision_grace_active_for(owner_rig), "Set Down release starts grace for the releasing stickman")
|
||||||
|
_expect(not prop.is_owner_collision_grace_active_for(other_rig), "Set Down grace does not apply to a different stickman")
|
||||||
|
var owner_exceptions: Array[PhysicsBody2D] = torso.get_collision_exceptions()
|
||||||
|
_expect(owner_exceptions.has(prop) and prop.get_collision_exceptions().has(torso), "Set Down grace installs a symmetric exception for the releasing stickman's collider")
|
||||||
|
var other_bodies: Dictionary = other_rig.call("get_collision_bodies")
|
||||||
|
var other_torso: AnimatableBody2D = other_bodies.get("torso") as AnimatableBody2D
|
||||||
|
_expect(other_torso != null and not other_torso.get_collision_exceptions().has(prop), "other stickmen keep ordinary prop collision")
|
||||||
|
var locomotion: Node = owner_rig.call("get_locomotion") as Node
|
||||||
|
var owner_sweep: Dictionary = locomotion.call("_sweep_actor_blocking_props", Vector2(40.0, 0.0))
|
||||||
|
_expect(float(owner_sweep.get("fraction", 0.0)) >= 0.999, "the releasing stickman's movement sweep skips its grace prop")
|
||||||
|
owner_rig.global_position += Vector2(1000.0, 0.0)
|
||||||
|
await physics_frame
|
||||||
|
_expect(prop.is_owner_collision_grace_active_for(owner_rig), "Set Down grace waits for a second clear physics frame")
|
||||||
|
await physics_frame
|
||||||
|
_expect(not prop.is_owner_collision_grace_active_for(owner_rig), "Set Down grace ends after the releasing stickman's collision shapes clear the prop")
|
||||||
|
_expect(not torso.get_collision_exceptions().has(prop) and not prop.get_collision_exceptions().has(torso), "clearance removes both sides of the temporary collision exception")
|
||||||
|
prop.apply_runtime_role(PropBlock.RuntimeRole.HELD)
|
||||||
|
interactor.set("_held_prop", prop)
|
||||||
|
interactor.call("_release_held", "manual", false, Vector2.ZERO, 0.0, true, false)
|
||||||
|
_expect(not prop.is_owner_collision_grace_active_for(owner_rig), "Drop does not receive Set Down collision grace")
|
||||||
|
world.queue_free()
|
||||||
|
await process_frame
|
||||||
|
|
||||||
|
|
||||||
|
func _test_reserved_pickup_collision_protection() -> void:
|
||||||
|
var world := Node2D.new()
|
||||||
|
root.add_child(world)
|
||||||
|
var rig := STICKMAN_RIG_SCENE.instantiate() as Node2D
|
||||||
|
world.add_child(rig)
|
||||||
|
await physics_frame
|
||||||
|
var collision_bodies: Dictionary = rig.call("get_collision_bodies")
|
||||||
|
var torso: AnimatableBody2D = collision_bodies.get("torso") as AnimatableBody2D
|
||||||
|
_expect(torso != null, "pickup protection fixture has an animated torso collider")
|
||||||
|
if torso == null:
|
||||||
|
world.queue_free()
|
||||||
|
await process_frame
|
||||||
|
return
|
||||||
|
var prop: PropBlock = PROP_BLOCK_SCRIPT.new()
|
||||||
|
prop.stage_object_id = "pickup-protection-test-prop"
|
||||||
|
prop.polygon_points = PackedVector2Array([Vector2(-24.0, -20.0), Vector2(24.0, -20.0), Vector2(24.0, 20.0), Vector2(-24.0, 20.0)])
|
||||||
|
prop.gravity_scale = 0.0
|
||||||
|
world.add_child(prop)
|
||||||
|
await physics_frame
|
||||||
|
prop.global_position = torso.global_position + Vector2(800.0, 0.0)
|
||||||
|
prop.set_interaction_anchors(PROP_ANCHOR_DATA.preset_layout("one_handed", Rect2(Vector2(-24.0, -20.0), Vector2(48.0, 40.0))))
|
||||||
|
var roles: Dictionary = PROP_STAGE_ROLES.new_placement(true)
|
||||||
|
roles["blocks_stickmen"] = true
|
||||||
|
roles["released_blocks_stickmen"] = true
|
||||||
|
prop.set_stage_roles(roles)
|
||||||
|
prop.apply_runtime_role(PropBlock.RuntimeRole.RELEASED)
|
||||||
|
_pickup_test_prop = prop
|
||||||
|
var interactor: Node = rig.get_node(NodePath("RigComponents/PropInteractor"))
|
||||||
|
interactor.set("_resolver", Callable(self, "_resolve_pickup_test_prop"))
|
||||||
|
var action := {"type": "pick_up_prop", "target_prop_id": prop.stage_object_id, "hand": "auto"}
|
||||||
|
var started: bool = bool(interactor.call("start_action", action))
|
||||||
|
_expect(started and int(interactor.get("_phase")) == PROP_INTERACTOR_SCRIPT.Phase.APPROACHING, "pickup reserves a distant prop and enters the approach phase")
|
||||||
|
_expect(prop.interaction_reserved_by == rig.get_instance_id() and prop.is_owner_collision_grace_active_for(rig), "pickup reservation starts protection for its target")
|
||||||
|
for _frame: int in 5:
|
||||||
|
await physics_frame
|
||||||
|
_expect(prop.is_owner_collision_grace_active_for(rig), "reserved pickup protection stays active while the stickman is far away")
|
||||||
|
var locomotion: Node = rig.call("get_locomotion") as Node
|
||||||
|
var approach_sweep: Dictionary = locomotion.call("_sweep_actor_blocking_props", Vector2(1000.0, 0.0))
|
||||||
|
_expect(float(approach_sweep.get("fraction", 0.0)) >= 0.999, "the owner's approach sweep skips its reserved pickup target")
|
||||||
|
var hand_marker: Marker2D = interactor.call("_hand_marker") as Marker2D
|
||||||
|
interactor.call("_commit_pickup", hand_marker)
|
||||||
|
_expect(prop.runtime_role == PropBlock.RuntimeRole.HELD and not prop.is_owner_collision_grace_active_for(rig), "successful pickup clears target protection through the held profile")
|
||||||
|
interactor.call("reset_for_scene_exit")
|
||||||
|
await physics_frame
|
||||||
|
var torso_local: Vector2 = rig.to_local(torso.global_position)
|
||||||
|
locomotion.call("cancel_walk")
|
||||||
|
rig.global_position = prop.global_position - torso_local
|
||||||
|
await physics_frame
|
||||||
|
var retry_started: bool = bool(interactor.call("start_action", action))
|
||||||
|
_expect(retry_started and prop.is_owner_collision_grace_active_for(rig), "a retry protects its target before approach begins")
|
||||||
|
locomotion.call("cancel_walk")
|
||||||
|
interactor.call("cancel_action")
|
||||||
|
_expect(prop.interaction_reserved_by == 0 and prop.is_owner_collision_grace_active_for(rig), "cancel releases the reservation but keeps exit protection")
|
||||||
|
for _frame: int in 4:
|
||||||
|
await physics_frame
|
||||||
|
_expect(prop.is_owner_collision_grace_active_for(rig), "cancel protection remains while the stickman still overlaps the target")
|
||||||
|
rig.global_position += Vector2(1000.0, 0.0)
|
||||||
|
await physics_frame
|
||||||
|
_expect(prop.is_owner_collision_grace_active_for(rig), "cancel protection waits for a second clear frame")
|
||||||
|
await physics_frame
|
||||||
|
_expect(not prop.is_owner_collision_grace_active_for(rig), "cancel protection clears after the stickman leaves the target")
|
||||||
|
_pickup_test_prop = null
|
||||||
|
world.queue_free()
|
||||||
|
await process_frame
|
||||||
|
|
||||||
|
|
||||||
|
func _resolve_pickup_test_prop(prop_id: String) -> PropBlock:
|
||||||
|
return _pickup_test_prop if _pickup_test_prop != null and _pickup_test_prop.stage_object_id == prop_id else null
|
||||||
|
|
||||||
|
|
||||||
func _test_start_still_support_contact() -> void:
|
func _test_start_still_support_contact() -> void:
|
||||||
var world := Node2D.new()
|
var world := Node2D.new()
|
||||||
root.add_child(world)
|
root.add_child(world)
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ func _test_adapter_identity_round_trip() -> void:
|
|||||||
"stk_path": "res://content/stickmen/phase20a_missing_character.stk",
|
"stk_path": "res://content/stickmen/phase20a_missing_character.stk",
|
||||||
"position": {"x": -360.0, "y": 0.0},
|
"position": {"x": -360.0, "y": 0.0},
|
||||||
"rotation": 0.0,
|
"rotation": 0.0,
|
||||||
"action_queue": [],
|
"action_plan": [],
|
||||||
}
|
}
|
||||||
var missing_character: Node2D = MISSING_STICKMAN.new() as Node2D
|
var missing_character: Node2D = MISSING_STICKMAN.new() as Node2D
|
||||||
missing_character.configure(missing_character_entry)
|
missing_character.configure(missing_character_entry)
|
||||||
@@ -282,6 +282,10 @@ func _object(file_id: String, object_type: String, stage_id: String, stage_name:
|
|||||||
|
|
||||||
|
|
||||||
func _current_document(objects: Array) -> Dictionary:
|
func _current_document(objects: Array) -> Dictionary:
|
||||||
|
for raw_object: Variant in objects:
|
||||||
|
if raw_object is Dictionary and String((raw_object as Dictionary).get("type", "")) == "stickman":
|
||||||
|
(raw_object as Dictionary)["action_plan"] = []
|
||||||
|
(raw_object as Dictionary).erase("action_queue")
|
||||||
return {
|
return {
|
||||||
"version": STAGE_SCENE_IO.FILE_VERSION,
|
"version": STAGE_SCENE_IO.FILE_VERSION,
|
||||||
"scene_name": "Identity Test",
|
"scene_name": "Identity Test",
|
||||||
|
|||||||
@@ -0,0 +1,376 @@
|
|||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
const STAGE_ACTION_PLAN := preload("res://scripts/stage/stage_action_plan.gd")
|
||||||
|
const STAGE_ACTION_IDENTITY := preload("res://scripts/stage/stage_action_identity.gd")
|
||||||
|
const STAGE_SCENE_IO := preload("res://scripts/stage/stage_scene_io.gd")
|
||||||
|
const ACTION_REGISTRY := preload("res://scripts/stage/action_registry.gd")
|
||||||
|
const ACTION_RUNNER := preload("res://scripts/characters/stickman/stickman_action_runner.gd")
|
||||||
|
const STICKMAN_RIG_SCENE := preload("res://scenes/characters/stickman/stickman_rig.tscn")
|
||||||
|
const STICKMAN_RIG := preload("res://scripts/characters/stickman/stickman_rig.gd")
|
||||||
|
const STICKMAN_LOCOMOTION := preload("res://scripts/characters/stickman/stickman_locomotion.gd")
|
||||||
|
const PROP_BLOCK := preload("res://scripts/props/prop_block.gd")
|
||||||
|
const TARGET_CAPTURE := preload("res://scripts/editors/stage/stage_target_capture_session.gd")
|
||||||
|
const STAGE_PLACEMENT_OVERLAY := preload("res://scripts/stage/stage_placement_overlay.gd")
|
||||||
|
const STAGE_DIRECTOR_VISUALS := preload("res://scripts/stage/stage_director_visuals.gd")
|
||||||
|
|
||||||
|
class FakeLocomotion extends "res://scripts/characters/stickman/stickman_locomotion.gd":
|
||||||
|
var walking: bool = false
|
||||||
|
var current_target: Vector2 = Vector2.ZERO
|
||||||
|
var retargets: Array[Vector2] = []
|
||||||
|
var styles: Array[String] = []
|
||||||
|
|
||||||
|
func project_target_to_navigation(target: Vector2) -> Vector2:
|
||||||
|
return target
|
||||||
|
|
||||||
|
func move_to(target: Vector2, style: String = "walk", _speed_override: float = -1.0) -> bool:
|
||||||
|
current_target = target
|
||||||
|
styles.append(style)
|
||||||
|
walking = true
|
||||||
|
return true
|
||||||
|
|
||||||
|
func retarget_walk(target: Vector2) -> bool:
|
||||||
|
current_target = target
|
||||||
|
retargets.append(target)
|
||||||
|
walking = true
|
||||||
|
return true
|
||||||
|
|
||||||
|
func is_walking() -> bool:
|
||||||
|
return walking
|
||||||
|
|
||||||
|
func cancel_walk(_restore_idle_pose: bool = true) -> void:
|
||||||
|
walking = false
|
||||||
|
|
||||||
|
func consume_walk_failed() -> bool:
|
||||||
|
return false
|
||||||
|
|
||||||
|
func consume_walk_completed() -> bool:
|
||||||
|
return false
|
||||||
|
|
||||||
|
|
||||||
|
var _checks: int = 0
|
||||||
|
var _failures: int = 0
|
||||||
|
|
||||||
|
|
||||||
|
func _initialize() -> void:
|
||||||
|
call_deferred("_run")
|
||||||
|
|
||||||
|
|
||||||
|
func _run() -> void:
|
||||||
|
_test_plan_helpers()
|
||||||
|
_test_v18_migration()
|
||||||
|
_test_v19_validation_and_round_trip()
|
||||||
|
await _test_group_runtime_barrier()
|
||||||
|
await _test_group_recover_say_runtime_barrier()
|
||||||
|
await _test_moving_prop_pursuit()
|
||||||
|
print("PHASE 20B ACTION PLAN: %d checks, %d failures" % [_checks, _failures])
|
||||||
|
quit(1 if _failures > 0 else 0)
|
||||||
|
|
||||||
|
|
||||||
|
func _check(condition: bool, message: String) -> void:
|
||||||
|
_checks += 1
|
||||||
|
if condition:
|
||||||
|
print("PASS: " + message)
|
||||||
|
else:
|
||||||
|
_failures += 1
|
||||||
|
push_error("FAIL: " + message)
|
||||||
|
|
||||||
|
|
||||||
|
func _test_plan_helpers() -> void:
|
||||||
|
var placement_overlay: StagePlacementOverlay = STAGE_PLACEMENT_OVERLAY.new() as StagePlacementOverlay
|
||||||
|
placement_overlay.set_action_trajectory(Vector2.ZERO, Vector2(100.0, 80.0), true)
|
||||||
|
_check(placement_overlay.action_show_trajectory and not placement_overlay.action_grounded_trajectory, "ordinary trajectories keep their authored direction")
|
||||||
|
placement_overlay.set_grounded_action_trajectory(Vector2.ZERO, Vector2(100.0, 80.0), true)
|
||||||
|
_check(placement_overlay.action_show_trajectory and placement_overlay.action_grounded_trajectory, "walk and run previews can keep a horizontal ground route")
|
||||||
|
placement_overlay.set_action_marker(Vector2(40.0, 55.0))
|
||||||
|
_check(placement_overlay.action_visible and not placement_overlay.action_show_trajectory and not placement_overlay.action_grounded_trajectory and placement_overlay.action_target.is_equal_approx(Vector2(40.0, 55.0)), "selection previews keep a cursor marker without a movement trajectory")
|
||||||
|
placement_overlay.free()
|
||||||
|
var director_visuals: StageDirectorVisuals = STAGE_DIRECTOR_VISUALS.new() as StageDirectorVisuals
|
||||||
|
director_visuals.set_plan_candidate(null, "candidate", {}, false, Vector2.INF, "run")
|
||||||
|
_check(director_visuals._plan_candidate_movement_label == "Run", "candidate route label follows the selected Run style")
|
||||||
|
director_visuals.free()
|
||||||
|
var place_capture: Dictionary = TARGET_CAPTURE.normalize_plan_destination(Vector2(33.0, 44.0))
|
||||||
|
_check(String(place_capture.get("kind", "")) == "place" and (place_capture.get("position", Vector2.INF) as Vector2).is_equal_approx(Vector2(33.0, 44.0)), "PLAN_PLACE capture Vector2 normalizes to an explicit free-place destination")
|
||||||
|
var prop_capture: Dictionary = {"kind": "prop", "target_prop_id": "stage-prop-1", "approach_offset": Vector2(12.0, -8.0)}
|
||||||
|
_check(TARGET_CAPTURE.normalize_plan_destination(prop_capture) == prop_capture, "exact-prop capture dictionaries preserve the stable target ID and world offset")
|
||||||
|
_check(TARGET_CAPTURE.normalize_plan_destination(null).is_empty(), "unsupported capture payloads do not author a destination")
|
||||||
|
var move: Dictionary = {"action_id": "move-1", "type": "move_to", "style": "walk", "destination": {"kind": "place", "position": Vector2(120.0, 420.0)}}
|
||||||
|
var say: Dictionary = {"action_id": "say-1", "type": "speak", "text": "Ready", "duration": 1.0}
|
||||||
|
var wait_action: Dictionary = {"action_id": "wait-1", "type": "wait", "duration": 0.25}
|
||||||
|
var together: Array[Dictionary] = [{"actions": [move, say]}]
|
||||||
|
_check(STAGE_ACTION_PLAN.validate_steps(together).is_empty(), "Move plus Say is a valid together step")
|
||||||
|
_check(not STAGE_ACTION_PLAN.validate_steps([{"actions": [move, wait_action]}]).is_empty(), "Move plus Wait is rejected as an authored together step")
|
||||||
|
_check(STAGE_ACTION_PLAN.can_add_together({"actions": [wait_action]}, "speak"), "Wait step offers Say as a compatible together action")
|
||||||
|
for action_type: String in ACTION_REGISTRY.types():
|
||||||
|
if action_type == "speak":
|
||||||
|
continue
|
||||||
|
var primary_action: Dictionary = {"action_id": "primary-%s" % action_type, "type": action_type}
|
||||||
|
_check(STAGE_ACTION_PLAN.can_add_together({"actions": [say]}, action_type), "%s step offers Say as a compatible together action" % ACTION_REGISTRY.label(action_type))
|
||||||
|
_check(STAGE_ACTION_PLAN.can_add_together({"actions": [primary_action]}, "speak"), "Say can join %s" % ACTION_REGISTRY.label(action_type))
|
||||||
|
_check(STAGE_ACTION_PLAN.validate_steps([{"actions": [primary_action, say]}]).is_empty(), "%s plus Say is a valid together step" % ACTION_REGISTRY.label(action_type))
|
||||||
|
_check(not STAGE_ACTION_PLAN.can_add_together({"actions": [say]}, "speak"), "a step cannot contain two Say actions")
|
||||||
|
_check(not STAGE_ACTION_PLAN.can_add_together({"actions": [move, say]}, "wait"), "full step rejects a third together action")
|
||||||
|
var reordered: Array[Dictionary] = STAGE_ACTION_PLAN.move_step([{"actions": [move]}, {"actions": [wait_action]}], 0, 1)
|
||||||
|
_check(String(reordered[1]["actions"][0]["action_id"]) == "move-1", "step reorder preserves action identity")
|
||||||
|
var removed: Array[Dictionary] = STAGE_ACTION_PLAN.remove_action(together, "say-1")
|
||||||
|
_check(removed.size() == 1 and (removed[0]["actions"] as Array).size() == 1, "deleting one grouped action preserves the remaining step")
|
||||||
|
var identity: StageActionIdentity = STAGE_ACTION_IDENTITY.new() as StageActionIdentity
|
||||||
|
var world: Node2D = Node2D.new()
|
||||||
|
var rig: StickmanRig = STICKMAN_RIG.new() as StickmanRig
|
||||||
|
world.add_child(rig)
|
||||||
|
rig.set_action_plan(together)
|
||||||
|
var first_id: String = identity.allocate(world)
|
||||||
|
_check(not first_id.is_empty() and first_id not in ["move-1", "say-1"], "scene-scoped allocator avoids IDs already present on a live actor")
|
||||||
|
world.free()
|
||||||
|
|
||||||
|
|
||||||
|
func _test_v18_migration() -> void:
|
||||||
|
var original: Dictionary = _legacy_v18_document([
|
||||||
|
{"type": "speak", "text": "Go!", "duration": 0.4, "keep_acting": true},
|
||||||
|
{"type": "move_to", "target": {"x": 130.0, "y": 420.0}, "style": "run"},
|
||||||
|
{"type": "speak", "text": "Wait", "duration": 0.4, "keep_acting": true},
|
||||||
|
{"type": "wait", "duration": 0.2},
|
||||||
|
{"type": "speak", "text": "Legacy", "duration": 0.4, "keep_acting": true},
|
||||||
|
{"type": "ragdoll"},
|
||||||
|
])
|
||||||
|
var migrated: Dictionary = STAGE_SCENE_IO._migrate_to_current(original)
|
||||||
|
var repeated: Dictionary = STAGE_SCENE_IO._migrate_to_current(original.duplicate(true))
|
||||||
|
var objects: Array = migrated.get("objects", [])
|
||||||
|
var actor: Dictionary = objects[0] as Dictionary
|
||||||
|
var plan: Array = actor.get("action_plan", [])
|
||||||
|
_check(String(migrated.get("version", "")) == "1.9", "v1.8 migrates to v1.9")
|
||||||
|
_check(not actor.has("action_queue"), "v1.8 migration removes the legacy authoritative queue")
|
||||||
|
_check(plan.size() == 4 and (plan[0]["actions"] as Array).size() == 2, "keep_acting Say pairs with its following Move")
|
||||||
|
_check(bool((plan[0]["actions"] as Array)[0].get("legacy_nonblocking", false)), "paired legacy Say retains nonblocking compatibility")
|
||||||
|
var moved_action: Dictionary = (plan[0]["actions"] as Array)[1] as Dictionary
|
||||||
|
var moved_destination: Dictionary = moved_action.get("destination", {})
|
||||||
|
_check(String(moved_destination.get("kind", "")) == "place" and moved_destination.get("position", {}) == {"x": 130.0, "y": 420.0}, "legacy flat Move migrates to an explicit place target")
|
||||||
|
_check((plan[1]["actions"] as Array).size() == 2 and String(((plan[1]["actions"] as Array)[1] as Dictionary).get("type", "")) == "wait", "keep_acting Say pairs with its following Wait")
|
||||||
|
_check(bool(((plan[2]["actions"] as Array)[0] as Dictionary).get("legacy_nonblocking", false)), "unpaired legacy Say retains its explicit compatibility flag")
|
||||||
|
_check(JSON.stringify(plan) == JSON.stringify((repeated["objects"] as Array)[0]["action_plan"]), "legacy action IDs are deterministic across repeated migration")
|
||||||
|
_check(String(migrated.get("sky_id", "")) == "sky_sunset" and String(migrated.get("background_kind", "")) == "plain", "v1.8 migration keeps its authored background values")
|
||||||
|
var warning_source: Dictionary = _legacy_v18_document([{"type": "not_a_real_action"}])
|
||||||
|
var warning_migration: Dictionary = STAGE_SCENE_IO._migrate_to_current(warning_source)
|
||||||
|
_check(not (warning_migration.get("_migration_warnings", []) as Array).is_empty(), "malformed legacy actions keep skip-and-warn migration behavior")
|
||||||
|
|
||||||
|
|
||||||
|
func _test_v19_validation_and_round_trip() -> void:
|
||||||
|
var canonical_plan: Array[Dictionary] = [
|
||||||
|
{"actions": [
|
||||||
|
{"action_id": "stable-move", "type": "move_to", "style": "run", "destination": {"kind": "prop", "target_prop_id": "prop-blue-door", "approach_offset": Vector2(-42.0, 0.0), "last_known_approach": Vector2(310.0, 420.0)}},
|
||||||
|
{"action_id": "stable-say", "type": "speak", "text": "Let's go!", "duration": 1.2},
|
||||||
|
]},
|
||||||
|
{"actions": [{"action_id": "stable-place", "type": "move_to", "style": "walk", "destination": {"kind": "place", "position": Vector2(510.0, 420.0)}}]},
|
||||||
|
]
|
||||||
|
var encoded_result: Dictionary = STAGE_SCENE_IO.encode_plan(canonical_plan)
|
||||||
|
var encoded_steps: Array = encoded_result.get("steps", [])
|
||||||
|
_check((encoded_result.get("warnings", []) as Array).is_empty(), "canonical plans encode without warnings")
|
||||||
|
var doc: Dictionary = _current_document([_stickman_entry("actor-a", "stage-actor-a", "Milo", encoded_steps)])
|
||||||
|
_check(bool(STAGE_SCENE_IO._validate_root(doc).get("ok", false)), "valid v1.9 grouped Move+Say and place actions validate")
|
||||||
|
var current_move: Dictionary = (((doc["objects"] as Array)[0] as Dictionary)["action_plan"] as Array)[0]["actions"][0]
|
||||||
|
var current_destination: Dictionary = current_move.get("destination", {})
|
||||||
|
_check(String(current_destination.get("target_prop_id", "")) == "prop-blue-door", "prop destination persists the exact stage object ID")
|
||||||
|
_check(current_destination.get("approach_offset", {}) == {"x": -42.0, "y": 0.0}, "prop destination persists its world-aligned offset")
|
||||||
|
var bad_duplicate: Dictionary = doc.duplicate(true)
|
||||||
|
var duplicated_actor: Dictionary = _stickman_entry("actor-b", "stage-actor-b", "Ava", encoded_steps.duplicate(true))
|
||||||
|
(bad_duplicate["objects"] as Array).append(duplicated_actor)
|
||||||
|
_check(not bool(STAGE_SCENE_IO._validate_root(bad_duplicate).get("ok", true)), "duplicate stable action IDs across actors are rejected")
|
||||||
|
var bad_queue: Dictionary = doc.duplicate(true)
|
||||||
|
((bad_queue["objects"] as Array)[0] as Dictionary)["action_queue"] = []
|
||||||
|
_check(not bool(STAGE_SCENE_IO._validate_root(bad_queue).get("ok", true)), "v1.9 rejects a second authoritative action_queue")
|
||||||
|
var bad_group: Dictionary = doc.duplicate(true)
|
||||||
|
var bad_first_action: Dictionary = ((((bad_group["objects"] as Array)[0] as Dictionary)["action_plan"] as Array)[0]["actions"] as Array)[0]
|
||||||
|
bad_first_action["type"] = "ragdoll"
|
||||||
|
bad_first_action.erase("style")
|
||||||
|
bad_first_action.erase("destination")
|
||||||
|
var bad_second_action: Dictionary = ((((bad_group["objects"] as Array)[0] as Dictionary)["action_plan"] as Array)[0]["actions"] as Array)[1]
|
||||||
|
bad_second_action["type"] = "wait"
|
||||||
|
bad_second_action["duration"] = 0.5
|
||||||
|
bad_second_action.erase("text")
|
||||||
|
_check(not bool(STAGE_SCENE_IO._validate_root(bad_group).get("ok", true)), "v1.9 rejects incompatible grouped actions")
|
||||||
|
var bad_destination: Dictionary = doc.duplicate(true)
|
||||||
|
var bad_move: Dictionary = ((((bad_destination["objects"] as Array)[0] as Dictionary)["action_plan"] as Array)[0]["actions"] as Array)[0]
|
||||||
|
(bad_move["destination"] as Dictionary).erase("target_prop_id")
|
||||||
|
_check(not bool(STAGE_SCENE_IO._validate_root(bad_destination).get("ok", true)), "v1.9 rejects a prop destination with a missing exact ID")
|
||||||
|
var save_path: String = ProjectSettings.globalize_path("res://tests/.phase20b_plan_round_trip.scene")
|
||||||
|
var write_result: Dictionary = STAGE_SCENE_IO.write_file_safe(save_path, doc)
|
||||||
|
var read_result: Dictionary = STAGE_SCENE_IO.read_file(save_path)
|
||||||
|
_check(bool(write_result.get("ok", false)) and bool(read_result.get("ok", false)), "v1.9 plan document writes and reads through the production IO path")
|
||||||
|
var read_actor: Dictionary = (((read_result.get("data", {}) as Dictionary).get("objects", []) as Array)[0] as Dictionary)
|
||||||
|
var decoded: Dictionary = STAGE_SCENE_IO.decode_plan(read_actor.get("action_plan", []))
|
||||||
|
var decoded_steps: Array = decoded.get("steps", [])
|
||||||
|
var decoded_prop: Dictionary = (((decoded_steps[0]["actions"] as Array)[0] as Dictionary).get("destination", {}) as Dictionary)
|
||||||
|
var decoded_place: Dictionary = (((decoded_steps[1]["actions"] as Array)[0] as Dictionary).get("destination", {}) as Dictionary)
|
||||||
|
_check(String(((decoded_steps[0]["actions"] as Array)[0] as Dictionary).get("action_id", "")) == "stable-move", "round-trip preserves stable action IDs")
|
||||||
|
_check(decoded_prop.get("approach_offset", Vector2.ZERO) == Vector2(-42.0, 0.0), "round-trip decodes the prop offset as a Vector2")
|
||||||
|
_check(String(decoded_place.get("kind", "")) == "place" and decoded_place.get("position", Vector2.ZERO) == Vector2(510.0, 420.0), "nearby free-place intent remains an explicit place after round-trip")
|
||||||
|
DirAccess.remove_absolute(save_path)
|
||||||
|
DirAccess.remove_absolute(save_path + ".bak")
|
||||||
|
|
||||||
|
|
||||||
|
func _test_group_runtime_barrier() -> void:
|
||||||
|
var rig: StickmanRig = STICKMAN_RIG_SCENE.instantiate() as StickmanRig
|
||||||
|
root.add_child(rig)
|
||||||
|
await process_frame
|
||||||
|
var runner: StickmanActionRunner = rig.get_node("RigComponents/ActionRunner") as StickmanActionRunner
|
||||||
|
var started: Array[Dictionary] = []
|
||||||
|
rig.planned_action_started.connect(func(action_id: String, _action: Dictionary, step_index: int) -> void:
|
||||||
|
started.append({"id": action_id, "step": step_index, "frame": Engine.get_physics_frames()})
|
||||||
|
)
|
||||||
|
var grouped: Array[Dictionary] = [
|
||||||
|
{"actions": [
|
||||||
|
{"action_id": "runtime-wait", "type": "wait", "duration": 0.05},
|
||||||
|
{"action_id": "runtime-say", "type": "speak", "text": "Together", "duration": 0.3, "legacy_fixed": true},
|
||||||
|
]},
|
||||||
|
{"actions": [{"action_id": "runtime-after", "type": "wait", "duration": 0.05}]},
|
||||||
|
]
|
||||||
|
_check(rig.set_action_plan(grouped), "runtime fixture accepts a grouped plan")
|
||||||
|
rig.start_queue()
|
||||||
|
runner.tick(0.01, int(StickmanRig.RigState.ANIMATED), false)
|
||||||
|
_check(started.size() == 2 and String(started[0]["id"]) == "runtime-wait" and String(started[1]["id"]) == "runtime-say", "group actions emit start together in plan order")
|
||||||
|
_check(int(started[0]["frame"]) == int(started[1]["frame"]), "grouped actions start on the same runtime tick")
|
||||||
|
runner.tick(0.06, int(StickmanRig.RigState.ANIMATED), false)
|
||||||
|
_check(started.size() == 2, "next step waits after primary Wait ends while grouped Say remains active")
|
||||||
|
runner.pause_simulation()
|
||||||
|
runner.tick(2.0, int(StickmanRig.RigState.ANIMATED), false)
|
||||||
|
_check(started.size() == 2, "paused runtime freezes the Say barrier")
|
||||||
|
runner.resume_simulation()
|
||||||
|
runner.tick(0.31, int(StickmanRig.RigState.ANIMATED), false)
|
||||||
|
_check(started.size() == 2, "completed Say releases the barrier before the next runner tick")
|
||||||
|
runner.tick(0.01, int(StickmanRig.RigState.ANIMATED), false)
|
||||||
|
_check(started.size() == 3 and String(started[2]["id"]) == "runtime-after", "next step starts only after every grouped action ends")
|
||||||
|
rig.stop_queue()
|
||||||
|
rig.queue_free()
|
||||||
|
await process_frame
|
||||||
|
|
||||||
|
|
||||||
|
func _test_group_recover_say_runtime_barrier() -> void:
|
||||||
|
var rig: StickmanRig = STICKMAN_RIG_SCENE.instantiate() as StickmanRig
|
||||||
|
root.add_child(rig)
|
||||||
|
await process_frame
|
||||||
|
var runner: StickmanActionRunner = rig.get_node("RigComponents/ActionRunner") as StickmanActionRunner
|
||||||
|
var started: Array[String] = []
|
||||||
|
rig.planned_action_started.connect(func(action_id: String, _action: Dictionary, _step_index: int) -> void:
|
||||||
|
started.append(action_id)
|
||||||
|
)
|
||||||
|
var grouped: Array[Dictionary] = [
|
||||||
|
{"actions": [
|
||||||
|
{"action_id": "runtime-recover", "type": "recover"},
|
||||||
|
{"action_id": "runtime-recover-say", "type": "speak", "text": "I am okay!", "duration": 0.3, "legacy_fixed": true},
|
||||||
|
]},
|
||||||
|
{"actions": [{"action_id": "runtime-after-recover", "type": "wait", "duration": 0.05}]},
|
||||||
|
]
|
||||||
|
_check(rig.set_action_plan(grouped), "runtime fixture accepts Recover plus Say")
|
||||||
|
rig.start_queue()
|
||||||
|
runner.tick(0.01, int(StickmanRig.RigState.ANIMATED), false)
|
||||||
|
_check(started == ["runtime-recover", "runtime-recover-say"], "Recover and Say start on the same runtime tick")
|
||||||
|
runner.tick(0.01, int(StickmanRig.RigState.ANIMATED), false)
|
||||||
|
_check(started.size() == 2, "next step waits after Recover ends while its grouped Say remains active")
|
||||||
|
runner.tick(0.31, int(StickmanRig.RigState.ANIMATED), false)
|
||||||
|
_check(started.size() == 2, "Recover plus Say completes its speech barrier before advancing")
|
||||||
|
runner.tick(0.01, int(StickmanRig.RigState.ANIMATED), false)
|
||||||
|
_check(started.size() == 3 and started[2] == "runtime-after-recover", "the following step starts after Recover and Say both end")
|
||||||
|
rig.stop_queue()
|
||||||
|
rig.queue_free()
|
||||||
|
await process_frame
|
||||||
|
|
||||||
|
|
||||||
|
func _test_moving_prop_pursuit() -> void:
|
||||||
|
var world: Node2D = Node2D.new()
|
||||||
|
root.add_child(world)
|
||||||
|
var rig: StickmanRig = STICKMAN_RIG_SCENE.instantiate() as StickmanRig
|
||||||
|
world.add_child(rig)
|
||||||
|
var prop: PropBlock = PROP_BLOCK.new() as PropBlock
|
||||||
|
prop.stage_object_id = "prop-fetch-target"
|
||||||
|
prop.global_position = Vector2(120.0, 420.0)
|
||||||
|
world.add_child(prop)
|
||||||
|
var fake_locomotion: FakeLocomotion = FakeLocomotion.new() as FakeLocomotion
|
||||||
|
var runner: StickmanActionRunner = ACTION_RUNNER.new() as StickmanActionRunner
|
||||||
|
root.add_child(runner)
|
||||||
|
await process_frame
|
||||||
|
runner.configure(rig, fake_locomotion)
|
||||||
|
var outcome: Array[StringName] = []
|
||||||
|
runner.planned_action_ended.connect(func(action_id: String, result: StringName, _step: int) -> void:
|
||||||
|
if action_id == "fetch-move":
|
||||||
|
outcome.append(result)
|
||||||
|
)
|
||||||
|
var move_plan: Array[Dictionary] = [{"actions": [{
|
||||||
|
"action_id": "fetch-move",
|
||||||
|
"type": "move_to",
|
||||||
|
"style": "run",
|
||||||
|
"destination": {"kind": "prop", "target_prop_id": prop.stage_object_id, "approach_offset": Vector2(-30.0, 0.0), "last_known_approach": Vector2(90.0, 420.0)},
|
||||||
|
}]}]
|
||||||
|
_check(runner.set_action_plan(move_plan), "pursuit fixture accepts an exact prop Move")
|
||||||
|
runner.start_queue()
|
||||||
|
runner.tick(0.01, int(StickmanRig.RigState.ANIMATED), false)
|
||||||
|
_check(runner.is_prop_pursuit_active() and fake_locomotion.current_target == Vector2(90.0, 420.0), "prop Move starts toward its world-aligned approach offset")
|
||||||
|
prop.global_position += Vector2(24.0, 0.0)
|
||||||
|
runner.pre_movement(0.11)
|
||||||
|
_check(fake_locomotion.retargets.size() == 1 and fake_locomotion.retargets[0] == Vector2(114.0, 420.0), "moving prop retargets after its shift using the fixed world offset")
|
||||||
|
runner.pause_simulation()
|
||||||
|
prop.global_position += Vector2(30.0, 0.0)
|
||||||
|
runner.pre_movement(0.5)
|
||||||
|
_check(fake_locomotion.retargets.size() == 1, "paused pursuit does not retarget or spend its time budget")
|
||||||
|
runner.resume_simulation()
|
||||||
|
runner.pre_movement(0.11)
|
||||||
|
_check(fake_locomotion.retargets.size() == 2 and fake_locomotion.retargets[1] == Vector2(144.0, 420.0), "pursuit resumes and retargets from the prop's translated position")
|
||||||
|
prop.queue_free()
|
||||||
|
await process_frame
|
||||||
|
runner.pre_movement(0.11)
|
||||||
|
_check(outcome == [&"failed"], "vanished prop ends the active Move as failure, not arrival")
|
||||||
|
runner.stop_queue()
|
||||||
|
world.queue_free()
|
||||||
|
runner.queue_free()
|
||||||
|
fake_locomotion.free()
|
||||||
|
await process_frame
|
||||||
|
|
||||||
|
|
||||||
|
func _legacy_v18_document(queue: Array) -> Dictionary:
|
||||||
|
var wall: Dictionary = {
|
||||||
|
"file_id": "wall-1",
|
||||||
|
"type": "wall_panel",
|
||||||
|
"position": {"x": 0.0, "y": 0.0},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"size": {"x": 320.0, "y": 400.0},
|
||||||
|
"finish_id": "finish_wall_paint",
|
||||||
|
"color": "#123456",
|
||||||
|
}
|
||||||
|
var actor: Dictionary = _stickman_entry("actor-a", "stage-actor-a", "Milo", [])
|
||||||
|
actor["action_queue"] = queue.duplicate(true)
|
||||||
|
return {
|
||||||
|
"version": "1.8",
|
||||||
|
"scene_name": "Legacy Plan",
|
||||||
|
"sky_id": "sky_sunset",
|
||||||
|
"background_kind": "plain",
|
||||||
|
"plain_color": "#F5EFE0",
|
||||||
|
"camera": {"position": {"x": 0.0, "y": 0.0}, "zoom": 0.5},
|
||||||
|
"objects": [actor, wall],
|
||||||
|
"event_rules": [],
|
||||||
|
"metadata": {},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func _current_document(objects: Array) -> Dictionary:
|
||||||
|
return {
|
||||||
|
"version": STAGE_SCENE_IO.FILE_VERSION,
|
||||||
|
"scene_name": "Plan Round Trip",
|
||||||
|
"sky_id": "sky_neutral",
|
||||||
|
"background_kind": "sky",
|
||||||
|
"plain_color": "#F5EFE0",
|
||||||
|
"camera": {"position": {"x": 0.0, "y": 0.0}, "zoom": 0.5},
|
||||||
|
"objects": objects,
|
||||||
|
"event_rules": [],
|
||||||
|
"metadata": {},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func _stickman_entry(file_id: String, stage_id: String, stage_name: String, action_plan: Array) -> Dictionary:
|
||||||
|
return {
|
||||||
|
"file_id": file_id,
|
||||||
|
"type": "stickman",
|
||||||
|
"stage_object_id": stage_id,
|
||||||
|
"stage_name": stage_name,
|
||||||
|
"stk_path": "res://content/stickmen/basic.stk",
|
||||||
|
"position": {"x": 0.0, "y": 0.0},
|
||||||
|
"rotation": 0.0,
|
||||||
|
"action_plan": action_plan.duplicate(true),
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dbf2n56l7bjk7
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
const SANDBOX_STAGE: PackedScene = preload("res://scenes/stage/sandbox_stage.tscn")
|
||||||
|
const STAGE_SELECTION := preload("res://scripts/stage/stage_selection.gd")
|
||||||
|
const STAGE_DIALOG_STYLER := preload("res://scripts/shared/stage_ui/stage_dialog_styler.gd")
|
||||||
|
const CAPTURE_DIR := "res://tests/phase20b_captures/pickup_action_marker"
|
||||||
|
|
||||||
|
var _stage: SandboxStage
|
||||||
|
var _failures: int = 0
|
||||||
|
|
||||||
|
|
||||||
|
func _initialize() -> void:
|
||||||
|
call_deferred("_run")
|
||||||
|
|
||||||
|
|
||||||
|
func _run() -> void:
|
||||||
|
root.size = Vector2i(1280, 720)
|
||||||
|
root.gui_embed_subwindows = true
|
||||||
|
DirAccess.make_dir_recursive_absolute(ProjectSettings.globalize_path(CAPTURE_DIR))
|
||||||
|
_stage = SANDBOX_STAGE.instantiate() as SandboxStage
|
||||||
|
root.add_child(_stage)
|
||||||
|
await _wait_frames(10)
|
||||||
|
var recovery: ConfirmationDialog = _stage.find_child("AutosaveRecoveryDialog", true, false) as ConfirmationDialog
|
||||||
|
if recovery != null:
|
||||||
|
STAGE_DIALOG_STYLER.hide(recovery)
|
||||||
|
_stage.call("_on_grid_toggled", false)
|
||||||
|
var spawner: StageSpawner = _stage.get("_spawner") as StageSpawner
|
||||||
|
var world: Node2D = _stage.get_node("World") as Node2D
|
||||||
|
var actor: StickmanRig = spawner.spawn_stickman_asset("res://content/stickmen/break.stk", Vector2(-160.0, -190.0))
|
||||||
|
var prop: PropBlock = spawner.spawn_prop_asset("crate", Vector2(150.0, -10.0))
|
||||||
|
_check(actor != null and prop != null, "production Stage fixture creates a character and pickup target")
|
||||||
|
if actor == null or prop == null:
|
||||||
|
await _finish()
|
||||||
|
return
|
||||||
|
_stage.call("_finalize_placed_node", actor)
|
||||||
|
_stage.call("_finalize_placed_node", prop)
|
||||||
|
var identity: StageObjectIdentity = _stage.get("_object_identity") as StageObjectIdentity
|
||||||
|
var rename_result: Dictionary = identity.rename(prop, "Brown Suitcase", world)
|
||||||
|
_check(bool(rename_result.get("ok", false)), "pickup target receives its friendly stage name")
|
||||||
|
var pickup_action: Dictionary = {
|
||||||
|
"action_id": "pickup-marker-step-one",
|
||||||
|
"type": "pick_up_prop",
|
||||||
|
"target_prop_id": prop.stage_object_id,
|
||||||
|
"hand": "auto",
|
||||||
|
}
|
||||||
|
_check(actor.set_action_plan([{"actions": [pickup_action]}]), "Step 1 receives a real Pick Up Prop action")
|
||||||
|
_stage.call("set_mode", SandboxStage.StageMode.DIRECT)
|
||||||
|
var selection: StageSelection = _stage.get("_selection") as StageSelection
|
||||||
|
selection.select_only(actor)
|
||||||
|
_stage.call("_refresh_character_settings_card")
|
||||||
|
await _wait_frames(8)
|
||||||
|
var visuals: StageDirectorVisuals = _stage.get("_director_visuals") as StageDirectorVisuals
|
||||||
|
var projection: Dictionary = {}
|
||||||
|
for entry: Dictionary in visuals._plan_projection(actor):
|
||||||
|
if String(entry.get("action_id", "")) == String(pickup_action["action_id"]):
|
||||||
|
projection = entry
|
||||||
|
break
|
||||||
|
_check(String(projection.get("kind", "")) == "other" and String((projection.get("action", {}) as Dictionary).get("type", "")) == "pick_up_prop", "pickup action reaches the production Stage overlay projection")
|
||||||
|
var canvas_transform: Transform2D = _stage.get_viewport().get_canvas_transform()
|
||||||
|
var prop_world_bounds: Rect2 = STAGE_SELECTION.get_world_aabb(prop)
|
||||||
|
var prop_screen_bounds: Rect2 = visuals._world_rect_to_screen_rect(prop_world_bounds, canvas_transform)
|
||||||
|
var badge_size: Vector2 = visuals._text_action_badge_screen_size("Pick up", visuals._zoom())
|
||||||
|
var viewport_size: Vector2 = root.size
|
||||||
|
var safe_rect: Rect2 = Rect2(Vector2(8.0, 72.0), Vector2(viewport_size.x - 16.0, viewport_size.y - 112.0))
|
||||||
|
var actor_name_rect: Rect2 = visuals._actor_name_badge_screen_rect(actor, visuals._zoom())
|
||||||
|
var badge_rect: Rect2 = visuals._pickup_badge_screen_rect(prop_screen_bounds, badge_size, safe_rect, actor_name_rect)
|
||||||
|
_check(safe_rect.encloses(badge_rect), "Pick up pill stays inside the visible Stage safe area")
|
||||||
|
_check(not badge_rect.intersects(prop_screen_bounds), "Pick up pill sits outside the target prop bounds")
|
||||||
|
if _can_capture_image():
|
||||||
|
await RenderingServer.frame_post_draw
|
||||||
|
var image: Image = root.get_texture().get_image()
|
||||||
|
var path: String = CAPTURE_DIR.path_join("pickup_step_one_pill_over_prop.png")
|
||||||
|
var save_error: Error = image.save_png(ProjectSettings.globalize_path(path)) if image != null and not image.is_empty() else ERR_CANT_CREATE
|
||||||
|
_check(save_error == OK, "focused Godot run saves the rendered pickup action marker PNG")
|
||||||
|
print("PICKUP_ACTION_MARKER_CAPTURE path=%s size=%s" % [path, str(image.get_size()) if image != null else "missing"])
|
||||||
|
print("PHASE20B_PICKUP_ACTION_MARKER_RESULT failures=%d" % _failures)
|
||||||
|
await _finish()
|
||||||
|
quit(1 if _failures > 0 else 0)
|
||||||
|
|
||||||
|
|
||||||
|
func _wait_frames(count: int) -> void:
|
||||||
|
for _index: int in count:
|
||||||
|
await process_frame
|
||||||
|
|
||||||
|
|
||||||
|
func _can_capture_image() -> bool:
|
||||||
|
var display_name: String = DisplayServer.get_name().to_lower()
|
||||||
|
return not OS.has_feature("headless") and display_name != "headless" and display_name != "dummy"
|
||||||
|
|
||||||
|
|
||||||
|
func _check(condition: bool, message: String) -> void:
|
||||||
|
if condition:
|
||||||
|
print("PASS: %s" % message)
|
||||||
|
else:
|
||||||
|
_failures += 1
|
||||||
|
push_error("FAIL: " + message)
|
||||||
|
|
||||||
|
|
||||||
|
func _finish() -> void:
|
||||||
|
if _stage != null and is_instance_valid(_stage):
|
||||||
|
_stage.queue_free()
|
||||||
|
await process_frame
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://stxib3pjfl3i
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
const SANDBOX_STAGE: PackedScene = preload("res://scenes/stage/sandbox_stage.tscn")
|
||||||
|
const PROP_ANCHOR_DATA := preload("res://scripts/props/prop_anchor_data.gd")
|
||||||
|
const CAPTURE_DIR := "res://tests/phase20b_captures/pickup_prop_ui"
|
||||||
|
|
||||||
|
var _stage: SandboxStage
|
||||||
|
var _resolved_prop: Node2D
|
||||||
|
var _failures: int = 0
|
||||||
|
|
||||||
|
|
||||||
|
func _initialize() -> void:
|
||||||
|
call_deferred("_run")
|
||||||
|
|
||||||
|
|
||||||
|
func _run() -> void:
|
||||||
|
var capture_width: int = int(OS.get_environment("PHASE20B_CAPTURE_WIDTH"))
|
||||||
|
root.size = Vector2i(capture_width if capture_width > 0 else 1280, 720)
|
||||||
|
root.gui_embed_subwindows = true
|
||||||
|
DirAccess.make_dir_recursive_absolute(ProjectSettings.globalize_path(CAPTURE_DIR))
|
||||||
|
_stage = SANDBOX_STAGE.instantiate() as SandboxStage
|
||||||
|
root.add_child(_stage)
|
||||||
|
await _wait_frames(10)
|
||||||
|
var recovery: ConfirmationDialog = _stage.find_child("AutosaveRecoveryDialog", true, false) as ConfirmationDialog
|
||||||
|
if recovery != null:
|
||||||
|
recovery.hide()
|
||||||
|
var spawner: StageSpawner = _stage.get("_spawner") as StageSpawner
|
||||||
|
var world: Node2D = _stage.get_node("World") as Node2D
|
||||||
|
var actor: StickmanRig = spawner.spawn_stickman_asset("res://content/stickmen/break.stk", Vector2(-160.0, -190.0))
|
||||||
|
var eligible: PropBlock = spawner.spawn_prop_asset("crate", Vector2(150.0, -10.0))
|
||||||
|
var unavailable: PropBlock = spawner.spawn_prop_asset("crate", Vector2(350.0, -10.0))
|
||||||
|
_check(actor != null and eligible != null and unavailable != null, "real Stage fixtures spawn")
|
||||||
|
if actor == null or eligible == null or unavailable == null:
|
||||||
|
await _finish()
|
||||||
|
return
|
||||||
|
_stage.call("_finalize_placed_node", actor)
|
||||||
|
_stage.call("_finalize_placed_node", eligible)
|
||||||
|
_stage.call("_finalize_placed_node", unavailable)
|
||||||
|
var identity: StageObjectIdentity = _stage.get("_object_identity") as StageObjectIdentity
|
||||||
|
identity.rename(eligible, "Brown Suitcase", world)
|
||||||
|
identity.rename(unavailable, "Garden Gnome", world)
|
||||||
|
eligible.set_interaction_anchors(PROP_ANCHOR_DATA.preset_layout("one_handed", Rect2(Vector2(-44.0, -32.0), Vector2(88.0, 64.0))))
|
||||||
|
eligible.stage_roles["can_pick_up"] = true
|
||||||
|
unavailable.set_interaction_anchors(PROP_ANCHOR_DATA.preset_layout("one_handed", Rect2(Vector2(-44.0, -32.0), Vector2(88.0, 64.0))))
|
||||||
|
unavailable.stage_roles["can_pick_up"] = false
|
||||||
|
_stage.call("set_mode", SandboxStage.StageMode.DIRECT)
|
||||||
|
var selection: StageSelection = _stage.get("_selection") as StageSelection
|
||||||
|
selection.select_only(actor)
|
||||||
|
_stage.call("_refresh_character_settings_card")
|
||||||
|
await _wait_frames(5)
|
||||||
|
var queue_controller: StageActionQueueController = _stage.get("_action_queue_controller") as StageActionQueueController
|
||||||
|
queue_controller.set_editor_actor_id(actor.get_instance_id())
|
||||||
|
var action_editor: ActionEditor = _stage.get("_action_editor") as ActionEditor
|
||||||
|
action_editor.open_new(false, false, "pick_up_prop")
|
||||||
|
await _wait_frames(2)
|
||||||
|
var choose_prop_button: Button = _button_with_text(action_editor, "Choose a prop")
|
||||||
|
_check(choose_prop_button != null, "pickup action editor offers a separate Choose a prop control")
|
||||||
|
if choose_prop_button != null:
|
||||||
|
choose_prop_button.pressed.emit()
|
||||||
|
await _wait_frames(3)
|
||||||
|
_stage.set_process(false)
|
||||||
|
var visuals: StageDirectorVisuals = _stage.get("_director_visuals") as StageDirectorVisuals
|
||||||
|
var candidates: Array = visuals.get("_pickup_candidate_props")
|
||||||
|
_check(int(_stage.get("_capture_kind")) == SandboxStage.CaptureKind.PICKUP_PROP and candidates.size() == 1 and candidates[0] == eligible, "Change prop enters pickup-specific capture and highlights only eligible props")
|
||||||
|
var pickup_candidates: Array[PropBlock] = [eligible]
|
||||||
|
visuals.set_pickup_candidates(pickup_candidates, eligible)
|
||||||
|
await _wait_frames(3)
|
||||||
|
_check(visuals.get("_pickup_hovered_prop") == eligible, "hovering the eligible prop highlights it and shows its stage name")
|
||||||
|
var overlay: StageInspectorCaptureOverlay = _stage.get("_inspector_capture_overlay") as StageInspectorCaptureOverlay
|
||||||
|
_check(overlay.has_capture(), "pickup capture keeps the visible Cancel strip on the character inspector")
|
||||||
|
var capture_prompt: Label = overlay.find_child("CapturePrompt", true, false) as Label
|
||||||
|
var capture_strip: Control = overlay.find_child("CaptureCancelStrip", true, false) as Control
|
||||||
|
var cancel_button: Button = overlay.find_child("Capture_cancel_capture", true, false) as Button
|
||||||
|
_check(capture_prompt != null and capture_prompt.text == "Pick up prop", "pickup capture caption only names the action")
|
||||||
|
_check(cancel_button != null and capture_strip != null and cancel_button.get_global_rect().end.x <= capture_strip.get_global_rect().end.x + 1.0, "pickup Cancel stays inside the inspector strip")
|
||||||
|
if _can_capture_image():
|
||||||
|
await RenderingServer.frame_post_draw
|
||||||
|
var texture: Texture2D = root.get_texture()
|
||||||
|
if texture != null:
|
||||||
|
var image: Image = texture.get_image()
|
||||||
|
if image != null and not image.is_empty():
|
||||||
|
image.save_png(ProjectSettings.globalize_path(CAPTURE_DIR.path_join("stage_pickup_capture.png")))
|
||||||
|
_stage.call("_resolve_capture", unavailable.global_position)
|
||||||
|
await _wait_frames(2)
|
||||||
|
_check(int(_stage.get("_capture_kind")) == SandboxStage.CaptureKind.PICKUP_PROP and String(_stage.get("_toast_text")).contains("grip"), "clicking an unavailable prop explains the pickup requirement and leaves capture active")
|
||||||
|
_stage.call("_resolve_capture", eligible.global_position)
|
||||||
|
await _wait_frames(3)
|
||||||
|
var prop_label: Label = action_editor.get("_prop_target_label") as Label
|
||||||
|
var change_prop_button: Button = _button_with_text(action_editor, "Change prop")
|
||||||
|
_check(action_editor.visible and prop_label != null and prop_label.text == "Brown Suitcase" and not prop_label.text.contains(eligible.stage_object_id), "selecting a prop returns to the dialog with its friendly name")
|
||||||
|
_check(int(_stage.get("_capture_kind")) == SandboxStage.CaptureKind.NONE and change_prop_button != null, "selection resolves capture and clears the temporary cues")
|
||||||
|
_check((visuals.get("_pickup_candidate_props") as Array).is_empty() and not overlay.has_capture(), "capture end removes both canvas cues and the inspector dimmer")
|
||||||
|
if _can_capture_image():
|
||||||
|
await RenderingServer.frame_post_draw
|
||||||
|
var dialog_texture: Texture2D = root.get_texture()
|
||||||
|
if dialog_texture != null:
|
||||||
|
var dialog_image: Image = dialog_texture.get_image()
|
||||||
|
if dialog_image != null and not dialog_image.is_empty():
|
||||||
|
dialog_image.save_png(ProjectSettings.globalize_path(CAPTURE_DIR.path_join("stage_pickup_action_dialog.png")))
|
||||||
|
change_prop_button.pressed.emit()
|
||||||
|
await _wait_frames(2)
|
||||||
|
_check(int(_stage.get("_capture_kind")) == SandboxStage.CaptureKind.PICKUP_PROP, "Change prop opens the same pickup capture flow")
|
||||||
|
_stage.call("_cancel_capture")
|
||||||
|
_check(int(_stage.get("_capture_kind")) == SandboxStage.CaptureKind.NONE and (visuals.get("_pickup_candidate_props") as Array).is_empty() and action_editor.visible and prop_label.text == "Brown Suitcase", "cancel clears the overlay and returns to the named prop dialog")
|
||||||
|
eligible.stage_roles["can_pick_up"] = false
|
||||||
|
action_editor.hide()
|
||||||
|
_stage.call("_begin_capture", SandboxStage.CaptureKind.PICKUP_PROP, "Choose a prop to pick up", Callable(), Callable())
|
||||||
|
var empty_capture_state: Dictionary = _stage.call("_target_capture_surface_state")
|
||||||
|
_check(String(empty_capture_state.get("prompt", "")) == "Pick up prop", "empty pickup capture keeps the action-only caption")
|
||||||
|
_stage.call("_cancel_capture")
|
||||||
|
print("PHASE20B_PICKUP_PROP_STAGE_RESULT failures=%d captures=%s" % [_failures, CAPTURE_DIR])
|
||||||
|
await _finish()
|
||||||
|
quit(1 if _failures > 0 else 0)
|
||||||
|
|
||||||
|
|
||||||
|
func _button_with_text(root_node: Node, expected_text: String) -> Button:
|
||||||
|
if root_node == null:
|
||||||
|
return null
|
||||||
|
for candidate: Node in root_node.find_children("*", "Button", true, false):
|
||||||
|
var button: Button = candidate as Button
|
||||||
|
if button != null and button.text == expected_text:
|
||||||
|
return button
|
||||||
|
return null
|
||||||
|
|
||||||
|
|
||||||
|
func _wait_frames(count: int) -> void:
|
||||||
|
for _index: int in count:
|
||||||
|
await process_frame
|
||||||
|
|
||||||
|
|
||||||
|
func _can_capture_image() -> bool:
|
||||||
|
var display_name: String = DisplayServer.get_name().to_lower()
|
||||||
|
return not OS.has_feature("headless") and display_name != "headless" and display_name != "dummy"
|
||||||
|
|
||||||
|
|
||||||
|
func _check(condition: bool, description: String) -> void:
|
||||||
|
if condition:
|
||||||
|
print("PASS: %s" % description)
|
||||||
|
else:
|
||||||
|
_failures += 1
|
||||||
|
push_error("FAIL: %s" % description)
|
||||||
|
|
||||||
|
|
||||||
|
func _finish() -> void:
|
||||||
|
if _stage != null and is_instance_valid(_stage):
|
||||||
|
_stage.queue_free()
|
||||||
|
await process_frame
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dlfqvtmghrm0w
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
const ACTION_EDITOR_SCRIPT := preload("res://scripts/editors/stage/action_editor.gd")
|
||||||
|
const ACTION_REGISTRY := preload("res://scripts/stage/action_registry.gd")
|
||||||
|
const PROP_BLOCK_SCRIPT := preload("res://scripts/props/prop_block.gd")
|
||||||
|
const PROP_ANCHOR_DATA := preload("res://scripts/props/prop_anchor_data.gd")
|
||||||
|
const STAGE_SELECTION_SCRIPT := preload("res://scripts/stage/stage_selection.gd")
|
||||||
|
const CAPTURE_SESSION_SCRIPT := preload("res://scripts/editors/stage/stage_target_capture_session.gd")
|
||||||
|
const DIRECTOR_VISUALS_SCRIPT := preload("res://scripts/stage/stage_director_visuals.gd")
|
||||||
|
const CAPTURE_DIR := "res://tests/phase20b_captures/pickup_prop_ui"
|
||||||
|
|
||||||
|
var _failures: int = 0
|
||||||
|
var _long_name: bool = false
|
||||||
|
var _resolved_action: Dictionary = {}
|
||||||
|
|
||||||
|
|
||||||
|
func _initialize() -> void:
|
||||||
|
call_deferred("_run")
|
||||||
|
|
||||||
|
|
||||||
|
func _run() -> void:
|
||||||
|
root.size = Vector2i(1280, 720)
|
||||||
|
root.gui_embed_subwindows = true
|
||||||
|
DirAccess.make_dir_recursive_absolute(ProjectSettings.globalize_path(CAPTURE_DIR))
|
||||||
|
var camera := Camera2D.new()
|
||||||
|
root.add_child(camera)
|
||||||
|
camera.make_current()
|
||||||
|
var world := Node2D.new()
|
||||||
|
world.name = "World"
|
||||||
|
root.add_child(world)
|
||||||
|
var eligible: PropBlock = _make_prop("pickup-prop-1", "Brown Suitcase", Vector2(-120.0, 30.0), true)
|
||||||
|
var ineligible: PropBlock = _make_prop("pickup-prop-2", "Garden Gnome", Vector2(190.0, 30.0), false)
|
||||||
|
world.add_child(eligible)
|
||||||
|
world.add_child(ineligible)
|
||||||
|
await _wait_frames(3)
|
||||||
|
|
||||||
|
var visuals: StageDirectorVisuals = DIRECTOR_VISUALS_SCRIPT.new() as StageDirectorVisuals
|
||||||
|
visuals.camera = camera
|
||||||
|
visuals.world = world
|
||||||
|
visuals.ui_font = ThemeDB.fallback_font
|
||||||
|
visuals.emoji_font = ThemeDB.fallback_font
|
||||||
|
root.add_child(visuals)
|
||||||
|
var candidate_props: Array[PropBlock] = [eligible]
|
||||||
|
visuals.set_pickup_candidates(candidate_props, eligible)
|
||||||
|
await _wait_frames(3)
|
||||||
|
if _can_capture_image():
|
||||||
|
var candidate_texture: Texture2D = root.get_texture()
|
||||||
|
if candidate_texture != null:
|
||||||
|
var candidate_image: Image = candidate_texture.get_image()
|
||||||
|
if candidate_image != null and not candidate_image.is_empty():
|
||||||
|
candidate_image.save_png(ProjectSettings.globalize_path(CAPTURE_DIR.path_join("pickup_candidates.png")))
|
||||||
|
_check(visuals.get("_pickup_candidate_props").size() == 1, "only eligible props are highlighted as pickup candidates")
|
||||||
|
_check(visuals.get("_pickup_hovered_prop") == eligible, "hover focus stays on an eligible prop")
|
||||||
|
|
||||||
|
var selection: StageSelection = STAGE_SELECTION_SCRIPT.new(world, camera) as StageSelection
|
||||||
|
var session: StageTargetCaptureSession = CAPTURE_SESSION_SCRIPT.new() as StageTargetCaptureSession
|
||||||
|
session.begin(StageTargetCaptureSession.Kind.PICKUP_PROP, "Choose a prop", Callable(), Callable())
|
||||||
|
var valid_result: Dictionary = session.resolve_target(eligible.global_position, selection, visuals, false, 16.0)
|
||||||
|
_check(bool(valid_result.get("valid", false)) and valid_result.get("value") == eligible, "pickup capture resolves an eligible prop")
|
||||||
|
var invalid_result: Dictionary = session.resolve_target(ineligible.global_position, selection, visuals, false, 16.0)
|
||||||
|
_check(not bool(invalid_result.get("valid", false)) and String(invalid_result.get("reason", "")).contains("grip"), "pickup capture explains why a non-pickup prop cannot be chosen")
|
||||||
|
session.kind = StageTargetCaptureSession.Kind.PROP
|
||||||
|
var generic_result: Dictionary = session.resolve_target(ineligible.global_position, selection, visuals, false, 16.0)
|
||||||
|
_check(bool(generic_result.get("valid", false)) and generic_result.get("value") == ineligible, "generic prop capture remains able to target any prop")
|
||||||
|
var pickup_action: Dictionary = {"type": "pick_up_prop", "target_prop_id": eligible.stage_object_id}
|
||||||
|
_check(ACTION_REGISTRY.summarize(pickup_action, Callable(self, "_resolve_prop_name")) == "Pick Up Prop · Brown Suitcase", "pickup summaries use the stage prop name")
|
||||||
|
_check(ACTION_REGISTRY.summarize(pickup_action) == "Pick Up Prop", "pickup summaries never expose internal IDs when no name resolver is set")
|
||||||
|
visuals.clear_pickup_candidates()
|
||||||
|
await _wait_frames(3)
|
||||||
|
|
||||||
|
var action_editor: ActionEditor = ACTION_EDITOR_SCRIPT.new() as ActionEditor
|
||||||
|
root.add_child(action_editor)
|
||||||
|
action_editor.set_prop_target_name_resolver(Callable(self, "_resolve_prop_name"))
|
||||||
|
action_editor.open_new(false, false, "pick_up_prop")
|
||||||
|
action_editor.set_prop_target(eligible.stage_object_id)
|
||||||
|
await _wait_frames(3)
|
||||||
|
var prop_label: Label = action_editor.get("_prop_target_label") as Label
|
||||||
|
var change_button: Button = action_editor.get("_set_prop_target_btn") as Button
|
||||||
|
var left_button: Button = _button_with_text(action_editor, "Left")
|
||||||
|
var auto_button: Button = _button_with_text(action_editor, "Auto")
|
||||||
|
var right_button: Button = _button_with_text(action_editor, "Right")
|
||||||
|
var done_button: Button = _button_with_text(action_editor, "Done")
|
||||||
|
var cancel_button: Button = _button_with_text(action_editor, "Cancel")
|
||||||
|
_check(prop_label != null and prop_label.text == "Brown Suitcase" and not prop_label.text.contains(eligible.stage_object_id), "pickup dialog shows the friendly stage name instead of the ID")
|
||||||
|
_check(change_button != null and change_button.text == "Change prop" and change_button.get_global_rect().size.x >= 300.0, "Change prop is its own wide control below the name card")
|
||||||
|
_check(left_button != null and auto_button != null and right_button != null and auto_button.custom_minimum_size.y >= 44.0 and left_button.custom_minimum_size.y >= 44.0 and right_button.custom_minimum_size.y >= 44.0, "hand choices are large, visible segmented buttons")
|
||||||
|
_check(done_button != null and cancel_button != null and done_button.get_global_rect().end.y <= root.size.y and cancel_button.get_global_rect().end.y <= root.size.y, "Cancel and Done remain visible in the safe viewport")
|
||||||
|
_long_name = true
|
||||||
|
action_editor.set_prop_target(eligible.stage_object_id)
|
||||||
|
await _wait_frames(3)
|
||||||
|
_check(prop_label.text.length() > 50 and prop_label.get_global_rect().position.x >= 0.0 and prop_label.get_global_rect().end.x <= root.size.x, "a long prop name wraps inside the dialog without clipping its controls")
|
||||||
|
var body_scroll: ScrollContainer = action_editor.find_child("ActionEditorBodyScroll", true, false) as ScrollContainer
|
||||||
|
_check(body_scroll != null and auto_button.get_global_rect().position.y >= body_scroll.get_global_rect().position.y and right_button.get_global_rect().end.y <= body_scroll.get_global_rect().end.y, "all hand choices remain visible without scrolling when the prop name is long")
|
||||||
|
if _can_capture_image():
|
||||||
|
var dialog_texture: Texture2D = root.get_texture()
|
||||||
|
if dialog_texture != null:
|
||||||
|
var dialog_image: Image = dialog_texture.get_image()
|
||||||
|
if dialog_image != null and not dialog_image.is_empty():
|
||||||
|
dialog_image.save_png(ProjectSettings.globalize_path(CAPTURE_DIR.path_join("pickup_action_dialog_long_name.png")))
|
||||||
|
action_editor.call("_set_pickup_hand", "left")
|
||||||
|
_check(String(action_editor.call("_selected_pickup_hand")) == "left", "hand selection records the clicked hand choice")
|
||||||
|
action_editor.committed.connect(func(action: Dictionary) -> void: _resolved_action = action.duplicate(true))
|
||||||
|
action_editor.call("_on_ok_pressed")
|
||||||
|
print("Pickup action commit: %s" % JSON.stringify(_resolved_action))
|
||||||
|
_check(String(_resolved_action.get("target_prop_id", "")) == eligible.stage_object_id and String(_resolved_action.get("hand", "")) == "left", "Done retains the prop ID for saved data and commits the selected hand")
|
||||||
|
|
||||||
|
_check((visuals.get("_pickup_candidate_props") as Array).is_empty(), "pickup highlights can be cleared after capture ends")
|
||||||
|
_print_result()
|
||||||
|
quit(1 if _failures > 0 else 0)
|
||||||
|
|
||||||
|
|
||||||
|
func _make_prop(stage_id: String, display_name: String, position: Vector2, eligible: bool) -> PropBlock:
|
||||||
|
var prop: PropBlock = PROP_BLOCK_SCRIPT.new() as PropBlock
|
||||||
|
prop.name = display_name.replace(" ", "")
|
||||||
|
prop.stage_object_id = stage_id
|
||||||
|
prop.stage_name = display_name
|
||||||
|
prop.position = position
|
||||||
|
prop.polygon_points = PackedVector2Array([Vector2(-44.0, -28.0), Vector2(44.0, -28.0), Vector2(44.0, 28.0), Vector2(-44.0, 28.0)])
|
||||||
|
prop.stage_roles = {"can_pick_up": eligible}
|
||||||
|
prop.set_interaction_anchors(PROP_ANCHOR_DATA.preset_layout("one_handed", Rect2(Vector2(-44.0, -28.0), Vector2(88.0, 56.0))))
|
||||||
|
return prop
|
||||||
|
|
||||||
|
|
||||||
|
func _resolve_prop_name(_prop_id: String) -> String:
|
||||||
|
return "The Very Long Brown Suitcase with a Surprisingly Long Name for Layout Testing" if _long_name else "Brown Suitcase"
|
||||||
|
|
||||||
|
|
||||||
|
func _button_with_text(root_node: Node, button_text: String) -> Button:
|
||||||
|
if root_node == null:
|
||||||
|
return null
|
||||||
|
for candidate: Node in root_node.find_children("*", "Button", true, false):
|
||||||
|
var button: Button = candidate as Button
|
||||||
|
if button != null and button.text == button_text:
|
||||||
|
return button
|
||||||
|
return null
|
||||||
|
|
||||||
|
|
||||||
|
func _wait_frames(count: int) -> void:
|
||||||
|
for _index: int in count:
|
||||||
|
await process_frame
|
||||||
|
|
||||||
|
|
||||||
|
func _can_capture_image() -> bool:
|
||||||
|
var display_name: String = DisplayServer.get_name().to_lower()
|
||||||
|
return not OS.has_feature("headless") and display_name != "headless" and display_name != "dummy"
|
||||||
|
|
||||||
|
|
||||||
|
func _check(condition: bool, description: String) -> void:
|
||||||
|
if condition:
|
||||||
|
print("PASS: %s" % description)
|
||||||
|
else:
|
||||||
|
_failures += 1
|
||||||
|
push_error("FAIL: %s" % description)
|
||||||
|
|
||||||
|
|
||||||
|
func _print_result() -> void:
|
||||||
|
print("PHASE20B_PICKUP_PROP_UI_RESULT failures=%d captures=%s" % [_failures, CAPTURE_DIR])
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cyrngnepw6vvi
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
const SANDBOX_STAGE: PackedScene = preload("res://scenes/stage/sandbox_stage.tscn")
|
||||||
|
const PROP_STAGE_ROLES := preload("res://scripts/props/prop_stage_roles.gd")
|
||||||
|
const CAPTURE_DIR := "res://tests/phase20b_captures/set_down_surface_highlights"
|
||||||
|
|
||||||
|
var _stage: SandboxStage
|
||||||
|
var _failures: int = 0
|
||||||
|
|
||||||
|
|
||||||
|
func _initialize() -> void:
|
||||||
|
call_deferred("_run")
|
||||||
|
|
||||||
|
|
||||||
|
func _run() -> void:
|
||||||
|
root.size = Vector2i(1280, 720)
|
||||||
|
root.gui_embed_subwindows = true
|
||||||
|
var make_dir_error: Error = DirAccess.make_dir_recursive_absolute(ProjectSettings.globalize_path(CAPTURE_DIR))
|
||||||
|
_check(make_dir_error == OK or make_dir_error == ERR_ALREADY_EXISTS, "capture folder is available")
|
||||||
|
_stage = SANDBOX_STAGE.instantiate() as SandboxStage
|
||||||
|
root.add_child(_stage)
|
||||||
|
await _wait_frames(10)
|
||||||
|
var recovery: ConfirmationDialog = _stage.find_child("AutosaveRecoveryDialog", true, false) as ConfirmationDialog
|
||||||
|
if recovery != null:
|
||||||
|
recovery.hide()
|
||||||
|
_stage.call("_on_grid_toggled", false)
|
||||||
|
var spawner: StageSpawner = _stage.get("_spawner") as StageSpawner
|
||||||
|
var actor: StickmanRig = spawner.spawn_stickman_asset("res://content/stickmen/break.stk", Vector2(-160.0, -190.0))
|
||||||
|
var supported_prop: PropBlock = spawner.spawn_prop_asset("crate", Vector2(110.0, -10.0))
|
||||||
|
var unsupported_prop: PropBlock = spawner.spawn_prop_asset("crate", Vector2(300.0, -10.0))
|
||||||
|
_check(actor != null and supported_prop != null and unsupported_prop != null, "stage fixtures spawn")
|
||||||
|
if actor == null or supported_prop == null or unsupported_prop == null:
|
||||||
|
await _finish()
|
||||||
|
quit(1)
|
||||||
|
return
|
||||||
|
_stage.call("_finalize_placed_node", actor)
|
||||||
|
_stage.call("_finalize_placed_node", supported_prop)
|
||||||
|
_stage.call("_finalize_placed_node", unsupported_prop)
|
||||||
|
var supported_roles: Dictionary = PROP_STAGE_ROLES.new_placement(supported_prop.has_usable_grip())
|
||||||
|
supported_roles["holds_other_props"] = true
|
||||||
|
supported_prop.set_stage_roles(supported_roles)
|
||||||
|
var unsupported_roles: Dictionary = PROP_STAGE_ROLES.new_placement(unsupported_prop.has_usable_grip())
|
||||||
|
unsupported_roles["holds_other_props"] = false
|
||||||
|
unsupported_prop.set_stage_roles(unsupported_roles)
|
||||||
|
var set_down_action: Dictionary = {
|
||||||
|
"action_id": "set-down-highlight-step-one",
|
||||||
|
"type": "set_down_prop",
|
||||||
|
"target_position": Vector2(110.0, -10.0),
|
||||||
|
}
|
||||||
|
_check(actor.set_action_plan([{"actions": [set_down_action]}]), "Step 1 contains the Set Down Prop action")
|
||||||
|
_stage.call("set_mode", SandboxStage.StageMode.DIRECT)
|
||||||
|
var selection: StageSelection = _stage.get("_selection") as StageSelection
|
||||||
|
selection.select_only(actor)
|
||||||
|
_stage.call("_refresh_character_settings_card")
|
||||||
|
await _wait_frames(8)
|
||||||
|
var overlay: StagePlacementOverlay = _stage.get("_placement_overlay") as StagePlacementOverlay
|
||||||
|
_check(overlay != null and overlay.surface_world == _stage.get_node("World"), "set-down overlay reads the live stage world")
|
||||||
|
var support_points: PackedVector2Array = overlay.call("_prop_collision_world_points", supported_prop)
|
||||||
|
var excluded_points: PackedVector2Array = overlay.call("_prop_collision_world_points", unsupported_prop)
|
||||||
|
var support_edges: Array[PackedVector2Array] = overlay.call("_top_facing_edges", support_points)
|
||||||
|
var excluded_edges: Array[PackedVector2Array] = overlay.call("_top_facing_edges", excluded_points)
|
||||||
|
_check(not support_edges.is_empty() and not excluded_edges.is_empty(), "both props expose a top edge for role filtering")
|
||||||
|
if support_edges.is_empty() or excluded_edges.is_empty():
|
||||||
|
await _finish()
|
||||||
|
quit(1)
|
||||||
|
return
|
||||||
|
var target_world: Vector2 = (support_edges[0][0] + support_edges[0][1]) * 0.5
|
||||||
|
var screen_target: Vector2 = _stage.get_viewport().get_canvas_transform() * target_world
|
||||||
|
await _send_mouse_motion(screen_target)
|
||||||
|
_stage.call("_begin_set_down_position_capture", actor, "Click where to let go", Callable(), Callable())
|
||||||
|
await _wait_frames(6)
|
||||||
|
var capture_overlay: StageInspectorCaptureOverlay = _stage.get("_inspector_capture_overlay") as StageInspectorCaptureOverlay
|
||||||
|
var capture_prompt: Label = capture_overlay.find_child("CapturePrompt", true, false) as Label if capture_overlay != null else null
|
||||||
|
var cancel_button: Button = capture_overlay.find_child("Capture_cancel_capture", true, false) as Button if capture_overlay != null else null
|
||||||
|
_check(capture_overlay != null and capture_overlay.has_capture(), "Set Down capture shows the inspector capture row")
|
||||||
|
_check(capture_prompt != null and capture_prompt.text == "Set Down Prop", "inspector row names the action without a long hint")
|
||||||
|
_check(cancel_button != null and cancel_button.visible, "the inspector Cancel button stays visible")
|
||||||
|
var action_tooltip: Control = _stage.find_child("ActionTooltip", true, false) as Control
|
||||||
|
_check(action_tooltip == null or not action_tooltip.visible, "set-down capture has no extra floating instruction text")
|
||||||
|
_check(overlay.action_visible and overlay.set_down_preview_visible and not overlay.action_show_trajectory, "set-down capture shows surfaces without the old trajectory")
|
||||||
|
var capture_path: String = CAPTURE_DIR.path_join("set_down_support_surface_filter.png")
|
||||||
|
await RenderingServer.frame_post_draw
|
||||||
|
var image: Image = root.get_texture().get_image()
|
||||||
|
var save_error: Error = image.save_png(ProjectSettings.globalize_path(capture_path)) if image != null and not image.is_empty() else ERR_CANT_CREATE
|
||||||
|
_check(save_error == OK, "focused Godot run saves the set-down surface capture")
|
||||||
|
var canvas_transform: Transform2D = _stage.get_viewport().get_canvas_transform()
|
||||||
|
var supported_mid: Vector2 = canvas_transform * ((support_edges[0][0] + support_edges[0][1]) * 0.5)
|
||||||
|
var unsupported_mid: Vector2 = canvas_transform * ((excluded_edges[0][0] + excluded_edges[0][1]) * 0.5)
|
||||||
|
_check(_has_cyan_near(image, supported_mid), "Props can sit on top surface receives a cyan highlight")
|
||||||
|
_check(not _has_cyan_near(image, unsupported_mid), "prop with Props can sit on top off receives no cyan highlight")
|
||||||
|
print("SET_DOWN_SURFACE_CAPTURE path=%s size=%s supported=%s unsupported=%s" % [capture_path, str(image.get_size()) if image != null else "missing", str(supported_mid), str(unsupported_mid)])
|
||||||
|
await _send_escape()
|
||||||
|
_check(not capture_overlay.has_capture(), "Escape cancels set-down capture and removes the inspector strip")
|
||||||
|
print("PHASE20B_SET_DOWN_SURFACE_RESULT failures=%d" % _failures)
|
||||||
|
await _finish()
|
||||||
|
quit(1 if _failures > 0 else 0)
|
||||||
|
|
||||||
|
|
||||||
|
func _has_cyan_near(image: Image, position: Vector2) -> bool:
|
||||||
|
if image == null or image.is_empty():
|
||||||
|
return false
|
||||||
|
var center: Vector2i = Vector2i(roundi(position.x), roundi(position.y))
|
||||||
|
for y: int in range(center.y - 3, center.y + 4):
|
||||||
|
for x: int in range(center.x - 3, center.x + 4):
|
||||||
|
if x < 0 or y < 0 or x >= image.get_width() or y >= image.get_height():
|
||||||
|
continue
|
||||||
|
var pixel: Color = image.get_pixel(x, y)
|
||||||
|
if pixel.g > pixel.r + 0.08 and pixel.b > pixel.r + 0.05:
|
||||||
|
return true
|
||||||
|
return false
|
||||||
|
|
||||||
|
|
||||||
|
func _send_mouse_motion(position: Vector2) -> void:
|
||||||
|
var motion: InputEventMouseMotion = InputEventMouseMotion.new()
|
||||||
|
motion.position = position
|
||||||
|
motion.global_position = position
|
||||||
|
Input.parse_input_event(motion)
|
||||||
|
await _wait_frames(2)
|
||||||
|
|
||||||
|
|
||||||
|
func _send_escape() -> void:
|
||||||
|
var escape: InputEventKey = InputEventKey.new()
|
||||||
|
escape.keycode = KEY_ESCAPE
|
||||||
|
escape.pressed = true
|
||||||
|
Input.parse_input_event(escape)
|
||||||
|
await _wait_frames(3)
|
||||||
|
|
||||||
|
|
||||||
|
func _wait_frames(count: int) -> void:
|
||||||
|
for _index: int in count:
|
||||||
|
await process_frame
|
||||||
|
await RenderingServer.frame_post_draw
|
||||||
|
|
||||||
|
|
||||||
|
func _check(condition: bool, message: String) -> void:
|
||||||
|
if condition:
|
||||||
|
print("PASS: %s" % message)
|
||||||
|
else:
|
||||||
|
_failures += 1
|
||||||
|
push_error("FAIL: " + message)
|
||||||
|
|
||||||
|
|
||||||
|
func _finish() -> void:
|
||||||
|
if _stage != null and is_instance_valid(_stage):
|
||||||
|
_stage.queue_free()
|
||||||
|
await process_frame
|
||||||
Reference in New Issue
Block a user