39enum EGadgetAnimVariable
54class SCR_GadgetComponent : ScriptGameComponent
56 [
Attribute(
"", UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EGadgetAnimVariable),
desc:
"Gadget anim variable",
category:
"Gadget")]
57 protected EGadgetAnimVariable m_eAnimVariable;
59 [
Attribute(
SCR_EUseContext.NONE.ToString(), uiwidget: UIWidgets.Flags,
desc:
"From what context this gadget can be toggled.\nValue NONE is always selected but it is ignored when there is any other value selected", enums: ParamEnumArray.FromEnum(
SCR_EUseContext),
category:
"Gadget")]
62 [
Attribute(
"0 0 0", UIWidgets.Coords,
desc:
"Adjusted position of prefab within equipment slot, for when items placed intto a same slot have different sizes like flashlights",
category:
"Gadget")]
63 protected vector m_vEquipmentSlotOffset;
65 [
Attribute(
"0.5", UIWidgets.Auto,
desc:
"Weapon no fire time set while equipped\n[s]",
category:
"Gadget")]
66 protected float m_fWeaponNoFireTime;
69 protected bool m_bCanBeHeld;
72 protected bool m_bActivated =
false;
73 protected EGadgetMode m_iMode = EGadgetMode.ON_GROUND;
78 EGadgetAnimVariable GetAnimVariable()
80 return m_eAnimVariable;
85 float GetWeaponNoFireTime()
87 return m_fWeaponNoFireTime;
105 void OnParentSlotChanged(InventoryStorageSlot oldSlot, InventoryStorageSlot newSlot)
108 if (!SCR_ChimeraCharacter.Cast(parentOwner))
111 SCR_GadgetManagerComponent.SetGadgetModeStashed(
this, EGadgetMode.ON_GROUND);
113 SCR_GadgetManagerComponent.SetGadgetModeStashed(
this, EGadgetMode.IN_STORAGE);
121 void OnModeChanged(EGadgetMode mode,
IEntity charOwner)
139 UpdateVisibility(mode);
142 if (mode == EGadgetMode.ON_GROUND)
151 protected void ModeClear(EGadgetMode mode);
156 void OnSlotOccludedStateChanged(
bool occluded);
162 ConnectToGadgetsSystem();
169 DisconnectFromGadgetsSystem();
176 void UpdateVisibility(EGadgetMode mode)
179 InventoryItemComponent itemComponent = InventoryItemComponent.Cast(
GetOwner().FindComponent(InventoryItemComponent));
184 if ( mode == EGadgetMode.IN_HAND || (mode == EGadgetMode.IN_SLOT &&
IsVisibleEquipped()) )
187 if (mode != EGadgetMode.IN_HAND)
189 InventoryStorageSlot slot = itemComponent.GetParentSlot();
190 ItemAnimationAttributes animAttr = ItemAnimationAttributes.Cast(itemComponent.FindAttribute(ItemAnimationAttributes));
191 if (slot && animAttr)
194 animAttr.GetAdditiveTransformLS(matLS);
195 matLS[3] = matLS[3] + m_vEquipmentSlotOffset;
196 slot.SetAdditiveTransformLS(matLS);
199 EquipmentStorageSlot equipSlot = EquipmentStorageSlot.Cast(slot);
200 if (equipSlot && equipSlot.IsOccluded())
202 itemComponent.HideOwner();
207 itemComponent.ShowOwner();
212 if (mode == EGadgetMode.ON_GROUND)
213 itemComponent.ShowOwner();
215 itemComponent.HideOwner();
230 RplComponent rplComponent = RplComponent.Cast(
m_CharacterOwner.FindComponent(RplComponent));
231 if (!rplComponent || !rplComponent.IsOwner())
235 rplComponent = RplComponent.Cast(
GetOwner().FindComponent(RplComponent));
236 if (rplComponent && rplComponent.IsProxy())
240 SCR_GadgetManagerComponent.GetGadgetManager(
m_CharacterOwner).AskToggleGadget(
this, state);
250 void ToggleFocused(
bool enable)
259 controller.SetGadgetFocus(enable);
275 return EGadgetType.NONE;
281 EGadgetMode GetMode()
330 void Update(
float timeSlice);
334 protected void ConnectToGadgetsSystem()
337 GadgetsSystem gadgetSystem = GadgetsSystem.Cast(world.FindSystem(GadgetsSystem));
345 protected void DisconnectFromGadgetsSystem()
348 GadgetsSystem gadgetSystem = GadgetsSystem.Cast(world.FindSystem(GadgetsSystem));
356 override bool RplSave(ScriptBitWriter writer)
358 writer.WriteIntRange(m_iMode, 0, EGadgetMode.LAST-1);
364 override bool RplLoad(ScriptBitReader reader)
366 reader.ReadIntRange(m_iMode, 0, EGadgetMode.LAST-1);
368 UpdateVisibility(m_iMode);
376 DisconnectFromGadgetsSystem();
378 super.OnDelete(owner);
386 InventoryItemComponent invComp = InventoryItemComponent.Cast(
GetOwner().FindComponent(InventoryItemComponent));
388 invComp.m_OnParentSlotChangedInvoker.Insert(OnParentSlotChanged);
ArmaReforgerScripted GetGame()
SCR_RplTestComponentClass m_CharacterOwner
SCR_AIGroupInfoComponentClass LAST
override bool RplLoad(ScriptBitReader reader)
override bool RplSave(ScriptBitWriter writer)
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
override bool IsVisibleEquipped()
override void ActivateGadgetUpdate()
override void DeactivateGadgetUpdate()
override bool CanBeRaised()
SCR_GadgetComponentClass FLASHLIGHT_SOVIET_01
SCR_GadgetComponentClass B12
SCR_GadgetComponentClass M22
SCR_GadgetComponentClass BUILDING_TOOL
SCR_GadgetComponentClass MAP
SCR_GadgetComponentClass GPS
SCR_GadgetComponentClass IN_STORAGE
SCR_GadgetComponentClass ANPRC68
SCR_GadgetComponentClass R148
SCR_GadgetComponentClass WRISTWATCH
SCR_GadgetComponentClass NIGHT_VISION
SCR_GadgetComponentClass IN_HAND
SCR_GadgetComponentClass RADIO
SCR_GadgetComponentClass ON_GROUND
Gadget mode.
SCR_GadgetComponentClass FLASHLIGHT
SCR_GadgetComponentClass IN_SLOT
SCR_GadgetComponentClass BINOCULARS
SCR_GadgetComponentClass SPECIALIST_ITEM
SCR_GadgetComponentClass MX991
SCR_GadgetComponentClass COMPASS
SCR_GadgetComponentClass DETONATOR
void ToggleActive()
Toggle map light.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
SCR_ChimeraCharacter GetCharacterOwner()
Returns the top most owner of this object or the operator of this turret.
override bool IsUsingADSControls()
enum EVehicleType IEntity
void Register(SCR_GadgetComponent component)
void Unregister(SCR_GadgetComponent component)
proto external BaseWorld GetWorld()
proto external IEntity GetRootParent()
IEntity GetOwner()
Owner entity of the fuel tank.
@ NONE
When Shape is created and not initialized yet.
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
proto external PlayerController GetPlayerController()