Compare commits

...

2 Commits

2 changed files with 37 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
Godot Engine v4.6.2.stable.official.71f334935 - https://godotengine.org
roundtrip bounds.position = (0.0, 0.0, 0.0) (expected (0.5, 1.5, 2.5))
roundtrip coord = (0, 0, 0) (expected (1, 2, 3))
format_version present? -> <null>
version field -> 1
SCRIPT ERROR: Invalid assignment of property or key 'properties' with value of type 'bool' on a base object of type 'RefCounted (WorldObjectData)'.
at: _parse_object_section (res://scripts/chunk_data_decoder.gd:407)
GDScript backtrace (most recent call first):
[0] _parse_object_section (res://scripts/chunk_data_decoder.gd:407)
[1] _init (res://test_review.gd:25)
SCRIPT ERROR: Out of bounds get index '0' (on base: 'Array[WorldObjectData]')
at: _init (res://test_review.gd:26)
GDScript backtrace (most recent call first):
[0] _init (res://test_review.gd:26)
+22
View File
@@ -0,0 +1,22 @@
extends SceneTree
func _init() -> void:
# 1. float32 encode/decode
var b: PackedByteArray = ChunkDataDecoder._write_float32(0.5)
print("float32(0.5) bytes = ", b, " (expected 00 00 00 3f)")
var decoded_f: float = ChunkDataDecoder._read_float32(PackedByteArray([0x00, 0x00, 0x00, 0x3f]), 0)
print("read_float32 of 0x3f000000 = ", decoded_f, " (expected 0.5)")
# 2. metadata section wrapping: inspect first bytes of encoded payload
var payload: ChunkDataDecoder.ChunkPayload = ChunkDataDecoder.ChunkPayload.new()
payload.world_id = "w"
payload.room_id = "r"
payload.coord = Vector3i(1, 2, 3)
var meta: PackedByteArray = ChunkDataDecoder._build_metadata_section(payload)
print("metadata section first 12 bytes = ", meta.slice(0, 12))
# 3. properties parse with empty-ish string
var props_str := "{}"
var val = JSON.parse_string(props_str) or {}
print("'JSON.parse_string(props_str) or {{}}' type = ", typeof(val), " value = ", val)
quit()