mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 06:57:28 +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();
|
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?!
|
//NANI?!
|
||||||
if (!isPlayer) {
|
if (!isPlayer) {
|
||||||
|
@ -41,7 +41,7 @@ QuickBuildComponent::QuickBuildComponent(Entity* parent, uint32_t id) : Activity
|
|||||||
SetPostImaginationCost(rebCompData[0].post_imagination_cost);
|
SetPostImaginationCost(rebCompData[0].post_imagination_cost);
|
||||||
SetTimeBeforeSmash(rebCompData[0].time_before_smash);
|
SetTimeBeforeSmash(rebCompData[0].time_before_smash);
|
||||||
const auto compTime = m_Parent->GetVar<float>(u"compTime");
|
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");
|
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) {
|
void QuickBuildComponent::Update(float deltaTime) {
|
||||||
m_Activator = GetActivator();
|
|
||||||
|
|
||||||
switch (m_State) {
|
switch (m_State) {
|
||||||
case eQuickBuildState::OPEN: {
|
case eQuickBuildState::OPEN: {
|
||||||
SpawnActivator();
|
SpawnActivator();
|
||||||
@ -141,9 +139,7 @@ void QuickBuildComponent::Update(float deltaTime) {
|
|||||||
|
|
||||||
if (m_TimerIncomplete >= m_TimeBeforeSmash) {
|
if (m_TimerIncomplete >= m_TimeBeforeSmash) {
|
||||||
ClearActivityPlayerData();
|
ClearActivityPlayerData();
|
||||||
|
|
||||||
GameMessages::SendDie(m_Parent, LWOOBJID_EMPTY, LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0.0f, 0.0f, 0.0f, false, true);
|
GameMessages::SendDie(m_Parent, LWOOBJID_EMPTY, LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0.0f, 0.0f, 0.0f, false, true);
|
||||||
|
|
||||||
ResetQuickBuild(false);
|
ResetQuickBuild(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,7 +175,6 @@ void QuickBuildComponent::Update(float deltaTime) {
|
|||||||
|
|
||||||
if (!builder) {
|
if (!builder) {
|
||||||
ResetQuickBuild(false);
|
ResetQuickBuild(false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,6 +201,7 @@ void QuickBuildComponent::Update(float deltaTime) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Game::entityManager->SerializeEntity(builder);
|
||||||
|
|
||||||
if (m_Timer >= m_CompleteTime && m_DrainedImagination >= m_TakeImagination) {
|
if (m_Timer >= m_CompleteTime && m_DrainedImagination >= m_TakeImagination) {
|
||||||
CompleteQuickBuild(builder);
|
CompleteQuickBuild(builder);
|
||||||
@ -226,9 +222,7 @@ void QuickBuildComponent::Update(float deltaTime) {
|
|||||||
|
|
||||||
if (m_TimerIncomplete >= m_TimeBeforeSmash) {
|
if (m_TimerIncomplete >= m_TimeBeforeSmash) {
|
||||||
ClearActivityPlayerData();
|
ClearActivityPlayerData();
|
||||||
|
|
||||||
GameMessages::SendDie(m_Parent, LWOOBJID_EMPTY, LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0.0f, 0.0f, 0.0f, false, true);
|
GameMessages::SendDie(m_Parent, LWOOBJID_EMPTY, LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0.0f, 0.0f, 0.0f, false, true);
|
||||||
|
|
||||||
ResetQuickBuild(false);
|
ResetQuickBuild(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,11 +267,8 @@ void QuickBuildComponent::SpawnActivator() {
|
|||||||
void QuickBuildComponent::DespawnActivator() {
|
void QuickBuildComponent::DespawnActivator() {
|
||||||
if (m_Activator) {
|
if (m_Activator) {
|
||||||
Game::entityManager->DestructEntity(m_Activator);
|
Game::entityManager->DestructEntity(m_Activator);
|
||||||
|
|
||||||
m_Activator->ScheduleKillAfterUpdate();
|
m_Activator->ScheduleKillAfterUpdate();
|
||||||
|
|
||||||
m_Activator = nullptr;
|
m_Activator = nullptr;
|
||||||
|
|
||||||
m_ActivatorId = LWOOBJID_EMPTY;
|
m_ActivatorId = LWOOBJID_EMPTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ void RacingControlComponent::OnRequestDie(Entity* player) {
|
|||||||
if (!racingPlayer.noSmashOnReload) {
|
if (!racingPlayer.noSmashOnReload) {
|
||||||
racingPlayer.smashedTimes++;
|
racingPlayer.smashedTimes++;
|
||||||
GameMessages::SendDie(vehicle, vehicle->GetObjectID(), LWOOBJID_EMPTY, true,
|
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>();
|
auto* destroyableComponent = vehicle->GetComponent<DestroyableComponent>();
|
||||||
uint32_t respawnImagination = 0;
|
uint32_t respawnImagination = 0;
|
||||||
@ -769,7 +769,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
|||||||
if (vehiclePosition.y < -500) {
|
if (vehiclePosition.y < -500) {
|
||||||
GameMessages::SendDie(vehicle, m_Parent->GetObjectID(),
|
GameMessages::SendDie(vehicle, m_Parent->GetObjectID(),
|
||||||
LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0,
|
LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0,
|
||||||
true, false, 0);
|
true, false);
|
||||||
|
|
||||||
OnRequestDie(playerEntity);
|
OnRequestDie(playerEntity);
|
||||||
|
|
||||||
|
@ -814,7 +814,7 @@ void GameMessages::SendTerminateInteraction(const LWOOBJID& objectID, eTerminate
|
|||||||
SEND_PACKET_BROADCAST;
|
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;
|
CBITSTREAM;
|
||||||
CMSGHEADER;
|
CMSGHEADER;
|
||||||
|
|
||||||
@ -825,9 +825,6 @@ void GameMessages::SendDie(Entity* entity, const LWOOBJID& killerID, const LWOOB
|
|||||||
bitStream.Write(bClientDeath);
|
bitStream.Write(bClientDeath);
|
||||||
bitStream.Write(bSpawnLoot);
|
bitStream.Write(bSpawnLoot);
|
||||||
|
|
||||||
//bitStream.Write(coinSpawnTime != -1.0f);
|
|
||||||
//if (coinSpawnTime != -1.0f) bitStream.Write(coinSpawnTime);
|
|
||||||
|
|
||||||
uint32_t deathTypeLength = deathType.size();
|
uint32_t deathTypeLength = deathType.size();
|
||||||
bitStream.Write(deathTypeLength);
|
bitStream.Write(deathTypeLength);
|
||||||
for (uint32_t k = 0; k < deathTypeLength; k++) {
|
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) {
|
void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||||
bool bClientDeath;
|
bool bClientDeath;
|
||||||
bool bSpawnLoot;
|
|
||||||
std::u16string deathType;
|
std::u16string deathType;
|
||||||
float directionRelativeAngleXZ;
|
float directionRelativeAngleXZ;
|
||||||
float directionRelativeAngleY;
|
float directionRelativeAngleY;
|
||||||
@ -4058,17 +4054,14 @@ void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity,
|
|||||||
eKillType killType = eKillType::VIOLENT;
|
eKillType killType = eKillType::VIOLENT;
|
||||||
LWOOBJID killerID;
|
LWOOBJID killerID;
|
||||||
LWOOBJID lootOwnerID = LWOOBJID_EMPTY;
|
LWOOBJID lootOwnerID = LWOOBJID_EMPTY;
|
||||||
|
uint32_t deathTypeLength = 0;
|
||||||
|
|
||||||
bClientDeath = inStream->ReadBit();
|
bClientDeath = inStream->ReadBit();
|
||||||
bSpawnLoot = inStream->ReadBit();
|
|
||||||
|
|
||||||
uint32_t deathTypeLength = 0;
|
|
||||||
inStream->Read(deathTypeLength);
|
inStream->Read(deathTypeLength);
|
||||||
|
|
||||||
for (size_t i = 0; i < deathTypeLength; i++) {
|
for (size_t i = 0; i < deathTypeLength; i++) {
|
||||||
char16_t character;
|
char16_t character;
|
||||||
inStream->Read(character);
|
inStream->Read(character);
|
||||||
|
|
||||||
deathType.push_back(character);
|
deathType.push_back(character);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4076,39 +4069,25 @@ void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity,
|
|||||||
inStream->Read(directionRelativeAngleY);
|
inStream->Read(directionRelativeAngleY);
|
||||||
inStream->Read(directionRelativeForce);
|
inStream->Read(directionRelativeForce);
|
||||||
|
|
||||||
if (inStream->ReadBit()) {
|
if (inStream->ReadBit()) inStream->Read(killType);
|
||||||
inStream->Read(killType);
|
|
||||||
}
|
|
||||||
|
|
||||||
inStream->Read(killerID);
|
inStream->Read(killerID);
|
||||||
|
|
||||||
if (inStream->ReadBit()) {
|
|
||||||
inStream->Read(lootOwnerID);
|
inStream->Read(lootOwnerID);
|
||||||
}
|
|
||||||
|
|
||||||
auto* zoneController = Game::zoneManager->GetZoneControlObject();
|
auto* zoneController = Game::zoneManager->GetZoneControlObject();
|
||||||
|
|
||||||
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
||||||
|
|
||||||
LOG("Got die request: %i", entity->GetLOT());
|
LOG("Got die request: %i", entity->GetLOT());
|
||||||
|
|
||||||
if (racingControlComponent != nullptr) {
|
if (racingControlComponent) {
|
||||||
auto* possessableComponent = entity->GetComponent<PossessableComponent>();
|
auto* possessableComponent = entity->GetComponent<PossessableComponent>();
|
||||||
|
if (possessableComponent) {
|
||||||
if (possessableComponent != nullptr) {
|
|
||||||
entity = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
|
entity = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
|
||||||
|
if (!entity) return;
|
||||||
if (entity == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
racingControlComponent->OnRequestDie(entity);
|
racingControlComponent->OnRequestDie(entity);
|
||||||
} else {
|
} else {
|
||||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||||
|
|
||||||
if (!destroyableComponent) return;
|
if (!destroyableComponent) return;
|
||||||
|
|
||||||
destroyableComponent->Smash(killerID, killType, deathType);
|
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) {
|
void GameMessages::HandleEquipItem(RakNet::BitStream* inStream, Entity* entity) {
|
||||||
bool immediate;
|
bool immediate;
|
||||||
LWOOBJID objectID;
|
LWOOBJID objectID;
|
||||||
|
@ -105,7 +105,7 @@ namespace GameMessages {
|
|||||||
void AddActivityOwner(Entity* entity, LWOOBJID& ownerID);
|
void AddActivityOwner(Entity* entity, LWOOBJID& ownerID);
|
||||||
void SendTerminateInteraction(const LWOOBJID& objectID, eTerminateType type, const LWOOBJID& terminator);
|
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);
|
void SendSetInventorySize(Entity* entity, int invType, int size);
|
||||||
|
|
||||||
@ -612,7 +612,6 @@ namespace GameMessages {
|
|||||||
void HandleHasBeenCollected(RakNet::BitStream* inStream, Entity* entity);
|
void HandleHasBeenCollected(RakNet::BitStream* inStream, Entity* entity);
|
||||||
void HandleNotifyServerLevelProcessingComplete(RakNet::BitStream* inStream, Entity* entity);
|
void HandleNotifyServerLevelProcessingComplete(RakNet::BitStream* inStream, Entity* entity);
|
||||||
void HandlePickupCurrency(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 HandleEquipItem(RakNet::BitStream* inStream, Entity* entity);
|
||||||
void HandleUnequipItem(RakNet::BitStream* inStream, Entity* entity);
|
void HandleUnequipItem(RakNet::BitStream* inStream, Entity* entity);
|
||||||
void HandleRemoveItemFromInventory(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr);
|
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();
|
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();
|
auto* zoneController = Game::zoneManager->GetZoneControlObject();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user