Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ItemPlacementComponent.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/Components", description: "")]
2 class SCR_ItemPlacementComponentClass : ScriptComponentClass
3 {
4 }
5 
7 {
8  [Attribute("{56EBF5038622AC95}Assets/Conflict/CanBuild.emat")]
9  ResourceName m_sCanBuildMaterial;
10 
11  [Attribute("{14A9DCEA57D1C381}Assets/Conflict/CannotBuild.emat")]
12  ResourceName m_sCannotBuildMaterial;
13 
14  [Attribute("5")]
15  int m_iFramesBetweenChecks; // unused?
16 
17  protected int m_iEquipComplete;
18  protected bool m_bCanPlace;
19  protected bool m_bInEditor;
20  protected vector m_vCurrentMat[4];
21  protected IEntity m_EquippedItem;
22  protected SCR_PlaceableItemComponent m_PlaceableItem;
23  protected IEntity m_PreviewEntity;
25 
26  //------------------------------------------------------------------------------------------------
33  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
34  void RPC_AskPlaceItem(vector right, vector up, vector forward, vector position, RplId id)
35  {
36  RplComponent rplComponent = RplComponent.Cast(Replication.FindItem(id));
37  if (!rplComponent)
38  return;
39 
40  IEntity item = rplComponent.GetEntity();
41  SCR_PlaceableInventoryItemComponent itemComponent = SCR_PlaceableInventoryItemComponent.Cast(item.FindComponent(SCR_PlaceableInventoryItemComponent));
42  if (!itemComponent)
43  return;
44 
45  itemComponent.PlaceItem(right, up, forward, position);
47  }
48 
49  //------------------------------------------------------------------------------------------------
51  {
52  if (!from)
53  return null;
54 
55  ChimeraCharacter character = ChimeraCharacter.Cast(from);
56  if (!character)
58 
59  return SCR_CharacterControllerComponent.Cast(character.GetCharacterController());
60  }
61 
62  //------------------------------------------------------------------------------------------------
63  protected void UnregisterEvents(IEntity from)
64  {
65  if (!from)
66  return;
67 
68  BaseWeaponManagerComponent weaponManager = BaseWeaponManagerComponent.Cast(from.FindComponent(BaseWeaponManagerComponent));
69  if (weaponManager)
70  {
71  weaponManager.m_OnWeaponChangeCompleteInvoker.Remove(OnWeaponChangeEnded);
72  weaponManager.m_OnWeaponChangeStartedInvoker.Remove(OnWeaponChanged);
73  }
74 
75  SCR_CharacterControllerComponent characterController = GetCharacterController(from);
76  if (characterController)
77  characterController.GetOnPlayerDeathWithParam().Remove(OnCharacterDeath);
78 
79  SCR_CompartmentAccessComponent compartmentAccessComponent = SCR_CompartmentAccessComponent.Cast(from.FindComponent(SCR_CompartmentAccessComponent));
80  if (compartmentAccessComponent)
81  {
82  compartmentAccessComponent.GetOnCompartmentEntered().Remove(OnComparmentEntered);
83  compartmentAccessComponent.GetOnCompartmentLeft().Remove(GetOnCompartmentLeft);
84  }
85  }
86 
87  //------------------------------------------------------------------------------------------------
88  protected void RegisterEvents(IEntity to)
89  {
90  if (!to)
91  return;
92 
93  BaseWeaponManagerComponent weaponManager = BaseWeaponManagerComponent.Cast(to.FindComponent(BaseWeaponManagerComponent));
94  if (weaponManager)
95  {
96  weaponManager.m_OnWeaponChangeCompleteInvoker.Insert(OnWeaponChangeEnded);
97  weaponManager.m_OnWeaponChangeStartedInvoker.Insert(OnWeaponChanged);
98  }
99 
101  if (characterController)
102  characterController.GetOnPlayerDeathWithParam().Insert(OnCharacterDeath);
103 
104  SCR_CompartmentAccessComponent compartmentAccessComponent = SCR_CompartmentAccessComponent.Cast(to.FindComponent(SCR_CompartmentAccessComponent));
105  if (compartmentAccessComponent)
106  {
107  compartmentAccessComponent.GetOnCompartmentEntered().Insert(OnComparmentEntered);
108  compartmentAccessComponent.GetOnCompartmentLeft().Insert(GetOnCompartmentLeft);
109  }
110  }
111 
112  //------------------------------------------------------------------------------------------------
113  protected void OnControlledEntityChanged(IEntity from, IEntity to)
114  {
115  m_EquippedItem = null;
116  ChimeraCharacter characterTo = ChimeraCharacter.Cast(to);
117 
118  if (characterTo)
119  {
121  m_EquippedItem = characterTo.GetCharacterController().GetRightHandItem();
122  }
123  else
124  {
126  }
127 
128  // unregister from previous event handler
129  UnregisterEvents(from);
130 
131  // register to new event handler
132  RegisterEvents(to);
133  }
134 
135  //------------------------------------------------------------------------------------------------
136  protected void NotifyItemPlacementDone(IEntity item)
137  {
138  SCR_PlaceableInventoryItemComponent placeableItem = SCR_PlaceableInventoryItemComponent.Cast(item.FindComponent(SCR_PlaceableInventoryItemComponent));
139  if (!placeableItem)
140  return;
141 
142  PlayerController playerController = PlayerController.Cast(GetOwner());
143  if (!playerController)
144  return;
145 
146  placeableItem.PlacementDone(playerController.GetControlledEntity());
147  }
148 
149  //------------------------------------------------------------------------------------------------
150  protected void StartPlaceItem()
151  {
152  if (!m_bCanPlace)
153  return;
154 
155  IEntity controlledEntity = GetGame().GetPlayerController().GetControlledEntity();
156  if (!controlledEntity)
157  return;
158 
159  SCR_CharacterControllerComponent characterController = GetCharacterController(controlledEntity);
160  if (!characterController)
161  return;
162 
163  characterController.SetDisableWeaponControls(true);
164  characterController.SetDisableMovementControls(true);
165 
166  if (characterController.IsUsingItem())
167  return;
168 
169  ChimeraCharacter character = ChimeraCharacter.Cast(controlledEntity);
170  CharacterAnimationComponent animationComponent = character.GetAnimationComponent();
171  int itemActionId = animationComponent.BindCommand("CMD_Item_Action");
172  vector mat[4];
173  Math3D.MatrixCopy(m_vCurrentMat, mat);
174  PointInfo ptWS = new PointInfo();
175  mat[2] = (mat[3] - character.GetOrigin()).Normalized();
176  mat[1] = vector.Up;
177  mat[0] = Vector(mat[2][2], mat[2][1], -mat[2][0]);
178  ptWS.Set(null, "", mat);
179 
181  params.SetEntity(m_EquippedItem);
182  params.SetAllowMovementDuringAction(false);
183  params.SetKeepInHandAfterSuccess(false);
184  params.SetCommandID(itemActionId);
185  params.SetCommandIntArg(1);
186  params.SetMaxAnimLength(15.0);
187  params.SetAlignmentPoint(ptWS);
188 
189  if (characterController.TryUseItemOverrideParams(params))
190  {
191  characterController.m_OnItemUseEndedInvoker.Insert(OnPlacingEnded);
192  DisablePreview();
193  }
194  characterController.GetAnimationComponent().GetCommandHandler().AlignNewTurns();
195 
197  }
198 
199  //------------------------------------------------------------------------------------------------
200  /*protected*/ void OnPlacingEnded(IEntity item, bool successful, ItemUseParameters animParams)
201  {
202  IEntity controlledEntity = GetGame().GetPlayerController().GetControlledEntity();
203  if (!controlledEntity)
204  return;
205 
206  SCR_CharacterControllerComponent characterController = GetCharacterController(controlledEntity);
207  if (!characterController)
208  return;
209 
210  characterController.SetDisableWeaponControls(true);
211  characterController.SetDisableMovementControls(true);
212 
213  characterController.m_OnItemUseEndedInvoker.Remove(OnPlacingEnded);
214 
215  if (!successful)
216  {
217  EnablePreview(item);
218  return;
219  }
220 
221  InventoryStorageManagerComponent storageManager = InventoryStorageManagerComponent.Cast(controlledEntity.FindComponent(InventoryStorageManagerComponent));
222  if (!storageManager)
223  return;
224 
225  SCR_CharacterInventoryStorageComponent storage = SCR_CharacterInventoryStorageComponent.Cast(controlledEntity.FindComponent(SCR_CharacterInventoryStorageComponent));
226  if (!storage)
227  return;
228 
229  RplComponent rplComponent = RplComponent.Cast(m_EquippedItem.FindComponent(RplComponent));
230  if (!rplComponent)
231  return;
232 
233  SCR_PlaceableInventoryItemComponent placeableItem = SCR_PlaceableInventoryItemComponent.Cast(m_EquippedItem.FindComponent(SCR_PlaceableInventoryItemComponent));
234  if (placeableItem)
235  Rpc(RPC_AskPlaceItem, m_vCurrentMat[0], m_vCurrentMat[1], m_vCurrentMat[2], m_vCurrentMat[3], rplComponent.Id());
236 
237  storageManager.TryRemoveItemFromStorage(m_EquippedItem, storage.GetWeaponStorage());
238 
239  DisablePreview();
240  }
241 
242  //------------------------------------------------------------------------------------------------
243  protected void DisablePreview()
244  {
245  GetGame().GetInputManager().RemoveActionListener("CharacterFire", EActionTrigger.DOWN, StartPlaceItem);
246  ClearEventMask(GetOwner(), EntityEvent.FRAME);
247  delete m_PreviewEntity;
248  }
249 
250  //------------------------------------------------------------------------------------------------
251  protected void EnablePreview(IEntity weapon)
252  {
253  m_PlaceableItem = SCR_PlaceableItemComponent.Cast(weapon.FindComponent(SCR_PlaceableItemComponent));
254 
255  EntityPrefabData prefabData = weapon.GetPrefabData();
256  if (!prefabData)
257  return;
258 
259  GetGame().GetInputManager().AddActionListener("CharacterFire", EActionTrigger.DOWN, StartPlaceItem);
260 
261  SetEventMask(GetOwner(), EntityEvent.FRAME);
262  if (!m_PreviewEntity)
263  m_PreviewEntity = GetGame().SpawnEntity(GenericEntity, GetOwner().GetWorld());
264  //m_PreviewEntity = SCR_PrefabPreviewEntity.SpawnPreviewFromPrefab(Resource.Load(prefabData.GetPrefabName()), "SCR_BasePreviewEntity");
265  // Use SCR_PrefabPreviewEntity API once we have api for hierarchi bbox
266 
267  SCR_PlaceableItemComponent placeableItemComponent = SCR_PlaceableItemComponent.Cast(weapon.FindComponent(SCR_PlaceableItemComponent));
268  if (!placeableItemComponent)
269  {
270  Print("SCR_PlaceableItemComponent not found! SCR_ItemPlacementComponent.EnablePreview()");
271  return;
272  }
273 
274  vector test = m_PreviewEntity.GetOrigin();
275  m_PreviewEntity.SetObject(placeableItemComponent.GetPreviewVobject(), "");
276  }
277 
278  //------------------------------------------------------------------------------------------------
279  protected void OnComparmentEntered(IEntity targetEntity, BaseCompartmentManagerComponent manager, int mgrID, int slotID, bool move)
280  {
281  DisablePreview();
282  }
283 
284  //------------------------------------------------------------------------------------------------
285  protected void GetOnCompartmentLeft()
286  {
288  }
289 
290  //------------------------------------------------------------------------------------------------
294  {
295  WeaponSlotComponent weaponSlot = WeaponSlotComponent.Cast(weaponComponent);
296  if (!weaponSlot)
297  return null;
298 
299  return weaponSlot.GetWeaponEntity();
300  }
301 
302  //------------------------------------------------------------------------------------------------
303  protected void OnWeaponChangeEnded(BaseWeaponComponent newWeaponSlot)
304  {
307  }
308 
309  //------------------------------------------------------------------------------------------------
310  protected void OnWeaponChanged(BaseWeaponComponent newWeaponSlot)
311  {
312  DisablePreview(); // Automatically disable preview to handle cases where anim event could be missing
314  }
315 
316  //------------------------------------------------------------------------------------------------
317  protected void OnCharacterDeath(SCR_CharacterControllerComponent characterController, IEntity killerEntity, notnull Instigator killer)
318  {
319  UnregisterEvents(killerEntity);
320  m_EquippedItem = null; // Reset this cached value
321  DisablePreview();
322  }
323 
324  //------------------------------------------------------------------------------------------------
325  // Reacts to weapon changes of local character
326  protected void TogglePreview(IEntity weapon)
327  {
328  if (m_bInEditor || !weapon || !weapon.FindComponent(SCR_PlaceableItemComponent))
329  DisablePreview();
330  else
331  EnablePreview(weapon);
332  }
333 
334  //------------------------------------------------------------------------------------------------
335  protected override void EOnFrame(IEntity owner, float timeSlice)
336  {
337  if (m_CompartmnetAccessComponent.IsGettingIn())
338  {
339  DisablePreview();
340  return;
341  }
342 
343  if (!m_EquippedItem)
344  {
345  // This handles situations where f. e. land mines explode in characters hands
346  DisablePreview();
347  return;
348  }
349 
350  CameraManager cameraManager = GetGame().GetCameraManager();
351  if (!cameraManager)
352  return;
353 
354  CameraBase currentCamera = cameraManager.CurrentCamera();
355  if (!currentCamera)
356  return;
357 
358  vector cameraMat[4];
359  currentCamera.GetTransform(cameraMat);
360  float maxPlacementDistance = m_PlaceableItem.GetMaxPlacementDistance();
361  SCR_EPlacementType placementType = m_PlaceableItem.GetPlacementType();
362 
363  switch (placementType)
364  {
365  case SCR_EPlacementType.XZ_FIXED:
366  UseXZFixedPlacement(owner, maxPlacementDistance, cameraMat);
367  break;
368 
369  case SCR_EPlacementType.XYZ:
370  UseXYZPlacement(owner, maxPlacementDistance, cameraMat);
371  break;
372  }
373 
374  if (m_bCanPlace)
375  SCR_Global.SetMaterial(m_PreviewEntity, m_sCanBuildMaterial);
376  else
378  }
379 
380  //------------------------------------------------------------------------------------------------
385  void UseXZFixedPlacement(IEntity owner, float maxPlacementDistance, vector cameraMat[4])
386  {
387  vector direction = cameraMat[2];
388  direction[1] = 0;
389  direction.Normalize();
390 
391  IEntity character = SCR_PlayerController.GetLocalControlledEntity();
392 
393  // Trace against terrain and entities to detect item placement position
394  TraceParam param = new TraceParam();
395  param.Start = character.GetOrigin() + maxPlacementDistance * direction + vector.Up;
396  param.End = param.Start - 5 * vector.Up;
397  param.Flags = TraceFlags.WORLD | TraceFlags.ENTS;
398  param.Exclude = character;
399  param.LayerMask = EPhysicsLayerPresets.Projectile;
400  BaseWorld world = owner.GetWorld();
401  float traceDistance = world.TraceMove(param, ExcludeWaterCallback);
402  m_PreviewEntity.GetTransform(m_vCurrentMat);
403  m_vCurrentMat[3] = param.Start + ((param.End - param.Start) * traceDistance);
404  vector up = param.TraceNorm;
405 
406  OrientToNormal(up);
407  m_PreviewEntity.SetTransform(m_vCurrentMat);
408  m_PreviewEntity.Update();
409 
410  m_bCanPlace = ValidatePlacement(up, param.TraceEnt, world, character);
411  }
412 
413  //------------------------------------------------------------------------------------------------
414  protected bool ExcludeWaterCallback(IEntity e)
415  {
416  Physics physics = e.GetPhysics();
417  if (physics && (physics.GetInteractionLayer() & EPhysicsLayerDefs.Water || physics.IsDynamic() || physics.IsKinematic()))
418  return false;
419 
420  return true;
421  }
422 
423  //------------------------------------------------------------------------------------------------
428  void UseXYZPlacement(IEntity owner, float maxPlacementDistance, vector cameraMat[4])
429  {
430  // Trace against terrain and entities to detect item placement position
431  TraceParam param = new TraceParam();
432  param.Start = cameraMat[3];
433  param.End = param.Start + cameraMat[2] * maxPlacementDistance;
434  param.Flags = TraceFlags.WORLD | TraceFlags.ENTS;
435  param.Exclude = SCR_PlayerController.GetLocalControlledEntity();
436  param.LayerMask = EPhysicsLayerPresets.Projectile;
437  BaseWorld world = owner.GetWorld();
438  float traceDistance = world.TraceMove(param, ExcludeWaterCallback);
439  m_PreviewEntity.GetTransform(m_vCurrentMat);
440  m_vCurrentMat[3] = param.Start + ((param.End - param.Start) * traceDistance);
441  vector up = param.TraceNorm;
442 
443  IEntity tracedEntity = param.TraceEnt;
444 
445  if (traceDistance == 1) // Assume we didn't hit anything and snap item on the ground
446  {
447  // Trace against terrain and entities to detect new placement position
448  TraceParam paramGround = new TraceParam();
449  paramGround.Start = param.End + vector.Up;
450  paramGround.End = paramGround.Start - vector.Up * 20;
451  paramGround.Flags = TraceFlags.WORLD | TraceFlags.ENTS;
452  paramGround.Exclude = SCR_PlayerController.GetLocalControlledEntity();
453  paramGround.LayerMask = EPhysicsLayerPresets.Projectile;
454  float traceGroundDistance = world.TraceMove(paramGround, ExcludeWaterCallback);
455  m_PreviewEntity.GetTransform(m_vCurrentMat);
456  m_vCurrentMat[3] = paramGround.Start + ((paramGround.End - paramGround.Start) * traceGroundDistance) + vector.Up * 0.01; // adding 1 cm to avoid collision with object under
457 
458  if (traceGroundDistance < 1)
459  up = paramGround.TraceNorm;
460 
461  tracedEntity = paramGround.TraceEnt;
462  }
463 
464  OrientToNormal(up);
465  m_PreviewEntity.SetTransform(m_vCurrentMat);
466  m_PreviewEntity.Update();
467 
468  IEntity character = SCR_PlayerController.GetLocalControlledEntity();
469  vector characterOrigin = character.GetOrigin();
470 
471  if (Math.AbsFloat(m_vCurrentMat[3][1] - characterOrigin[1] > 0.4)) // Reject based on vertical distance from character
472  {
473  m_bCanPlace = false;
474  return;
475  }
476 
477  if (vector.Distance(m_vCurrentMat[3], characterOrigin) > maxPlacementDistance) // Reject based on distance from character (the maximum should be dictated by item settings)
478  {
479  m_bCanPlace = false;
480  return;
481  }
482 
483  m_bCanPlace = ValidatePlacement(up, tracedEntity, world, SCR_PlayerController.GetLocalControlledEntity());
484  }
485 
486  //------------------------------------------------------------------------------------------------
490  bool ValidateEntity(notnull IEntity entity)
491  {
492  Physics physics = entity.GetPhysics();
493  if (physics && physics.IsDynamic())
494  return false;
495 
496  // F. e. Slotted vehicle parts are physically static, but their main parent (vehicle) is not, we need to check that
497  IEntity mainEntity = SCR_EntityHelper.GetMainParent(entity);
498  if (mainEntity && mainEntity != entity)
499  {
500  physics = mainEntity.GetPhysics();
501  if (physics && physics.IsDynamic())
502  return false;
503  }
504 
505  return true;
506  }
507 
508  //------------------------------------------------------------------------------------------------
515  bool ValidatePlacement(vector up, IEntity tracedEntity, BaseWorld world, IEntity character)
516  {
517  if (vector.Dot(up, vector.Up) < 0.5) // Early reject based on the angle of placement (the maximum should be dictated by item settings)
518  {
520  return false;
521  }
522 
523  if (tracedEntity && !ValidateEntity(tracedEntity)) // Reject on items with dynamic physics
524  return false;
525 
526  array<IEntity> excludeArray = {};
527  excludeArray.Insert(m_PreviewEntity);
528  excludeArray.Insert(character);
529 
530  // Reject based on bbox collision with surrounding objects - last check, as it's the most expensive one
531  // Check bbox
532  TraceOBB paramOBB = new TraceOBB();
533  Math3D.MatrixIdentity3(paramOBB.Mat);
534  paramOBB.Mat[0] = m_vCurrentMat[0];
535  paramOBB.Mat[1] = m_vCurrentMat[1];
536  paramOBB.Mat[2] = m_vCurrentMat[2];
537  paramOBB.Start = m_vCurrentMat[3] + 0.05 * paramOBB.Mat[1];
538  paramOBB.Flags = TraceFlags.ENTS;
539  paramOBB.ExcludeArray = excludeArray;
540  paramOBB.LayerMask = EPhysicsLayerPresets.Projectile;
541  m_PreviewEntity.GetBounds(paramOBB.Mins, paramOBB.Maxs);
542  world.TracePosition(paramOBB, TraceEntitiesCallback);
543 
544  // collides with another entity
545  if (paramOBB.TraceEnt)
546  return false;
547 
548  return true;
549  }
550 
551  //------------------------------------------------------------------------------------------------
555  bool TraceEntitiesCallback(notnull IEntity e, vector start = "0 0 0", vector dir = "0 0 0")
556  {
557  return true;
558  }
559 
560  //------------------------------------------------------------------------------------------------
563  void OrientToNormal(vector normal)
564  {
565  vector origin = m_vCurrentMat[3];
566  vector perpend = normal.Perpend();
567  Math3D.DirectionAndUpMatrix(perpend, normal, m_vCurrentMat);
568 
569  vector basis[4];
570  Math3D.AnglesToMatrix(Vector(-perpend.VectorToAngles()[0], 0, 0), basis);
571  Math3D.MatrixMultiply3(m_vCurrentMat, basis, m_vCurrentMat);
572  m_vCurrentMat[3] = origin;
573  }
574 
575  //------------------------------------------------------------------------------------------------
576  protected void OnEditorOpened()
577  {
578  m_bInEditor = true;
579  DisablePreview();
580  }
581 
582  //------------------------------------------------------------------------------------------------
583  protected void OnEditorClosed()
584  {
585  m_bInEditor = false;
587  }
588 
589  //------------------------------------------------------------------------------------------------
591  {
592  manager.GetOnOpened().Insert(OnEditorOpened);
593  manager.GetOnClosed().Insert(OnEditorClosed);
594  }
595 
596  //------------------------------------------------------------------------------------------------
597  protected override void OnPostInit(IEntity owner)
598  {
599  SetEventMask(owner, EntityEvent.INIT);
600  }
601 
602  //------------------------------------------------------------------------------------------------
603  protected void InitEditorListeners()
604  {
606  if (!core)
607  return;
608 
609  SCR_EditorManagerEntity editorManager = core.GetEditorManager();
610 
611  if (!editorManager)
612  core.Event_OnEditorManagerInitOwner.Insert(RegisterToManagerInvokers);
613  else
614  RegisterToManagerInvokers(editorManager);
615  }
616 
617  //------------------------------------------------------------------------------------------------
618  protected override void EOnInit(IEntity owner)
619  {
620  SCR_PlayerController playerController = SCR_PlayerController.Cast(GetOwner());
621  if (!playerController)
622  {
623  Print("SCR_ItemPlacementComponent is not attached to SCR_PlayerController!", LogLevel.WARNING);
624  return;
625  }
626 
627  Math3D.MatrixIdentity4(m_vCurrentMat);
628  GetGame().GetInputManager().AddActionListener("CharacterFire", EActionTrigger.DOWN, StartPlaceItem);
629 
631 
632  playerController.m_OnControlledEntityChanged.Insert(OnControlledEntityChanged);
633  }
634 
635  //------------------------------------------------------------------------------------------------
636  // constructor
640  void SCR_ItemPlacementComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
641  {
642  m_iEquipComplete = GameAnimationUtils.RegisterAnimationEvent("EquipComplete");
643  }
644 }
m_sCannotBuildMaterial
Assets Conflict CannotBuild emat ResourceName m_sCannotBuildMaterial
Definition: SCR_ItemPlacementComponent.c:12
direction
vector direction
Definition: SCR_DestructibleTreeV2.c:31
m_EquippedItem
protected IEntity m_EquippedItem
Definition: SCR_ItemPlacementComponent.c:21
GetCharacterController
protected SCR_CharacterControllerComponent GetCharacterController(IEntity from)
Definition: SCR_ItemPlacementComponent.c:50
SCR_PlayerController
Definition: SCR_PlayerController.c:31
SCR_EntityHelper
Definition: SCR_EntityHelper.c:1
SCR_CompartmentAccessComponent
Definition: SCR_CompartmentAccessComponent.c:15
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
UseXYZPlacement
void UseXYZPlacement(IEntity owner, float maxPlacementDistance, vector cameraMat[4])
Definition: SCR_ItemPlacementComponent.c:428
ScriptComponent
SCR_SiteSlotEntityClass ScriptComponent
OnControlledEntityChanged
protected void OnControlledEntityChanged(IEntity from, IEntity to)
Runs every time the controlled entity has been changed.
Definition: SCR_ItemPlacementComponent.c:113
SCR_EPlacementType
SCR_EPlacementType
Definition: SCR_PlaceableItemComponent.c:50
ExcludeWaterCallback
protected bool ExcludeWaterCallback(IEntity e)
Definition: SCR_ItemPlacementComponent.c:414
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
ValidatePlacement
bool ValidatePlacement(vector up, IEntity tracedEntity, BaseWorld world, IEntity character)
Definition: SCR_ItemPlacementComponent.c:515
SCR_ItemPlacementComponentClass
Definition: SCR_ItemPlacementComponent.c:2
ItemUseParameters
Definition: ItemUseParameters.c:15
OnWeaponChangeEnded
protected void OnWeaponChangeEnded(BaseWeaponComponent newWeaponSlot)
Definition: SCR_ItemPlacementComponent.c:303
GetOnCompartmentLeft
protected void GetOnCompartmentLeft()
Definition: SCR_ItemPlacementComponent.c:285
EnablePreview
protected void EnablePreview(IEntity weapon)
Definition: SCR_ItemPlacementComponent.c:251
WeaponSlotComponent
Definition: WeaponSlotComponent.c:12
UseXZFixedPlacement
void UseXZFixedPlacement(IEntity owner, float maxPlacementDistance, vector cameraMat[4])
Definition: SCR_ItemPlacementComponent.c:385
RplRpc
SCR_AchievementsHandlerClass ScriptComponentClass RplRpc(RplChannel.Reliable, RplRcver.Owner)] void UnlockOnClient(AchievementId achievement)
Definition: SCR_AchievementsHandler.c:11
m_PreviewEntity
protected IEntity m_PreviewEntity
Definition: SCR_ItemPlacementComponent.c:23
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
func
func
Definition: SCR_AIThreatSystem.c:5
RPC_AskPlaceItem
void RPC_AskPlaceItem(vector right, vector up, vector forward, vector position, RplId id)
Definition: SCR_ItemPlacementComponent.c:34
SCR_CharacterControllerComponent
Definition: SCR_CharacterControllerComponent.c:35
m_bInEditor
protected bool m_bInEditor
Definition: SCR_ItemPlacementComponent.c:19
Instigator
Definition: Instigator.c:6
TraceEntitiesCallback
bool TraceEntitiesCallback(notnull IEntity e, vector start="0 0 0", vector dir="0 0 0")
Definition: SCR_ItemPlacementComponent.c:555
ValidateEntity
bool ValidateEntity(notnull IEntity entity)
Definition: SCR_ItemPlacementComponent.c:490
m_vCurrentMat
protected vector m_vCurrentMat[4]
Definition: SCR_ItemPlacementComponent.c:20
TogglePreview
protected void TogglePreview(IEntity weapon)
Definition: SCR_ItemPlacementComponent.c:326
SCR_ItemPlacementComponent
void SCR_ItemPlacementComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_ItemPlacementComponent.c:640
InventoryStorageManagerComponent
Definition: InventoryStorageManagerComponent.c:12
OnWeaponChanged
protected void OnWeaponChanged(BaseWeaponComponent newWeaponSlot)
Definition: SCR_ItemPlacementComponent.c:310
SCR_EditorManagerCore
Core component to manage SCR_EditorManagerEntity.
Definition: SCR_EditorManagerCore.c:5
DisablePreview
protected void DisablePreview()
Definition: SCR_ItemPlacementComponent.c:243
m_bCanPlace
protected bool m_bCanPlace
Definition: SCR_ItemPlacementComponent.c:18
BaseWeaponComponent
Definition: BaseWeaponComponent.c:12
RegisterToManagerInvokers
protected void RegisterToManagerInvokers(SCR_EditorManagerEntity manager)
Definition: SCR_ItemPlacementComponent.c:590
OnPostInit
protected override void OnPostInit(IEntity owner)
Called on PostInit when all components are added.
Definition: SCR_ItemPlacementComponent.c:597
OnEditorOpened
protected void OnEditorOpened()
Definition: SCR_ItemPlacementComponent.c:576
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
NotifyItemPlacementDone
protected void NotifyItemPlacementDone(IEntity item)
Definition: SCR_ItemPlacementComponent.c:136
RegisterEvents
protected void RegisterEvents(IEntity to)
Definition: SCR_ItemPlacementComponent.c:88
OrientToNormal
void OrientToNormal(vector normal)
Definition: SCR_ItemPlacementComponent.c:563
OnEditorClosed
protected void OnEditorClosed()
Definition: SCR_ItemPlacementComponent.c:583
EOnInit
protected override void EOnInit(IEntity owner)
Definition: SCR_ItemPlacementComponent.c:618
StartPlaceItem
protected void StartPlaceItem()
Definition: SCR_ItemPlacementComponent.c:150
GameAnimationUtils
Definition: GameAnimationUtils.c:7
InitEditorListeners
protected void InitEditorListeners()
Definition: SCR_ItemPlacementComponent.c:603
SCR_Global
Definition: Functions.c:6
Attribute
SCR_ItemPlacementComponentClass ScriptComponentClass Attribute("{56EBF5038622AC95}Assets/Conflict/CanBuild.emat")
Definition: SCR_ItemPlacementComponent.c:8
m_CompartmnetAccessComponent
protected SCR_CompartmentAccessComponent m_CompartmnetAccessComponent
Definition: SCR_ItemPlacementComponent.c:24
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
OnCharacterDeath
protected void OnCharacterDeath(SCR_CharacterControllerComponent characterController, IEntity killerEntity, notnull Instigator killer)
Definition: SCR_ItemPlacementComponent.c:317
UnregisterEvents
protected void UnregisterEvents(IEntity from)
Definition: SCR_ItemPlacementComponent.c:63
m_PlaceableItem
protected SCR_PlaceableItemComponent m_PlaceableItem
Definition: SCR_ItemPlacementComponent.c:22
GetWeaponFromWeaponComponent
IEntity GetWeaponFromWeaponComponent(BaseWeaponComponent weaponComponent)
Definition: SCR_ItemPlacementComponent.c:293
position
vector position
Definition: SCR_DestructibleTreeV2.c:30
m_iEquipComplete
protected int m_iEquipComplete
Definition: SCR_ItemPlacementComponent.c:17
EOnFrame
protected override void EOnFrame(IEntity owner, float timeSlice)
Definition: SCR_ItemPlacementComponent.c:335
m_iFramesBetweenChecks
int m_iFramesBetweenChecks
Definition: SCR_ItemPlacementComponent.c:15
OnPlacingEnded
void OnPlacingEnded(IEntity item, bool successful, ItemUseParameters animParams)
Definition: SCR_ItemPlacementComponent.c:200
OnComparmentEntered
protected void OnComparmentEntered(IEntity targetEntity, BaseCompartmentManagerComponent manager, int mgrID, int slotID, bool move)
Definition: SCR_ItemPlacementComponent.c:279
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180
SCR_EditorManagerEntity
Definition: SCR_EditorManagerEntity.c:26