mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-21 21:17:25 +00:00
this work. but engi turret is weird
This commit is contained in:
parent
e5bea0a5ef
commit
05466f924d
@ -725,7 +725,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
||||
|
||||
const auto isPlayer = m_Parent->IsPlayer();
|
||||
|
||||
GameMessages::SendDie(m_Parent, source, source, true, killType, deathType, 0, 0, 0, isPlayer, false, 1);
|
||||
GameMessages::SendDie(m_Parent, source, source, true, killType, deathType, 0, 0, 0, isPlayer, false);
|
||||
|
||||
//NANI?!
|
||||
if (!isPlayer) {
|
||||
|
@ -41,7 +41,7 @@ QuickBuildComponent::QuickBuildComponent(Entity* parent, uint32_t id) : Activity
|
||||
SetPostImaginationCost(rebCompData[0].post_imagination_cost);
|
||||
SetTimeBeforeSmash(rebCompData[0].time_before_smash);
|
||||
const auto compTime = m_Parent->GetVar<float>(u"compTime");
|
||||
if (compTime > 0) SetCompleteTime(compTime);
|
||||
if (m_Parent->HasVar(u"compTime") && compTime > 0) SetCompleteTime(compTime);
|
||||
}
|
||||
std::u16string checkPreconditions = m_Parent->GetVar<std::u16string>(u"CheckPrecondition");
|
||||
|
||||
@ -118,8 +118,6 @@ void QuickBuildComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIni
|
||||
}
|
||||
|
||||
void QuickBuildComponent::Update(float deltaTime) {
|
||||
m_Activator = GetActivator();
|
||||
|
||||
switch (m_State) {
|
||||
case eQuickBuildState::OPEN: {
|
||||
SpawnActivator();
|
||||
@ -141,9 +139,7 @@ void QuickBuildComponent::Update(float deltaTime) {
|
||||
|
||||
if (m_TimerIncomplete >= m_TimeBeforeSmash) {
|
||||
ClearActivityPlayerData();
|
||||
|
||||
GameMessages::SendDie(m_Parent, LWOOBJID_EMPTY, LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0.0f, 0.0f, 0.0f, false, true);
|
||||
|
||||
ResetQuickBuild(false);
|
||||
}
|
||||
}
|
||||
@ -179,7 +175,6 @@ void QuickBuildComponent::Update(float deltaTime) {
|
||||
|
||||
if (!builder) {
|
||||
ResetQuickBuild(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -206,6 +201,7 @@ void QuickBuildComponent::Update(float deltaTime) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Game::entityManager->SerializeEntity(builder);
|
||||
|
||||
if (m_Timer >= m_CompleteTime && m_DrainedImagination >= m_TakeImagination) {
|
||||
CompleteQuickBuild(builder);
|
||||
@ -226,9 +222,7 @@ void QuickBuildComponent::Update(float deltaTime) {
|
||||
|
||||
if (m_TimerIncomplete >= m_TimeBeforeSmash) {
|
||||
ClearActivityPlayerData();
|
||||
|
||||
GameMessages::SendDie(m_Parent, LWOOBJID_EMPTY, LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0.0f, 0.0f, 0.0f, false, true);
|
||||
|
||||
ResetQuickBuild(false);
|
||||
}
|
||||
}
|
||||
@ -273,11 +267,8 @@ void QuickBuildComponent::SpawnActivator() {
|
||||
void QuickBuildComponent::DespawnActivator() {
|
||||
if (m_Activator) {
|
||||
Game::entityManager->DestructEntity(m_Activator);
|
||||
|
||||
m_Activator->ScheduleKillAfterUpdate();
|
||||
|
||||
m_Activator = nullptr;
|
||||
|
||||
m_ActivatorId = LWOOBJID_EMPTY;
|
||||
}
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ void RacingControlComponent::OnRequestDie(Entity* player) {
|
||||
if (!racingPlayer.noSmashOnReload) {
|
||||
racingPlayer.smashedTimes++;
|
||||
GameMessages::SendDie(vehicle, vehicle->GetObjectID(), LWOOBJID_EMPTY, true,
|
||||
eKillType::VIOLENT, u"", 0, 0, 90.0f, false, true, 0);
|
||||
eKillType::VIOLENT, u"", 0, 0, 90.0f, false, true);
|
||||
|
||||
auto* destroyableComponent = vehicle->GetComponent<DestroyableComponent>();
|
||||
uint32_t respawnImagination = 0;
|
||||
@ -769,7 +769,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
||||
if (vehiclePosition.y < -500) {
|
||||
GameMessages::SendDie(vehicle, m_Parent->GetObjectID(),
|
||||
LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0,
|
||||
true, false, 0);
|
||||
true, false);
|
||||
|
||||
OnRequestDie(playerEntity);
|
||||
|
||||
|
@ -814,7 +814,7 @@ void GameMessages::SendTerminateInteraction(const LWOOBJID& objectID, eTerminate
|
||||
SEND_PACKET_BROADCAST;
|
||||
}
|
||||
|
||||
void GameMessages::SendDie(Entity* entity, const LWOOBJID& killerID, const LWOOBJID& lootOwnerID, bool bDieAccepted, eKillType killType, std::u16string deathType, float directionRelative_AngleY, float directionRelative_AngleXZ, float directionRelative_Force, bool bClientDeath, bool bSpawnLoot, float coinSpawnTime) {
|
||||
void GameMessages::SendDie(Entity* entity, const LWOOBJID& killerID, const LWOOBJID& lootOwnerID, bool bDieAccepted, eKillType killType, std::u16string deathType, float directionRelative_AngleY, float directionRelative_AngleXZ, float directionRelative_Force, bool bClientDeath, bool bSpawnLoot) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
@ -825,9 +825,6 @@ void GameMessages::SendDie(Entity* entity, const LWOOBJID& killerID, const LWOOB
|
||||
bitStream.Write(bClientDeath);
|
||||
bitStream.Write(bSpawnLoot);
|
||||
|
||||
//bitStream.Write(coinSpawnTime != -1.0f);
|
||||
//if (coinSpawnTime != -1.0f) bitStream.Write(coinSpawnTime);
|
||||
|
||||
uint32_t deathTypeLength = deathType.size();
|
||||
bitStream.Write(deathTypeLength);
|
||||
for (uint32_t k = 0; k < deathTypeLength; k++) {
|
||||
@ -4050,7 +4047,6 @@ void GameMessages::HandleRacingClientReady(RakNet::BitStream* inStream, Entity*
|
||||
|
||||
void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||
bool bClientDeath;
|
||||
bool bSpawnLoot;
|
||||
std::u16string deathType;
|
||||
float directionRelativeAngleXZ;
|
||||
float directionRelativeAngleY;
|
||||
@ -4058,17 +4054,14 @@ void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity,
|
||||
eKillType killType = eKillType::VIOLENT;
|
||||
LWOOBJID killerID;
|
||||
LWOOBJID lootOwnerID = LWOOBJID_EMPTY;
|
||||
uint32_t deathTypeLength = 0;
|
||||
|
||||
bClientDeath = inStream->ReadBit();
|
||||
bSpawnLoot = inStream->ReadBit();
|
||||
|
||||
uint32_t deathTypeLength = 0;
|
||||
inStream->Read(deathTypeLength);
|
||||
|
||||
for (size_t i = 0; i < deathTypeLength; i++) {
|
||||
char16_t character;
|
||||
inStream->Read(character);
|
||||
|
||||
deathType.push_back(character);
|
||||
}
|
||||
|
||||
@ -4076,39 +4069,25 @@ void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity,
|
||||
inStream->Read(directionRelativeAngleY);
|
||||
inStream->Read(directionRelativeForce);
|
||||
|
||||
if (inStream->ReadBit()) {
|
||||
inStream->Read(killType);
|
||||
}
|
||||
|
||||
if (inStream->ReadBit()) inStream->Read(killType);
|
||||
inStream->Read(killerID);
|
||||
|
||||
if (inStream->ReadBit()) {
|
||||
inStream->Read(lootOwnerID);
|
||||
}
|
||||
inStream->Read(lootOwnerID);
|
||||
|
||||
auto* zoneController = Game::zoneManager->GetZoneControlObject();
|
||||
|
||||
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
||||
|
||||
LOG("Got die request: %i", entity->GetLOT());
|
||||
|
||||
if (racingControlComponent != nullptr) {
|
||||
if (racingControlComponent) {
|
||||
auto* possessableComponent = entity->GetComponent<PossessableComponent>();
|
||||
|
||||
if (possessableComponent != nullptr) {
|
||||
if (possessableComponent) {
|
||||
entity = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
|
||||
|
||||
if (entity == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (!entity) return;
|
||||
}
|
||||
|
||||
racingControlComponent->OnRequestDie(entity);
|
||||
} else {
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (!destroyableComponent) return;
|
||||
|
||||
destroyableComponent->Smash(killerID, killType, deathType);
|
||||
}
|
||||
}
|
||||
@ -5236,45 +5215,6 @@ void GameMessages::HandlePickupCurrency(RakNet::BitStream* inStream, Entity* ent
|
||||
}
|
||||
}
|
||||
|
||||
void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity) {
|
||||
LWOOBJID killerID;
|
||||
LWOOBJID lootOwnerID;
|
||||
bool bDieAccepted = false;
|
||||
eKillType killType;
|
||||
std::u16string deathType;
|
||||
float directionRelative_AngleY;
|
||||
float directionRelative_AngleXZ;
|
||||
float directionRelative_Force;
|
||||
bool bClientDeath = false;
|
||||
bool bSpawnLoot = true;
|
||||
float coinSpawnTime = -1.0f;
|
||||
|
||||
inStream->Read(bClientDeath);
|
||||
inStream->Read(bDieAccepted);
|
||||
inStream->Read(bSpawnLoot);
|
||||
|
||||
bool coinSpawnTimeIsDefault{};
|
||||
inStream->Read(coinSpawnTimeIsDefault);
|
||||
if (coinSpawnTimeIsDefault != 0) inStream->Read(coinSpawnTime);
|
||||
|
||||
/*uint32_t deathTypeLength = deathType.size();
|
||||
inStream->Read(deathTypeLength);
|
||||
for (uint32_t k = 0; k < deathTypeLength; k++) {
|
||||
inStream->Read<uint16_t>(deathType[k]);
|
||||
}*/
|
||||
|
||||
inStream->Read(directionRelative_AngleXZ);
|
||||
inStream->Read(directionRelative_AngleY);
|
||||
inStream->Read(directionRelative_Force);
|
||||
|
||||
bool killTypeIsDefault{};
|
||||
inStream->Read(killTypeIsDefault);
|
||||
if (killTypeIsDefault != 0) inStream->Read(killType);
|
||||
|
||||
inStream->Read(lootOwnerID);
|
||||
inStream->Read(killerID);
|
||||
}
|
||||
|
||||
void GameMessages::HandleEquipItem(RakNet::BitStream* inStream, Entity* entity) {
|
||||
bool immediate;
|
||||
LWOOBJID objectID;
|
||||
|
@ -105,7 +105,7 @@ namespace GameMessages {
|
||||
void AddActivityOwner(Entity* entity, LWOOBJID& ownerID);
|
||||
void SendTerminateInteraction(const LWOOBJID& objectID, eTerminateType type, const LWOOBJID& terminator);
|
||||
|
||||
void SendDie(Entity* entity, const LWOOBJID& killerID, const LWOOBJID& lootOwnerID, bool bDieAccepted, eKillType killType, std::u16string deathType, float directionRelative_AngleY, float directionRelative_AngleXZ, float directionRelative_Force, bool bClientDeath, bool bSpawnLoot, float coinSpawnTime);
|
||||
void SendDie(Entity* entity, const LWOOBJID& killerID, const LWOOBJID& lootOwnerID, bool bDieAccepted, eKillType killType, std::u16string deathType, float directionRelative_AngleY, float directionRelative_AngleXZ, float directionRelative_Force, bool bClientDeath, bool bSpawnLoot);
|
||||
|
||||
void SendSetInventorySize(Entity* entity, int invType, int size);
|
||||
|
||||
@ -612,7 +612,6 @@ namespace GameMessages {
|
||||
void HandleHasBeenCollected(RakNet::BitStream* inStream, Entity* entity);
|
||||
void HandleNotifyServerLevelProcessingComplete(RakNet::BitStream* inStream, Entity* entity);
|
||||
void HandlePickupCurrency(RakNet::BitStream* inStream, Entity* entity);
|
||||
void HandleRequestDie(RakNet::BitStream* inStream, Entity* entity);
|
||||
void HandleEquipItem(RakNet::BitStream* inStream, Entity* entity);
|
||||
void HandleUnequipItem(RakNet::BitStream* inStream, Entity* entity);
|
||||
void HandleRemoveItemFromInventory(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr);
|
||||
|
@ -55,7 +55,7 @@ void RaceMaelstromGeiser::OnProximityUpdate(Entity* self, Entity* entering, std:
|
||||
}
|
||||
|
||||
|
||||
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0, true, false, 0);
|
||||
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0, true, false);
|
||||
|
||||
auto* zoneController = Game::zoneManager->GetZoneControlObject();
|
||||
|
||||
|
@ -40,7 +40,7 @@ void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
}
|
||||
|
||||
|
||||
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0, true, false, 0);
|
||||
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0, true, false);
|
||||
|
||||
auto* zoneController = Game::zoneManager->GetZoneControlObject();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user