mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
fixed SwitchUnits
needed to wait in initPlayer
This commit is contained in:
parent
903c41308c
commit
509bfefff1
@ -16,15 +16,24 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_sides";
|
||||
DFUNC(pfhClientInit) = {
|
||||
|
||||
if (GVAR(EnableSwitchUnits)) exitWith {
|
||||
|
||||
private ["_sides"];
|
||||
_sides = [];
|
||||
|
||||
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;};
|
||||
|
||||
_sides = [];
|
||||
|
||||
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 (player getVariable ["ACE_CanSwitchUnits", false]) then {
|
||||
[player, _sides] call FUNC(initPlayer);
|
||||
if (player getVariable ["ACE_CanSwitchUnits", false]) then {
|
||||
[player, _sides] call FUNC(initPlayer);
|
||||
};
|
||||
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
};
|
||||
|
||||
[FUNC(pfhClientInit), 0.5, []] call cba_fnc_addPerFrameHandler;
|
||||
|
@ -24,28 +24,28 @@ _sides = _this select 1;
|
||||
|
||||
if (vehicle _playerUnit == _playerUnit) then {
|
||||
|
||||
[_sides] call FUNC(markAiOnMap);
|
||||
[_sides] call FUNC(markAiOnMap);
|
||||
|
||||
_playerUnit setVariable [QGVAR(IsPlayerUnit), true];
|
||||
_playerUnit allowDamage false;
|
||||
_playerUnit setVariable [QGVAR(IsPlayerUnit), true];
|
||||
_playerUnit allowDamage false;
|
||||
|
||||
GVAR(OriginalUnit) = _playerUnit;
|
||||
//GVAR(OriginalName) = [_playerUnit] call EFUNC(common,getName);
|
||||
GVAR(OriginalName) = name _playerUnit;
|
||||
GVAR(OriginalGroup) = group _playerUnit;
|
||||
GVAR(OriginalUnit) = _playerUnit;
|
||||
//GVAR(OriginalName) = [_playerUnit] call EFUNC(common,getName);
|
||||
GVAR(OriginalName) = name _playerUnit;
|
||||
GVAR(OriginalGroup) = group _playerUnit;
|
||||
|
||||
// remove all starting gear of a player
|
||||
removeAllWeapons _playerUnit;
|
||||
removeGoggles _playerUnit;
|
||||
removeHeadgear _playerUnit;
|
||||
removeVest _playerUnit;
|
||||
removeAllAssignedItems _playerUnit;
|
||||
clearAllItemsFromBackpack _playerUnit;
|
||||
removeBackpack _playerUnit;
|
||||
_playerUnit linkItem "ItemMap";
|
||||
removeUniform _playerUnit;
|
||||
// remove all starting gear of a player
|
||||
removeAllWeapons _playerUnit;
|
||||
removeGoggles _playerUnit;
|
||||
removeHeadgear _playerUnit;
|
||||
removeVest _playerUnit;
|
||||
removeAllAssignedItems _playerUnit;
|
||||
clearAllItemsFromBackpack _playerUnit;
|
||||
removeBackpack _playerUnit;
|
||||
_playerUnit linkItem "ItemMap";
|
||||
removeUniform _playerUnit;
|
||||
|
||||
[_playerUnit, "ACE_SwitchUnits", true] call EFUNC(common,setForceWalkStatus);
|
||||
[_playerUnit, "ACE_SwitchUnits", true] call EFUNC(common,setForceWalkStatus);
|
||||
|
||||
[_playerUnit, _sides] call FUNC(addMapFunction);
|
||||
[_playerUnit, _sides] call FUNC(addMapFunction);
|
||||
};
|
||||
|
@ -10,7 +10,7 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [west, east] call FUNC(markAiOnMap)
|
||||
* [[west, east]] call FUNC(markAiOnMap)
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -34,11 +34,13 @@ DFUNC(pfhMarkAiOnMap) = {
|
||||
} forEach GVAR(AllMarkerNames);
|
||||
|
||||
if (alive ACE_player && {GVAR(OriginalUnit) getVariable ["ACE_CanSwitchUnits", false]}) then {
|
||||
|
||||
|
||||
// create markers
|
||||
{
|
||||
if (([_x] call FUNC(isValidAi) && (side group _x in _sides)) || (_x getVariable [QGVAR(IsPlayerControlled), false])) then {
|
||||
private ["_markerName", "_marker", "_markerColor"];
|
||||
|
||||
hint format ["marker. %1", time];
|
||||
|
||||
//_markerName = format ["%1", [_x] call EFUNC(common,getName)];
|
||||
_markerName = str _x;
|
||||
|
@ -27,8 +27,6 @@ if !(_activated) exitWith {};
|
||||
|
||||
GVAR(Module) = true;
|
||||
|
||||
[QGVAR(EnableSwitchUnits), true] call EFUNC(common,setParameter);
|
||||
|
||||
[_logic, QGVAR(SwitchToWest), "SwitchToWest"] call EFUNC(common,readBooleanParameterFromModule);
|
||||
[_logic, QGVAR(SwitchToEast), "SwitchToEast"] call EFUNC(common,readBooleanParameterFromModule);
|
||||
[_logic, QGVAR(SwitchToIndependent), "SwitchToIndependent"] call EFUNC(common,readBooleanParameterFromModule);
|
||||
@ -37,4 +35,6 @@ GVAR(Module) = true;
|
||||
[_logic, QGVAR(EnableSafeZone), "EnableSafeZone"] call EFUNC(common,readBooleanParameterFromModule);
|
||||
[_logic, QGVAR(SafeZoneRadius), "SafeZoneRadius"] call EFUNC(common,readNumericParameterFromModule);
|
||||
|
||||
[QGVAR(EnableSwitchUnits), true] call EFUNC(common,setParameter);
|
||||
|
||||
diag_log text "[ACE]: SwitchUnits Module Initialized.";
|
||||
|
Loading…
Reference in New Issue
Block a user