Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EditableDecalComponent.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/Editor (Editables)", description: "")]
3 {
4 }
5 
7 
18 class SCR_EditableDecalComponent : SCR_EditableEntityComponent
19 {
20  protected DecalEntity m_Decal;
21  protected vector m_vDecalTransform[4];
22  protected float m_vDecalScale;
23 
24  //------------------------------------------------------------------------------------------------
25  [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
26  override protected void SetTransformBroadcast(vector transform[4])
27  {
28  super.SetTransformBroadcast(transform);
29 
30  if (m_Decal)
31  {
32  //--- Create a new decal and delete the previous one, because moving existing decals is not possible
33  EntitySpawnParams spawnParams = new EntitySpawnParams();
34  spawnParams.Parent = GetOwner();
35  spawnParams.TransformMode = ETransformMode.LOCAL;
36  spawnParams.Transform = m_vDecalTransform;
37  spawnParams.Scale = m_vDecalScale;
38 
39  EntityPrefabData decalPrefabData = m_Decal.GetPrefabData();
40  ResourceName decalPrefab = SCR_BaseContainerTools.GetPrefabResourceName(decalPrefabData.GetPrefab());
41  DecalEntity newDecal = DecalEntity.Cast(GetGame().SpawnEntityPrefab(Resource.Load(decalPrefab), GetOwner().GetWorld(), spawnParams));
42 
43  delete m_Decal;
44  m_Decal = newDecal;
45  }
46  }
47 
48  //------------------------------------------------------------------------------------------------
49  override void EOnInit(IEntity owner)
50  {
51  m_Decal = DecalEntity.Cast(owner.GetChildren());
52  if (m_Decal)
53  {
54  m_Decal.GetLocalTransform(m_vDecalTransform);
55  m_vDecalScale = owner.GetWorldTransformAxis(0).Length() / m_Decal.GetScale();
56  }
57  else
58  {
59  Log("No child of type DecalEntity found!", true, LogLevel.WARNING);
60  }
61  }
62 
63  //------------------------------------------------------------------------------------------------
64  override void OnPostInit(IEntity owner)
65  {
66  super.OnPostInit(owner);
67  SetEventMask(owner, EntityEvent.INIT);
68  owner.SetFlags(EntityFlags.NO_LINK | EntityFlags.NO_TREE);
69  owner.ClearFlags(EntityFlags.TRACEABLE);
70  }
71 
72  //------------------------------------------------------------------------------------------------
73  override void OnDelete(IEntity owner)
74  {
75  super.OnDelete(owner);
76  delete m_Decal;
77  }
78 }
m_Decal
SCR_EditableDecalComponentClass m_Decal
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
OnDelete
override void OnDelete(IEntity owner)
Definition: SCR_EditableDecalComponent.c:73
RplRpc
SCR_AchievementsHandlerClass ScriptComponentClass RplRpc(RplChannel.Reliable, RplRcver.Owner)] void UnlockOnClient(AchievementId achievement)
Definition: SCR_AchievementsHandler.c:11
OnPostInit
override void OnPostInit(IEntity owner)
Called on PostInit when all components are added.
Definition: SCR_EditableDecalComponent.c:64
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
m_vDecalScale
protected float m_vDecalScale
Definition: SCR_EditableDecalComponent.c:22
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
EOnInit
override void EOnInit(IEntity owner)
Definition: SCR_EditableDecalComponent.c:49
SCR_BaseContainerTools
Definition: SCR_BaseContainerTools.c:3
SetTransformBroadcast
override protected void SetTransformBroadcast(vector transform[4])
Definition: SCR_EditableDecalComponent.c:26
SCR_EditableDecalComponentClass
Definition: SCR_EditableDecalComponent.c:2
SCR_EditableEntityComponentClass
Definition: SCR_EditableEntityComponentClass.c:2
m_vDecalTransform
protected vector m_vDecalTransform[4]
Definition: SCR_EditableDecalComponent.c:21
Log
override void Log()
Definition: SCR_VotingBase.c:75
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180