9 [
Attribute(
"",
UIWidgets.ResourceAssignArray,
"Generated projectiles will loop through the projectiles on this array",
"et")]
10 private ref array<ResourceName> m_ProjectilesToTrigger;
13 [
Attribute(
"0",
UIWidgets.EditBox,
"Number of projectiles to create. 0 = until time ends")]
16 [
Attribute(
"0",
UIWidgets.EditBox,
"Time until this entity creates a new projectile.")]
17 float m_TimeBetweenProjectiles;
19 [
Attribute(
"0",
UIWidgets.EditBox,
"Size of zone around the point where the airstrike will take place")]
20 float m_AirstrikeRadius;
22 [
Attribute(
"0",
UIWidgets.CheckBox,
"If true, even if there is a random radius it will have a bias towards the original airstrike target")]
23 bool m_BiasTowardsCenter;
25 [
Attribute(
"0",
UIWidgets.Range,
"Random delay [0,X] applied to the time between projectiles to make it more believable. Ignore Z parameter, 2D vectors are not supported by script")]
26 vector m_RandomDelayBetweenRockets;
32 private ref array<ref Resource> m_LoadedPrefabs =
new array<ref Resource>();
35 int m_RemainingProjectiles = 0;
36 float m_TimeUntilNextProjectile = 0;
39 private int m_CurrentProjectilePrefab = 0;
40 private int m_PreviousProjectilePrefab = 0;
45 private BaseSoundComponent m_SoundComponent;
46 private int m_SoundShotIndex = 0;
48 private vector m_direction;
50 private IEntity m_lastSpawnedProjectile = null;
54 private RplComponent m_RplComponent = null;
61 for(
int i = 0; i < m_ProjectilesToTrigger.Count(); i++)
63 if(!m_ProjectilesToTrigger[i])
68 m_LoadedPrefabs.Insert(projectile);
71 m_RemainingProjectiles = m_NumProjectiles;
72 m_TimeUntilNextProjectile = m_TimeBetweenProjectiles;
81 m_RplComponent = RplComponent.Cast(owner.
FindComponent(RplComponent));
83 m_TimeUntilNextProjectile += m_InitialDelay;
88 if(m_lastSpawnedProjectile)
92 m_lastSpawnedProjectile = null;
96 if (m_RemainingProjectiles <= 0)
103 m_TimeUntilNextProjectile -= timeSlice;
106 if (m_TimeUntilNextProjectile > 0)
110 m_TimeUntilNextProjectile += m_TimeBetweenProjectiles;
113 if(!m_RplComponent || !m_RplComponent.IsProxy())
119 ref
Resource prefab = m_LoadedPrefabs[m_CurrentProjectilePrefab];
123 m_RemainingProjectiles--;
129 spawnParams.TransformMode = ETransformMode.WORLD;
142 m_PreviousProjectilePrefab = m_CurrentProjectilePrefab;
143 ++m_CurrentProjectilePrefab;
145 if (m_CurrentProjectilePrefab >= m_LoadedPrefabs.Count())
146 m_CurrentProjectilePrefab = 0;
155 if(m_AirstrikeRadius == 0)
156 return ownerTransform[3];
158 vector missileTarget = m_RandomGenerator.GenerateRandomPointInRadius(0, m_AirstrikeRadius, ownerTransform[3], !m_BiasTowardsCenter);
159 missileTarget[1] = ownerTransform[3][1];
161 return missileTarget;
172 m_spawnPos[1] = m_spawnPos[1] + 100;
178 transform[3] = m_spawnPos;
186 m_lastSpawnedProjectile = spawnedProjectile;
193 RplComponent rplComp = RplComponent.Cast(m_lastSpawnedProjectile.FindComponent(RplComponent));
204 RplComponent rocketRplComp = RplComponent.Cast(
Replication.FindItem(
id));
220 moveComp.Launch(
direction,
vector.Zero, 1, rocket, null, null, null, null);
226 if(m_RandomDelayBetweenRockets[0] >= m_RandomDelayBetweenRockets[1])
229 float delay = m_RandomGenerator.RandFloatXY(m_RandomDelayBetweenRockets[0], m_RandomDelayBetweenRockets[1]);
231 m_TimeUntilNextProjectile += delay;
ArmaReforgerScripted GetGame()
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
void Rpc(func method, void p0=NULL, void p1=NULL, void p2=NULL, void p3=NULL, void p4=NULL, void p5=NULL, void p6=NULL, void p7=NULL)
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()
proto external EntityFlags SetFlags(EntityFlags flags, bool recursively=false)
proto external void GetTransform(out vector mat[])
proto external EntityFlags ClearFlags(EntityFlags flags, bool recursively=false)
Object holding reference to resource. In destructor release the resource.
Replication item identifier.
void LaunchMissile(IEntity rocket, vector direction)
void Do_LaunchMissile(vector direction)
void ~SCR_AirstrikePrototype()
void RpcLaunchMissile_BC(RplId id, vector direction)
vector ComputeMissileTarget()
void ComputeProjectileTransform(out vector transform[4], out vector direction, vector missileTarget)
void EOnInit(IEntity owner)
void AddRandomDelayToNextProjectile()
void EOnFrame(IEntity owner, float timeSlice)
void FireProjectile(Resource prefab, EntitySpawnParams spawnParams, vector direction)
void AdvanceProjectilePrefab()
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
EntityFlags
Various entity flags.
RespawnSystemComponentClass GameComponentClass vector vector rotation
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.