switchUnits - Fix switching units not working (#6188) (#7676)

This commit is contained in:
McDiod 2020-06-08 01:25:11 +02:00 committed by GitHub
parent c99e122d84
commit e25b02263a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 18 deletions

View File

@ -16,12 +16,9 @@
* Public: No
*/
params ["_unit", "_sides"];
["theMapClick", "onMapSingleClick", {
// IGNORE_PRIVATE_WARNING(_pos,_shift,_alt)
addMissionEventHandler ["MapSingleClick", {
params ["", "_pos"];
if (alive ACE_player && {GVAR(OriginalUnit) getVariable ["ACE_CanSwitchUnits", false]}) then {
[_this, _pos, _shift, _alt] call FUNC(handleMapClick);
[GVAR(switchableSides), _pos] call FUNC(handleMapClick);
};
}, [_unit, _sides]] call BIS_fnc_addStackedEventHandler;
}];

View File

@ -18,8 +18,7 @@
* Public: No
*/
params ["_faction", "_pos"];
_faction params ["", "_sides"];
params ["_sides", "_pos"];
private _nearestObjects = nearestObjects [_pos, ["Man"], 15];

View File

@ -16,10 +16,10 @@
* Public: No
*/
params ["_playerUnit", "_sides"];
params ["_playerUnit"];
if (vehicle _playerUnit == _playerUnit) then {
[_sides] call FUNC(markAiOnMap);
[GVAR(switchableSides)] call FUNC(markAiOnMap);
_playerUnit setVariable [QGVAR(IsPlayerUnit), true, true];
_playerUnit allowDamage false;
@ -38,5 +38,5 @@ if (vehicle _playerUnit == _playerUnit) then {
[_playerUnit, "forceWalk", "ACE_SwitchUnits", true] call EFUNC(common,statusEffect_set);
[_playerUnit, _sides] call FUNC(addMapFunction);
[] call FUNC(addMapFunction);
};

View File

@ -18,14 +18,14 @@
params ["_player"];
if (GVAR(EnableSwitchUnits)) then {
private _sides = [];
GVAR(switchableSides) = [];
if (GVAR(SwitchToWest)) then {_sides pushBack west;};
if (GVAR(SwitchToEast)) then {_sides pushBack east;};
if (GVAR(SwitchToIndependent)) then {_sides pushBack independent;};
if (GVAR(SwitchToCivilian)) then {_sides pushBack civilian;};
if (GVAR(SwitchToWest)) then {GVAR(switchableSides) pushBack west;};
if (GVAR(SwitchToEast)) then {GVAR(switchableSides) pushBack east;};
if (GVAR(SwitchToIndependent)) then {GVAR(switchableSides) pushBack independent;};
if (GVAR(SwitchToCivilian)) then {GVAR(switchableSides) pushBack civilian;};
if (_player getVariable ["ACE_CanSwitchUnits", false]) then {
[_player, _sides] call FUNC(initPlayer);
[_player] call FUNC(initPlayer);
};
};