4 private void Register(
SCR_DebugMenuID id,
string name,
bool angles =
false)
6 const string angleLimits =
"-180, 180, 0, 0.01";
7 const string linearLimits =
"-10, 10, 0, 0.0001";
10 DiagMenu.RegisterRange(
id,
"", name,
"TestAimModifier", angleLimits);
12 DiagMenu.RegisterRange(
id,
"", name,
"TestAimModifier", linearLimits);
16 protected override void OnInit(IEntity weaponEnt)
19 DiagMenu.RegisterMenu(
SCR_DebugMenuID.DEBUGUI_AIMMODIFIER_MENU,
"TestAimModifier",
"Weapons");
40 DiagMenu.RegisterBool(
SCR_DebugMenuID.DEBUGUI_AIMMODIFIER_RESET,
"",
"Reset aim mod",
"TestAimModifier");
44 private void SetLinear(vector v)
46 DiagMenu.SetRangeValue(
SCR_DebugMenuID.DEBUGUI_AIMMODIFIER_LIN_X, v[0]);
47 DiagMenu.SetRangeValue(
SCR_DebugMenuID.DEBUGUI_AIMMODIFIER_LIN_Y, v[1]);
48 DiagMenu.SetRangeValue(
SCR_DebugMenuID.DEBUGUI_AIMMODIFIER_LIN_Z, v[2]);
52 private vector GetLinear()
62 private void SetAngular(vector v)
64 DiagMenu.SetRangeValue(
SCR_DebugMenuID.DEBUGUI_AIMMODIFIER_ANG_X, v[0]);
65 DiagMenu.SetRangeValue(
SCR_DebugMenuID.DEBUGUI_AIMMODIFIER_ANG_Y, v[1]);
66 DiagMenu.SetRangeValue(
SCR_DebugMenuID.DEBUGUI_AIMMODIFIER_ANG_Z, v[2]);
70 private vector GetAngular()
80 private void SetTurn(vector v)
82 DiagMenu.SetRangeValue(
SCR_DebugMenuID.DEBUGUI_AIMMODIFIER_TURN_X, v[0]);
83 DiagMenu.SetRangeValue(
SCR_DebugMenuID.DEBUGUI_AIMMODIFIER_TURN_Y, v[1]);
87 private vector GetTurn()
97 protected override void OnCalculate(IEntity owner,
WeaponAimModifierContext context,
float timeSlice, out vector translation, out vector
rotation, out vector turnOffset)
102 SetLinear(vector.Zero);
103 SetAngular(vector.Zero);
104 SetTurn(vector.Zero);
107 translation = GetLinear();
109 turnOffset = GetTurn();
111 if (m_weaponManagerComponent)
116 BaseSightsComponent bsc = weaponComponent.GetSights();
119 bsc.ForceSightsZeroValue(translation,
rotation, turnOffset);
126 protected override void OnWeaponFired()
133 protected override void OnActivated(IEntity weaponOwner)
135 m_weaponManagerComponent = BaseWeaponManagerComponent.Cast(weaponOwner.FindComponent(BaseWeaponManagerComponent));
138 protected BaseWeaponManagerComponent m_weaponManagerComponent;