From a2eac36d063ad4f38ccbbda5b04a9a9016973101 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Sat, 8 Nov 2025 20:14:06 -0500 Subject: [PATCH] feat: add enhanced entity injection script with full property support --- tools/inject_entities_enhanced.py | 276 ++++++++++++++++++++++++++++++ 1 file changed, 276 insertions(+) create mode 100755 tools/inject_entities_enhanced.py 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('