diff --git a/tools/inject_entities_enhanced.py b/tools/inject_entities_enhanced.py new file mode 100755 index 0000000..00a077e --- /dev/null +++ b/tools/inject_entities_enhanced.py @@ -0,0 +1,276 @@ +#!/usr/bin/env python3 +""" +Enhanced entity injection script with full property support: +- Position (x, y, z) +- Rotation (quaternion: x, y, z, w) +- Dimensions (x, y, z) / Scale +- Model URL +- Texture URL +- Color +""" + +import socket +import struct +import time +import argparse + +# Overte packet types +PACKET_TYPE_ENTITY_ADD = 0x10 +PACKET_TYPE_ENTITY_EDIT = 0x11 +PACKET_TYPE_ENTITY_ERASE = 0x12 + +def send_entity_add_full(sock, addr, entity_id, name, position, rotation, dimensions, model_url="", texture_url="", color=(1.0, 1.0, 1.0)): + """ + Send a full EntityAdd packet with all properties + + Args: + entity_id: uint64 + name: string + position: (x, y, z) tuple of floats + rotation: (x, y, z, w) quaternion tuple of floats + dimensions: (x, y, z) tuple of floats + model_url: string (optional) + texture_url: string (optional) + color: (r, g, b) tuple of floats 0-1 (optional) + """ + # Packet structure: + # [type:u8][id:u64][name:null-terminated][position:3xf32][rotation:4xf32][dimensions:3xf32][model_url:null-terminated][texture_url:null-terminated][color:3xf32] + + packet = struct.pack('