← Home SEEBIE90 DOCS
Download PDF
The GTG Thermal Framework mod is published under the Arma Public License (APL)Example code is free to useSuggestions: Discord to the author

Build it into your mod

Keys and hooks

The component only knows the names of actions. Where the keys come from is your decision – and there is one rule that decides it.

In plain wordsThe framework ships no key bindings, because only one addon can override the input configuration. You define actions yourself, or reuse the ones of the SOFLAM Core, and an empty hook lets you add a laser power key.

Why the framework ships no bindings

The input configuration of the game, Configs/System/chimeraInputCommon.conf, is one file. If two addons both override it, one of them wins and the other one loses its actions – without an error. A framework that shipped its own copy would silently remove the keys of every other mod that does the same. So the framework leaves the file alone.

You build…Do this
A mod without the SOFLAM CoreDefine your own actions with your own names and enter the names on the component (step 2 of Add it to your optic). Your chimeraInputCommon.conf is then the only one.
A mod with the SOFLAM Core as a dependencyDo not ship a copy of the input configuration. The Core already defines the default actions below and puts them into the character, helicopter and turret contexts. Leave the attributes at their defaults.
Two ownersA mod that overrides the input configuration while the Core is loaded takes the Core’s keys away, or loses its own. Pick one owner for the file in a collection, and make the others reuse its action names.

The default action names

These are the names the component uses when its key attributes are left alone. They are defined by the SOFLAM Core, not by the framework.

AttributeDefault actionKey in the CoreDoes
m_sCycleActionGTG_SOFLAM_VisionModeActionICycle normal / night vision / thermal
m_sToggleNvThermalActionGTG_SOFLAM_ToggleNvThermalActionright mouse buttonStraight between night vision and thermal
m_sPaletteActionGTG_SOFLAM_ThermalPaletteActionJNext palette
m_sGainUpAction / m_sGainDownActionGTG_SOFLAM_GainUpAction / _GainDownActionShift + wheelNight-vision gain, thermal window
m_sLaserPowerUpAction / m_sLaserPowerDownActionemptyH + wheel (SOFLAM)Laser power – the framework knows no laser, see the hook below

Define your own actions

An action needs a name and an input source; a context decides where it is active. This is the shape of the real file, cut down to one action. The two ActionRefs +{ ... } blocks add to contexts the game already has, so your keys work where the player looks through the optic: in the character weapon context (handheld and mounted weapons) and, if your optic sits in a vehicle turret, in the turret context.

Example code – free to useMyOptic / Configs/System/chimeraInputCommon.conf (shape, shortened)
ActionManager {
 Actions {
  Action MyOptic_VisionModeAction {
   InputSource InputSourceSum "{<unique id>}" {
    Sources {
     InputSourceValue "{<unique id>}" {
      FilterPreset "click"
      Input "keyboard:KC_I"
      Filter InputFilterValue "{<unique id>}" {
      }
     }
     InputSourceCombo "{<unique id>}" {
      FilterPreset "gamepad:click"
      Sources {
       InputSourceValue "{<unique id>}" {
        Input "gamepad0:shoulder_right"
       }
       InputSourceValue "{<unique id>}" {
        Input "gamepad0:pad_up"
        Filter InputFilterDown "{<unique id>}" {
        }
       }
      }
     }
    }
   }
  }
  // ... MyOptic_ToggleNvThermalAction, MyOptic_PaletteAction, MyOptic_GainUpAction, MyOptic_GainDownAction in the same way
 }
 Contexts {
  ActionContext CharacterWeaponContext {
   ActionRefs +{
    "MyOptic_VisionModeAction"
    "MyOptic_ToggleNvThermalAction"
    "MyOptic_PaletteAction"
    "MyOptic_GainUpAction"
    "MyOptic_GainDownAction"
   }
  }
  ActionContext TurretContext {
   ActionRefs +{
    "MyOptic_VisionModeAction"
    "MyOptic_ToggleNvThermalAction"
    "MyOptic_PaletteAction"
    "MyOptic_GainUpAction"
    "MyOptic_GainDownAction"
   }
  }
 }
}
An action is only live in its contextsThe vanilla zoom keys are a good example of the context rule: WeaponOpticsZoomIn sits in a context that is active only during weapon aiming and in turrets. A handheld device of the binoculars kind is aimed as a gadget, and the zoom keys never arrive until you add them to a context that is active there. The page about zoom on a handheld device shows what that took.
NoteA key that does nothing at all for a player with about seventy mods loaded may simply be taken by another mod. The SOFLAM sight first used N for its mode key; in a collection like that N did not reach the action at all, not even with shift (measured in a multiplayer test). It uses I and J now. Measure on a loaded server before you promise a key.

