bazar_alea/client/scripts/PackedFlowPush.gd

35 lines
736 B
GDScript

class_name PackedFlowPush
var data:PackedByteArray = PackedByteArray()
func _init() -> void:
self.data.clear()
func put_u8(value:int) -> void:
data.append(value)
func put_u64(value:int) -> void:
var pos:PackedInt64Array = PackedInt64Array()
pos.append(value)
data += pos.to_byte_array()
func puf_f64(value:float) -> void:
var pos:PackedFloat64Array = PackedFloat64Array()
pos.append(value)
data += pos.to_byte_array()
func put_vector3(value:Vector3) -> void:
var pos:PackedFloat64Array = PackedFloat64Array()
pos.append(value.x)
pos.append(value.y)
pos.append(value.z)
data += pos.to_byte_array()
func push(dataEnet:ENetPacketPeer, channel:int, flags:int) -> Error:
return dataEnet.send(channel, data, flags)