-
Notifications
You must be signed in to change notification settings - Fork 738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add toggle flashlight and NVG zeus modules #4556
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't do full review, just quick skim and that caught my attention.
private _units = []; | ||
|
||
if (_target == 4) then { | ||
_units = units (attachedTo _logic); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excessive space.
if (_target == 4) then { | ||
_units = units (attachedTo _logic); | ||
} else { | ||
_units = allUnits select {alive _x && {side _x == ([blufor, opfor, independent, civilian] select _target)}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excessive space.
}; | ||
|
||
} else { | ||
_x linkitem "NVGoggles"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linkItem
private _unit = effectiveCommander (attachedTo _logic); | ||
|
||
scopeName "Main"; | ||
private _fnc_errorAndClose = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this and the switch a few lines below is used in at least two places. Maybe make it a separate function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't do that due to scopeName being used, I could do that but other people writing curator modules would have to know that they have to define the scopeName before calling the function.
private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); | ||
if (isNull _logic) exitWith {}; | ||
|
||
private _combo1 = _display displayCtrl 56218; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
|
||
_control ctrlRemoveAllEventHandlers "setFocus"; | ||
|
||
// Handles errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not meant for the code on line 32 right?
private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); | ||
if (isNull _logic) exitWith {}; | ||
|
||
private _combo1 = _display displayCtrl 92855; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
Made the changes required by the review above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix header things :)
* | ||
* Return Value: | ||
* Nothing | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a example.
And return value is None
* | ||
* Return Value: | ||
* Nothing | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a example.
And return value is None
* 0: Nvg toggle controls group <CONTROL> | ||
* | ||
* Return Value: | ||
* Nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return Value: None
* 0: Flashlight toggle controls group <CONTROL> | ||
* | ||
* Return Value: | ||
* Nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return Value: None
private _pointer = (_x weaponAccessories (currentWeapon _x)) select 1; | ||
|
||
if (!(_pointer isEqualTo "") && {isNull (configfile >> "CfgWeapons" >> _pointer >> "ItemInfo" >> "Pointer")}) then { | ||
_x enableGunLights "ForceOn"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In https://community.bistudio.com/wiki/enableGunLights uses"forceOn" But I guess this is tested so it might still work :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably isn't case-sensitive.
@alganthe Plan to work on that further, headers need some fixing. Aditionally, I think we should rather provide the option to give units gear, for cases when you want to enable NVGs/lights on a group but only certain units have them and you want only those enabled, not that every other unit gets them as well. |
@jonpas that would only apply to flashlights, as NVGs are just put on by AI whenever they feel like it,. |
Could use |
|
|
}; | ||
|
||
//Specific on-load stuff: | ||
private _comboBox = _display displayCtrl 56218; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small usability improvement, should set the default to toggle their current state
private _enabledDefault = false;
if (!isNull _unit) then {
_enabledDefault = !isFlashlightOn (leader _unit);
};
_comboBox lbSetCurSel [0,1] select _enabledDefault;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why leader _unit
?
Don't you mean currentWeapon _unit
?
there we go, indeed I didn't notice enableGunLights was AL. |
if (local _x) then { | ||
_x enableGunLights "forceOn"; | ||
} else { | ||
[QGVAR(enableFlashlight), [_x, "forceOn"], _x] call CBA_fnc_targetEvent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Target event handles locality on its own, so you don't need duplicate code. Probably minor performance difference, shouldn't matter here at all.
@@ -48,12 +52,11 @@ if (_toggle) then { | |||
|
|||
if (local _x) then { | |||
_x addWeaponItem [(currentWeapon _x), _flashlight]; | |||
_x enableGunLights "ForceOn"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
@@ -62,7 +65,11 @@ if (_toggle) then { | |||
} else { | |||
{ | |||
if !(isPlayer _x || {(currentWeapon _x) isEqualTo ""}) then { | |||
_x enableGunLights "ForceOff"; | |||
if (local _x) then { | |||
_x enableGunLights "ForceOff"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
Nice, this will be a welcomed addition. |
addons/zeus/CfgVehicles.hpp
Outdated
@@ -214,6 +214,18 @@ class CfgVehicles { | |||
function = QFUNC(moduleUnconscious); | |||
icon = QPATHTOF(UI\Icon_Module_Zeus_Unconscious_ca.paa); | |||
}; | |||
class GVAR(moduleToggleNvg): GVAR(moduleBase) { | |||
curatorCanAttach = 1; | |||
category = QGVAR(Utility); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this rather be category AI? It specifically shouldn't work on players anyways (flashlight already doesn't).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't really know where to put it, good point.
|
||
if (_toggle) then { | ||
{ | ||
if (hmd _x isEqualTo "") then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore if player?
👍 Thanks for handling review @jonpas, good to see this finally in 😄 |
When merged this pull request will:
Both of those are added if they're not already present on the unit's weapon or head, it uses whatever the unit is supposed to have.
It works with headgear that has built in night vision / thermal.
If the units don't have flashlights on their weapons it checks if they have a compatible attachment that is a flashlight and give it to them (if none are available then so be it)