Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_DestructionMultiPhaseComponent.c
Go to the documentation of this file.
1 #define ENABLE_BASE_DESTRUCTION
2 
4 {
5  NONE,
20 }
21 
22 enum SCR_EMaterialSoundTypeBreak
23 {
24  NONE,
35  BREAK_ROCK,
37  BREAK_TENT,
39  BREAK_WOOD_SOLID
40 }
41 
42 [ComponentEditorProps(category: "GameScripted/Destruction", description: "Multi-Phase destruction component, for objects that go through several damage phases")]
43 class SCR_DestructionMultiPhaseComponentClass: SCR_DestructionDamageManagerComponentClass
44 {
45  [Attribute("1", UIWidgets.CheckBox, "If true, the object will be deleted after being damaged beyond the final damage phase", category: "Destruction Multi-Phase")]
46  bool m_bDeleteAfterFinalPhase;
47 
48  [Attribute("", UIWidgets.Object, "List of the individual damage phases (sequential) above initial damage phase", category: "Destruction Multi-Phase")]
49  ref array<ref SCR_DamagePhaseData> m_aDamagePhases;
50 
51  [Attribute("0", uiwidget: UIWidgets.ComboBox, "Type of material for destruction sound", "", ParamEnumArray.FromEnum(SCR_EMaterialSoundTypeBreak))]
52  SCR_EMaterialSoundTypeBreak m_eMaterialSoundType;
53 
54  [Attribute("0")]
55  float m_fMeshChangeDelay;
56 }
57 
59 class SCR_DestructionMultiPhaseComponent : SCR_DestructionDamageManagerComponent
60 {
61 #ifdef ENABLE_BASE_DESTRUCTION
62  private static int s_iFirstFreeDestructionMultiPhaseData = -1;
63  private static ref array<ref SCR_DestructionMultiPhaseData> s_aDestructionMultiPhaseData = {};
64 
65  private int m_iDestructionMultiPhaseDataIndex = -1;
66 
67  protected int m_iOriginalHealth;
68 
69  static const string DAMAGE_PHASE_SIGNAL_NAME = "DamagePhase";
70 
71  //------------------------------------------------------------------------------------------------
72  protected notnull SCR_DestructionMultiPhaseData GetDestructionMultiPhaseData()
73  {
74  if (m_iDestructionMultiPhaseDataIndex == -1)
75  m_iDestructionMultiPhaseDataIndex = AllocateDestructionMultiPhaseData();
76 
77  return s_aDestructionMultiPhaseData[m_iDestructionMultiPhaseDataIndex];
78  }
79 
80  //------------------------------------------------------------------------------------------------
81  private int AllocateDestructionMultiPhaseData()
82  {
83  if (s_iFirstFreeDestructionMultiPhaseData == -1)
84  return s_aDestructionMultiPhaseData.Insert(new SCR_DestructionMultiPhaseData());
85  else
86  {
87  int returnIndex = s_iFirstFreeDestructionMultiPhaseData;
88  SCR_DestructionMultiPhaseData data = s_aDestructionMultiPhaseData[returnIndex];
89  s_iFirstFreeDestructionMultiPhaseData = data.m_iNextFreeIndex;
90  data.m_iNextFreeIndex = -1;
91  return returnIndex;
92  }
93  }
94 
95  //------------------------------------------------------------------------------------------------
96  private void FreeDestructionMultiPhaseData(int index)
97  {
98  s_aDestructionMultiPhaseData[index].Reset();
99  s_aDestructionMultiPhaseData[index].m_iNextFreeIndex = s_iFirstFreeDestructionMultiPhaseData;
100  s_iFirstFreeDestructionMultiPhaseData = index;
101  }
102 
103  //------------------------------------------------------------------------------------------------
105  SCR_DamagePhaseData GetDamagePhaseData(int damagePhase)
106  {
107  if (damagePhase <= 0 || damagePhase >= GetNumDamagePhases())
108  return null;
109 
110  return SCR_DestructionMultiPhaseComponentClass.Cast(GetComponentData(GetOwner())).m_aDamagePhases.Get(damagePhase - 1);
111  }
112 
113  //------------------------------------------------------------------------------------------------
115  override bool GetDisablePhysicsOnDestroy()
116  {
117  return false;
118  }
119 
120  //------------------------------------------------------------------------------------------------
122  bool GetIsInInitialDamagePhase()
123  {
124  return GetDamagePhase() == 0;
125  }
126 
127  //------------------------------------------------------------------------------------------------
129  int GetDamagePhase()
130  {
131  if (m_iDestructionMultiPhaseDataIndex == -1)
132  return 0;
133 
134  return GetDestructionMultiPhaseData().GetDamagePhase();
135  }
136 
137  //------------------------------------------------------------------------------------------------
139  int GetNumDamagePhases()
140  {
141  SCR_DestructionMultiPhaseComponentClass componentData = SCR_DestructionMultiPhaseComponentClass.Cast(GetComponentData(GetOwner()));
142 
143  if (componentData.m_aDamagePhases)
144  return componentData.m_aDamagePhases.Count() + 1;
145  else
146  return 1;
147  }
148 
149  //------------------------------------------------------------------------------------------------
155  int CalculateDamagePhase(int damagePhase, float health, float damage)
156  {
157  if (damage < 0)
158  return damagePhase;
159 
160  while (damage >= 0)
161  {
162  damagePhase++;
163  SCR_DamagePhaseData damagePhaseData = GetDamagePhaseData(damagePhase);
164  if (!damagePhaseData)
165  break;
166 
167  damage -= damagePhaseData.m_fPhaseHealth;
168  }
169 
170  if (SCR_DestructionMultiPhaseComponentClass.Cast(GetComponentData(GetOwner())).m_bDeleteAfterFinalPhase)
171  return Math.ClampInt(damagePhase, 0, GetNumDamagePhases()); // Clamp between initial and 1 past final phase
172  else
173  return Math.ClampInt(damagePhase, 0, GetNumDamagePhases() - 1);
174  }
175 
176 
177  //------------------------------------------------------------------------------------------------
179  float GetDestructibleSize()
180  {
181  vector mins, maxs;
182  GetOwner().GetBounds(mins, maxs);
183  return (maxs[0] - mins[0]) * (maxs[1] - mins[1]);
184  }
185 
186  //------------------------------------------------------------------------------------------------
189  protected void SetDamagePhaseSignal()
190  {
191  SignalsManagerComponent signalsManagerComponent = SignalsManagerComponent.Cast(GetOwner().FindComponent(SignalsManagerComponent));
192  if (!signalsManagerComponent)
193  return;
194 
195  signalsManagerComponent.SetSignalValue(signalsManagerComponent.AddOrFindSignal(DAMAGE_PHASE_SIGNAL_NAME), GetDamagePhase());
196  }
197 
198  //------------------------------------------------------------------------------------------------
199  protected void SetOriginalResourceName(ResourceName originalResourceName)
200  {
201  GetDestructionMultiPhaseData().SetOriginalResourceName(originalResourceName);
202  }
203 
204  //------------------------------------------------------------------------------------------------
205  protected ResourceName GetOriginalResourceName()
206  {
207  if (m_iDestructionMultiPhaseDataIndex == -1)
208  return "";
209 
210  return GetDestructionMultiPhaseData().GetOriginalResourceName();
211  }
212 
213  //------------------------------------------------------------------------------------------------
214  protected int GetTargetDamagePhase()
215  {
216  if (m_iDestructionMultiPhaseDataIndex == -1)
217  return 0;
218 
219  return GetDestructionMultiPhaseData().GetTargetDamagePhase();
220  }
221 
222  //------------------------------------------------------------------------------------------------
223  protected void SetTargetDamagePhase(int targetDamagePhase)
224  {
225  GetDestructionMultiPhaseData().SetTargetDamagePhase(targetDamagePhase);
226  }
227 
228  //------------------------------------------------------------------------------------------------
229  protected void SetDamagePhase(int damagePhase)
230  {
231  GetDestructionMultiPhaseData().SetDamagePhase(damagePhase);
232 
234  }
235 
236  //------------------------------------------------------------------------------------------------
240  void GoToDamagePhase(int damagePhase, bool delayMeshChange)
241  {
242  if (damagePhase >= GetNumDamagePhases()) // Going past final phase, so delete if we can
243  {
245  s_OnDestructibleDestroyed.Invoke(this);
246 
247  SCR_DestructionMultiPhaseComponentClass componentData = SCR_DestructionMultiPhaseComponentClass.Cast(GetComponentData(GetOwner()));
248  if (componentData && componentData.m_bDeleteAfterFinalPhase)
250 
251  return;
252  }
253 
254  SetHitZoneDamage(0);
255 
256  int currentDamagePhase = GetDamagePhase();
257  if (currentDamagePhase == damagePhase) // Same phase, ignore
258  return;
259 
261 
262  if (currentDamagePhase == 0)
263  {
264  VObject vObject = GetOwner().GetVObject();
265  if (vObject)
266  SetOriginalResourceName(vObject.GetResourceName());
267  }
268 
269  SetDamagePhase(damagePhase);
270  SetTargetDamagePhase(damagePhase);
271 
272  ApplyDamagePhaseData(GetDamagePhaseData(GetDamagePhase()), delayMeshChange);
273  }
274 
275  //------------------------------------------------------------------------------------------------
279  void ApplyDamagePhaseData(SCR_DamagePhaseData damagePhaseData, bool delayMeshChange)
280  {
281  ResourceName model;
282  float health, hitZoneHealth;
283 
284  if (!damagePhaseData)
285  {
286  model = GetOriginalResourceName();
287  health = m_iOriginalHealth;
288  hitZoneHealth = GetHealth();
289  }
290  else
291  {
292  model = damagePhaseData.m_PhaseModel;
293  health = damagePhaseData.m_fPhaseHealth;
294  hitZoneHealth = damagePhaseData.m_fPhaseHealth;
295  }
296 
297  if (delayMeshChange)
298  {
299  float delay = 0;
300  SCR_DestructionMultiPhaseComponentClass prefabData = SCR_DestructionMultiPhaseComponentClass.Cast(GetComponentData(GetOwner()));
301  if (prefabData)
302  delay = prefabData.m_fMeshChangeDelay;
303 
304  if (delay > 0) // Only delay if there is a reason for it
305  {
306  GetGame().GetCallqueue().CallLater(SetModel, delay * 1000, false, model);
307  return;
308  }
309  else
310  SetModel(damagePhaseData.m_PhaseModel); // Otherwise set model straight away
311  }
312  else
313  SetModel(damagePhaseData.m_PhaseModel);
314 
315  if (!damagePhaseData)
316  {
317  SetHitZoneHealth(m_iOriginalHealth);
318  GetDestructionBaseData().SetPreviousHealth(GetHealth());
319  return;
320  }
321 
322  GetDestructionBaseData().SetPreviousHealth(damagePhaseData.m_fPhaseHealth);
323  SetHitZoneHealth(damagePhaseData.m_fPhaseHealth);
324  }
325 
326  //------------------------------------------------------------------------------------------------
327  override void PlaySound()
328  {
329  SCR_SoundManagerEntity soundManagerEntity = GetGame().GetSoundManagerEntity();
330  if (!soundManagerEntity)
331  return;
332 
333  IEntity owner = GetOwner();
334 
335  SCR_DestructionMultiPhaseComponentClass componentData = SCR_DestructionMultiPhaseComponentClass.Cast(GetComponentData(owner));
336  if (!componentData || componentData.m_eMaterialSoundType == 0)
337  return;
338 
339  SCR_MPDestructionManager destructionManager = SCR_MPDestructionManager.GetInstance();
340  if (!destructionManager)
341  return;
342 
343  SCR_AudioSourceConfiguration audioSourceConfiguration = destructionManager.GetAudioSourceConfiguration();
344  if (!audioSourceConfiguration)
345  return;
346 
347  // Get AudioSource
348  audioSourceConfiguration.m_sSoundEventName = SCR_SoundEvent.SOUND_MPD_ + typename.EnumToString(SCR_EMaterialSoundTypeBreak, componentData.m_eMaterialSoundType);
349 
350  SCR_AudioSource audioSource = soundManagerEntity.CreateAudioSource(owner, audioSourceConfiguration);
351  if (!audioSource)
352  return;
353 
354  // Set signals
355  audioSource.SetSignalValue(SCR_AudioSource.PHASES_TO_DESTROYED_PHASE_SIGNAL_NAME, GetNumDamagePhases() - GetDamagePhase() - 1);
356  audioSource.SetSignalValue(SCR_AudioSource.ENTITY_SIZE_SIGNAL_NAME, GetDestructibleSize());
357 
358  // Set position
359  vector mat[4];
360  owner.GetTransform(mat);
361 
362  // Get position offset for slotted entities
363  vector mins;
364  vector maxs;
365  owner.GetWorldBounds(mins, maxs);
366 
367  // Get center of bounding box
368  mat[3] = vector.Lerp(mins, maxs, 0.5);
369 
370  // Play sound
371  soundManagerEntity.PlayAudioSource(audioSource, mat);
372  }
373 
374  //------------------------------------------------------------------------------------------------
376  override bool GetCanBeDamaged()
377  {
378  SCR_DestructionMultiPhaseComponentClass componentData = SCR_DestructionMultiPhaseComponentClass.Cast(GetComponentData(GetOwner()));
379  if (!componentData)
380  return true;
381 
382  if (componentData.m_bDeleteAfterFinalPhase)
383  return GetDamagePhase() < GetNumDamagePhases();
384 
385  return GetDamagePhase() < GetNumDamagePhases() - 1;
386  }
387 
388  //------------------------------------------------------------------------------------------------
391  override void SpawnDestroyObjects(SCR_HitInfo hitInfo)
392  {
393  Physics ownerPhysics = GetOwner().GetPhysics();
394  SCR_HitInfo spawnHitInfo = hitInfo;
395  if (!spawnHitInfo)
396  spawnHitInfo = GetDestructionHitInfo();
397 
398  if (GetIsInInitialDamagePhase()) // Initial phase
399  {
400  array<ref SCR_BaseSpawnable> destroySpawnObjects = SCR_DestructionDamageManagerComponentClass.Cast(GetComponentData(GetOwner())).m_DestroySpawnObjects;
401  int numSpawnOnDestroy = destroySpawnObjects.Count();
402  for (int i = 0; i < numSpawnOnDestroy; i++)
403  {
404  SCR_BaseSpawnable spawnObject = destroySpawnObjects[i];
405  spawnObject.Spawn(GetOwner(), ownerPhysics, spawnHitInfo);
406  }
407  }
408  else
409  {
410  SCR_DamagePhaseData damagePhaseData = GetDamagePhaseData(GetDamagePhase());
411  if (damagePhaseData) // We have data for phase
412  {
413  int numSpawnOnDestroy = damagePhaseData.m_PhaseDestroySpawnObjects.Count();
414  for (int i = 0; i < numSpawnOnDestroy; i++)
415  {
416  SCR_BaseSpawnable spawnObject = damagePhaseData.m_PhaseDestroySpawnObjects[i];
417  spawnObject.Spawn(GetOwner(), ownerPhysics, spawnHitInfo);
418  }
419  }
420  }
421  }
422 
423  //------------------------------------------------------------------------------------------------
425  override void QueueDestroy()
426  {
427  SCR_DestructionHitInfo hitInfo = GetDestructionHitInfo();
428  if (!hitInfo)
429  return;
430 
431  if (hitInfo.m_TotalDestruction)
432  return;
433 
434  // Calculate which damage phase we should jump to in case we are meant to skip through multiple
435  SetTargetDamagePhase(CalculateDamagePhase(GetDamagePhase(), hitInfo.m_LastHealth, hitInfo.m_HitDamage));
436  }
437 
438  //------------------------------------------------------------------------------------------------
440  override void HandleDestruction()
441  {
442  if (GetOwner().IsDeleted())
443  return;
444 
445  if (!ShouldDestroyParent()) // If parent should be destroyed, we leave effects to them
446  SpawnDestroyObjects(null);
447 
448  PlaySound();
449 
450  GetDestructionBaseData().SetDestructionQueued(false);
451 
452  SCR_DestructionHitInfo hitInfo = GetDestructionHitInfo();
453  if (!hitInfo)
454  return;
455 
456  SCR_DestructionMultiPhaseComponentClass componentData = SCR_DestructionMultiPhaseComponentClass.Cast(GetComponentData(GetOwner()));
457  if (!componentData)
458  return;
459 
460  if (hitInfo.m_TotalDestruction) // If total destruction, check if destructible should be deleted; if not, go to last damage phase
461  {
462  if (componentData.m_bDeleteAfterFinalPhase)
464  else
465  GoToDamagePhase(componentData.m_aDamagePhases.Count(), true);
466  }
467  else // Go to the stored target damage phase
468  {
469  GoToDamagePhase(GetTargetDamagePhase(), true);
470  }
471 
472  if (hitInfo)
473  GetDestructionBaseData().DeleteHitInfo();
474  }
475 
476  //------------------------------------------------------------------------------------------------
477  override void UpdateResponseIndex()
478  {
479  SCR_DestructionMultiPhaseComponentClass prefabData = SCR_DestructionMultiPhaseComponentClass.Cast(GetComponentData(GetOwner()));
480  if (!prefabData || !prefabData.m_bDeleteAfterFinalPhase)
481  return; // We don't want to drive through indestructible objects
482 
483  Physics physics = GetOwner().GetPhysics();
484  if (!physics)
485  return; // No physics, no need to update anything
486 
487  if (GetDamagePhase() + 1 >= GetNumDamagePhases()) // Is in last phase and will be destroyed after it
488  {
489  super.UpdateResponseIndex();
490  return;
491  }
492 
493  // Not the last phase - don't update the response index
494  }
495 
496  //------------------------------------------------------------------------------------------------
497  [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
498  protected void RPC_ReplicateMultiPhaseDestructionState(int phase)
499  {
500  GoToDamagePhase(phase, true);
501  }
502 
503  //------------------------------------------------------------------------------------------------
504  override void ReplicateDestructibleState(bool forceUpdate = false)
505  {
506  int damagePhase = GetDamagePhase();
507 
508  // Only send update if this destructible has changed phase
509  if (forceUpdate || damagePhase != 0)
510  Rpc(RPC_ReplicateMultiPhaseDestructionState, damagePhase);
511  }
512 
513  //------------------------------------------------------------------------------------------------
514  protected override event bool OnRplSave(ScriptBitWriter writer)
515  {
516  if (!super.OnRplSave(writer))
517  return false;
518 
519  bool writeDamagePhase = GetDamagePhase() != 0;
520  writer.Write(writeDamagePhase, 1);
521 
522  if (writeDamagePhase)
523  writer.Write(GetDamagePhase(), 8); // Write which damage phase we are in
524 
525  return true;
526  }
527 
528  //------------------------------------------------------------------------------------------------
529  protected override bool OnRplLoad(ScriptBitReader reader)
530  {
531  if (!super.OnRplLoad(reader))
532  return false;
533 
534  bool readDamagePhase;
535  reader.Read(readDamagePhase, 1);
536 
537  if (!readDamagePhase)
538  return true;
539 
540  int damagePhase;
541  reader.Read(damagePhase, 8); // Read which damage phase we are meant to be in
542 
543  if (damagePhase != GetDamagePhase())
544  GoToDamagePhase(damagePhase, false);
545 
546  return true;
547  }
548 
549  //------------------------------------------------------------------------------------------------
550  override void OnPostInit(IEntity owner)
551  {
552  super.OnPostInit(owner);
553 
554  m_iOriginalHealth = GetHealth();
555  }
556 #endif
557 }
558 
559 class SCR_DamagePhaseTitle : BaseContainerCustomTitle
560 {
561  //------------------------------------------------------------------------------------------------
562  override bool _WB_GetCustomTitle(BaseContainer source, out string title)
563  {
564  float health = 0;
565  source.Get("m_fPhaseHealth", health);
566  title = "Phase | HP: " + health.ToString();
567  return true;
568  }
569 }
570 
572 [BaseContainerProps(), SCR_DamagePhaseTitle()]
573 class SCR_DamagePhaseData
574 {
575  [Attribute("100", UIWidgets.Slider, "Base health value for the damage phase. Upon switching to this phase, this value replaces the base health of the object", "0.01 100000 0.01")]
576  float m_fPhaseHealth;
577 
578  [Attribute(ResourceName.Empty, UIWidgets.ResourcePickerThumbnail, "Model to use for the damage phase", "xob")]
579  ResourceName m_PhaseModel;
580 
581  [Attribute("", UIWidgets.Object, "List of objects (particles, debris, etc) to spawn on destruction of the phase")]
582  ref array<ref SCR_BaseSpawnable> m_PhaseDestroySpawnObjects;
583 }
NONE
enum SCR_EMaterialSoundTypeDebris NONE
Definition: SCR_DestructionMultiPhaseComponent.c:5
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
ReplicateDestructibleState
void ReplicateDestructibleState(bool forceUpdate=false)
Definition: SCR_DestructionBaseComponent.c:379
SCR_AudioSource
Definition: SCR_AudioSource.c:1
ROCK
@ ROCK
Definition: SCR_DestructionMultiPhaseComponent.c:15
BREAK_METAL_POLE
enum SCR_EMaterialSoundTypeDebris BREAK_METAL_POLE
SANDBAG
@ SANDBAG
Definition: SCR_DestructionMultiPhaseComponent.c:17
PlaySound
SCR_ParticleContactComponentClass ScriptComponentClass PlaySound(IEntity owner, SCR_ParticleContactComponentClass prefabData, Contact contact)
Definition: SCR_ParticleContactComponent.c:38
BREAK_PIANO
enum SCR_EMaterialSoundTypeDebris BREAK_PIANO
QueueDestroy
void QueueDestroy()
Called when the object should be destroyed and various effects or other things need to be performed (...
Definition: SCR_DestructionBaseComponent.c:260
ShouldDestroyParent
bool ShouldDestroyParent()
Definition: SCR_DestructionBaseComponent.c:117
_WB_GetCustomTitle
SCR_ControlPlayerCameraComponent _WB_GetCustomTitle
Definition: SCR_DestructionBaseComponent.c:697
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
BREAK_MATRESS
enum SCR_EMaterialSoundTypeDebris BREAK_MATRESS
SCR_EMaterialSoundTypeDebris
SCR_EMaterialSoundTypeDebris
Definition: SCR_DestructionMultiPhaseComponent.c:3
GetDestructionBaseData
protected notnull SCR_DestructionBaseData GetDestructionBaseData()
Definition: SCR_DestructionBaseComponent.c:64
SpawnDestroyObjects
void SpawnDestroyObjects(SCR_HitInfo hitInfo)
Definition: SCR_DestructionBaseComponent.c:267
SCR_SoundEvent
Definition: SCR_SoundEvent.c:1
RegenerateNavmeshDelayed
void RegenerateNavmeshDelayed()
Definition: SCR_DestructibleEntity.c:132
UpdateResponseIndex
void UpdateResponseIndex(float currentHealth)
Definition: SCR_DestructibleEntity.c:362
BELL_SMALL
@ BELL_SMALL
Definition: SCR_DestructionMultiPhaseComponent.c:6
SCR_DestructionMultiPhaseData
Definition: SCR_DestructionMultiPhaseData.c:1
GetDestructionHitInfo
SCR_DestructionHitInfo GetDestructionHitInfo(bool createNew=false)
Definition: SCR_DestructionBaseComponent.c:107
BREAK_METAL_GENERATOR
enum SCR_EMaterialSoundTypeDebris BREAK_METAL_GENERATOR
RplRpc
SCR_AchievementsHandlerClass ScriptComponentClass RplRpc(RplChannel.Reliable, RplRcver.Owner)] void UnlockOnClient(AchievementId achievement)
Definition: SCR_AchievementsHandler.c:11
SCR_SoundManagerEntity
Definition: SCR_SoundManagerEntity.c:17
BREAK_GLASS
enum SCR_EMaterialSoundTypeDebris BREAK_GLASS
SCR_HitInfo
Class to temporarily store information about the last hit that dealt damage.
Definition: SCR_DestructionBaseComponent.c:659
METAL_POLE
@ METAL_POLE
Definition: SCR_DestructionMultiPhaseComponent.c:12
GoToDamagePhase
protected void GoToDamagePhase(int damagePhaseIndex, int previousDamagePhaseIndex, SCR_DestructionData destructionData, bool streamed)
Only call from OnStateChanged, otherwise you have HUGE desync.
Definition: SCR_DestructibleEntity.c:221
ROCK_SMALL
@ ROCK_SMALL
Definition: SCR_DestructionMultiPhaseComponent.c:16
SetDamagePhaseSignal
protected void SetDamagePhaseSignal(int damagePhaseIndex=0)
Definition: SCR_DestructibleEntity.c:319
GetDestructibleSize
float GetDestructibleSize()
Definition: SCR_DestructibleEntity.c:265
SetHitZoneHealth
void SetHitZoneHealth(float baseHealth, bool clearDamage=true)
Definition: SCR_DestructionBaseComponent.c:208
GetHealth
float GetHealth()
Definition: SCR_FuelNode.c:196
BREAK_METAL_NETFENCE
enum SCR_EMaterialSoundTypeDebris BREAK_METAL_NETFENCE
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_MPDestructionManager
Definition: SCR_MPDestructionManager.c:103
s_OnDestructibleDestroyed
SCR_DestructionDamageManagerComponentClass s_OnDestructibleDestroyed
Base destruction component, destruction types extend from this.
OnPostInit
override void OnPostInit(IEntity owner)
Called on PostInit when all components are added.
Definition: SCR_AIConfigComponent.c:72
BREAK_PLASTIC
enum SCR_EMaterialSoundTypeDebris BREAK_PLASTIC
SCR_DestructionDamageManagerComponentClass
Definition: SCR_DestructionBaseComponent.c:2
GetCanBeDamaged
bool GetCanBeDamaged()
Called when the object receives damage, return false if damage should be ignored.
Definition: SCR_DestructionBaseComponent.c:253
HandleDestruction
void HandleDestruction()
Handle destruction.
Definition: SCR_DestructionBaseComponent.c:303
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
OnRplLoad
event protected bool OnRplLoad(ScriptBitReader r)
Definition: RespawnSystemComponent.c:36
SetHitZoneDamage
void SetHitZoneDamage(float damage)
Definition: SCR_DestructionBaseComponent.c:220
OnRplSave
event protected bool OnRplSave(ScriptBitWriter w)
Definition: RespawnSystemComponent.c:31
BREAK_GROUNDRADAR
enum SCR_EMaterialSoundTypeDebris BREAK_GROUNDRADAR
BREAK_TENT
enum SCR_EMaterialSoundTypeDebris BREAK_TENT
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
BREAK_WATERHYDRANT
enum SCR_EMaterialSoundTypeDebris BREAK_WATERHYDRANT
PLASTIC_HOLLOW
@ PLASTIC_HOLLOW
Definition: SCR_DestructionMultiPhaseComponent.c:13
GLASS
@ GLASS
Definition: SCR_DestructionMultiPhaseComponent.c:7
DeleteDestructible
void DeleteDestructible()
Used in cases where we don't care about effects or anything, e. g. building destruction.
Definition: SCR_DestructionBaseComponent.c:183
WOOD_PLANK_SMALL
@ WOOD_PLANK_SMALL
Definition: SCR_DestructionMultiPhaseComponent.c:18
METAL_LIGHT
@ METAL_LIGHT
Definition: SCR_DestructionMultiPhaseComponent.c:10
PLASTIC_SOLID
@ PLASTIC_SOLID
Definition: SCR_DestructionMultiPhaseComponent.c:14
SetModel
void SetModel(ResourceName model)
Sets the model of the object.
Definition: SCR_DestructibleEntity.c:176
BREAK_GLASS_PANE
enum SCR_EMaterialSoundTypeDebris BREAK_GLASS_PANE
BREAK_ROCK
enum SCR_EMaterialSoundTypeDebris BREAK_ROCK
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
BREAK_METAL
enum SCR_EMaterialSoundTypeDebris BREAK_METAL
WOOD_PLANK_LARGE
@ WOOD_PLANK_LARGE
Definition: SCR_DestructionMultiPhaseComponent.c:19
MATRESS
@ MATRESS
Definition: SCR_DestructionMultiPhaseComponent.c:8
BREAK_SANDBAG
enum SCR_EMaterialSoundTypeDebris BREAK_SANDBAG
METAL_HEAVY
@ METAL_HEAVY
Definition: SCR_DestructionMultiPhaseComponent.c:9
m_eMaterialSoundType
SCR_EMaterialSoundTypeDebris m_eMaterialSoundType
Definition: SCR_DestructionBaseComponent.c:728
GetDisablePhysicsOnDestroy
bool GetDisablePhysicsOnDestroy()
Definition: SCR_DestructionBaseComponent.c:125
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468
METAL_NETFENCE
@ METAL_NETFENCE
Definition: SCR_DestructionMultiPhaseComponent.c:11
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180