mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-27 23:20:20 +00:00
most of gameplay tab works
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
#include "Amf3.h"
|
||||
#include "ControlBehaviorMsgs.h"
|
||||
#include "tinyxml2.h"
|
||||
#include "dEntity/EntityInfo.h"
|
||||
#include "ModelComponent.h"
|
||||
#include "PlayerManager.h"
|
||||
|
||||
template <>
|
||||
void Strip::HandleMsg(AddStripMessage& msg) {
|
||||
@@ -75,7 +78,54 @@ void Strip::HandleMsg(MigrateActionsMessage& msg) {
|
||||
} else {
|
||||
m_Actions.insert(m_Actions.begin() + msg.GetDstActionIndex(), msg.GetMigratedActions().begin(), msg.GetMigratedActions().end());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template<>
|
||||
void Strip::HandleMsg(GameMessages::RequestUse& msg) {
|
||||
if (m_Actions[m_NextActionIndex].GetType() == "OnInteract") IncrementAction();
|
||||
}
|
||||
|
||||
void Strip::IncrementAction() {
|
||||
if (m_Actions.empty()) return;
|
||||
m_NextActionIndex++;
|
||||
m_NextActionIndex %= m_Actions.size();
|
||||
}
|
||||
|
||||
void Strip::Spawn(LOT lot, Entity& entity) {
|
||||
EntityInfo info{};
|
||||
info.lot = lot; // Dark Ronin property
|
||||
info.pos = entity.GetPosition();
|
||||
info.rot = NiQuaternionConstant::IDENTITY;
|
||||
info.spawnerID = entity.GetObjectID();
|
||||
Game::entityManager->ConstructEntity(Game::entityManager->CreateEntity(info, nullptr, &entity));
|
||||
IncrementAction();
|
||||
}
|
||||
|
||||
// Spawns a specific drop for all
|
||||
void Strip::SpawnDrop(LOT dropLOT, Entity& entity) {
|
||||
for (auto* const player : PlayerManager::GetAllPlayers()) {
|
||||
GameMessages::SendDropClientLoot(player, entity.GetObjectID(), dropLOT, 0, entity.GetPosition());
|
||||
}
|
||||
IncrementAction();
|
||||
}
|
||||
|
||||
void Strip::Update(float deltaTime, ModelComponent& modelComponent) {
|
||||
auto& entity = *modelComponent.GetParent();
|
||||
auto number = static_cast<int32_t>(GetNextAction().GetValueParameterDouble());
|
||||
if (GetNextAction().GetType() == "SpawnStromling") {
|
||||
Spawn(10495, entity);
|
||||
} else if (GetNextAction().GetType() == "SpawnPirate") {
|
||||
Spawn(10497, entity);
|
||||
} else if (GetNextAction().GetType() == "SpawnRonin") {
|
||||
Spawn(10498, entity);
|
||||
} else if (GetNextAction().GetType() == "DropImagination") {
|
||||
for (; number > 0; number--) SpawnDrop(935, entity);
|
||||
} else if (GetNextAction().GetType() == "DropHealth") {
|
||||
for (; number > 0; number--) SpawnDrop(177, entity);
|
||||
} else if (GetNextAction().GetType() == "DropArmor") {
|
||||
for (; number > 0; number--) SpawnDrop(6431, entity);
|
||||
}
|
||||
}
|
||||
|
||||
void Strip::SendBehaviorBlocksToClient(AMFArrayValue& args) const {
|
||||
m_Position.SendBehaviorBlocksToClient(args);
|
||||
|
||||
Reference in New Issue
Block a user