mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-19 22:08:08 +00:00
Merge branch 'main' into PetFixes
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "SkillComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "PlayerManager.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -53,11 +54,13 @@ void BossSpiderQueenEnemyServer::OnStartup(Entity* self) {
|
||||
|
||||
void BossSpiderQueenEnemyServer::OnDie(Entity* self, Entity* killer) {
|
||||
if (Game::zoneManager->GetZoneID().GetMapID() == instanceZoneID && killer) {
|
||||
auto* missionComponent = killer->GetComponent<MissionComponent>();
|
||||
if (missionComponent == nullptr)
|
||||
return;
|
||||
for (const auto& player : PlayerManager::GetAllPlayers()) {
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
if (missionComponent == nullptr)
|
||||
return;
|
||||
|
||||
missionComponent->CompleteMission(instanceMissionID);
|
||||
missionComponent->CompleteMission(instanceMissionID);
|
||||
}
|
||||
}
|
||||
|
||||
// There is suppose to be a 0.1 second delay here but that may be admitted?
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#include "SkillComponent.h"
|
||||
#include "BaseCombatAIComponent.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "eAninmationFlags.h"
|
||||
#include "eAnimationFlags.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
void AmDarklingDragon::OnStartup(Entity* self) {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include "SkillComponent.h"
|
||||
#include "BaseCombatAIComponent.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "eAninmationFlags.h"
|
||||
#include "eAnimationFlags.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include "EntityManager.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "eAninmationFlags.h"
|
||||
#include "eAnimationFlags.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "eStateChangeType.h"
|
||||
|
||||
|
@@ -1,3 +1,6 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_FV_RACING
|
||||
"RaceFireballs.cpp"
|
||||
"RaceMaelstromGeiser.cpp"
|
||||
"RaceShipLapColumnsServer.cpp"
|
||||
"FvRacingColumns.cpp"
|
||||
PARENT_SCOPE)
|
||||
|
15
dScripts/02_server/Map/FV/Racing/FvRacingColumns.cpp
Normal file
15
dScripts/02_server/Map/FV/Racing/FvRacingColumns.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "FvRacingColumns.h"
|
||||
#include "MovingPlatformComponent.h"
|
||||
|
||||
void FvRacingColumns::OnStartup(Entity* self) {
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
if (!movingPlatformComponent) return;
|
||||
|
||||
movingPlatformComponent->StopPathing();
|
||||
movingPlatformComponent->SetSerialized(true);
|
||||
int32_t pathStart = 0;
|
||||
if (self->HasVar(u"attached_path_start")) {
|
||||
pathStart = self->GetVar<uint32_t>(u"attached_path_start");
|
||||
}
|
||||
movingPlatformComponent->WarpToWaypoint(pathStart);
|
||||
}
|
6
dScripts/02_server/Map/FV/Racing/FvRacingColumns.h
Normal file
6
dScripts/02_server/Map/FV/Racing/FvRacingColumns.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "CppScripts.h"
|
||||
|
||||
class FvRacingColumns : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
};
|
15
dScripts/02_server/Map/FV/Racing/RaceFireballs.cpp
Normal file
15
dScripts/02_server/Map/FV/Racing/RaceFireballs.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "RaceFireballs.h"
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void RaceFireballs::OnStartup(Entity* self) {
|
||||
self->AddTimer("fire", GeneralUtils::GenerateRandomNumber<float>(3.0f, 10.0f));
|
||||
}
|
||||
|
||||
void RaceFireballs::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "fire") {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (skillComponent) skillComponent->CastSkill(894);
|
||||
self->AddTimer("fire", GeneralUtils::GenerateRandomNumber<float>(3.0f, 10.0f));
|
||||
|
||||
}
|
||||
}
|
9
dScripts/02_server/Map/FV/Racing/RaceFireballs.h
Normal file
9
dScripts/02_server/Map/FV/Racing/RaceFireballs.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class RaceFireballs : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
@@ -0,0 +1,47 @@
|
||||
#include "RaceShipLapColumnsServer.h"
|
||||
|
||||
#include "RacingControlComponent.h"
|
||||
#include "MovingPlatformComponent.h"
|
||||
|
||||
void RaceShipLapColumnsServer::OnStartup(Entity* self) {
|
||||
self->SetVar(u"Lap2Complete", false);
|
||||
self->SetVar(u"Lap3Complete", false);
|
||||
}
|
||||
|
||||
void SetMovingToWaypoint(const int32_t waypointIndex, const std::string group) {
|
||||
const auto entities = Game::entityManager->GetEntitiesInGroup(group);
|
||||
if (entities.empty()) return;
|
||||
|
||||
auto* entity = entities[0];
|
||||
entity->SetIsGhostingCandidate(false);
|
||||
|
||||
auto* movingPlatfromComponent = entity->GetComponent<MovingPlatformComponent>();
|
||||
if (!movingPlatfromComponent) return;
|
||||
|
||||
movingPlatfromComponent->SetSerialized(true);
|
||||
movingPlatfromComponent->GotoWaypoint(waypointIndex);
|
||||
Game::entityManager->SerializeEntity(entity);
|
||||
}
|
||||
|
||||
void RaceShipLapColumnsServer::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
if (!target) return;
|
||||
|
||||
const auto racingControllers = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::RACING_CONTROL);
|
||||
if (racingControllers.empty()) return;
|
||||
|
||||
auto* racingControlComponent = racingControllers[0]->GetComponent<RacingControlComponent>();
|
||||
if (!racingControlComponent) return;
|
||||
|
||||
const auto* player = racingControlComponent->GetPlayerData(target->GetObjectID());
|
||||
if (!player) return;
|
||||
|
||||
if (player->lap == 1 && !self->GetVar<bool>(u"Lap2Complete")) {
|
||||
self->SetVar(u"Lap2Complete", true);
|
||||
SetMovingToWaypoint(1, "Lap2Column");
|
||||
SetMovingToWaypoint(0, "Lap2Ramp");
|
||||
} else if (player->lap == 2 && !self->GetVar<bool>(u"Lap3Complete")) {
|
||||
self->SetVar(u"Lap3Complete", true);
|
||||
SetMovingToWaypoint(1, "Lap3Column");
|
||||
SetMovingToWaypoint(0, "Lap3Ramp");
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class RaceShipLapColumnsServer : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||
};
|
@@ -227,20 +227,20 @@ void PetDigServer::SpawnPet(Entity* self, const Entity* owner, const DigInfo dig
|
||||
Game::entityManager->ConstructEntity(spawnedPet);
|
||||
}
|
||||
|
||||
Entity* PetDigServer::GetClosestTresure(NiPoint3 position) {
|
||||
Entity* PetDigServer::GetClosestTreasure(NiPoint3 position) {
|
||||
float closestDistance = 0;
|
||||
Entity* closest = nullptr;
|
||||
|
||||
for (const auto tresureId : treasures) {
|
||||
auto* tresure = Game::entityManager->GetEntity(tresureId);
|
||||
for (const auto treasureId : treasures) {
|
||||
auto* treasure = Game::entityManager->GetEntity(treasureId);
|
||||
|
||||
if (tresure == nullptr) continue;
|
||||
if (treasure == nullptr) continue;
|
||||
|
||||
float distance = Vector3::DistanceSquared(tresure->GetPosition(), position);
|
||||
float distance = Vector3::DistanceSquared(treasure->GetPosition(), position);
|
||||
|
||||
if (closest == nullptr || distance < closestDistance) {
|
||||
closestDistance = distance;
|
||||
closest = tresure;
|
||||
closest = treasure;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,7 @@ public:
|
||||
*/
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
|
||||
static Entity* GetClosestTresure(NiPoint3 position);
|
||||
static Entity* GetClosestTreasure(NiPoint3 position);
|
||||
|
||||
private:
|
||||
static void ProgressPetDigMissions(const Entity* owner, const Entity* chest);
|
||||
|
@@ -56,10 +56,6 @@ void AgSurvivalBuffStation::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto member = Game::entityManager->GetEntity(memberID);
|
||||
if (member != nullptr && !member->GetIsDead()) {
|
||||
GameMessages::SendDropClientLoot(member, self->GetObjectID(), powerupToDrop, 0, self->GetPosition());
|
||||
} else {
|
||||
// If player left the team or left early erase them from the team variable.
|
||||
team.erase(std::find(team.begin(), team.end(), memberID));
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"BuilderTeam", team);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user