fix[protocol]: avoid the constant has the same name as a global class defined in gdscript

This commit is contained in:
godotg
2025-04-06 16:29:06 +08:00
parent 588de0130a
commit b25a995c55
2 changed files with 4 additions and 4 deletions
@@ -1,17 +1,17 @@
class ${protocol_name}Registration:
func write(buffer: ByteBuffer, packet: ${protocol_name}):
func write(buffer: ByteBuffer, packet: _${protocol_name}):
if (packet == null):
buffer.writeInt(0)
return
${protocol_write_serialization}
pass
func read(buffer: ByteBuffer) -> ${protocol_name}:
func read(buffer: ByteBuffer) -> _${protocol_name}:
var length = buffer.readInt()
if (length == 0):
return null
var beforeReadIndex = buffer.getReadOffset()
var packet: ${protocol_name} = buffer.newInstance(${protocol_id})
var packet: _${protocol_name} = buffer.newInstance(${protocol_id})
${protocol_read_deserialization}
if (length > 0):
buffer.setReadOffset(beforeReadIndex + length)
@@ -1,4 +1,4 @@
class_name ${protocol_name}
class_name _${protocol_name}
${protocol_imports}