6 class SCR_SupportStationGadgetComponent : SCR_GadgetComponent
9 protected ref array<ESupportStationType> m_aSupportStationTypes;
11 [
Attribute(
"1",
desc:
"If true then the animation target will be the gadget Offset in world position",
category:
"Support Gadget")]
14 protected ref map<ESupportStationType, SCR_BaseSupportStationComponent>
m_mSupportStations =
new map<ESupportStationType, SCR_BaseSupportStationComponent>();
21 types.Copy(m_aSupportStationTypes);
31 return m_aSupportStationTypes.Contains(
type);
39 ChimeraCharacter chimeraCharacter = ChimeraCharacter.Cast(character);
40 if (!chimeraCharacter)
43 CharacterControllerComponent charController = chimeraCharacter.GetCharacterController();
47 CharacterAnimationComponent animationComponent = charController.GetAnimationComponent();
48 if (!animationComponent)
51 CharacterCommandHandlerComponent commandHandlerComponent = CharacterCommandHandlerComponent.Cast(animationComponent.FindComponent(CharacterCommandHandlerComponent));
52 return commandHandlerComponent && commandHandlerComponent.IsItemActionLoopTag();
62 if (animationCommand < 0)
77 if (animationCommand < 0)
80 ChimeraCharacter chimeraCharacter = ChimeraCharacter.Cast(character);
81 if (!chimeraCharacter)
84 CharacterControllerComponent charController = chimeraCharacter.GetCharacterController();
88 CharacterAnimationComponent animationComponent = charController.GetAnimationComponent();
89 if (!animationComponent)
92 CharacterCommandHandlerComponent commandHandlerComponent = CharacterCommandHandlerComponent.Cast(animationComponent.FindComponent(CharacterCommandHandlerComponent));
93 if (commandHandlerComponent)
94 commandHandlerComponent.FinishItemUse();
100 ChimeraCharacter chimeraCharacter = ChimeraCharacter.Cast(character);
101 if (!chimeraCharacter)
104 CharacterControllerComponent charController = chimeraCharacter.GetCharacterController();
108 CharacterAnimationComponent animationComponent = charController.GetAnimationComponent();
109 if (!animationComponent)
112 PointInfo ptWS =
null;
115 if (animationTarget != vector.Zero)
117 vector charWorldMat[4];
118 character.GetWorldTransform(charWorldMat);
119 charWorldMat[3] = animationTarget;
120 ptWS =
new PointInfo();
121 ptWS.Set(
null,
"", charWorldMat);
124 int itemActionId = animationComponent.BindCommand(
"CMD_Item_Action");
128 params.SetAllowMovementDuringAction(
false);
129 params.SetKeepInHandAfterSuccess(
true);
130 params.SetCommandID(itemActionId);
131 params.SetCommandIntArg(animationCMD);
132 params.SetCommandFloatArg(2.0);
133 params.SetAlignmentPoint(ptWS);
135 charController.TryUseItemOverrideParams(
params);
144 SCR_BaseSupportStationComponent supportStation;
147 return supportStation;
155 static SCR_BaseSupportStationComponent GetHeldSupportStation(
ESupportStationType supportStationType, notnull IEntity character)
157 SCR_SupportStationGadgetComponent gadgetComponent = GetHeldSupportStationGadget(supportStationType, character);
158 if (!gadgetComponent)
161 return gadgetComponent.GetSupportStation(supportStationType);
169 static SCR_SupportStationGadgetComponent GetHeldSupportStationGadget(
ESupportStationType supportStationType, notnull IEntity character)
175 SCR_SupportStationGadgetComponent gadgetComponent = SCR_SupportStationGadgetComponent.Cast(gadgetManager.GetHeldGadgetComponent());
176 if (!gadgetComponent)
179 if (!gadgetComponent.IsGadgetOfSupportStationType(supportStationType))
182 return gadgetComponent;
192 static bool GetHeldSupportStationAndGadget(
ESupportStationType supportStationType, notnull IEntity character, out SCR_BaseSupportStationComponent supportStation, out SCR_SupportStationGadgetComponent supportStationGadget)
198 supportStationGadget = SCR_SupportStationGadgetComponent.Cast(gadgetManager.GetHeldGadgetComponent());
199 if (!supportStationGadget)
202 if (!supportStationGadget.IsGadgetOfSupportStationType(supportStationType))
205 supportStation = supportStationGadget.GetSupportStation(supportStationType);
206 return supportStation;
212 super.EOnInit(owner);
214 array<Managed> supportStations = {};
215 GetOwner().FindComponents(SCR_BaseSupportStationComponent, supportStations);
218 SCR_BaseSupportStationComponent supportStation;
219 foreach (Managed supportStationManaged : supportStations)
221 supportStation = SCR_BaseSupportStationComponent.Cast(supportStationManaged);
227 Print(
"Support Station Gadget has two or more support stations of type: '" +
typename.EnumToString(
ESupportStationType, supportStation.GetSupportStationType()) +
"' it can only have one of the same type!", LogLevel.WARNING);
238 return EGadgetType.SPECIALIST_ITEM;