Make the keys rebindable in the menu

An action in chimeraInputCommon.conf works, but players can only see and rebind it if the key binding menu lists it. That is a second file, Configs/System/keyBindingMenu.conf: a category with one entry per action. Each entry names the action and gives it a label.

Example code – free to useMyOptic / Configs/System/keyBindingMenu.conf (shape, shortened)
SCR_KeyBindingMenuConfig {
 m_KeyBindingCategories {
  SCR_KeyBindingCategory "{<unique id>}" {
   m_sName "MYOPTIC"
   m_sDisplayName "My Optic"
   m_KeyBindingEntries {
    SCR_KeyBindingEntry "{<unique id>}" {
     m_sActionName "MyOptic_VisionModeAction"
     m_sDisplayName "Cycle Vision Mode"
     m_sPreset "click"
    }
    // ... one entry per action
   }
  }
 }
}
A rebind that does nothingm_sPreset has to be the FilterPreset of the action’s input sources (click in the examples on this page). The menu stores a rebind under the action and the preset. An entry without a preset stores it under an empty preset that no source carries: the menu accepts the new key, and the game never uses it. In the log it shows as settingsClosed ... 'MyOptic_VisionModeAction_' with nothing behind the underscore. The SOFLAM Core had exactly this fault for six keys until version 3.1.2. For controllers the menu adds the device prefix itself; the controller sources of the example carry gamepad:click.

What the menu can rebind

The key binding menu of the game assigns single keys. A rebind replaces all current binds of the action with the key the player presses. The advanced dialog offers a few more things, but the list is short:

Offered in the advanced dialogWhat
Special bindsEsc, mouse wheel up and down, mouse movement (vertical and horizontal) and the joystick directions.
A combination keyOnly the left Alt key. The game’s list holds no other.
An action prefixPress, release, click, single click, double click and a few more.

So a default such as Shift + mouse wheel (the gain keys of the SOFLAM) or H + wheel (laser power) works for the player who keeps it, but nobody can rebuild it in the menu: after a rebind it is one plain key, and Reset to default brings the original back. Alt + wheel is the game’s zoom, and the wheel on its own belongs to the game’s “speed up”. If your default is a wheel combination, think about a plain key as a second default.

The empty laser hook

The component also registers two optional actions for “laser power up / down”. The framework has no laser, so the method behind them is an empty hook. Whoever has a laser fills it with a modded class. This is the real one of the SOFLAM Core, shortened:

Example code – free to useGTG_SOFLAM_VisionModeComponent.c (framework)
//! in the framework: empty on purpose
protected void GTG_AdjustLaserPower(int direction)
{
}
Example code – free to useGTG_SOFLAM_VisionLaserPower.c (SOFLAM Core)
modded class GTG_SOFLAM_VisionModeComponent
{
	override protected void GTG_AdjustLaserPower(int direction)
	{
		IEntity owner = GetOwner();
		if (!owner)
			return;

		GTG_SOFLAM_BeamComponent beam = GTG_SOFLAM_BeamComponent.Cast(owner.FindComponent(GTG_SOFLAM_BeamComponent));
		if (!beam)
			return;

		float current = beam.GTG_GetEffectiveLV();		// what the light carries right now
		if (current < 0)
			return;

		GTG_SOFLAM_LaserDesignatorComponent designator = GTG_SOFLAM_LaserDesignatorComponent.FindOn(owner);
		if (designator)
			designator.AdjustLaserPower(current, direction);	// direction: +1 one step up, -1 one step down
	}
}

For your own device: modded class GTG_SOFLAM_VisionModeComponent, override GTG_AdjustLaserPower, translate direction into one step of whatever you have (a laser, a lamp, a zoom ring), and enter the action names in m_sLaserPowerUpAction and m_sLaserPowerDownAction. Empty names mean no keys.

One place for the keysWhy the input hangs on the vision component and not on the device: that is the place that already knows when the player looks through. A second place with the same logic would be a second place that can be wrong.
Example code on this page is free to use in your own projects (credit appreciated). The GTG Thermal Framework mod is published under the Arma Public License (APL). Suggestions: Discord. Arma Reforger / Enfusion are trademarks of Bohemia Interactive.
Impressum · Privacy Policy