adding missing file

This commit is contained in:
AleaJactaEst 2023-11-26 23:56:11 +01:00
parent 3564ff8d58
commit 2a560388d8

View file

@ -0,0 +1,31 @@
class_name PackedFlow
var data:PackedByteArray = PackedByteArray()
var offset:int = 0
func _init(dataSrc:ENetPacketPeer) -> void:
if dataSrc != null:
self.data = dataSrc.get_packet()
else:
self.data.clear()
self.offset = 0
func get_u8() -> int:
var ret:int
#print(self.data.size(), " - " , self.offset)
ret = self.data[self.offset]
self.offset += 1
return ret
func get_u64() -> int:
var ret:int
ret = data.decode_u64(self.offset)
self.offset += 8
return ret
func get_f64() -> float:
var ret:float
ret = data.decode_double(self.offset)
self.offset += 8
return ret