flockbay 0.10.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/bin/flockbay-mcp.mjs +56 -0
- package/bin/flockbay.mjs +78 -0
- package/dist/codex/flockbayMcpStdioBridge.cjs +383 -0
- package/dist/codex/flockbayMcpStdioBridge.d.cts +2 -0
- package/dist/codex/flockbayMcpStdioBridge.d.mts +2 -0
- package/dist/codex/flockbayMcpStdioBridge.mjs +381 -0
- package/dist/flockbayScreenshotGate-DJX3Is5d.mjs +136 -0
- package/dist/flockbayScreenshotGate-DkxU24cR.cjs +138 -0
- package/dist/index--o4BPz5o.cjs +10311 -0
- package/dist/index-CUp3juDS.mjs +10268 -0
- package/dist/index.cjs +43 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +40 -0
- package/dist/lib.cjs +33 -0
- package/dist/lib.d.cts +957 -0
- package/dist/lib.d.mts +957 -0
- package/dist/lib.mjs +23 -0
- package/dist/runCodex-D3eT-TvB.cjs +3449 -0
- package/dist/runCodex-o6PCbHQ7.mjs +3446 -0
- package/dist/runGemini-Bt0oEj_g.mjs +3183 -0
- package/dist/runGemini-CBxZp6I7.cjs +3185 -0
- package/dist/types-C-jnUdn_.cjs +4498 -0
- package/dist/types-DGd6ea2Z.mjs +4450 -0
- package/kits/kit.open_world/kit.json +59 -0
- package/package.json +130 -0
- package/scripts/claude_local_launcher.cjs +73 -0
- package/scripts/claude_remote_launcher.cjs +16 -0
- package/scripts/claude_version_utils.cjs +391 -0
- package/scripts/ripgrep_launcher.cjs +33 -0
- package/scripts/session_hook_forwarder.cjs +49 -0
- package/scripts/test-codex-abort-history.mjs +77 -0
- package/scripts/unpack-tools.cjs +222 -0
- package/tools/licenses/difftastic-LICENSE +21 -0
- package/tools/licenses/ripgrep-LICENSE +3 -0
- package/tools/unreal-mcp/UPSTREAM_VERSION.md +8 -0
- package/tools/unreal-mcp/upstream/Docs/README.md +8 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/README.md +7 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/actor_tools.md +184 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/blueprint_tools.md +268 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/editor_tools.md +104 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/node_tools.md +274 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Config/FilterPlugin.ini +8 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPBlueprintCommands.cpp +1160 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPBlueprintNodeCommands.cpp +924 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPCommonUtils.cpp +709 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPEditorCommands.cpp +896 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPProjectCommands.cpp +72 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPUMGCommands.cpp +544 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/MCPServerRunnable.cpp +321 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/UnrealMCPBridge.cpp +419 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/UnrealMCPModule.cpp +21 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPBlueprintCommands.h +34 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPBlueprintNodeCommands.h +27 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPCommonUtils.h +59 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPEditorCommands.h +40 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPProjectCommands.h +20 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPUMGCommands.h +82 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/MCPServerRunnable.h +34 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/UnrealMCPBridge.h +64 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/UnrealMCPModule.h +22 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/UnrealMCP.Build.cs +78 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/UnrealMCP.uplugin +36 -0
- package/tools/unreal-mcp/upstream/Python/README.md +40 -0
- package/tools/unreal-mcp/upstream/Python/pyproject.toml +22 -0
- package/tools/unreal-mcp/upstream/Python/scripts/actors/test_cube.py +203 -0
- package/tools/unreal-mcp/upstream/Python/scripts/blueprints/test_create_and_spawn_blueprints_with_different_components.py +497 -0
- package/tools/unreal-mcp/upstream/Python/scripts/blueprints/test_create_and_spawn_cube_blueprint.py +194 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_component_reference.py +267 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_create_bird_blueprint_with_input_and_camera.py +618 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_input_mapping.py +366 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_physics_variables.py +390 -0
- package/tools/unreal-mcp/upstream/Python/tools/blueprint_tools.py +420 -0
- package/tools/unreal-mcp/upstream/Python/tools/editor_tools.py +369 -0
- package/tools/unreal-mcp/upstream/Python/tools/node_tools.py +430 -0
- package/tools/unreal-mcp/upstream/Python/tools/project_tools.py +64 -0
- package/tools/unreal-mcp/upstream/Python/tools/umg_tools.py +333 -0
- package/tools/unreal-mcp/upstream/Python/unreal_mcp_server.py +398 -0
- package/tools/unreal-mcp/upstream/Python/uv.lock +521 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""
|
|
3
|
+
Test script for blueprint input mapping via MCP.
|
|
4
|
+
This script creates input mappings and connects them to functions in a Blueprint.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
import os
|
|
9
|
+
import time
|
|
10
|
+
import socket
|
|
11
|
+
import json
|
|
12
|
+
import logging
|
|
13
|
+
from typing import Dict, List, Any, Optional
|
|
14
|
+
|
|
15
|
+
# Add the parent directory to the path so we can import the server module
|
|
16
|
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
|
17
|
+
|
|
18
|
+
# Set up logging
|
|
19
|
+
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
20
|
+
logger = logging.getLogger("TestInputMapping")
|
|
21
|
+
|
|
22
|
+
def send_command(sock: socket.socket, command: str, params: Dict[str, Any]) -> Optional[Dict[str, Any]]:
|
|
23
|
+
"""Send a command to the Unreal MCP server and get the response."""
|
|
24
|
+
try:
|
|
25
|
+
# Create command object
|
|
26
|
+
command_obj = {
|
|
27
|
+
"type": command,
|
|
28
|
+
"params": params
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# Convert to JSON and send
|
|
32
|
+
command_json = json.dumps(command_obj)
|
|
33
|
+
logger.info(f"Sending command: {command_json}")
|
|
34
|
+
sock.sendall(command_json.encode('utf-8'))
|
|
35
|
+
|
|
36
|
+
# Receive response
|
|
37
|
+
chunks = []
|
|
38
|
+
while True:
|
|
39
|
+
chunk = sock.recv(4096)
|
|
40
|
+
if not chunk:
|
|
41
|
+
break
|
|
42
|
+
chunks.append(chunk)
|
|
43
|
+
|
|
44
|
+
# Try parsing to see if we have a complete response
|
|
45
|
+
try:
|
|
46
|
+
data = b''.join(chunks)
|
|
47
|
+
json.loads(data.decode('utf-8'))
|
|
48
|
+
# If we can parse it, we have the complete response
|
|
49
|
+
break
|
|
50
|
+
except json.JSONDecodeError:
|
|
51
|
+
# Not a complete JSON object yet, continue receiving
|
|
52
|
+
continue
|
|
53
|
+
|
|
54
|
+
# Parse response
|
|
55
|
+
data = b''.join(chunks)
|
|
56
|
+
response = json.loads(data.decode('utf-8'))
|
|
57
|
+
logger.info(f"Received response: {response}")
|
|
58
|
+
return response
|
|
59
|
+
|
|
60
|
+
except Exception as e:
|
|
61
|
+
logger.error(f"Error sending command: {e}")
|
|
62
|
+
return None
|
|
63
|
+
|
|
64
|
+
def setup_input_mapping(sock: socket.socket, action_name: str, key: str, input_type: str = "Action") -> bool:
|
|
65
|
+
"""Helper function to set up an input mapping."""
|
|
66
|
+
input_params = {
|
|
67
|
+
"action_name": action_name,
|
|
68
|
+
"key": key,
|
|
69
|
+
"input_type": input_type
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
response = send_command(sock, "create_input_mapping", input_params)
|
|
73
|
+
|
|
74
|
+
success = (response and
|
|
75
|
+
response.get("status") == "success" and
|
|
76
|
+
response.get("result", {}).get("success"))
|
|
77
|
+
|
|
78
|
+
if success:
|
|
79
|
+
logger.info(f"Input mapping '{action_name}' created with key '{key}'")
|
|
80
|
+
else:
|
|
81
|
+
logger.error(f"Failed to create input mapping: {response}")
|
|
82
|
+
|
|
83
|
+
return success
|
|
84
|
+
|
|
85
|
+
def main():
|
|
86
|
+
"""Main function to test input mappings in blueprints."""
|
|
87
|
+
try:
|
|
88
|
+
# Step 1: Create a controller blueprint
|
|
89
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
90
|
+
sock.connect(("127.0.0.1", 55557))
|
|
91
|
+
|
|
92
|
+
bp_params = {
|
|
93
|
+
"name": "InputControllerBP",
|
|
94
|
+
"parent_class": "Actor"
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
response = send_command(sock, "create_blueprint", bp_params)
|
|
98
|
+
|
|
99
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
100
|
+
logger.error(f"Failed to create blueprint: {response}")
|
|
101
|
+
return
|
|
102
|
+
|
|
103
|
+
# Check if blueprint already existed
|
|
104
|
+
if response.get("result", {}).get("already_exists"):
|
|
105
|
+
logger.info(f"Blueprint 'InputControllerBP' already exists, reusing it")
|
|
106
|
+
else:
|
|
107
|
+
logger.info("Controller blueprint created successfully!")
|
|
108
|
+
|
|
109
|
+
# Close and reopen connection for each command
|
|
110
|
+
sock.close()
|
|
111
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
112
|
+
sock.connect(("127.0.0.1", 55557))
|
|
113
|
+
|
|
114
|
+
# Step 2: Add variables to track state
|
|
115
|
+
var_params_list = [
|
|
116
|
+
{
|
|
117
|
+
"blueprint_name": "InputControllerBP",
|
|
118
|
+
"variable_name": "Score",
|
|
119
|
+
"variable_type": "Integer",
|
|
120
|
+
"default_value": 0,
|
|
121
|
+
"is_exposed": True
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"blueprint_name": "InputControllerBP",
|
|
125
|
+
"variable_name": "IsGameActive",
|
|
126
|
+
"variable_type": "Boolean",
|
|
127
|
+
"default_value": True,
|
|
128
|
+
"is_exposed": True
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"blueprint_name": "InputControllerBP",
|
|
132
|
+
"variable_name": "PlayerName",
|
|
133
|
+
"variable_type": "String",
|
|
134
|
+
"default_value": "Player1",
|
|
135
|
+
"is_exposed": True
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
|
|
139
|
+
for var_params in var_params_list:
|
|
140
|
+
response = send_command(sock, "add_blueprint_variable", var_params)
|
|
141
|
+
|
|
142
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
143
|
+
logger.error(f"Failed to add variable: {response}")
|
|
144
|
+
return
|
|
145
|
+
|
|
146
|
+
logger.info(f"Variable {var_params['variable_name']} added successfully!")
|
|
147
|
+
|
|
148
|
+
# Close and reopen connection
|
|
149
|
+
sock.close()
|
|
150
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
151
|
+
sock.connect(("127.0.0.1", 55557))
|
|
152
|
+
|
|
153
|
+
# Step 3: Set up input mappings for a simple game controller
|
|
154
|
+
input_mappings = [
|
|
155
|
+
("Jump", "SpaceBar", "Action"),
|
|
156
|
+
("Pause", "P", "Action"),
|
|
157
|
+
("Restart", "R", "Action"),
|
|
158
|
+
("MoveForward", "W", "Axis"),
|
|
159
|
+
("MoveRight", "D", "Axis")
|
|
160
|
+
]
|
|
161
|
+
|
|
162
|
+
for action_name, key, input_type in input_mappings:
|
|
163
|
+
success = setup_input_mapping(sock, action_name, key, input_type)
|
|
164
|
+
if not success:
|
|
165
|
+
return
|
|
166
|
+
|
|
167
|
+
# Close and reopen connection
|
|
168
|
+
sock.close()
|
|
169
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
170
|
+
sock.connect(("127.0.0.1", 55557))
|
|
171
|
+
|
|
172
|
+
# Step 4: Add event nodes for BeginPlay and input actions
|
|
173
|
+
event_node_ids = {}
|
|
174
|
+
|
|
175
|
+
# BeginPlay event
|
|
176
|
+
begin_play_params = {
|
|
177
|
+
"blueprint_name": "InputControllerBP",
|
|
178
|
+
"event_type": "BeginPlay",
|
|
179
|
+
"node_position": [0, 0]
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
response = send_command(sock, "add_blueprint_event_node", begin_play_params)
|
|
183
|
+
|
|
184
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
185
|
+
logger.error(f"Failed to add BeginPlay event node: {response}")
|
|
186
|
+
return
|
|
187
|
+
|
|
188
|
+
logger.info("BeginPlay event node added successfully!")
|
|
189
|
+
event_node_ids["BeginPlay"] = response.get("result", {}).get("node_id")
|
|
190
|
+
|
|
191
|
+
# Close and reopen connection
|
|
192
|
+
sock.close()
|
|
193
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
194
|
+
sock.connect(("127.0.0.1", 55557))
|
|
195
|
+
|
|
196
|
+
# Step 5: Add function nodes for different actions
|
|
197
|
+
function_node_ids = {}
|
|
198
|
+
|
|
199
|
+
# Print String function for BeginPlay
|
|
200
|
+
function_params = {
|
|
201
|
+
"blueprint_name": "InputControllerBP",
|
|
202
|
+
"target": "self",
|
|
203
|
+
"function_name": "PrintString",
|
|
204
|
+
"params": {
|
|
205
|
+
"InString": "Input Controller Initialized",
|
|
206
|
+
"Duration": 5.0
|
|
207
|
+
},
|
|
208
|
+
"node_position": [250, 0]
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
response = send_command(sock, "add_blueprint_function_node", function_params)
|
|
212
|
+
|
|
213
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
214
|
+
logger.error(f"Failed to add PrintString function node: {response}")
|
|
215
|
+
return
|
|
216
|
+
|
|
217
|
+
logger.info("PrintString function node added successfully!")
|
|
218
|
+
function_node_ids["PrintInit"] = response.get("result", {}).get("node_id")
|
|
219
|
+
|
|
220
|
+
# For each action, add a event node and function node
|
|
221
|
+
action_positions = {
|
|
222
|
+
"Jump": [0, 150],
|
|
223
|
+
"Pause": [0, 300],
|
|
224
|
+
"Restart": [0, 450],
|
|
225
|
+
"MoveForward": [0, 600],
|
|
226
|
+
"MoveRight": [0, 750]
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function_positions = {
|
|
230
|
+
"Jump": [250, 150],
|
|
231
|
+
"Pause": [250, 300],
|
|
232
|
+
"Restart": [250, 450],
|
|
233
|
+
"MoveForward": [250, 600],
|
|
234
|
+
"MoveRight": [250, 750]
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
# Since we can't directly create InputAction nodes, we'll simulate with BeginPlay
|
|
238
|
+
for action_name in ["Jump", "Pause", "Restart"]:
|
|
239
|
+
# Close and reopen connection
|
|
240
|
+
sock.close()
|
|
241
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
242
|
+
sock.connect(("127.0.0.1", 55557))
|
|
243
|
+
|
|
244
|
+
# Create placeholder event node
|
|
245
|
+
event_params = {
|
|
246
|
+
"blueprint_name": "InputControllerBP",
|
|
247
|
+
"event_type": "BeginPlay", # Using BeginPlay as a placeholder for InputAction
|
|
248
|
+
"node_position": action_positions[action_name]
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
response = send_command(sock, "add_blueprint_event_node", event_params)
|
|
252
|
+
|
|
253
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
254
|
+
logger.error(f"Failed to add event node for {action_name}: {response}")
|
|
255
|
+
return
|
|
256
|
+
|
|
257
|
+
logger.info(f"Event node for {action_name} added (simulated)")
|
|
258
|
+
event_node_ids[action_name] = response.get("result", {}).get("node_id")
|
|
259
|
+
|
|
260
|
+
# Close and reopen connection
|
|
261
|
+
sock.close()
|
|
262
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
263
|
+
sock.connect(("127.0.0.1", 55557))
|
|
264
|
+
|
|
265
|
+
# Create function node to print what action was performed
|
|
266
|
+
function_params = {
|
|
267
|
+
"blueprint_name": "InputControllerBP",
|
|
268
|
+
"target": "self",
|
|
269
|
+
"function_name": "PrintString",
|
|
270
|
+
"params": {
|
|
271
|
+
"InString": f"{action_name} Action Triggered",
|
|
272
|
+
"Duration": 2.0
|
|
273
|
+
},
|
|
274
|
+
"node_position": function_positions[action_name]
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
response = send_command(sock, "add_blueprint_function_node", function_params)
|
|
278
|
+
|
|
279
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
280
|
+
logger.error(f"Failed to add function node for {action_name}: {response}")
|
|
281
|
+
return
|
|
282
|
+
|
|
283
|
+
logger.info(f"Function node for {action_name} added successfully!")
|
|
284
|
+
function_node_ids[action_name] = response.get("result", {}).get("node_id")
|
|
285
|
+
|
|
286
|
+
# Step 6: Connect nodes
|
|
287
|
+
for action_name in ["BeginPlay"] + list(action_positions.keys())[:3]: # BeginPlay + first 3 actions
|
|
288
|
+
# Close and reopen connection
|
|
289
|
+
sock.close()
|
|
290
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
291
|
+
sock.connect(("127.0.0.1", 55557))
|
|
292
|
+
|
|
293
|
+
# Connect appropriate function based on event type
|
|
294
|
+
if action_name == "BeginPlay":
|
|
295
|
+
target_function = "PrintInit"
|
|
296
|
+
else:
|
|
297
|
+
target_function = action_name
|
|
298
|
+
|
|
299
|
+
connect_params = {
|
|
300
|
+
"blueprint_name": "InputControllerBP",
|
|
301
|
+
"source_node_id": event_node_ids[action_name],
|
|
302
|
+
"source_pin": "Then", # Execute pin on event
|
|
303
|
+
"target_node_id": function_node_ids[target_function],
|
|
304
|
+
"target_pin": "execute" # Execute pin on function
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
response = send_command(sock, "connect_blueprint_nodes", connect_params)
|
|
308
|
+
|
|
309
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
310
|
+
logger.error(f"Failed to connect nodes for {action_name}: {response}")
|
|
311
|
+
return
|
|
312
|
+
|
|
313
|
+
logger.info(f"Connected {action_name} event to function successfully!")
|
|
314
|
+
|
|
315
|
+
# Step 7: Compile the blueprint
|
|
316
|
+
sock.close()
|
|
317
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
318
|
+
sock.connect(("127.0.0.1", 55557))
|
|
319
|
+
|
|
320
|
+
compile_params = {
|
|
321
|
+
"blueprint_name": "InputControllerBP"
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
response = send_command(sock, "compile_blueprint", compile_params)
|
|
325
|
+
|
|
326
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
327
|
+
logger.error(f"Failed to compile blueprint: {response}")
|
|
328
|
+
return
|
|
329
|
+
|
|
330
|
+
logger.info("Blueprint compiled successfully!")
|
|
331
|
+
|
|
332
|
+
# Step 8: Spawn the controller in the level
|
|
333
|
+
sock.close()
|
|
334
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
335
|
+
sock.connect(("127.0.0.1", 55557))
|
|
336
|
+
|
|
337
|
+
spawn_params = {
|
|
338
|
+
"blueprint_name": "InputControllerBP",
|
|
339
|
+
"actor_name": "InputController",
|
|
340
|
+
"location": [0.0, 0.0, 100.0],
|
|
341
|
+
"rotation": [0.0, 0.0, 0.0],
|
|
342
|
+
"scale": [1.0, 1.0, 1.0]
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
response = send_command(sock, "spawn_blueprint_actor", spawn_params)
|
|
346
|
+
|
|
347
|
+
if not response or response.get("status") != "success" or not response.get("result", {}).get("success"):
|
|
348
|
+
logger.error(f"Failed to spawn blueprint actor: {response}")
|
|
349
|
+
return
|
|
350
|
+
|
|
351
|
+
logger.info("Input controller spawned successfully!")
|
|
352
|
+
logger.info("The controller will run the BeginPlay event and show a message.")
|
|
353
|
+
logger.info("The following input mappings have been set up:")
|
|
354
|
+
|
|
355
|
+
for action_name, key, input_type in input_mappings:
|
|
356
|
+
logger.info(f" - {action_name}: {key} ({input_type})")
|
|
357
|
+
|
|
358
|
+
# Close final connection
|
|
359
|
+
sock.close()
|
|
360
|
+
|
|
361
|
+
except Exception as e:
|
|
362
|
+
logger.error(f"Error: {e}")
|
|
363
|
+
sys.exit(1)
|
|
364
|
+
|
|
365
|
+
if __name__ == "__main__":
|
|
366
|
+
main()
|