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

Tweaks to core tested internally #359

Merged
merged 12 commits into from
Feb 18, 2024
2 changes: 1 addition & 1 deletion addons/danger/functions/fnc_brainVehicle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ if (_armored && {!isNull _dangerCausedBy}) exitWith {
// foot infantry support ~ unload
private _group = group _vehicle;
private _cargo = ((fullCrew [_vehicle, "cargo"]) apply {_x select 0});
_cargo append ((fullCrew [_vehicle, "turret"]) apply {_x select 0});
_cargo append ((fullCrew [_vehicle, "turret"] select {_x select 4}) apply {_x select 0});
if (
_validTarget
&& {_cargo isNotEqualTo []}
Expand Down
2 changes: 2 additions & 0 deletions addons/danger/functions/fnc_tacticsAssess.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ if !(_enemies isEqualTo [] || {_unitCount < random 4}) then {
};

// enemies near and below
/*
private _farNoCoverTarget = _enemies findIf {
_unit distance2D _x < RANGE_MID
&& {((getPosASL _x) select 2) < ((_eyePos select 2) - 15)}
Expand All @@ -169,6 +170,7 @@ if !(_enemies isEqualTo [] || {_unitCount < random 4}) then {
_plan pushBack TACTICS_ATTACK;
_pos = _enemies select _farNoCoverTarget;
};
*/

// enemy at inside buildings or fortified or far
private _fortifiedTarget = _enemies findIf {
Expand Down
2 changes: 1 addition & 1 deletion addons/danger/functions/fnc_tacticsFlank.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* Public: No
*/
params ["_group", "_target", ["_units", []], ["_cycle", 4], ["_overwatch", []], ["_delay", 100]];
params ["_group", "_target", ["_units", []], ["_cycle", 4], ["_overwatch", []], ["_delay", 120]];

// group is missing
if (isNull _group) exitWith {false};
Expand Down
7 changes: 7 additions & 0 deletions addons/danger/functions/fnc_tacticsReinforce.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ if (_units isEqualTo []) then {
// has artillery? ~ if so fire in support?
// is aircraft or tank? Different movement waypoint?

// clear HOLD waypointss
private _waypoints = waypoints _group;
private _currentWP = _waypoints select ((currentWaypoint _group) min ((count _waypoints) - 1));
if ((waypointType _currentWP) isEqualTo "HOLD") then {
[_group] call CBA_fnc_clearWaypoints;
};

// formation changes ~ allowed here as Reinforcing units have full autonomy - nkenny
private _distance = _unit distance2D _target;
if (_distance > 500) then {
Expand Down
20 changes: 9 additions & 11 deletions addons/danger/scripts/lambs_dangerCivilian.fsm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ item10[] = {"Reset",2,250,-700.000000,1400.000000,-600.000000,1450.000000,0.0000
item11[] = {"Hide_vs__run",2,250,-540.000000,40.000000,-440.000000,100.000000,0.000000,"Hide vs. run"};
item12[] = {"Vehicle",4,218,-920.000000,360.000000,-820.000000,420.000000,1.000000,"Vehicle"};
item13[] = {"Man",8,218,-700.000000,350.000000,-600.000000,400.000000,0.000000,"Man"};
item14[] = {"Man",2,250,-680.000000,600.000000,-580.000000,660.000000,0.000000,"Man"};
item14[] = {"Man",2,4346,-680.000000,600.000000,-580.000000,660.000000,0.000000,"Man"};
item15[] = {"Order_out",2,250,-940.000000,600.000000,-840.000000,660.000000,0.000000,"Order out"};
item16[] = {"Always",8,218,-800.000000,600.000000,-700.000000,660.000000,0.000000,"Always"};
item17[] = {"Select_danger",2,250,-820.000000,-160.000000,-720.000000,-100.000000,0.000000,"Select danger"};
Expand Down Expand Up @@ -180,8 +180,8 @@ link63[] = {54,2};
link64[] = {55,2};
link65[] = {56,4};
link66[] = {57,58};
globals[] = {0.000000,0,0,0,0,640,480,1,225,6316128,1,-1872.445801,594.427734,1279.814941,-590.437561,1166,884,1};
window[] = {2,-1,-1,-1,-1,870,52,673,52,3,1184};
globals[] = {0.000000,0,0,0,0,640,480,1,225,6316128,1,-1487.644531,43.572693,1070.380371,-90.508331,1166,884,1};
window[] = {2,-1,-1,-1,-1,1026,208,829,208,3,1184};
*//*%FSM</HEAD>*/
class FSM
{
Expand Down Expand Up @@ -393,13 +393,11 @@ class FSM
" _this setUnitPos selectRandom [""DOWN"",""DOWN"",""MIDDLE""];" \n
"}; " \n
"" \n
"// animation" \n
"if (_this call lambs_danger_fnc_fsmAllowAnimation) then {" \n
" _this playMoveNow selectRandom [""ApanPknlMsprSnonWnonDf"", ""ApanPercMsprSnonWnonDf"", ""ApanPpneMsprSnonWnonDf"", ""ApanPpneMrunSnonWnonDf""];" \n
"}; " \n
"" \n
"// execute hide" \n
"[_this, _dangerPos] call lambs_main_fnc_doHide; " \n
"[_this, _dangerPos, 10] call lambs_main_fnc_doHide; " \n
"" \n
"// time dodge" \n
"private _timeDodge = time + 2;" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
Expand All @@ -423,8 +421,8 @@ class FSM
priority = 0.000000;
to="Clean_up";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"getSuppression _this > 0.99"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
condition=/*%FSM<CONDITION""">*/"time > _timeDodge && getSuppression _this > 0.99"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"[_this] call lambs_main_fnc_doFleeing;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
Expand Down
3 changes: 2 additions & 1 deletion addons/main/functions/GroupAction/fnc_doGroupAssault.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ private _targetPos = _pos select 0;
_assaultPos = _unit getPos [20, _unit getDir _assaultPos];
};
// set movement
if (((expectedDestination _unit) select 0) distance2D _assaultPos > 1) then {
if (((expectedDestination _unit) select 0) distanceSqr _assaultPos > 1) then {

_unit doMove _assaultPos;
_unit setDestination [_assaultPos, "LEADER PLANNED", true];
};
Expand Down
4 changes: 2 additions & 2 deletions addons/main/functions/GroupAction/fnc_doGroupFlank.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
params ["_cycle", "_units", "_vehicles", "_pos", "_overwatch"];

// update
_units = _units select { _x call FUNC(isAlive) && { !isPlayer _x } };
_units = _units select { _x call FUNC(isAlive) && { !isPlayer _x } && {_x distance2D _overwatch > 5}};
_vehicles = _vehicles select { canFire _x };

private _posASL = AGLtoASL (selectRandom _pos);
Expand All @@ -37,7 +37,7 @@ private _posASL = AGLtoASL (selectRandom _pos);

// suppress
if (
RND(0.7)
RND(0.6)
&& {(leader _x) isNotEqualTo _x}
&& {!(terrainIntersectASL [eyePos _x, _posASL vectorAdd [0, 0, 3]])}
) then {
Expand Down
1 change: 1 addition & 0 deletions addons/main/functions/UnitAction/fnc_doAssault.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ private _pos = call {
};

// select target location
_doMove = true;
_getHide
};

Expand Down
2 changes: 1 addition & 1 deletion addons/main/functions/UnitAction/fnc_doAssaultMemory.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (_groupMemory isEqualTo []) then {
};

// exit or sort it!
_groupMemory = _groupMemory select {(leader _unit) distanceSqr _x < 20164 && {_unit distanceSqr _x > 2.25}};
_groupMemory = _groupMemory select {_unit distanceSqr _x < 20164 && {_unit distanceSqr _x > 2.25}};
if (_groupMemory isEqualTo []) exitWith {
_group setVariable [QGVAR(groupMemory), [], false];
false
Expand Down
10 changes: 5 additions & 5 deletions addons/main/functions/UnitAction/fnc_doAssaultSpeed.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ params ["_unit", ["_target", objNull]];

// speed
if ((behaviour _unit) isEqualTo "STEALTH") exitWith {_unit forceSpeed 1; 1};
private _distance = _unit distance2D _target;
if ((speedMode _unit) isEqualTo "FULL") exitWith {private _speed = [24, 3] select (_distance < 12); _unit forceSpeed _speed; _speed};
if (_distance > 80) exitWith {_unit forceSpeed -1; -1};
if (_distance > 6) exitWith {_unit forceSpeed 3; 3};
if (_distance > 3) exitWith {_unit forceSpeed 2; 2};
private _distanceSqr = _unit distanceSqr _target;
if ((speedMode _unit) isEqualTo "FULL") exitWith {private _speed = [24, 3] select (_distanceSqr < 144); _unit forceSpeed _speed; _speed};
if (_distanceSqr > 6400) exitWith {_unit forceSpeed -1; -1};
if (_distanceSqr > 36) exitWith {_unit forceSpeed 3; 3};
if (_distanceSqr > 9) exitWith {_unit forceSpeed 2; 2};
_unit forceSpeed 1;
1
Loading