Skip to content
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 group settings for Attack, Reinforce and Dynamic Reinforcement #441

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/danger/XEH_preInitClient.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Here four buttons are added:
These functions and buttons could conceivably be moved to their own module.
They might also benefit from added interface and more nuanced functions handling.
That said: within the current scope of the AI mod. They can make a comfortable
home here. Until revisited by more capable personnell.
home here. Until revisited by more capable personell.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can find, the former personnell was closer, should just drop the extra trailing l. Still, I'd go with people instead, since seemingly personnel is people working in a company:

Suggested change
home here. Until revisited by more capable personell.
home here. Until revisited by more capable people.

- nkenny
*/

Expand Down Expand Up @@ -103,7 +103,7 @@ private _fnc_assault_AI = {
} else {
_cursorPos = getPos cursorObject;
};
private _buildings = [_cursorPos, 50, true, false] call EFUNC(main,findBuildings);
private _buildings = [_cursorPos, 12, true, false] call EFUNC(main,findBuildings);
(group player) setVariable [QEGVAR(main,groupMemory), _buildings];
{
private _enemy = _x findNearestEnemy _cursorPos;
Expand Down
64 changes: 64 additions & 0 deletions addons/danger/settings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,70 @@ _curCat = LSTRING(Settings_GeneralCat);
1
] call CBA_fnc_addSetting;

addMissionEventHandler ["GroupCreated", {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be in the EventHandlers pbo

params ["_group"];
[
{
if (count (units _this) > 0) then {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (count (units _this) > 0) then {
if (units _this isNotEqualTo []) then {

if (GVAR(autoAddDynamicReinforcement)) then {_this setVariable [QGVAR(enableGroupReinforce), true, true];};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we maybe should split this up into a more logical system. why should we, for example, wait when all 3 settings are disabled?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a 3-second wait before executing (waitAndExecute) instead of waiting until all 3 are enabled (waitUntilAndExecute), but that's still a good point.

if !(GVAR(disableAttackOverride)) then {_this enableAttack false;};
if (GVAR(disableFleeingOverride)) then {_this allowFleeing 0;};
};
},
_group,
3
] call CBA_fnc_waitAndExecute;
}];

// auto disable enableAttack on groups
[
QGVAR(disableAttackOverride),
"CHECKBOX",
[LSTRING(Settings_AttackOverride), LSTRING(Settings_AttackOverride_ToolTip)],
[COMPONENT_NAME, _curCat],
false,
false, {
params ["_value"];
if (_value) exitWith {};
if (!_value && time > 0) then {
{_x enableAttack false;} forEach (allGroups select {local (leader _x)});
};
}
] call CBA_fnc_addSetting;

// auto disable allowFleeing on groups
[
QGVAR(disableFleeingOverride),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the next setting need a XEH initPost eventhandler instead. People spawn in units all the time, which will not get caught by this.

"CHECKBOX",
[LSTRING(Settings_FleeingOverride), LSTRING(Settings_FleeingOverride_ToolTip)],
[COMPONENT_NAME, _curCat],
false,
false, {
params ["_value"];
if (_value) exitWith {};
if (!_value && time > 0) then {
{_x allowFleeing 0;} forEach (allGroups select {local (leader _x)});
};
}
] call CBA_fnc_addSetting;

// auto add dynamic reinforcement
[
QGVAR(autoAddDynamicReinforcement),
"CHECKBOX",
[LSTRING(Settings_UniversalDynamicReinforcement), LSTRING(Settings_UniversalDynamicReinforcement_ToolTip)],
[COMPONENT_NAME, _curCat],
false,
false, {
params ["_value"];
if (!_value) exitWith {};
if (_value) then {
{_x setVariable [QGVAR(enableGroupReinforce), true, true];} forEach (allGroups select {local (leader _x)});
};
}
] call CBA_fnc_addSetting;


/*
TEMPORARILY DISABLED FOR VERSION 2.5 RELEASE
WAITING BETTER OR OTHER SOLUTION
Expand Down
18 changes: 18 additions & 0 deletions addons/danger/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -422,5 +422,23 @@
<Italian>Lamber Danger FSM</Italian>
<Chinesesimp>Lambs Danger FSM</Chinesesimp>
</Key>
<Key ID="STR_Lambs_Danger_Settings_AttackOverride">
<English>Disable LAMBS Attack Override</English>
</Key>
<Key ID="STR_Lambs_Danger_Settings_AttackOverride_ToolTip">
<English>LAMBS Danger.fsm introduces new attack patterns that in many cases replace vanilla options. If, for some reason, you want to keep the vanilla Attack cycle check this box.</English>
</Key>
<Key ID="STR_Lambs_Danger_Settings_UniversalDynamicReinforcement">
<English>Enable universal Dynamic Reinforcement</English>
</Key>
<Key ID="STR_Lambs_Danger_Settings_UniversalDynamicReinforcement_ToolTip">
<English>Enable this feature to apply Dynamic Reinforcement logic to all groups. This means all groups will respond to the Shared Information feature.\nBehaviours include: creating new waypoints, abandoning garrisons packing and claiming static weapons and vehicles.\nNB: This setting can dramatically alter missions. Use with care.</English>
</Key>
<Key ID="STR_Lambs_Danger_Settings_FleeingOverride">
<English>Disable vanilla fleeing feature</English>
</Key>
<Key ID="STR_Lambs_Danger_Settings_FleeingOverride_ToolTip">
<English>Chgecking this option prevents groups from initiating the default 'fleeing' mode. This can be particularly useful for ZEUS missions where the mission designer wants additional control of the group.\nThis setting is functionally identical with setting '(group) allowFleeing 0' in group inits</English>
</Key>
</Package>
</Project>
Loading