2#define ENABLE_BASE_DESTRUCTION
3[
EntityEditorProps(
category:
"GameScripted/Debris", description:
"Entity used to represent small chunks of debris. Automatically managed.", dynamicBox:
true)]
14#ifdef ENABLE_BASE_DESTRUCTION
19 [
Attribute(defvalue:
"30",
params:
"0 inf",
desc:
"How long until the debris despawns (seconds)")]
26 protected static const float MINIMAL_DISTANCE_SQ = 0.25;
29 protected static const float MINIMAL_AGE = 0.25;
32 protected static const float KINETIC_ENERGY_THRESHOLD = 15;
42 protected float m_fdVelocityPeak;
45 protected float m_fdVelocityPeakAgeTime;
53 return GetGame().GetWorldEntity() != null;
57 protected static float GetDistanceToCamera(BaseWorld world, vector
position)
60 world.GetCurrentCamera(cameraMat);
61 return vector.Distance(cameraMat[3],
position);
79 entityPhysics.Destroy();
87 void SoundDebugOnFrame(
float soundThreshold)
89 if (DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_SOUNDS_MPDESTRUCTION_SHOW_IMPULSEVALUES))
95 const vector centerDebug = vector.Lerp(minsDebug, maxsDebug, 0.5);
98 if (
m_fAgeTime - m_fdVelocityPeakAgeTime > 1 || m_fdVelocity > m_fdVelocityPeak)
100 m_Text = DebugTextWorldSpace.Create(
GetWorld(), m_fdVelocity.ToString(1, 2) +
"/" + soundThreshold.ToString(1, 2) +
"/" + GetPhysics().GetMass().
ToString(),
DebugTextFlags.FACE_CAMERA, centerDebug[0], centerDebug[1], centerDebug[2], 20);
101 m_fdVelocityPeak = m_fdVelocity;
107 void SoundDebugPlaySound(
float soundThreshold,
float dVelocity, vector pos)
109 if (DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_SOUNDS_MPDESTRUCTION_SHOW_IMPULSEVALUES))
111 m_Text = DebugTextWorldSpace.Create(
GetWorld(), dVelocity.ToString(1, 2) +
"/" + soundThreshold.ToString(1, 2) +
"/" + GetPhysics().GetMass().
ToString(),
DebugTextFlags.FACE_CAMERA, pos[0], pos[1], pos[2], 20,
COLOR_BLUE);
SCR_BaseDebrisSmallEntityClass m_bDelete
Whether this debris has reached end of its lifetime and should be deleted.
void SCR_BaseDebrisSmallEntity(IEntitySource src, IEntity parent)
float m_fLifeTime
The lifetime in seconds.
float m_fAgeTime
Entity age in seconds. After this time is bigger thatn m_fLifeTime, debris will despawn.
void DeleteDebris()
Delete debris - unregisters it from the list and makes it scale down and delete.
ArmaReforgerScripted GetGame()
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external EntityEvent SetEventMask(EntityEvent e)
proto external Physics GetPhysics()
void EOnFrame(IEntity owner, float timeSlice)
proto external EntityEvent ClearEventMask(EntityEvent e)
proto external BaseWorld GetWorld()
proto external EntityFlags SetFlags(EntityFlags flags, bool recursively=false)
proto external void GetWorldBounds(out vector mins, out vector maxs)
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
EntityFlags
Various entity flags.
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.