Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_EditableDecalComponent.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/Editor (Editables)", description: "")]
5
7
18class SCR_EditableDecalComponent : SCR_EditableEntityComponent
19{
20 protected DecalEntity m_Decal;
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}
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
float m_vDecalScale
vector m_vDecalTransform[4]
override void Log()
proto external int SetEventMask(notnull IEntity owner, int mask)
proto external vector GetWorldTransformAxis(int axis)
See IEntity::GetTransformAxis.
proto external IEntity GetChildren()
proto external EntityFlags SetFlags(EntityFlags flags, bool recursively=false)
proto external EntityFlags ClearFlags(EntityFlags flags, bool recursively=false)
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
void SetTransformBroadcast(vector transform[4])
proto external GenericEntity GetOwner()
Get owner entity.
void EOnInit(IEntity owner)
void EntitySpawnParams()
Definition gameLib.c:130
IEntity GetOwner()
Owner entity of the fuel tank.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_EditableDecalComponentClass m_Decal
EntityEvent
Various entity events.
Definition EntityEvent.c:14
EntityFlags
Various entity flags.
Definition EntityFlags.c:14
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
Definition EnNetwork.c:95
RplRcver
Definition RplRcver.c:59
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.
Definition RplChannel.c:14