smash unsmash and wait working

This commit is contained in:
David Markowitz 2025-03-31 22:00:53 -07:00
parent 0278123a0c
commit 5d061c0274
4 changed files with 62 additions and 6 deletions

View File

@ -6442,4 +6442,18 @@ namespace GameMessages {
missionComponent->Progress(eMissionTaskType::TALK_TO_NPC, interactedObject->GetLOT(), interactedObject->GetObjectID()); missionComponent->Progress(eMissionTaskType::TALK_TO_NPC, interactedObject->GetLOT(), interactedObject->GetObjectID());
missionComponent->Progress(eMissionTaskType::INTERACT, interactedObject->GetLOT(), interactedObject->GetObjectID()); missionComponent->Progress(eMissionTaskType::INTERACT, interactedObject->GetLOT(), interactedObject->GetObjectID());
} }
void Smash::Serialize(RakNet::BitStream& stream) const {
stream.Write(bIgnoreObjectVisibility);
stream.Write(force);
stream.Write(ghostCapacity);
stream.Write(killerID);
}
void UnSmash::Serialize(RakNet::BitStream& stream) const {
stream.Write(builderID != LWOOBJID_EMPTY);
if (builderID != LWOOBJID_EMPTY) stream.Write(builderID);
stream.Write(duration != 3.0f);
if (builderID != 3.0f) stream.Write(duration);
}
} }

View File

@ -801,6 +801,26 @@ namespace GameMessages {
// Used only for multi-interaction, is of the enum type InteractionType // Used only for multi-interaction, is of the enum type InteractionType
int multiInteractType{}; int multiInteractType{};
}; };
struct Smash : public GameMsg {
Smash() : GameMsg(MessageType::Game::SMASH) {}
void Serialize(RakNet::BitStream& stream) const;
bool bIgnoreObjectVisibility{};
bool force{};
float ghostCapacity{};
LWOOBJID killerID{};
};
struct UnSmash : public GameMsg {
UnSmash() : GameMsg(MessageType::Game::UN_SMASH) {}
void Serialize(RakNet::BitStream& stream) const;
LWOOBJID builderID{ LWOOBJID_EMPTY };
float duration{ 3.0f };
};
}; };
#endif // GAMEMESSAGES_H #endif // GAMEMESSAGES_H

View File

@ -98,7 +98,6 @@ void Strip::Spawn(LOT lot, Entity& entity) {
info.rot = NiQuaternionConstant::IDENTITY; info.rot = NiQuaternionConstant::IDENTITY;
info.spawnerID = entity.GetObjectID(); info.spawnerID = entity.GetObjectID();
Game::entityManager->ConstructEntity(Game::entityManager->CreateEntity(info, nullptr, &entity)); Game::entityManager->ConstructEntity(Game::entityManager->CreateEntity(info, nullptr, &entity));
IncrementAction();
} }
// Spawns a specific drop for all // Spawns a specific drop for all
@ -106,12 +105,17 @@ void Strip::SpawnDrop(LOT dropLOT, Entity& entity) {
for (auto* const player : PlayerManager::GetAllPlayers()) { for (auto* const player : PlayerManager::GetAllPlayers()) {
GameMessages::SendDropClientLoot(player, entity.GetObjectID(), dropLOT, 0, entity.GetPosition()); GameMessages::SendDropClientLoot(player, entity.GetObjectID(), dropLOT, 0, entity.GetPosition());
} }
IncrementAction();
} }
void Strip::Update(float deltaTime, ModelComponent& modelComponent) { void Strip::Update(float deltaTime, ModelComponent& modelComponent) {
m_PausedTime -= deltaTime;
if (m_PausedTime > 0.0f) return;
m_PausedTime = 0.0f;
auto& entity = *modelComponent.GetParent(); auto& entity = *modelComponent.GetParent();
auto number = static_cast<int32_t>(GetNextAction().GetValueParameterDouble()); auto& nextAction = GetNextAction();
auto number = nextAction.GetValueParameterDouble();
auto numberAsInt = static_cast<int32_t>(number);
if (GetNextAction().GetType() == "SpawnStromling") { if (GetNextAction().GetType() == "SpawnStromling") {
Spawn(10495, entity); Spawn(10495, entity);
} else if (GetNextAction().GetType() == "SpawnPirate") { } else if (GetNextAction().GetType() == "SpawnPirate") {
@ -119,12 +123,29 @@ void Strip::Update(float deltaTime, ModelComponent& modelComponent) {
} else if (GetNextAction().GetType() == "SpawnRonin") { } else if (GetNextAction().GetType() == "SpawnRonin") {
Spawn(10498, entity); Spawn(10498, entity);
} else if (GetNextAction().GetType() == "DropImagination") { } else if (GetNextAction().GetType() == "DropImagination") {
for (; number > 0; number--) SpawnDrop(935, entity); for (; numberAsInt > 0; numberAsInt--) SpawnDrop(935, entity);
} else if (GetNextAction().GetType() == "DropHealth") { } else if (GetNextAction().GetType() == "DropHealth") {
for (; number > 0; number--) SpawnDrop(177, entity); for (; numberAsInt > 0; numberAsInt--) SpawnDrop(177, entity);
} else if (GetNextAction().GetType() == "DropArmor") { } else if (GetNextAction().GetType() == "DropArmor") {
for (; number > 0; number--) SpawnDrop(6431, entity); for (; numberAsInt > 0; numberAsInt--) SpawnDrop(6431, entity);
} else if (GetNextAction().GetType() == "Smash") {
GameMessages::Smash smash{};
smash.target = entity.GetObjectID();
smash.killerID = entity.GetObjectID();
smash.Send(UNASSIGNED_SYSTEM_ADDRESS);
} else if (GetNextAction().GetType() == "UnSmash") {
GameMessages::UnSmash unsmash{};
unsmash.target = entity.GetObjectID();
unsmash.duration = number;
unsmash.builderID = LWOOBJID_EMPTY;
unsmash.Send(UNASSIGNED_SYSTEM_ADDRESS);
} else if (nextAction.GetType() == "Wait") {
m_PausedTime = number;
} else {
return;
} }
IncrementAction();
} }
void Strip::SendBehaviorBlocksToClient(AMFArrayValue& args) const { void Strip::SendBehaviorBlocksToClient(AMFArrayValue& args) const {

View File

@ -34,6 +34,7 @@ public:
void Update(float deltaTime, ModelComponent& modelComponent); void Update(float deltaTime, ModelComponent& modelComponent);
void SpawnDrop(LOT dropLOT, Entity& entity); void SpawnDrop(LOT dropLOT, Entity& entity);
private: private:
float m_PausedTime{ 0.0f };
size_t m_NextActionIndex{ 0 }; size_t m_NextActionIndex{ 0 };
std::vector<Action> m_Actions; std::vector<Action> m_Actions;
StripUiPosition m_Position; StripUiPosition m_Position;