Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_DeployableInventoryItemInventoryComponent.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/Components", description: "Mine inventory item component.")]
3{
4 [Attribute(desc: "Additional offset to the position at which entity will be dropped from inventory.\nGame will use position of the user that dropped this item on the groun and add to it this offset.\nWhen both rotation and position offsets are set to zero. then default placement mechanism will be used, unless forced by m_bForceItemDropOnCharacterPosition.", category: "Setup")]
6
7 [Attribute(desc: "Additional rotation to the orientation in which entity end up after it is dropped from the inventory.\nGame will use position of the user that dropped this item on the groun and add to it this offset.\nWhen both rotation and position offsets are set to zero. then default placement mechanism will be used, unless forced by m_bForceItemDropOnCharacterPosition.", category: "Setup")]
9
10 [Attribute(desc: "Ensures that even when item offsets are not defined, then game will place dropped item on the position of the character that dropped it.", category: "Setup")]
12
13 //------------------------------------------------------------------------------------------------
18
19 //------------------------------------------------------------------------------------------------
24
25 //------------------------------------------------------------------------------------------------
30}
31
32class SCR_DeployableInventoryItemInventoryComponent : SCR_PlaceableInventoryItemComponent
33{
34
35 //------------------------------------------------------------------------------------------------
36 override bool ShouldHideInVicinity()
37 {
39 if (!deployableItemComponent)
40 return false;
42 return deployableItemComponent.IsDeployed();
43 }
45 //------------------------------------------------------------------------------------------------
46 override bool OverridePlacementTransform(IEntity caller, out vector computedTransform[4])
47 {
48 if (m_bUseTransform)
49 return super.OverridePlacementTransform(caller, computedTransform);
50
51 IEntity owner = GetOwner();
52 if (!owner || owner.IsDeleted())
53 return false;
54
55 ChimeraCharacter character = ChimeraCharacter.Cast(caller);
56 if (!character)
57 return false;
58
63 if (!data.IsItemForceDroppedOnCharacterPosition() && data.GetAdditionalDropOffset() == vector.Zero && data.GetAdditionalDropRotation() == vector.Zero)
64 return false;
65
66 TraceParam param = new TraceParam();
67 array<IEntity> exclude = {owner, caller};
68 param.ExcludeArray = exclude;
69
70 //figure out where we can place this
71 SCR_TerrainHelper.GetTerrainBasis(character.AimingPosition(), computedTransform, caller.GetWorld(), false, param);
72
73 //rotate to where character is facing while being parallel to the ground
74 vector charMat[4];
75 character.GetTransform(charMat);
76 vector right = computedTransform[1] * charMat[0];
77 vector forward = computedTransform[1] * right;
78 computedTransform[0] = forward.Normalized();
79 computedTransform[2] = right.Normalized();
80
81 //apply offsets
82 vector additiveMat[4];
83 Math3D.AnglesToMatrix(data.GetAdditionalDropRotation(), additiveMat);
84 additiveMat[3] = data.GetAdditionalDropOffset();
85 Math3D.MatrixMultiply4(computedTransform, additiveMat, computedTransform);
86
87 return true;
88 }
89
90 //------------------------------------------------------------------------------------------------
91 override protected void PlayPlacedSound(vector up, vector position, string overrideSoundEvent = SCR_SoundEvent.SOUND_PLACE_OBJECT)
92 {
93 if (overrideSoundEvent == SCR_SoundEvent.SOUND_PLACE_OBJECT)
94 overrideSoundEvent = SCR_SoundEvent.SOUND_DROP;
95
96 super.PlayPlacedSound(up, position, overrideSoundEvent)
97 }
98}
SCR_CharacterSoundComponentClass GetComponentData()
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
SCR_DeployableInventoryItemInventoryComponentClass SCR_PlaceableInventoryItemComponentClass ShouldHideInVicinity()
vector position
Get all prefabs that have the spawner data
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external BaseWorld GetWorld()
proto external bool IsDeleted()
Base class which all deployable inventory items inherit from.
override bool OverridePlacementTransform(IEntity caller, out vector computedTransform[4])
void PlayPlacedSound(vector up, vector position, string overrideSoundEvent=SCR_SoundEvent.SOUND_PLACE_OBJECT)
IEntity GetOwner()
Owner entity of the fuel tank.
SCR_FieldOfViewSettings Attribute