diff --git a/protocol/src/main/resources/gdscript/ByteBuffer.gd b/protocol/src/main/resources/gdscript/ByteBuffer.gd index 5173c97c..daec9937 100644 --- a/protocol/src/main/resources/gdscript/ByteBuffer.gd +++ b/protocol/src/main/resources/gdscript/ByteBuffer.gd @@ -1,4 +1,4 @@ -const ProtocolManager = preload("res://zfoogd/ProtocolManager.gd") +const ProtocolManager = preload("./ProtocolManager.gd") const EMPTY: String = "" diff --git a/protocol/src/main/resources/gdscript/ProtocolClassDefaultTemplate.gd b/protocol/src/main/resources/gdscript/ProtocolClassDefaultTemplate.gd index 6aa220c5..5b93623b 100644 --- a/protocol/src/main/resources/gdscript/ProtocolClassDefaultTemplate.gd +++ b/protocol/src/main/resources/gdscript/ProtocolClassDefaultTemplate.gd @@ -4,9 +4,6 @@ ${protocol_field_definition} func protocolId() -> int: return ${protocol_id} -func get_class_name() -> String: - return "${protocol_name}" - func _to_string() -> String: const jsonTemplate = "${protocol_json}" var params = [${protocol_to_string}] diff --git a/protocol/src/main/resources/gdscript/ProtocolRegistrationTemplate.gd b/protocol/src/main/resources/gdscript/ProtocolRegistrationTemplate.gd index 59af87ba..1bd31fd7 100644 --- a/protocol/src/main/resources/gdscript/ProtocolRegistrationTemplate.gd +++ b/protocol/src/main/resources/gdscript/ProtocolRegistrationTemplate.gd @@ -1,17 +1,17 @@ class ${protocol_name}Registration: - func write(buffer: ByteBuffer, packet: Object): + func write(buffer: ByteBuffer, packet: ${protocol_name}): if (packet == null): buffer.writeInt(0) return ${protocol_write_serialization} pass - func read(buffer: ByteBuffer): + func read(buffer: ByteBuffer) -> ${protocol_name}: var length = buffer.readInt() if (length == 0): return null var beforeReadIndex = buffer.getReadOffset() - var packet = buffer.newInstance(${protocol_id}) + var packet: ${protocol_name} = buffer.newInstance(${protocol_id}) ${protocol_read_deserialization} if (length > 0): buffer.setReadOffset(beforeReadIndex + length) diff --git a/protocol/src/main/resources/gdscript/ProtocolTemplate.gd b/protocol/src/main/resources/gdscript/ProtocolTemplate.gd index dd81a0dd..635d3842 100644 --- a/protocol/src/main/resources/gdscript/ProtocolTemplate.gd +++ b/protocol/src/main/resources/gdscript/ProtocolTemplate.gd @@ -1,3 +1,5 @@ +class_name ${protocol_name} + ${protocol_imports} ${protocol_class}