mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-17 03:37:08 -06:00
Compare commits
2 Commits
add-messag
...
component-
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ee448d3da | |||
| 82aee95d32 |
191
dGame/Entity.cpp
191
dGame/Entity.cpp
@@ -1018,24 +1018,36 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
moduleAssemblyComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
// basephys > controllable
|
||||
ControllablePhysicsComponent* controllablePhysicsComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS, controllablePhysicsComponent)) {
|
||||
controllablePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
SimplePhysicsComponent* simplePhysicsComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::SIMPLE_PHYSICS, simplePhysicsComponent)) {
|
||||
simplePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
// ProjectilePhysics Deserilized
|
||||
|
||||
// basephys > physicssystem (base on but not for serialization)
|
||||
// PhysicsSystem Deserialized
|
||||
|
||||
// basephys > vehicle
|
||||
// VehiclePhysics Deserialized
|
||||
|
||||
// basephys > havokveh
|
||||
// This is Havok Vehicle
|
||||
VehiclePhysicsComponent* vehiclePhysicsComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::VEHICLE_PHYSICS, vehiclePhysicsComponent)) {
|
||||
vehiclePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
// basephys > rigidbody (base on but not for serialization)
|
||||
RigidbodyPhantomPhysicsComponent* rigidbodyPhantomPhysics;
|
||||
if (TryGetComponent(eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS, rigidbodyPhantomPhysics)) {
|
||||
rigidbodyPhantomPhysics->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
VehiclePhysicsComponent* vehiclePhysicsComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::VEHICLE_PHYSICS, vehiclePhysicsComponent)) {
|
||||
vehiclePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
// basephys > simple (base on but not for serialization)
|
||||
SimplePhysicsComponent* simplePhysicsComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::SIMPLE_PHYSICS, simplePhysicsComponent)) {
|
||||
simplePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
PhantomPhysicsComponent* phantomPhysicsComponent;
|
||||
@@ -1043,11 +1055,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
phantomPhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
SoundTriggerComponent* soundTriggerComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::SOUND_TRIGGER, soundTriggerComponent)) {
|
||||
soundTriggerComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
// Destroyable
|
||||
BuffComponent* buffComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::BUFF, buffComponent)) {
|
||||
buffComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
@@ -1059,13 +1067,24 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
destroyableSerialized = true;
|
||||
}
|
||||
|
||||
if (HasComponent(eReplicaComponentType::COLLECTIBLE)) {
|
||||
DestroyableComponent* destroyableComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent) && !destroyableSerialized) {
|
||||
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
|
||||
CharacterComponent* characterComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::CHARACTER, characterComponent)) {
|
||||
PossessorComponent* possessorComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::POSSESSOR, possessorComponent)) {
|
||||
possessorComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
destroyableSerialized = true;
|
||||
outBitStream->Write(m_CollectibleID); // Collectable component
|
||||
|
||||
LevelProgressionComponent* levelProgressionComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::LEVEL_PROGRESSION, levelProgressionComponent)) {
|
||||
levelProgressionComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
PlayerForcedMovementComponent* playerForcedMovementComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::PLAYER_FORCED_MOVEMENT, playerForcedMovementComponent)) {
|
||||
playerForcedMovementComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
characterComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
PetComponent* petComponent;
|
||||
@@ -1073,40 +1092,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
petComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
CharacterComponent* characterComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::CHARACTER, characterComponent)) {
|
||||
|
||||
PossessorComponent* possessorComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::POSSESSOR, possessorComponent)) {
|
||||
possessorComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
} else {
|
||||
// Should never happen, but just to be safe
|
||||
outBitStream->Write0();
|
||||
}
|
||||
|
||||
LevelProgressionComponent* levelProgressionComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::LEVEL_PROGRESSION, levelProgressionComponent)) {
|
||||
levelProgressionComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
} else {
|
||||
// Should never happen, but just to be safe
|
||||
outBitStream->Write0();
|
||||
}
|
||||
|
||||
PlayerForcedMovementComponent* playerForcedMovementComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::PLAYER_FORCED_MOVEMENT, playerForcedMovementComponent)) {
|
||||
playerForcedMovementComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
} else {
|
||||
// Should never happen, but just to be safe
|
||||
outBitStream->Write0();
|
||||
}
|
||||
|
||||
characterComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
if (HasComponent(eReplicaComponentType::ITEM)) {
|
||||
outBitStream->Write0();
|
||||
}
|
||||
|
||||
// currently has Client and equiped item serialization in it
|
||||
InventoryComponent* inventoryComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::INVENTORY, inventoryComponent)) {
|
||||
inventoryComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
@@ -1127,6 +1113,12 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
baseCombatAiComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
// kek
|
||||
if (HasComponent(eReplicaComponentType::ITEM)) {
|
||||
outBitStream->Write0();
|
||||
}
|
||||
|
||||
// QUICKBUILD
|
||||
RebuildComponent* rebuildComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::QUICK_BUILD, rebuildComponent)) {
|
||||
DestroyableComponent* destroyableComponent;
|
||||
@@ -1137,41 +1129,49 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
rebuildComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
MovingPlatformComponent* movingPlatformComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::MOVING_PLATFORM, movingPlatformComponent)) {
|
||||
movingPlatformComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
SwitchComponent* switchComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::SWITCH, switchComponent)) {
|
||||
switchComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
// base vendor
|
||||
VendorComponent* vendorComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::VENDOR, vendorComponent)) {
|
||||
vendorComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
// base vendor > Donation
|
||||
// Donation Vendor Deserialized
|
||||
|
||||
BouncerComponent* bouncerComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::BOUNCER, bouncerComponent)) {
|
||||
bouncerComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
ScriptedActivityComponent* scriptedActivityComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::SCRIPTED_ACTIVITY, scriptedActivityComponent)) {
|
||||
scriptedActivityComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
// base vendor
|
||||
// Achievement Vendor Deserialized
|
||||
|
||||
// activity > shooting gall
|
||||
ShootingGalleryComponent* shootingGalleryComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::SHOOTING_GALLERY, shootingGalleryComponent)) {
|
||||
shootingGalleryComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
RacingControlComponent* racingControlComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::RACING_CONTROL, racingControlComponent)) {
|
||||
racingControlComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
// Roller Deserialized
|
||||
|
||||
// activity
|
||||
ScriptedActivityComponent* scriptedActivityComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::SCRIPTED_ACTIVITY, scriptedActivityComponent)) {
|
||||
scriptedActivityComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
// Collectible
|
||||
if (HasComponent(eReplicaComponentType::COLLECTIBLE)) {
|
||||
DestroyableComponent* destroyableComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent) && !destroyableSerialized) {
|
||||
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
destroyableSerialized = true;
|
||||
outBitStream->Write(m_CollectibleID); // Collectable component
|
||||
}
|
||||
|
||||
|
||||
MovingPlatformComponent* movingPlatformComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::MOVING_PLATFORM, movingPlatformComponent)) {
|
||||
movingPlatformComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
// ChoiceBuilds Deserialized
|
||||
|
||||
LUPExhibitComponent* lupExhibitComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::LUP_EXHIBIT, lupExhibitComponent)) {
|
||||
lupExhibitComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
@@ -1182,11 +1182,6 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
modelComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
RenderComponent* renderComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::RENDER, renderComponent)) {
|
||||
renderComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
if (modelComponent) {
|
||||
DestroyableComponent* destroyableComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent) && !destroyableSerialized) {
|
||||
@@ -1195,12 +1190,48 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
}
|
||||
}
|
||||
|
||||
BouncerComponent* bouncerComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::BOUNCER, bouncerComponent)) {
|
||||
bouncerComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
SwitchComponent* switchComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::SWITCH, switchComponent)) {
|
||||
switchComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
// activity
|
||||
if (HasComponent(eReplicaComponentType::ZONE_CONTROL)) {
|
||||
outBitStream->Write<uint32_t>(0x40000000);
|
||||
}
|
||||
|
||||
// Sound Repeater Deserialized
|
||||
// Chest Deserialized
|
||||
|
||||
// actually fx comp, that get's loaded via render comp
|
||||
RenderComponent* renderComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::RENDER, renderComponent)) {
|
||||
renderComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
SoundTriggerComponent* soundTriggerComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::SOUND_TRIGGER, soundTriggerComponent)) {
|
||||
soundTriggerComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
// just sound trigger again
|
||||
// Racing Sound Trigger Deserialize (base is SoundTrigger)
|
||||
|
||||
// activity > scripted activity > base racing > racing
|
||||
RacingControlComponent* racingControlComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::RACING_CONTROL, racingControlComponent)) {
|
||||
racingControlComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
// activity > scripted activity > base racing > gaterush
|
||||
// Gate Rush Deserialize
|
||||
|
||||
// BBB Component, unused currently
|
||||
// Need to to write0 so that is serialized correctly
|
||||
// TODO: Implement BBB Component
|
||||
outBitStream->Write0();
|
||||
}
|
||||
|
||||
@@ -725,6 +725,7 @@ void InventoryComponent::Serialize(RakNet::BitStream* outBitStream, const bool b
|
||||
outBitStream->Write(item.id);
|
||||
outBitStream->Write(item.lot);
|
||||
|
||||
// subkey
|
||||
outBitStream->Write0();
|
||||
|
||||
outBitStream->Write(item.count > 0);
|
||||
@@ -732,7 +733,7 @@ void InventoryComponent::Serialize(RakNet::BitStream* outBitStream, const bool b
|
||||
|
||||
outBitStream->Write(item.slot != 0);
|
||||
if (item.slot != 0) outBitStream->Write<uint16_t>(item.slot);
|
||||
|
||||
//invtype
|
||||
outBitStream->Write0();
|
||||
|
||||
bool flag = !item.config.empty();
|
||||
@@ -763,7 +764,7 @@ void InventoryComponent::Serialize(RakNet::BitStream* outBitStream, const bool b
|
||||
} else {
|
||||
outBitStream->Write(false);
|
||||
}
|
||||
|
||||
//EquippedModelTransform
|
||||
outBitStream->Write(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user