mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-17 03:37:08 -06:00
Compare commits
2 Commits
add-sqlite
...
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);
|
moduleAssemblyComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// basephys > controllable
|
||||||
ControllablePhysicsComponent* controllablePhysicsComponent;
|
ControllablePhysicsComponent* controllablePhysicsComponent;
|
||||||
if (TryGetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS, controllablePhysicsComponent)) {
|
if (TryGetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS, controllablePhysicsComponent)) {
|
||||||
controllablePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
controllablePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
SimplePhysicsComponent* simplePhysicsComponent;
|
// ProjectilePhysics Deserilized
|
||||||
if (TryGetComponent(eReplicaComponentType::SIMPLE_PHYSICS, simplePhysicsComponent)) {
|
|
||||||
simplePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
// 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;
|
RigidbodyPhantomPhysicsComponent* rigidbodyPhantomPhysics;
|
||||||
if (TryGetComponent(eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS, rigidbodyPhantomPhysics)) {
|
if (TryGetComponent(eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS, rigidbodyPhantomPhysics)) {
|
||||||
rigidbodyPhantomPhysics->Serialize(outBitStream, bIsInitialUpdate, flags);
|
rigidbodyPhantomPhysics->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||||
}
|
}
|
||||||
|
// basephys > simple (base on but not for serialization)
|
||||||
VehiclePhysicsComponent* vehiclePhysicsComponent;
|
SimplePhysicsComponent* simplePhysicsComponent;
|
||||||
if (TryGetComponent(eReplicaComponentType::VEHICLE_PHYSICS, vehiclePhysicsComponent)) {
|
if (TryGetComponent(eReplicaComponentType::SIMPLE_PHYSICS, simplePhysicsComponent)) {
|
||||||
vehiclePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
simplePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
PhantomPhysicsComponent* phantomPhysicsComponent;
|
PhantomPhysicsComponent* phantomPhysicsComponent;
|
||||||
@@ -1043,11 +1055,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
|||||||
phantomPhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
phantomPhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundTriggerComponent* soundTriggerComponent;
|
// Destroyable
|
||||||
if (TryGetComponent(eReplicaComponentType::SOUND_TRIGGER, soundTriggerComponent)) {
|
|
||||||
soundTriggerComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuffComponent* buffComponent;
|
BuffComponent* buffComponent;
|
||||||
if (TryGetComponent(eReplicaComponentType::BUFF, buffComponent)) {
|
if (TryGetComponent(eReplicaComponentType::BUFF, buffComponent)) {
|
||||||
buffComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
buffComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||||
@@ -1059,13 +1067,24 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
|||||||
destroyableSerialized = true;
|
destroyableSerialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasComponent(eReplicaComponentType::COLLECTIBLE)) {
|
|
||||||
DestroyableComponent* destroyableComponent;
|
CharacterComponent* characterComponent;
|
||||||
if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent) && !destroyableSerialized) {
|
if (TryGetComponent(eReplicaComponentType::CHARACTER, characterComponent)) {
|
||||||
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
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;
|
PetComponent* petComponent;
|
||||||
@@ -1073,40 +1092,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
|||||||
petComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
petComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterComponent* characterComponent;
|
// currently has Client and equiped item serialization in it
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
InventoryComponent* inventoryComponent;
|
InventoryComponent* inventoryComponent;
|
||||||
if (TryGetComponent(eReplicaComponentType::INVENTORY, inventoryComponent)) {
|
if (TryGetComponent(eReplicaComponentType::INVENTORY, inventoryComponent)) {
|
||||||
inventoryComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
inventoryComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||||
@@ -1127,6 +1113,12 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
|||||||
baseCombatAiComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
baseCombatAiComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// kek
|
||||||
|
if (HasComponent(eReplicaComponentType::ITEM)) {
|
||||||
|
outBitStream->Write0();
|
||||||
|
}
|
||||||
|
|
||||||
|
// QUICKBUILD
|
||||||
RebuildComponent* rebuildComponent;
|
RebuildComponent* rebuildComponent;
|
||||||
if (TryGetComponent(eReplicaComponentType::QUICK_BUILD, rebuildComponent)) {
|
if (TryGetComponent(eReplicaComponentType::QUICK_BUILD, rebuildComponent)) {
|
||||||
DestroyableComponent* destroyableComponent;
|
DestroyableComponent* destroyableComponent;
|
||||||
@@ -1137,41 +1129,49 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
|||||||
rebuildComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
rebuildComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
MovingPlatformComponent* movingPlatformComponent;
|
// base vendor
|
||||||
if (TryGetComponent(eReplicaComponentType::MOVING_PLATFORM, movingPlatformComponent)) {
|
|
||||||
movingPlatformComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
SwitchComponent* switchComponent;
|
|
||||||
if (TryGetComponent(eReplicaComponentType::SWITCH, switchComponent)) {
|
|
||||||
switchComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
VendorComponent* vendorComponent;
|
VendorComponent* vendorComponent;
|
||||||
if (TryGetComponent(eReplicaComponentType::VENDOR, vendorComponent)) {
|
if (TryGetComponent(eReplicaComponentType::VENDOR, vendorComponent)) {
|
||||||
vendorComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
vendorComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||||
}
|
}
|
||||||
|
// base vendor > Donation
|
||||||
|
// Donation Vendor Deserialized
|
||||||
|
|
||||||
BouncerComponent* bouncerComponent;
|
// base vendor
|
||||||
if (TryGetComponent(eReplicaComponentType::BOUNCER, bouncerComponent)) {
|
// Achievement Vendor Deserialized
|
||||||
bouncerComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
ScriptedActivityComponent* scriptedActivityComponent;
|
|
||||||
if (TryGetComponent(eReplicaComponentType::SCRIPTED_ACTIVITY, scriptedActivityComponent)) {
|
|
||||||
scriptedActivityComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// activity > shooting gall
|
||||||
ShootingGalleryComponent* shootingGalleryComponent;
|
ShootingGalleryComponent* shootingGalleryComponent;
|
||||||
if (TryGetComponent(eReplicaComponentType::SHOOTING_GALLERY, shootingGalleryComponent)) {
|
if (TryGetComponent(eReplicaComponentType::SHOOTING_GALLERY, shootingGalleryComponent)) {
|
||||||
shootingGalleryComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
shootingGalleryComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
RacingControlComponent* racingControlComponent;
|
// Roller Deserialized
|
||||||
if (TryGetComponent(eReplicaComponentType::RACING_CONTROL, racingControlComponent)) {
|
|
||||||
racingControlComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
// 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;
|
LUPExhibitComponent* lupExhibitComponent;
|
||||||
if (TryGetComponent(eReplicaComponentType::LUP_EXHIBIT, lupExhibitComponent)) {
|
if (TryGetComponent(eReplicaComponentType::LUP_EXHIBIT, lupExhibitComponent)) {
|
||||||
lupExhibitComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
lupExhibitComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||||
@@ -1182,11 +1182,6 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
|||||||
modelComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
modelComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderComponent* renderComponent;
|
|
||||||
if (TryGetComponent(eReplicaComponentType::RENDER, renderComponent)) {
|
|
||||||
renderComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modelComponent) {
|
if (modelComponent) {
|
||||||
DestroyableComponent* destroyableComponent;
|
DestroyableComponent* destroyableComponent;
|
||||||
if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent) && !destroyableSerialized) {
|
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)) {
|
if (HasComponent(eReplicaComponentType::ZONE_CONTROL)) {
|
||||||
outBitStream->Write<uint32_t>(0x40000000);
|
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
|
// BBB Component, unused currently
|
||||||
// Need to to write0 so that is serialized correctly
|
|
||||||
// TODO: Implement BBB Component
|
// TODO: Implement BBB Component
|
||||||
outBitStream->Write0();
|
outBitStream->Write0();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -725,6 +725,7 @@ void InventoryComponent::Serialize(RakNet::BitStream* outBitStream, const bool b
|
|||||||
outBitStream->Write(item.id);
|
outBitStream->Write(item.id);
|
||||||
outBitStream->Write(item.lot);
|
outBitStream->Write(item.lot);
|
||||||
|
|
||||||
|
// subkey
|
||||||
outBitStream->Write0();
|
outBitStream->Write0();
|
||||||
|
|
||||||
outBitStream->Write(item.count > 0);
|
outBitStream->Write(item.count > 0);
|
||||||
@@ -732,7 +733,7 @@ void InventoryComponent::Serialize(RakNet::BitStream* outBitStream, const bool b
|
|||||||
|
|
||||||
outBitStream->Write(item.slot != 0);
|
outBitStream->Write(item.slot != 0);
|
||||||
if (item.slot != 0) outBitStream->Write<uint16_t>(item.slot);
|
if (item.slot != 0) outBitStream->Write<uint16_t>(item.slot);
|
||||||
|
//invtype
|
||||||
outBitStream->Write0();
|
outBitStream->Write0();
|
||||||
|
|
||||||
bool flag = !item.config.empty();
|
bool flag = !item.config.empty();
|
||||||
@@ -763,7 +764,7 @@ void InventoryComponent::Serialize(RakNet::BitStream* outBitStream, const bool b
|
|||||||
} else {
|
} else {
|
||||||
outBitStream->Write(false);
|
outBitStream->Write(false);
|
||||||
}
|
}
|
||||||
|
//EquippedModelTransform
|
||||||
outBitStream->Write(false);
|
outBitStream->Write(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user