mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 23:17:28 +00:00
d8ac148cee
* Re-write AOE behavior for new filter targets Update Tacarc to use new filter targets Added dev commands for skill and attack debugging * Get all entities by detroyable rather than controllable physics Since destroyables are what can be hit * Re-work filter targets to be 100% live accurate reduce memory usage by only using one vector and removing invalid entries get entities in the proximity rather than all entities with des comps in the instance, as was done in live * remove debuging longs and remove oopsie * address feedback * make log more useful * make filter more flat * Add some more checks to filter targets add pvp checks to isenemy * fix typing * Add filter target to TacArc and update filter target * fix double declaration * Some debugging logs * Update TacArc reading * make log clearer * logs * Update TacArcBehavior.cpp * banana * fix max targets * remove extreanous parenthesesuuesdsds * make behavior slot use a real type --------- Co-authored-by: David Markowitz <EmosewaMC@gmail.com>
120 lines
2.6 KiB
C++
120 lines
2.6 KiB
C++
#pragma once
|
|
|
|
#include "RakPeerInterface.h"
|
|
#include "dCommonVars.h"
|
|
#include "BehaviorBranchContext.h"
|
|
#include "GameMessages.h"
|
|
|
|
#include <vector>
|
|
#include <forward_list>
|
|
|
|
class Behavior;
|
|
|
|
struct BehaviorSyncEntry
|
|
{
|
|
uint32_t handle = 0;
|
|
|
|
float time = 0;
|
|
|
|
bool ignoreInterrupts = false;
|
|
|
|
Behavior* behavior = nullptr;
|
|
|
|
BehaviorBranchContext branchContext;
|
|
|
|
BehaviorSyncEntry();
|
|
};
|
|
|
|
struct BehaviorTimerEntry
|
|
{
|
|
float time = 0;
|
|
|
|
Behavior* behavior = nullptr;
|
|
|
|
BehaviorBranchContext branchContext;
|
|
|
|
LWOOBJID second = LWOOBJID_EMPTY;
|
|
|
|
BehaviorTimerEntry();
|
|
};
|
|
|
|
struct BehaviorEndEntry
|
|
{
|
|
Behavior* behavior = nullptr;
|
|
|
|
uint32_t start = 0;
|
|
|
|
BehaviorBranchContext branchContext;
|
|
|
|
LWOOBJID second = LWOOBJID_EMPTY;
|
|
|
|
BehaviorEndEntry();
|
|
};
|
|
|
|
struct BehaviorContext
|
|
{
|
|
LWOOBJID originator = LWOOBJID_EMPTY;
|
|
|
|
bool foundTarget = false;
|
|
|
|
float skillTime = 0;
|
|
|
|
uint32_t skillID = 0;
|
|
|
|
uint32_t skillUId = 0;
|
|
|
|
bool failed = false;
|
|
|
|
bool clientInitalized = false;
|
|
|
|
std::vector<BehaviorSyncEntry> syncEntries;
|
|
|
|
std::vector<BehaviorTimerEntry> timerEntries;
|
|
|
|
std::vector<BehaviorEndEntry> endEntries;
|
|
|
|
std::vector<LWOOBJID> scheduledUpdates;
|
|
|
|
bool unmanaged = false;
|
|
|
|
LWOOBJID caster = LWOOBJID_EMPTY;
|
|
|
|
uint32_t GetUniqueSkillId() const;
|
|
|
|
void UpdatePlayerSyncs(float deltaTime);
|
|
|
|
void RegisterSyncBehavior(uint32_t syncId, Behavior* behavior, const BehaviorBranchContext& branchContext, const float duration, bool ignoreInterrupts = false);
|
|
|
|
void RegisterTimerBehavior(Behavior* behavior, const BehaviorBranchContext& branchContext, LWOOBJID second = LWOOBJID_EMPTY);
|
|
|
|
void RegisterEndBehavior(Behavior* behavior, const BehaviorBranchContext& branchContext, LWOOBJID second = LWOOBJID_EMPTY);
|
|
|
|
void ScheduleUpdate(LWOOBJID id);
|
|
|
|
void ExecuteUpdates();
|
|
|
|
void SyncBehavior(uint32_t syncId, RakNet::BitStream* bitStream);
|
|
|
|
void Update(float deltaTime);
|
|
|
|
void SyncCalculation(uint32_t syncId, float time, Behavior* behavior, const BehaviorBranchContext& branch, bool ignoreInterrupts = false);
|
|
|
|
void InvokeEnd(uint32_t id);
|
|
|
|
bool CalculateUpdate(float deltaTime);
|
|
|
|
void Interrupt();
|
|
|
|
void Reset();
|
|
|
|
void FilterTargets(std::vector<Entity*>& targetsReference, std::forward_list<int32_t>& ignoreFaction, std::forward_list<int32_t>& includeFaction, const bool targetSelf = false, const bool targetEnemy = true, const bool targetFriend = false, const bool targetTeam = false) const;
|
|
|
|
bool CheckTargetingRequirements(const Entity* target) const;
|
|
|
|
bool CheckFactionList(std::forward_list<int32_t>& factionList, std::vector<int32_t>& objectsFactions) const;
|
|
|
|
explicit BehaviorContext(LWOOBJID originator, bool calculation = false);
|
|
|
|
~BehaviorContext();
|
|
};
|