feat(destroyable): enemy preconditions from the level, as the client

An object's EnemyPrecondition (level config) decides who it is an enemy of:
whoever asks and doesn't meet the preconditions, whatever the factions
(LWODestroyableComponent::msgIsEnemy 0x00c9e930; ',' ';' ':' join groups
that must all pass, '|' alternatives). Forbidden Valley Siege's objects use
it today; any level object can.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-02 09:31:35 -05:00
parent 4b84677cba
commit 0253fea006
3 changed files with 38 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
#define DESTROYABLECOMPONENT_H
#include "RakNetTypes.h"
#include <memory>
#include <optional>
#include <vector>
#include "tinyxml2.h"
@@ -10,6 +11,8 @@
#include "eReplicaComponentType.h"
#include "Implementation.h"
class PreconditionExpression;
struct ObjectLoadState;
namespace GameMessages {
@@ -471,6 +474,10 @@ public:
*/
static void Resurrect(Entity& entity);
// The level's EnemyPrecondition: an object asking whether this one is its enemy must meet it, or it is one
// (LWODestroyableComponent::msgIsEnemy 0x00c9e930); its factions don't count then
const PreconditionExpression* GetEnemyPrecondition() const { return m_EnemyPrecondition.get(); }
// Whether a resurrection has started and not finished (the client's isResurrecting)
bool GetIsResurrecting() const { return m_IsResurrecting; }
@@ -640,6 +647,9 @@ private:
// A resurrection has started (Resurrect) and its respawn animation hasn't finished
bool m_IsResurrecting = false;
// The level config's EnemyPrecondition, when it has one
std::unique_ptr<PreconditionExpression> m_EnemyPrecondition;
/**
* Whether this entity is smashed. Unused, here for serialization
*/