1#define ENABLE_BASE_DESTRUCTION
58 snapshot.Serialize(packet, 16);
64 return snapshot.Serialize(packet, 16);
70 return lhs.CompareSnapshots(rhs, 16);
77 && snapshot.Compare(prop.
m_RplId, 4)
78 && snapshot.Compare(prop.
m_iIndex, 4);
85 snapshot.SerializeBytes(prop.
m_RplId, 4);
86 snapshot.SerializeBytes(prop.
m_iIndex, 4);
95 snapshot.SerializeBytes(prop.
m_RplId, 4);
96 snapshot.SerializeBytes(prop.
m_iIndex, 4);
105#ifdef ENABLE_BASE_DESTRUCTION
107 ref SCR_AudioSourceConfiguration m_AudioSourceConfiguration;
109 static const string ENTITY_SIZE_SIGNAL_NAME =
"EntitySize";
110 static const string PHASES_TO_DESTROYED_PHASE_SIGNAL_NAME =
"PhasesToDestroyed";
111 static const string COLLISIONDV_SIGNAL_NAME =
"CollisionDV";
112 static const ResourceName DESTRUCTION_MANAGER_PREFAB =
"{9BB369F2803C6F71}Prefabs/MP/MPDestructionManager.et";
114 static bool s_bInitialized =
false;
127 return s_bInitialized;
138 Print(
"SCR_MPDestructionManager::CreateInstance(): Failed to create instance! Destruction of objects will not be synched!",
LogLevel.ERROR);
142 GetGame().SpawnEntityPrefab(resource);
145 s_bInitialized =
true;
187 SCR_DestructionDamageManagerComponent.SetReadingInit(
true);
191 reader.ReadInt(numDeleted);
192 for (
int i = 0; i < numDeleted; i++)
195 reader.ReadEntityId(entID);
201 SCR_DestructionDamageManagerComponent
destructible = SCR_DestructionDamageManagerComponent.Cast(entity.
FindComponent(SCR_DestructionDamageManagerComponent));
209 int numDestructibles;
210 reader.ReadInt(numDestructibles);
211 for (
int i = 0; i < numDestructibles; i++)
214 reader.ReadBool(hasEntityID);
220 reader.ReadEntityId(entID);
226 SCR_DestructionDamageManagerComponent
destructible = SCR_DestructionDamageManagerComponent.Cast(entity.
FindComponent(SCR_DestructionDamageManagerComponent));
233 SCR_DestructionDamageManagerComponent.SetReadingInit(
false);
243 writer.WriteInt(numDeleted);
244 for (
int i = 0; i < numDeleted; i++)
251 writer.WriteInt(numChanged);
252 for (
int i = 0; i < numChanged; i++)
258 writer.WriteBool(
false);
262 SCR_DestructionDamageManagerComponent
destructible = SCR_DestructionDamageManagerComponent.Cast(entity.
FindComponent(SCR_DestructionDamageManagerComponent));
265 writer.WriteBool(
false);
269 writer.WriteBool(
true);
270 writer.WriteEntityId(entID);
281 return m_AudioSourceConfiguration;
303 destructibles =
new array<SCR_DestructionDamageManagerComponent>();
317 if (
index >= 0 &&
index < destructibles.Count())
318 return destructibles[
index];
340 if (!deletedDestructibles)
342 deletedDestructibles =
new array<int>();
346 deletedDestructibles.Insert(
index);
357 if (!changedDestructibles)
359 changedDestructibles =
new array<int>();
363 changedDestructibles.Insert(
index);
375 DiagMenu.RegisterBool(
SCR_DebugMenuID.DEBUGUI_SOUNDS_MPDESTRUCTION_SHOW_IMPULSEVALUES,
"",
"Show MPD Impulse Values",
"Sounds");
ArmaReforgerScripted GetGame()
IEntity SpawnEntity(ResourceName entityResourceName, notnull IEntity slotOwner)
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
SCR_DestructionDamageManagerComponent destructible
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
proto external EntityEvent SetEventMask(EntityEvent e)
proto external Managed FindComponent(typename typeName)
proto external EntityEvent ClearEventMask(EntityEvent e)
proto external BaseWorld GetWorld()
Object holding reference to resource. In destructor release the resource.
Replication item identifier.
void SetEntityID(EntityID entityID)
static bool SnapCompare(SSnapSerializerBase lhs, SSnapSerializerBase rhs, ScriptCtx ctx)
void SetRplId(RplId rplId)
static bool Decode(ScriptBitSerializer packet, ScriptCtx ctx, SSnapSerializerBase snapshot)
RplId GetRplId(out int index)
static bool PropCompare(SCR_DestructibleIdentificator prop, SSnapSerializerBase snapshot, ScriptCtx ctx)
static bool Extract(SCR_DestructibleIdentificator prop, ScriptCtx ctx, SSnapSerializerBase snapshot)
static bool Inject(SSnapSerializerBase snapshot, ScriptCtx ctx, SCR_DestructibleIdentificator prop)
static void Encode(SSnapSerializerBase snapshot, ScriptCtx ctx, ScriptBitSerializer packet)
Codec methods.
static notnull SCR_MPDestructionManager InitializeDestructionManager()
void ~SCR_MPDestructionManager()
void SCR_MPDestructionManager(IEntitySource src, IEntity parent)
static bool IsInitialized()
override void EOnInit(IEntity owner)
ref array< SCR_DestructionBaseHandler > m_aDestroyInFrame
ref map< RplId, ref array< SCR_DestructionDamageManagerComponent > > m_mDynamicallySpawnedDestructibles
override bool RplLoad(ScriptBitReader reader)
Called when Item is initialized from replication stream. Carries the data from Master.
void RegisterChangedDynamicallySpawnedDestructible(notnull SCR_DestructionDamageManagerComponent destructible, RplId rplId)
override void EOnFrame(IEntity owner, float timeSlice)
override bool RplSave(ScriptBitWriter writer)
Called when Item is getting replicated from Master to Slave connection. The data will be delivered to...
ref map< RplId, ref array< int > > m_mDeletedDynamicallySpawnedDestructibles
void DestroyInFrame(SCR_DestructionBaseHandler handler)
SCR_DestructionDamageManagerComponent FindDynamicallySpawnedDestructibleByIndex(RplId rplId, int index)
void RegisterDeletedDynamicallySpawnedDestructible(notnull SCR_DestructionDamageManagerComponent destructible, RplId rplId)
static SCR_MPDestructionManager GetInstance()
Returns the instance of the destruction manager.
ref map< RplId, ref array< int > > m_mChangedDynamicallySpawnedDestructibles
ref array< EntityID > m_ChangedDestructibles
bool IsProxy()
Checks if this entity is locally owned.
int FindDynamicallySpawnedDestructibleIndex(RplId rplId, SCR_DestructionDamageManagerComponent destructible)
SCR_AudioSourceConfiguration GetAudioSourceConfiguration()
ref array< EntityID > m_DeletedDestructibles
RplComponent m_RplComponent
int RegisterDynamicallySpawnedDestructible(notnull SCR_DestructionDamageManagerComponent destructible, RplId rplId)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.