Changed tabs to 4 spaces

This commit is contained in:
Thomas Kooi 2015-01-18 20:09:19 +01:00
parent 86663e8a8e
commit 8dfdd11f3c
53 changed files with 747 additions and 735 deletions

View File

@ -15,60 +15,60 @@ _unit = [_this, 0,ObjNull, [ObjNull]] call bis_fnc_param;
_to = [_this, 1,ObjNull, [ObjNull]] call bis_fnc_param; _to = [_this, 1,ObjNull, [ObjNull]] call bis_fnc_param;
_fallDown = false; _fallDown = false;
if (count _this > 3) then { if (count _this > 3) then {
_fallDown = _this select 3; _fallDown = _this select 3;
}; };
_return = false; _return = false;
[format["fnc_carryObj - UNIT: %1 ATTEMPTS TO CARRY %2",_unit,_to],2] call FUNC(debug); [format["fnc_carryObj - UNIT: %1 ATTEMPTS TO CARRY %2",_unit,_to],2] call FUNC(debug);
if (((typeName _to) == "OBJECT" && (isNull ([_unit] call FUNC(getCarriedObj)))) || isNull _to) then { if (((typeName _to) == "OBJECT" && (isNull ([_unit] call FUNC(getCarriedObj)))) || isNull _to) then {
if (vehicle _unit != _unit) exitwith {}; if (vehicle _unit != _unit) exitwith {};
if (!isNull _to) then { if (!isNull _to) then {
if ((isNull ([_to] call FUNC(getCarriedObj))) && ([_unit] call FUNC(canInteract))) then { if ((isNull ([_to] call FUNC(getCarriedObj))) && ([_unit] call FUNC(canInteract))) then {
_return = true; _return = true;
_unit setvariable [QGVAR(carriedObj),_to,true]; _unit setvariable [QGVAR(carriedObj),_to,true];
if (_fallDown) then { if (_fallDown) then {
// [_unit,_fallDown] call FUNC(limitMovementSpeed); // [_unit,_fallDown] call FUNC(limitMovementSpeed);
}; };
[_to, _unit] call FUNC(setCarriedBy); [_to, _unit] call FUNC(setCarriedBy);
if (count _this > 2) then { if (count _this > 2) then {
if (count (_this select 2) == 3) then { if (count (_this select 2) == 3) then {
_to attachTo [_unit,(_this select 2)]; _to attachTo [_unit,(_this select 2)];
[format["fnc_carryObj - UNIT: %1 TO %2 - attachTo offset: %3",_unit,_to,(_this select 2)],2] call FUNC(debug); [format["fnc_carryObj - UNIT: %1 TO %2 - attachTo offset: %3",_unit,_to,(_this select 2)],2] call FUNC(debug);
}; };
} else { } else {
[format["fnc_carryObj - UNIT: %1 TO %2 - Script expects external handling of attachTo Command. Exiting",_unit,_to],2] call FUNC(debug); [format["fnc_carryObj - UNIT: %1 TO %2 - Script expects external handling of attachTo Command. Exiting",_unit,_to],2] call FUNC(debug);
}; };
[[_unit, _to, _fallDown],"carryObject"] call FUNC(raiseScriptedEvent_f); [[_unit, _to, _fallDown],"carryObject"] call FUNC(raiseScriptedEvent_f);
}; };
} else { } else {
if (!isNull ([_unit] call FUNC(getCarriedObj))) then { if (!isNull ([_unit] call FUNC(getCarriedObj))) then {
[format["fnc_carryObj - UNIT: %1 DROPING CARRIED OBJECT",_unit],2] call FUNC(debug); [format["fnc_carryObj - UNIT: %1 DROPING CARRIED OBJECT",_unit],2] call FUNC(debug);
_carriedObj = ([_unit] call FUNC(getCarriedObj)); _carriedObj = ([_unit] call FUNC(getCarriedObj));
detach _carriedObj; detach _carriedObj;
//_carriedObj setPosATL [(getPosATL _carriedObj) select 0, (getPosATL _carriedObj) select 1,0]; //_carriedObj setPosATL [(getPosATL _carriedObj) select 0, (getPosATL _carriedObj) select 1,0];
if (!surfaceIsWater getPos _unit) then { if (!surfaceIsWater getPos _unit) then {
_positionUnit = getPosATL _carriedObj; _positionUnit = getPosATL _carriedObj;
_positionUnit set [2, ((getPosATL _unit) select 2) + 0.1]; _positionUnit set [2, ((getPosATL _unit) select 2) + 0.1];
_carriedObj setPosATL _positionUnit; _carriedObj setPosATL _positionUnit;
} else { } else {
_positionUnit = getPosASL _carriedObj; _positionUnit = getPosASL _carriedObj;
_positionUnit set [2, ((getPosASL _unit) select 2) + 0.1]; _positionUnit set [2, ((getPosASL _unit) select 2) + 0.1];
_carriedObj setPosASL _positionUnit; _carriedObj setPosASL _positionUnit;
}; };
[[_unit, _carriedObj],"carryObjectDropped"] call FUNC(raiseScriptedEvent_f); [[_unit, _carriedObj],"carryObjectDropped"] call FUNC(raiseScriptedEvent_f);
[[_unit] call FUNC(getCarriedObj), objNull] call FUNC(setCarriedBy); [[_unit] call FUNC(getCarriedObj), objNull] call FUNC(setCarriedBy);
_unit setvariable [QGVAR(carriedObj),_to,true]; _unit setvariable [QGVAR(carriedObj),_to,true];
_return = true; _return = true;
[[_unit, _to, _fallDown],"carryObject"] call FUNC(raiseScriptedEvent_f); [[_unit, _to, _fallDown],"carryObject"] call FUNC(raiseScriptedEvent_f);
}; };
}; };
} else { } else {
[format["fnc_carryObj - UNIT: %1 FAILED TO CARRY %2 - not an object or already carrying",_unit,_to],2] call FUNC(debug); [format["fnc_carryObj - UNIT: %1 FAILED TO CARRY %2 - not an object or already carrying",_unit,_to],2] call FUNC(debug);
}; };
_return _return

View File

@ -20,7 +20,7 @@ if (isnil "_copy") exitwith {false};
_unit setvariable [QGVAR(originalCopy_f), nil, true]; _unit setvariable [QGVAR(originalCopy_f), nil, true];
_unit setvariable [QGVAR(copyOfBody_f), nil, true]; _unit setvariable [QGVAR(copyOfBody_f), nil, true];
if (!isNull _copy) then { if (!isNull _copy) then {
deleteVehicle _copy; deleteVehicle _copy;
}; };
true; true;

View File

@ -10,5 +10,5 @@
#include "script_component.hpp" #include "script_component.hpp"
while {dialog} do { while {dialog} do {
closeDialog 0; closeDialog 0;
}; };

View File

@ -17,37 +17,37 @@ _msg = _this select 0;
_level = if (count _this > 1) then {_this select 1} else { 2 }; _level = if (count _this > 1) then {_this select 1} else { 2 };
_defaultLoglevel = if (isNil QGVAR(LOGLEVEL)) then { _defaultLoglevel = if (isNil QGVAR(LOGLEVEL)) then {
DEFAULT_LOGGING_LEVEL; DEFAULT_LOGGING_LEVEL;
} else { } else {
GVAR(LOGLEVEL); GVAR(LOGLEVEL);
}; };
_defaultLogDisplayLevel = if (isnil QGVAR(LOGDISPLAY_LEVEL)) then { _defaultLogDisplayLevel = if (isnil QGVAR(LOGDISPLAY_LEVEL)) then {
DEFAULT_TEXT_DISPLAY; DEFAULT_TEXT_DISPLAY;
} else { } else {
GVAR(LOGDISPLAY_LEVEL); GVAR(LOGDISPLAY_LEVEL);
}; };
if (_defaultLoglevel < 0) exitwith { if (_defaultLoglevel < 0) exitwith {
false false
}; };
if (_level <= _defaultLoglevel) then { if (_level <= _defaultLoglevel) then {
_prefix = switch (_level) do { _prefix = switch (_level) do {
case 0: { "ACE Error" }; case 0: { "ACE Error" };
case 1: { "ACE Warn" }; case 1: { "ACE Warn" };
case 2: { "ACE Debug" }; case 2: { "ACE Debug" };
case 3: { "ACE Info" }; case 3: { "ACE Info" };
default { "ACE Unknown" }; default { "ACE Unknown" };
}; };
_message = format["[%1] %2",_prefix,_msg]; _message = format["[%1] %2",_prefix,_msg];
if (_level >= _defaultLogDisplayLevel) then { if (_level >= _defaultLogDisplayLevel) then {
systemChat _message; systemChat _message;
}; };
diag_log _message; diag_log _message;
// pass it onwards to the log function: // pass it onwards to the log function:
// [0, [], compile format["%1",_msg], true] call FUNC(log); // [0, [], compile format["%1",_msg], true] call FUNC(log);
}; };
true true

View File

@ -19,18 +19,18 @@ _persistent = false;
if (count _this < 3) exitwith {}; if (count _this < 3) exitwith {};
if (count _this > 4) then { if (count _this > 4) then {
_code = _this select 4; _code = _this select 4;
if (count _this > 5) then { if (count _this > 5) then {
_persistent = _this select 5; _persistent = _this select 5;
}; };
}; };
if (typeName _name != typeName "") exitwith { if (typeName _name != typeName "") exitwith {
[format["Tried to the deinfe a variable with an invalid name: %1 Arguments: %2", _name, _this]] call FUNC(debug); [format["Tried to the deinfe a variable with an invalid name: %1 Arguments: %2", _name, _this]] call FUNC(debug);
}; };
if (isnil QGVAR(OBJECT_VARIABLES_STORAGE)) then { if (isnil QGVAR(OBJECT_VARIABLES_STORAGE)) then {
GVAR(OBJECT_VARIABLES_STORAGE) = []; GVAR(OBJECT_VARIABLES_STORAGE) = [];
}; };
GVAR(OBJECT_VARIABLES_STORAGE) pushback [_name,_value,_defaultGlobal,_catagory,_code, _persistent]; GVAR(OBJECT_VARIABLES_STORAGE) pushback [_name,_value,_defaultGlobal,_catagory,_code, _persistent];

View File

@ -13,11 +13,11 @@ _unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param;
_disable = [_this, 1,false,[false]] call BIS_fnc_Param; _disable = [_this, 1,false,[false]] call BIS_fnc_Param;
if (local _unit && !(IsPlayer _unit)) then { if (local _unit && !(IsPlayer _unit)) then {
if (_disable) then { if (_disable) then {
_unit disableAI "Move"; _unit disableAI "Move";
_unit disableAI "TARGET"; _unit disableAI "TARGET";
} else { } else {
_unit enableAI "Move"; _unit enableAI "Move";
_unit enableAI "TARGET"; _unit enableAI "TARGET";
}; };
}; };

View File

@ -26,14 +26,14 @@ _secondairyWeapon = secondaryWeapon _unit;
_handGunWeapon = handgunWeapon _unit; _handGunWeapon = handgunWeapon _unit;
switch (_currentWeapon) do { switch (_currentWeapon) do {
case _primairyWeapon: { case _primairyWeapon: {
}; };
case _secondairyWeapon: { case _secondairyWeapon: {
}; };
case _handGunWeapon: { case _handGunWeapon: {
}; };
default {}; default {};
}; };

View File

@ -7,22 +7,24 @@
* @Return: ARRAY REturns an array with the format [ [name STRING, typeName STRING, value ANY, publicFlag BOOL, peristentFlag BOOL] ] * @Return: ARRAY REturns an array with the format [ [name STRING, typeName STRING, value ANY, publicFlag BOOL, peristentFlag BOOL] ]
* @PublicAPI: true * @PublicAPI: true
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_object", "_return", "_val", "_category"]; private ["_object", "_return", "_val", "_category"];
_object = _this select 0; _object = _this select 0;
_category = if (count _this > 1) then { _this select 1 } else { "" }; _category = if (count _this > 1) then { _this select 1 } else { "" };
if (isnil QGVAR(OBJECT_VARIABLES_STORAGE)) exitwith { if (isnil QGVAR(OBJECT_VARIABLES_STORAGE)) exitwith {
[]; [];
}; };
_return = []; _return = [];
{ {
_val = _object getvariable (_x select 0); _val = _object getvariable (_x select 0);
if (!isnil "_val") then { if (!isnil "_val") then {
if (_category == "" || _category == _x select 3) then { if (_category == "" || _category == _x select 3) then {
_return pushback [_x select 0, typeName _val, _val, _x select 2, _x select 5]; _return pushback [_x select 0, typeName _val, _val, _x select 2, _x select 5];
}; };
}; };
}foreach GVAR(OBJECT_VARIABLES_STORAGE); }foreach GVAR(OBJECT_VARIABLES_STORAGE);
_return _return

View File

@ -17,29 +17,29 @@ _handle = _this select 1;
_eventHandlerName = ("ace_f_custom_results_eventhandler_" + _handle); _eventHandlerName = ("ace_f_custom_results_eventhandler_" + _handle);
_eventHandlerCollection = missionNamespace getvariable _eventHandlerName; _eventHandlerCollection = missionNamespace getvariable _eventHandlerName;
if (isnil "_eventHandlerCollection") then { if (isnil "_eventHandlerCollection") then {
_eventHandlerCollection = []; _eventHandlerCollection = [];
// TODO Get a replacement for this // TODO Get a replacement for this
_cfg = (ConfigFile >> "Advanced_Combat_Environment" >> "CustomResults" >> _handle); _cfg = (ConfigFile >> "Advanced_Combat_Environment" >> "CustomResults" >> _handle);
if (isClass _cfg) then { if (isClass _cfg) then {
_numberOfEH = count _cfg; _numberOfEH = count _cfg;
for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do { for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do {
_ehCfg = _cfg select _EHiterator; _ehCfg = _cfg select _EHiterator;
if (isClass _ehCfg) then { if (isClass _ehCfg) then {
_classType = (ConfigName _ehCfg); _classType = (ConfigName _ehCfg);
_code = (compile getText(_ehCfg >> "onCall")); _code = (compile getText(_ehCfg >> "onCall"));
_eventHandlerCollection pushback [_classType, _code]; _eventHandlerCollection pushback [_classType, _code];
true; true;
}; };
}; };
}; };
missionNamespace setvariable [_eventHandlerName, _eventHandlerCollection]; missionNamespace setvariable [_eventHandlerName, _eventHandlerCollection];
}; };
_return = []; _return = [];
{ {
_return pushback (_arguments call (_x select 1)); _return pushback (_arguments call (_x select 1));
false; false;
}count _eventHandlerCollection; }count _eventHandlerCollection;
_return _return

View File

@ -13,26 +13,26 @@ private ["_unit", "_curAnim", "_animation", "_cfg","_unitAnimation", "_animation
_unit = _this select 0; _unit = _this select 0;
if (vehicle _unit != _unit) exitwith { if (vehicle _unit != _unit) exitwith {
_animation = ""; _animation = "";
_animationState = (animationState _unit); _animationState = (animationState _unit);
_unitAnimation = (configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState); _unitAnimation = (configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState);
if (isText (_unitAnimation >> "actions")) then { if (isText (_unitAnimation >> "actions")) then {
if ((vehicle _unit) != _unit) then { if ((vehicle _unit) != _unit) then {
_cfg = (configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState); _cfg = (configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState);
if (isArray (_cfg >> "interpolateTo")) then { if (isArray (_cfg >> "interpolateTo")) then {
_animation = getArray (_cfg >> "interpolateTo") select 0; _animation = getArray (_cfg >> "interpolateTo") select 0;
}; };
} else { } else {
_cfg = (configFile >> "CfgMovesBasic" >> "Actions" >> (getText (_unitAnimation >> "actions")) >> "die"); _cfg = (configFile >> "CfgMovesBasic" >> "Actions" >> (getText (_unitAnimation >> "actions")) >> "die");
if (isText _cfg) then { if (isText _cfg) then {
_animation = getText _cfg; _animation = getText _cfg;
}; };
}; };
}; };
if (isnil "_animation") then { if (isnil "_animation") then {
_animation = ""; _animation = "";
}; };
_animation; _animation;
}; };
"Unconscious"; "Unconscious";

View File

@ -17,17 +17,17 @@ private "_value";
_value = UNIT getvariable VARIABLE; _value = UNIT getvariable VARIABLE;
if (isnil "_value") then { if (isnil "_value") then {
if (count _this >2) then { if (count _this >2) then {
_value = _this select 2; _value = _this select 2;
} else { } else {
private "_definedVariable"; private "_definedVariable";
_definedVariable = ([VARIABLE] call FUNC(getDefinedVariableInfo)); _definedVariable = ([VARIABLE] call FUNC(getDefinedVariableInfo));
if (count _definedVariable > 1) then { if (count _definedVariable > 1) then {
_value = _definedVariable select 1; _value = _definedVariable select 1;
}; };
}; };
if (isnil "_value") then { if (isnil "_value") then {
_value = 0; _value = 0;
}; };
}; };
_value _value

View File

@ -13,7 +13,7 @@
private "_variableDefinition"; private "_variableDefinition";
_variableDefinition = ([_this select 0] call FUNC(getDefinedVariableInfo)); _variableDefinition = ([_this select 0] call FUNC(getDefinedVariableInfo));
if (count _variableDefinition > 0) exitwith { if (count _variableDefinition > 0) exitwith {
_variableDefinition select 1; _variableDefinition select 1;
}; };
nil; nil;

View File

@ -19,26 +19,26 @@ _result = [false, [0, 0, 0]];
_distance = _source vectorDistance _destination; _distance = _source vectorDistance _destination;
if (count (lineIntersectsWith [_source, _destination]) > 0) then { if (count (lineIntersectsWith [_source, _destination]) > 0) then {
_lower = 0; _lower = 0;
_upper = 1; _upper = 1;
_mid = 0.5; _mid = 0.5;
_dir = _source vectorFromTo _destination; _dir = _source vectorFromTo _destination;
while {(_upper - _lower) * _distance > _accuracy} do { while {(_upper - _lower) * _distance > _accuracy} do {
_mid = _lower + (_upper - _lower) / 2; _mid = _lower + (_upper - _lower) / 2;
_intersections = count (lineIntersectsWith [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))]); _intersections = count (lineIntersectsWith [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))]);
if (_intersections > 0) then { if (_intersections > 0) then {
_upper = _mid; _upper = _mid;
} else { } else {
_lower = _mid; _lower = _mid;
}; };
}; };
_mid = _lower + (_upper - _lower) / 2; _mid = _lower + (_upper - _lower) / 2;
_result = [true, _source vectorAdd (_dir vectorMultiply (_mid * _distance))]; _result = [true, _source vectorAdd (_dir vectorMultiply (_mid * _distance))];
}; };
_result _result

View File

@ -19,26 +19,26 @@ _result = [false, [0, 0, 0]];
_distance = _source vectorDistance _destination; _distance = _source vectorDistance _destination;
if (terrainIntersectASL [_source, _destination]) then { if (terrainIntersectASL [_source, _destination]) then {
_lower = 0; _lower = 0;
_upper = 1; _upper = 1;
_mid = 0.5; _mid = 0.5;
_dir = _source vectorFromTo _destination; _dir = _source vectorFromTo _destination;
while {(_upper - _lower) * _distance > _accuracy} do { while {(_upper - _lower) * _distance > _accuracy} do {
_mid = _lower + (_upper - _lower) / 2; _mid = _lower + (_upper - _lower) / 2;
_intersection = terrainIntersectASL [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))]; _intersection = terrainIntersectASL [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))];
if (_intersection) then { if (_intersection) then {
_upper = _mid; _upper = _mid;
} else { } else {
_lower = _mid; _lower = _mid;
}; };
}; };
_mid = _lower + (_upper - _lower) / 2; _mid = _lower + (_upper - _lower) / 2;
_result = [true, _source vectorAdd (_dir vectorMultiply (_mid * _distance))]; _result = [true, _source vectorAdd (_dir vectorMultiply (_mid * _distance))];
}; };
_result _result

View File

@ -16,13 +16,13 @@ _magazine = _this select 1;
_return = 0; _return = 0;
if (_unit isKindOf "CAManBase") then { if (_unit isKindOf "CAManBase") then {
_return = {_x == _magazine} count magazines _unit; _return = {_x == _magazine} count magazines _unit;
} else { } else {
{ {
_return = _return + {_x == _magazine} count magazines _x; _return = _return + {_x == _magazine} count magazines _x;
}foreach (crew _unit); }foreach (crew _unit);
_return = _return + ({_x == _magazine} count getMagazineCargo _unit); _return = _return + ({_x == _magazine} count getMagazineCargo _unit);
}; };
_return _return

View File

@ -14,16 +14,16 @@ private ["_unit","_return"];
_unit = _this select 0; _unit = _this select 0;
if (isnil QGVAR(unconsciousConditions_F)) then { if (isnil QGVAR(unconsciousConditions_F)) then {
GVAR(unconsciousConditions_F) = []; GVAR(unconsciousConditions_F) = [];
}; };
_return = false; _return = false;
{ {
if (typeName _x == typeName {}) then { if (typeName _x == typeName {}) then {
if (([_unit] call _x)) then { if (([_unit] call _x)) then {
_return = true; _return = true;
}; };
}; };
if (_return) exitwith{}; if (_return) exitwith{};
}foreach GVAR(unconsciousConditions_F); }foreach GVAR(unconsciousConditions_F);
_return _return

View File

@ -15,8 +15,8 @@ _unit = _this select 0;
_magazine = _this select 1; _magazine = _this select 1;
if (_magazine != "") then { if (_magazine != "") then {
_return = (_magazine in magazines _unit); _return = (_magazine in magazines _unit);
} else { } else {
_return = false; _return = false;
}; };
_return _return

View File

@ -14,9 +14,9 @@ private ["_unit","_return","_aslPos"];
_unit = _this select 0; _unit = _this select 0;
_return = false; _return = false;
if ((surfaceIsWater getPos _unit)) then { if ((surfaceIsWater getPos _unit)) then {
_aslPos = _unit modelToWorld (_unit selectionPosition "head"); _aslPos = _unit modelToWorld (_unit selectionPosition "head");
if ((_aslPos select 2) <= 0) then { if ((_aslPos select 2) <= 0) then {
_return = true; _return = true;
}; };
}; };
_return; _return;

View File

@ -19,8 +19,8 @@ if (configName _configEntry == ",") exitWith { false };
_match = false; _match = false;
while {configName _configEntry != ""} do { while {configName _configEntry != ""} do {
if (configName _configEntry == _configMatch) exitWith { _match = true }; if (configName _configEntry == _configMatch) exitWith { _match = true };
_configEntry = inheritsFrom(_configEntry); _configEntry = inheritsFrom(_configEntry);
}; };
_match _match

View File

@ -14,21 +14,21 @@ private ["_list", "_ascending", "_tmp", "_i", "_j"];
_list = +(_this select 0); _list = +(_this select 0);
_ascending = true; _ascending = true;
if (count _this > 1) then { if (count _this > 1) then {
_ascending = _this select 1; _ascending = _this select 1;
}; };
for "_i" from 1 to (count _list) - 1 do { for "_i" from 1 to (count _list) - 1 do {
_tmp = _list select _i; _tmp = _list select _i;
_j = _i; _j = _i;
while {_j >= 1 && {_tmp < _list select (_j - 1)}} do { while {_j >= 1 && {_tmp < _list select (_j - 1)}} do {
_list set [_j, _list select (_j - 1)]; _list set [_j, _list select (_j - 1)];
_j = _j - 1; _j = _j - 1;
}; };
_list set[_j, _tmp]; _list set[_j, _tmp];
}; };
if (!_ascending) then { if (!_ascending) then {
reverse _list; reverse _list;
}; };
_list _list

View File

@ -13,12 +13,12 @@
private ["_return"]; private ["_return"];
if (!isMultiplayer) then { if (!isMultiplayer) then {
_return = true; _return = true;
} else { } else {
if (isServer && !isDedicated) then { if (isServer && !isDedicated) then {
_return = true; _return = true;
} else { } else {
_return = !(hasInterface || isDedicated); _return = !(hasInterface || isDedicated);
}; };
}; };
_return _return

View File

@ -14,40 +14,40 @@ private ["_unit","_carriedObj"];
_unit = _this select 0; _unit = _this select 0;
_fallDown = false; _fallDown = false;
if (count _this > 1) then { if (count _this > 1) then {
_fallDown = _this select 1; _fallDown = _this select 1;
}; };
if ((_unit getvariable [QGVAR(limitMovementSpeed),false])) exitwith { if ((_unit getvariable [QGVAR(limitMovementSpeed),false])) exitwith {
_unit setvariable [QGVAR(limitMovementSpeed),nil,true]; _unit setvariable [QGVAR(limitMovementSpeed),nil,true];
}; };
[{ [{
private["_unit","_fallDown","_carriedObj"]; private["_unit","_fallDown","_carriedObj"];
_unit = (_this select 0) select 0; _unit = (_this select 0) select 0;
_fallDown = (_this select 0) select 1; _fallDown = (_this select 0) select 1;
_carriedObj = [_unit] call FUNC(getCarriedObj); _carriedObj = [_unit] call FUNC(getCarriedObj);
if !(_unit getvariable [QGVAR(limitMovementSpeed),false]) exitwith { if !(_unit getvariable [QGVAR(limitMovementSpeed),false]) exitwith {
[(_this select 1)] call cba_fnc_removePerFrameHandler; [(_this select 1)] call cba_fnc_removePerFrameHandler;
}; };
if !((!isNull _carriedObj) && (alive _unit)) exitwith { if !((!isNull _carriedObj) && (alive _unit)) exitwith {
[(_this select 1)] call cba_fnc_removePerFrameHandler; [(_this select 1)] call cba_fnc_removePerFrameHandler;
}; };
if (speed _unit > 12 && vehicle _unit == _unit && isTouchingGround _unit) then { if (speed _unit > 12 && vehicle _unit == _unit && isTouchingGround _unit) then {
_unit setVelocity [0,0,0]; _unit setVelocity [0,0,0];
if (_fallDown) then { if (_fallDown) then {
_unit playMove "amovppnemstpsraswrfldnon"; _unit playMove "amovppnemstpsraswrfldnon";
}; };
if (_carriedObj isKindOf "Man") then { if (_carriedObj isKindOf "Man") then {
hint "You can not move this fast while transporting this person."; hint "You can not move this fast while transporting this person.";
} else { } else {
hint "You can not move this fast while carrying this object"; hint "You can not move this fast while carrying this object";
}; };
[_unit,ObjNull] call FUNC(carryObj); [_unit,ObjNull] call FUNC(carryObj);
}; };
}, 0.5, [_unit,_fallDown] ] call CBA_fnc_addPerFrameHandler; }, 0.5, [_unit,_fallDown] ] call CBA_fnc_addPerFrameHandler;

View File

@ -16,7 +16,7 @@ _vehicle = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param;
_caller = [_this, 2, ObjNull,[ObjNull]] call BIS_fnc_Param; _caller = [_this, 2, ObjNull,[ObjNull]] call BIS_fnc_Param;
if (!alive _unit) then { if (!alive _unit) then {
_unit = [_unit,_caller] call FUNC(makeCopyOfBody_F); _unit = [_unit,_caller] call FUNC(makeCopyOfBody_F);
}; };
_unit moveInCargo _vehicle; _unit moveInCargo _vehicle;
@ -24,16 +24,16 @@ _loaded = _vehicle getvariable [QGVAR(loaded_persons_F),[]];
_loaded pushback _unit; _loaded pushback _unit;
_vehicle setvariable [QGVAR(loaded_persons_F),_loaded,true]; _vehicle setvariable [QGVAR(loaded_persons_F),_loaded,true];
if (!([_unit] call FUNC(isAwake))) then { if (!([_unit] call FUNC(isAwake))) then {
_handle = [_unit,_vehicle] spawn { _handle = [_unit,_vehicle] spawn {
private ["_unit","_vehicle"]; private ["_unit","_vehicle"];
_unit = _this select 0; _unit = _this select 0;
_vehicle = _this select 1; _vehicle = _this select 1;
waituntil {vehicle _unit == _vehicle}; waituntil {vehicle _unit == _vehicle};
sleep 0.5; sleep 0.5;
[_unit,([_unit] call FUNC(getDeathAnim)), 1] call FUNC(doAnimation); [_unit,([_unit] call FUNC(getDeathAnim)), 1] call FUNC(doAnimation);
}; };
} else { } else {
if ([_unit] call FUNC(isArrested)) then { if ([_unit] call FUNC(isArrested)) then {
}; };
}; };

View File

@ -21,22 +21,22 @@ if (!([_caller] call FUNC(canInteract)) || {_caller == _unit}) exitwith {_vehicl
_loadcar = nearestObject [_unit, "car"]; _loadcar = nearestObject [_unit, "car"];
if (_unit distance _loadcar <= 10) then { if (_unit distance _loadcar <= 10) then {
_vehicle = _loadcar; _vehicle = _loadcar;
} else { } else {
_loadhelicopter = nearestObject [_unit, "air"]; _loadhelicopter = nearestObject [_unit, "air"];
if (_unit distance _loadhelicopter <= 10) then { if (_unit distance _loadhelicopter <= 10) then {
_vehicle = _loadhelicopter; _vehicle = _loadhelicopter;
} else { } else {
_loadtank = nearestObject [_unit, "tank"]; _loadtank = nearestObject [_unit, "tank"];
if (_unit distance _loadtank <= 10) then { if (_unit distance _loadtank <= 10) then {
_vehicle = _loadtank; _vehicle = _loadtank;
}; };
}; };
}; };
if (!isNull _vehicle) then { if (!isNull _vehicle) then {
[_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide_f); [_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide_f);
[_caller,objNull] call FUNC(carryObj); [_caller,objNull] call FUNC(carryObj);
[_unit,objNull] call FUNC(carryObj); [_unit,objNull] call FUNC(carryObj);
[[_unit, _vehicle,_caller], QUOTE(FUNC(loadPersonLocal_F)), _unit, false] call EFUNC(common,execRemoteFnc); [[_unit, _vehicle,_caller], QUOTE(FUNC(loadPersonLocal_F)), _unit, false] call EFUNC(common,execRemoteFnc);
}; };
_vehicle _vehicle

View File

@ -14,62 +14,62 @@ private ["_oldBody","_newUnit","_class","_group","_position","_side","_allVariab
_oldBody = _this select 0; _oldBody = _this select 0;
_caller = _this select 1; _caller = _this select 1;
if (alive _oldBody) exitwith {_oldBody}; // we only want to do this for dead bodies if (alive _oldBody) exitwith {_oldBody}; // we only want to do this for dead bodies
_name = _oldBody getvariable [QGVAR(name),"unknown"]; _name = _oldBody getvariable [QGVAR(name),"unknown"];
_class = typeof _oldBody; _class = typeof _oldBody;
_side = side _caller; _side = side _caller;
_group = createGroup _side; _group = createGroup _side;
_position = getPos _oldBody; _position = getPos _oldBody;
_newUnit = _group createUnit [typeof _oldBody, _position, [], 0, "NONE"]; _newUnit = _group createUnit [typeof _oldBody, _position, [], 0, "NONE"];
_allVariables = [_oldBody] call FUNC(getAllDefinedSetVariables); _allVariables = [_oldBody] call FUNC(getAllDefinedSetVariables);
// [NAME (STRING), TYPENAME (STRING), VALUE (ANY), DEFAULT GLOBAL (BOOLEAN)] // [NAME (STRING), TYPENAME (STRING), VALUE (ANY), DEFAULT GLOBAL (BOOLEAN)]
{ {
[_newUnit,_x select 0, _x select 2] call FUNC(setDefinedVariable); [_newUnit,_x select 0, _x select 2] call FUNC(setDefinedVariable);
}foreach _allVariables; }foreach _allVariables;
_newUnit setVariable [QGVAR(name),_name,true]; _newUnit setVariable [QGVAR(name),_name,true];
_newUnit disableAI "TARGET"; _newUnit disableAI "TARGET";
_newUnit disableAI "AUTOTARGET"; _newUnit disableAI "AUTOTARGET";
_newUnit disableAI "MOVE"; _newUnit disableAI "MOVE";
_newUnit disableAI "ANIM"; _newUnit disableAI "ANIM";
_newUnit disableAI "FSM"; _newUnit disableAI "FSM";
_newUnit setvariable [QGVAR(isDead),true,true]; _newUnit setvariable [QGVAR(isDead),true,true];
removeallweapons _newUnit; removeallweapons _newUnit;
removeallassigneditems _newUnit; removeallassigneditems _newUnit;
removeUniform _newUnit; removeUniform _newUnit;
removeHeadgear _newUnit; removeHeadgear _newUnit;
removeBackpack _newUnit; removeBackpack _newUnit;
removeVest _newUnit; removeVest _newUnit;
_newUnit addHeadgear (headgear _oldBody); _newUnit addHeadgear (headgear _oldBody);
_newUnit addBackpack (backpack _oldBody); _newUnit addBackpack (backpack _oldBody);
clearItemCargoGlobal (backpackContainer _newUnit); clearItemCargoGlobal (backpackContainer _newUnit);
clearMagazineCargoGlobal (backpackContainer _newUnit); clearMagazineCargoGlobal (backpackContainer _newUnit);
clearWeaponCargoGlobal (backpackContainer _newUnit); clearWeaponCargoGlobal (backpackContainer _newUnit);
_newUnit addVest (vest _oldBody); _newUnit addVest (vest _oldBody);
clearItemCargoGlobal (backpackContainer _newUnit); clearItemCargoGlobal (backpackContainer _newUnit);
clearMagazineCargoGlobal (backpackContainer _newUnit); clearMagazineCargoGlobal (backpackContainer _newUnit);
clearWeaponCargoGlobal (backpackContainer _newUnit); clearWeaponCargoGlobal (backpackContainer _newUnit);
_newUnit addUniform (uniform _oldBody); _newUnit addUniform (uniform _oldBody);
clearItemCargoGlobal (backpackContainer _newUnit); clearItemCargoGlobal (backpackContainer _newUnit);
clearMagazineCargoGlobal (backpackContainer _newUnit); clearMagazineCargoGlobal (backpackContainer _newUnit);
clearWeaponCargoGlobal (backpackContainer _newUnit); clearWeaponCargoGlobal (backpackContainer _newUnit);
{_newUnit addMagazine _x} count (magazines _oldBody); {_newUnit addMagazine _x} count (magazines _oldBody);
{_newUnit addWeapon _x} count (weapons _oldBody); {_newUnit addWeapon _x} count (weapons _oldBody);
{_newUnit addItem _x} count (items _oldBody); {_newUnit addItem _x} count (items _oldBody);
_newUnit selectWeapon (primaryWeapon _newUnit); _newUnit selectWeapon (primaryWeapon _newUnit);
//_newUnit playMoveNow ([_newUnit] call FUNC(getDeathAnim)); //_newUnit playMoveNow ([_newUnit] call FUNC(getDeathAnim));
deleteVehicle _oldBody; deleteVehicle _oldBody;
// TODO sometimes the old body does not get cleaned up properly. Look into garbage collection. // TODO sometimes the old body does not get cleaned up properly. Look into garbage collection.
_newUnit setDamage 0.9; _newUnit setDamage 0.9;
_newUnit _newUnit

View File

@ -20,5 +20,5 @@ GVAR(Module) = true;
[_logic, QGVAR(REVIVE_NUMBER_MAX_F), "amountOf" ] call EFUNC(common,readNumericParameterFromModule); [_logic, QGVAR(REVIVE_NUMBER_MAX_F), "amountOf" ] call EFUNC(common,readNumericParameterFromModule);
[ [
{(((_this select 0) getvariable[QGVAR(ENABLE_REVIVE_SETDEAD_F),0]) > 0)} {(((_this select 0) getvariable[QGVAR(ENABLE_REVIVE_SETDEAD_F),0]) > 0)}
] call FUNC(registerUnconsciousCondition); ] call FUNC(registerUnconsciousCondition);

View File

@ -15,18 +15,18 @@ _unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param;
_moveTo = [_this, 1,false,[false]] call BIS_fnc_Param; _moveTo = [_this, 1,false,[false]] call BIS_fnc_Param;
if (_moveTo) then { if (_moveTo) then {
_previousGroup = group _unit; _previousGroup = group _unit;
_newGroup = createGroup (side _previousGroup); _newGroup = createGroup (side _previousGroup);
[_unit] joinSilent _newGroup; [_unit] joinSilent _newGroup;
_unit setvariable [QGVAR(previousGroup_F),_previousGroup]; _unit setvariable [QGVAR(previousGroup_F),_previousGroup];
} else { } else {
_previousGroup = _unit getvariable QGVAR(previousGroup_F); _previousGroup = _unit getvariable QGVAR(previousGroup_F);
if (!isnil "_previousGroup") then { if (!isnil "_previousGroup") then {
_currentGroup = group _unit; _currentGroup = group _unit;
_unit setvariable [QGVAR(previousGroup_F),nil]; _unit setvariable [QGVAR(previousGroup_F),nil];
[_unit] joinSilent _previousGroup; [_unit] joinSilent _previousGroup;
if (count units _currentGroup == 0) then { if (count units _currentGroup == 0) then {
deleteGroup _currentGroup; deleteGroup _currentGroup;
}; };
}; };
}; };

View File

@ -16,23 +16,23 @@ _accepted = _this select 2;
_info = _unit getvariable _id; _info = _unit getvariable _id;
if (!isnil "_info") then { if (!isnil "_info") then {
_caller = _info select 0; _caller = _info select 0;
_target = _info select 1; _target = _info select 1;
_requestID = _info select 2; _requestID = _info select 2;
_requestMessage = _info select 3; _requestMessage = _info select 3;
_callBack = _info select 4; _callBack = _info select 4;
_replyParams = [_info, _accepted]; _replyParams = [_info, _accepted];
[_replyParams, QUOTE(FUNC(requestCallback)), _caller, false] call FUNC(execRemoteFnc); [_replyParams, QUOTE(FUNC(requestCallback)), _caller, false] call FUNC(execRemoteFnc);
_unit setvariable [_id, nil]; _unit setvariable [_id, nil];
}; };
GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = nil; GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = nil;
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then { if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then {
_unit removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT); _unit removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT);
GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil; GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil;
}; };
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then { if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then {
_unit removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE); _unit removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE);
GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil; GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil;
}; };

View File

@ -19,46 +19,46 @@ _handle = _this select 1;
_eventHandlerName = (QGVAR(f_custom_eventhandlers_) + _handle); _eventHandlerName = (QGVAR(f_custom_eventhandlers_) + _handle);
_eventHandlerCollection = missionNamespace getvariable _eventHandlerName; _eventHandlerCollection = missionNamespace getvariable _eventHandlerName;
if (isnil "_eventHandlerCollection") then { if (isnil "_eventHandlerCollection") then {
_eventHandlerCollection = []; _eventHandlerCollection = [];
[format["caching Custom Eventhandler: %1",_handle]] call FUNC(debug); [format["caching Custom Eventhandler: %1",_handle]] call FUNC(debug);
_cfg = (ConfigFile >> "ACE_Eventhandlers" >> "CustomEventHandlers" >> _handle); _cfg = (ConfigFile >> "ACE_Eventhandlers" >> "CustomEventHandlers" >> _handle);
if (isClass _cfg) then { if (isClass _cfg) then {
_numberOfEH = count _cfg; _numberOfEH = count _cfg;
for "_EHiterator" from 0 to (_numberOfEH -1) /* step +1 */ do { for "_EHiterator" from 0 to (_numberOfEH -1) /* step +1 */ do {
//for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do { //for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do {
_ehCfg = _cfg select _EHiterator; _ehCfg = _cfg select _EHiterator;
if (isClass _ehCfg) then { if (isClass _ehCfg) then {
_classType = (ConfigName _ehCfg); _classType = (ConfigName _ehCfg);
_code = (compile getText(_ehCfg >> "onCall")); _code = (compile getText(_ehCfg >> "onCall"));
_eventHandlerCollection pushback [_classType, _code]; _eventHandlerCollection pushback [_classType, _code];
true; true;
}; };
}; };
}; };
_cfg = (MissionConfigFile >> "ACE_Eventhandlers" >> "CustomEventHandlers" >> _handle); _cfg = (MissionConfigFile >> "ACE_Eventhandlers" >> "CustomEventHandlers" >> _handle);
if (isClass _cfg) then { if (isClass _cfg) then {
_numberOfEH = count _cfg; _numberOfEH = count _cfg;
for "_EHiterator" from 0 to (_numberOfEH -1) /* step +1 */ do { for "_EHiterator" from 0 to (_numberOfEH -1) /* step +1 */ do {
//for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do { //for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do {
_ehCfg = _cfg select _EHiterator; _ehCfg = _cfg select _EHiterator;
if (isClass _ehCfg) then { if (isClass _ehCfg) then {
_classType = (ConfigName _ehCfg); _classType = (ConfigName _ehCfg);
_code = (compile getText(_ehCfg >> "onCall")); _code = (compile getText(_ehCfg >> "onCall"));
_eventHandlerCollection pushback [_classType, _code]; _eventHandlerCollection pushback [_classType, _code];
true; true;
}; };
}; };
}; };
missionNamespace setvariable [_eventHandlerName, _eventHandlerCollection]; missionNamespace setvariable [_eventHandlerName, _eventHandlerCollection];
[format["Custom Eventhandler: %1 cache: %2",_handle, _eventHandlerCollection]] call FUNC(debug); [format["Custom Eventhandler: %1 cache: %2",_handle, _eventHandlerCollection]] call FUNC(debug);
}; };
_return = []; _return = [];
{ {
_return pushback (_arguments call (_x select 1)); _return pushback (_arguments call (_x select 1));
}foreach _eventHandlerCollection; }foreach _eventHandlerCollection;
_return _return

View File

@ -22,23 +22,23 @@ _requestID = ("ace_recieveRequest_f_id_"+_requestID);
_target setvariable [_requestID, _this]; _target setvariable [_requestID, _this];
if (isLocalized _requestMessage) then { if (isLocalized _requestMessage) then {
_requestMessage = format[localize _requestMessage,[_caller] call FUNC(getName)]; _requestMessage = format[localize _requestMessage,[_caller] call FUNC(getName)];
} else { } else {
_requestMessage = format[_requestMessage,[_caller] call FUNC(getName)]; _requestMessage = format[_requestMessage,[_caller] call FUNC(getName)];
}; };
hint format["%1",_requestMessage]; hint format["%1",_requestMessage];
if !(isnil QGVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT)) then { if !(isnil QGVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT)) then {
terminate GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT); terminate GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT);
}; };
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then { if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then {
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT); _target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT);
GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil; GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil;
}; };
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then { if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then {
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE); _target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE);
GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil; GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil;
}; };
GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = _target addAction ["Accept", compile format["[player,'%1', true] call FUNC(onAnswerRequest);", _requestID]]; GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = _target addAction ["Accept", compile format["[player,'%1', true] call FUNC(onAnswerRequest);", _requestID]];
@ -47,23 +47,23 @@ GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = _target addAction ["Decline", compile
GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = _requestID; GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = _requestID;
GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [time, _target, _requestID] spawn { GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [time, _target, _requestID] spawn {
_t = (_this select 0) + 40; _t = (_this select 0) + 40;
_target = _this select 1; _target = _this select 1;
_requestID = _this select 2; _requestID = _this select 2;
_id = _target getvariable _requestID; _id = _target getvariable _requestID;
waituntil { waituntil {
_id = _target getvariable _requestID; _id = _target getvariable _requestID;
(time > _t || isnil "_id")}; (time > _t || isnil "_id")};
_target setvariable [_requestID, nil]; _target setvariable [_requestID, nil];
GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = nil; GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = nil;
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then { if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then {
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT); _target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT);
GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil; GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil;
}; };
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then { if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then {
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE); _target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE);
GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil; GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil;
}; };
}; };

View File

@ -11,12 +11,12 @@
#include "script_component.hpp" #include "script_component.hpp"
if (isnil QGVAR(unconsciousConditions_F)) then { if (isnil QGVAR(unconsciousConditions_F)) then {
GVAR(unconsciousConditions_F) = []; GVAR(unconsciousConditions_F) = [];
}; };
if (typeName _this == typeName []) then { if (typeName _this == typeName []) then {
{ {
if (typeName _x == typeName {}) then { if (typeName _x == typeName {}) then {
GVAR(unconsciousConditions_F) pushback _x; GVAR(unconsciousConditions_F) pushback _x;
}; };
}foreach _this; }foreach _this;
}; };

View File

@ -17,22 +17,22 @@ _unit setvariable [QGVAR(isDead),nil,true];
_unit setvariable ["ACE_isUnconscious", nil, true]; _unit setvariable ["ACE_isUnconscious", nil, true];
if (isPlayer _unit) then { if (isPlayer _unit) then {
[true] call FUNC(setVolume_f); [true] call FUNC(setVolume_f);
[false] call FUNC(disableKeyInput_f); [false] call FUNC(disableKeyInput_f);
[false] call EFUNC(GUI,effectBlackOut); [false] call EFUNC(GUI,effectBlackOut);
if !(isnil QGVAR(DISABLE_USER_INPUT_COLLECTION_F)) then { if !(isnil QGVAR(DISABLE_USER_INPUT_COLLECTION_F)) then {
// clear all disable user input // clear all disable user input
{ {
[_X, false] call FUNC(setDisableUserInputStatus); [_X, false] call FUNC(setDisableUserInputStatus);
}foreach GVAR(DISABLE_USER_INPUT_COLLECTION_F); }foreach GVAR(DISABLE_USER_INPUT_COLLECTION_F);
}; };
}; };
{ {
if (!(_x select 4)) then { if (!(_x select 4)) then {
_unit setvariable [(_x select 0),nil,_x select 3]; _unit setvariable [(_x select 0),nil,_x select 3];
}; };
}foreach ([_unit] call FUNC(getAllDefinedSetVariables)); }foreach ([_unit] call FUNC(getAllDefinedSetVariables));
[[_unit],"resetToDefaults"] call FUNC(raiseScriptedEvent_f); [[_unit],"resetToDefaults"] call FUNC(raiseScriptedEvent_f);

View File

@ -1,5 +1,15 @@
/**
* fnc_revealObject_f.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp" #include "script_component.hpp"
if (hasInterface) then { if (hasInterface) then {
player reveal (_this select 0); player reveal (_this select 0);
}; };

View File

@ -18,9 +18,9 @@ _requestMessage = _this select 3;
_callBack = _this select 4; _callBack = _this select 4;
if (isPlayer _target) then { if (isPlayer _target) then {
// Pass request on to target locality for player accept/decline. // Pass request on to target locality for player accept/decline.
[[_caller, _target, _requestID, _requestMessage, _callBack], QUOTE(FUNC(receiveRequest)), _target, false] call EFUNC(common,execRemoteFnc); [[_caller, _target, _requestID, _requestMessage, _callBack], QUOTE(FUNC(receiveRequest)), _target, false] call EFUNC(common,execRemoteFnc);
} else { } else {
// accept it, since it's an AI. // accept it, since it's an AI.
[_caller, _target, true] call compile _callBack; [_caller, _target, true] call compile _callBack;
}; };

View File

@ -15,31 +15,31 @@ _unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param;
_setArrest = [_this, 1, false, [false]] call BIS_fnc_Param; _setArrest = [_this, 1, false, [false]] call BIS_fnc_Param;
if (_setArrest) then { if (_setArrest) then {
[_unit, QGVAR(StateArrested), true] call FUNC(setDefinedVariable); [_unit, QGVAR(StateArrested), true] call FUNC(setDefinedVariable);
if ([_unit] call FUNC(isAwake)) then { if ([_unit] call FUNC(isAwake)) then {
if (vehicle _unit == _unit) then { if (vehicle _unit == _unit) then {
[_unit,"UnaErcPoslechVelitele2",1] call FUNC(doAnimation); [_unit,"UnaErcPoslechVelitele2",1] call FUNC(doAnimation);
}; };
}; };
if (IsPlayer _unit) then { if (IsPlayer _unit) then {
[["arrested", true],QUOTE(FUNC(setDisableUserInputStatus)),_unit,false] call EFUNC(common,execRemoteFnc); [["arrested", true],QUOTE(FUNC(setDisableUserInputStatus)),_unit,false] call EFUNC(common,execRemoteFnc);
}; };
_unit disableAI "Move"; _unit disableAI "Move";
_unit disableAI "ANIM"; _unit disableAI "ANIM";
} else { } else {
[_unit, QGVAR(StateArrested), false] call FUNC(setDefinedVariable); [_unit, QGVAR(StateArrested), false] call FUNC(setDefinedVariable);
if ([_unit] call FUNC(isAwake)) then { if ([_unit] call FUNC(isAwake)) then {
if (vehicle _unit == _unit) then { if (vehicle _unit == _unit) then {
[_unit,"",1] call FUNC(doAnimation); [_unit,"",1] call FUNC(doAnimation);
}; };
_unit enableAI "Move"; _unit enableAI "Move";
_unit enableAI "ANIM"; _unit enableAI "ANIM";
}; };
if (IsPlayer _unit) then { if (IsPlayer _unit) then {
[["arrested", false],QUOTE(FUNC(setDisableUserInputStatus)),_unit,false] call EFUNC(common,execRemoteFnc); [["arrested", false],QUOTE(FUNC(setDisableUserInputStatus)),_unit,false] call EFUNC(common,execRemoteFnc);
}; };
}; };
[[_unit, _setArrest],"setArrestState"] call FUNC(raiseScriptedEvent_f); [[_unit, _setArrest],"setArrestState"] call FUNC(raiseScriptedEvent_f);

View File

@ -15,14 +15,14 @@ _unit = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
_to = _this select 1; _to = _this select 1;
_return = false; _return = false;
if (((typeName _to) == "SCALAR")) then { if (((typeName _to) == "SCALAR")) then {
if (_to <-1) then { if (_to <-1) then {
_to = -1; _to = -1;
} else { } else {
if (_to > 1) then { if (_to > 1) then {
_to = 1; _to = 1;
}; };
}; };
_unit setvariable [QGVAR(canInteract), ([_unit] call FUNC(getCanInteract)) + _to,false]; _unit setvariable [QGVAR(canInteract), ([_unit] call FUNC(getCanInteract)) + _to,false];
_return = true; _return = true;
}; };
_return _return

View File

@ -17,17 +17,17 @@ _setCaptive = [_this, 1, false, [false]] call BIS_fnc_Param;
_captiveSwitch = true; _captiveSwitch = true;
if (_setCaptive) then { if (_setCaptive) then {
if (captive _unit) then { if (captive _unit) then {
_captiveSwitch = false; _captiveSwitch = false;
} else { } else {
_unit setCaptive true; _unit setCaptive true;
}; };
} else { } else {
if (captive _unit) then { if (captive _unit) then {
_unit setCaptive false; _unit setCaptive false;
} else { } else {
_captiveSwitch = false; _captiveSwitch = false;
}; };
}; };
_captiveSwitch _captiveSwitch

View File

@ -4,7 +4,7 @@
* @Author: Glowbal * @Author: Glowbal
* *
* @Arguments: [unitToBeCarried OBJECT, objectCarrying OBJECT] * @Arguments: [unitToBeCarried OBJECT, objectCarrying OBJECT]
* @Return: BOOL True if succesfully registered * @Return: BOOL True if succesfully registered
* @PublicAPI: false * @PublicAPI: false
*/ */
@ -15,7 +15,7 @@ _unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
_to = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param; _to = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param;
_return = false; _return = false;
if ((isNull ([_unit] call FUNC(getCarriedBy))) || isNull _to) then { if ((isNull ([_unit] call FUNC(getCarriedBy))) || isNull _to) then {
_return = true; _return = true;
_unit setvariable [QGVAR(carriedBy),_to,true]; _unit setvariable [QGVAR(carriedBy),_to,true];
}; };
_return _return

View File

@ -10,77 +10,77 @@
#include "script_component.hpp" #include "script_component.hpp"
#define TIME_BETWEEN_REVIVE_RUNS 0.5 #define TIME_BETWEEN_REVIVE_RUNS 0.5
private ["_unit"]; private ["_unit"];
_unit = _this select 0; _unit = _this select 0;
_force = false; _force = false;
if (count _this >= 2) then { if (count _this >= 2) then {
_force = _this select 1; _force = _this select 1;
}; };
if (!alive _unit) exitwith{}; if (!alive _unit) exitwith{};
if (!local _unit) exitwith { if (!local _unit) exitwith {
[[_unit, _force], QUOTE(FUNC(setDead)), _unit, false] call BIS_fnc_MP; [[_unit, _force], QUOTE(FUNC(setDead)), _unit, false] call BIS_fnc_MP;
}; };
if (isnil QGVAR(ENABLE_REVIVE_F)) then { if (isnil QGVAR(ENABLE_REVIVE_F)) then {
GVAR(ENABLE_REVIVE_F) = 0; GVAR(ENABLE_REVIVE_F) = 0;
}; };
if (((GVAR(ENABLE_REVIVE_F) == 1 && isPlayer _unit) || (GVAR(ENABLE_REVIVE_F) == 2)) && !_force && (alive (vehicle _unit))) exitwith { if (((GVAR(ENABLE_REVIVE_F) == 1 && isPlayer _unit) || (GVAR(ENABLE_REVIVE_F) == 2)) && !_force && (alive (vehicle _unit))) exitwith {
// enter revive state // enter revive state
_unit setvariable [QGVAR(inReviveState), true, true]; _unit setvariable [QGVAR(inReviveState), true, true];
// Remain unconscious while in revive state // Remain unconscious while in revive state
[_unit] call FUNC(setUnconsciousState); [_unit] call FUNC(setUnconsciousState);
// setting the revive default values // setting the revive default values
if (isnil QGVAR(REVIVE_TIMER_F)) then { if (isnil QGVAR(REVIVE_TIMER_F)) then {
GVAR(REVIVE_TIMER_F) = 10; GVAR(REVIVE_TIMER_F) = 10;
}; };
if (isnil QGVAR(REVIVE_NUMBER_MAX_F)) then { if (isnil QGVAR(REVIVE_NUMBER_MAX_F)) then {
GVAR(REVIVE_NUMBER_MAX_F) = -1; GVAR(REVIVE_NUMBER_MAX_F) = -1;
}; };
[{ [{
private ["_unit","_playerDead","_counter"]; private ["_unit","_playerDead","_counter"];
_unit = (_this select 0) select 0; _unit = (_this select 0) select 0;
_playerDead = (_this select 0) select 1; _playerDead = (_this select 0) select 1;
// Check if a unit woke up or was already killed // Check if a unit woke up or was already killed
if (!([_unit] call FUNC(isUnconscious)) || !alive _unit) exitwith { if (!([_unit] call FUNC(isUnconscious)) || !alive _unit) exitwith {
[(_this select 1)] call cba_fnc_removePerFrameHandler; [(_this select 1)] call cba_fnc_removePerFrameHandler;
// Cleaning up the variables, as we no longer need them. // Cleaning up the variables, as we no longer need them.
_unit setvariable [QGVAR(reviveCounter_f), nil]; _unit setvariable [QGVAR(reviveCounter_f), nil];
_unit setvariable [QGVAR(inReviveState), nil, true]; _unit setvariable [QGVAR(inReviveState), nil, true];
}; };
_counter = _unit getvariable [QGVAR(reviveCounter_f), 0]; _counter = _unit getvariable [QGVAR(reviveCounter_f), 0];
if (_counter >= GVAR(REVIVE_TIMER_F)) exitwith{ if (_counter >= GVAR(REVIVE_TIMER_F)) exitwith{
if (isPlayer _unit) then { if (isPlayer _unit) then {
titleText ["You died..","PLAIN DOWN"]; titleText ["You died..","PLAIN DOWN"];
}; };
[_unit,QGVAR(isDead), true, true] call FUNC(setDefinedVariable); [_unit,QGVAR(isDead), true, true] call FUNC(setDefinedVariable);
if (_playerDead) then { if (_playerDead) then {
[_unit,QGVAR(isDeadPlayer),true,true] call FUNC(setDefinedVariable); [_unit,QGVAR(isDeadPlayer),true,true] call FUNC(setDefinedVariable);
}; };
_unit setdamage 1; // killing a unit will automatically clean up all variables. _unit setdamage 1; // killing a unit will automatically clean up all variables.
[[_unit, true],"killed"] call FUNC(raiseScriptedEvent_f); [[_unit, true],"killed"] call FUNC(raiseScriptedEvent_f);
[(_this select 1)] call cba_fnc_removePerFrameHandler; [(_this select 1)] call cba_fnc_removePerFrameHandler;
}; };
_unit setvariable [QGVAR(reviveCounter_f),_counter + TIME_BETWEEN_REVIVE_RUNS]; _unit setvariable [QGVAR(reviveCounter_f),_counter + TIME_BETWEEN_REVIVE_RUNS];
}, TIME_BETWEEN_REVIVE_RUNS, [_unit, isPlayer _unit] ] call CBA_fnc_addPerFrameHandler; }, TIME_BETWEEN_REVIVE_RUNS, [_unit, isPlayer _unit] ] call CBA_fnc_addPerFrameHandler;
}; };
[_unit,QGVAR(isDead),true,true] call FUNC(setDefinedVariable); [_unit,QGVAR(isDead),true,true] call FUNC(setDefinedVariable);
if (isPLayer _unit) then { if (isPLayer _unit) then {
[_unit,QGVAR(isDeadPlayer),true,true] call FUNC(setDefinedVariable); [_unit,QGVAR(isDeadPlayer),true,true] call FUNC(setDefinedVariable);
}; };
_unit setdamage 1; _unit setdamage 1;

View File

@ -17,15 +17,15 @@ _value = _this select 2;
_global = false; _global = false;
if (count _this > 3) then { if (count _this > 3) then {
_global = _this select 3; _global = _this select 3;
} else { } else {
_definedVariable = ([_variable] call FUNC(getDefinedVariableInfo)); _definedVariable = ([_variable] call FUNC(getDefinedVariableInfo));
if (count _definedVariable > 2) then { if (count _definedVariable > 2) then {
_global = _definedVariable select 2; _global = _definedVariable select 2;
}; };
}; };
if (!isNil "_value") exitwith { if (!isNil "_value") exitwith {
_unit setvariable [_variable, _value, _global]; _unit setvariable [_variable, _value, _global];
}; };
_unit setvariable [_variable, nil, _global]; _unit setvariable [_variable, nil, _global];

View File

@ -14,15 +14,15 @@ _disable = _this select 1;
if (isnil QGVAR(DISABLE_USER_INPUT_COLLECTION_F)) then { if (isnil QGVAR(DISABLE_USER_INPUT_COLLECTION_F)) then {
GVAR(DISABLE_USER_INPUT_COLLECTION_F) = []; GVAR(DISABLE_USER_INPUT_COLLECTION_F) = [];
}; };
if (_disable) then { if (_disable) then {
GVAR(DISABLE_USER_INPUT_COLLECTION_F) pushback _id; GVAR(DISABLE_USER_INPUT_COLLECTION_F) pushback _id;
[true] call FUNC(disableUserInput); [true] call FUNC(disableUserInput);
} else { } else {
GVAR(DISABLE_USER_INPUT_COLLECTION_F) = GVAR(DISABLE_USER_INPUT_COLLECTION_F) - [_id]; GVAR(DISABLE_USER_INPUT_COLLECTION_F) = GVAR(DISABLE_USER_INPUT_COLLECTION_F) - [_id];
if (GVAR(DISABLE_USER_INPUT_COLLECTION_F) isEqualTo []) then { if (GVAR(DISABLE_USER_INPUT_COLLECTION_F) isEqualTo []) then {
[false] call FUNC(disableUserInput); [false] call FUNC(disableUserInput);
}; };
}; };

View File

@ -15,26 +15,26 @@ _id = _this select 0;
_settings = _this select 1; _settings = _this select 1;
_add = true; _add = true;
if (count _this > 2) then { if (count _this > 2) then {
_add = _this select 2; _add = _this select 2;
}; };
_map = missionNamespace getVariable [QGVAR(setHearingCapabilityMap),[]]; _map = missionNamespace getVariable [QGVAR(setHearingCapabilityMap),[]];
_exists = false; _exists = false;
{ {
if (_id == _x select 0) exitWith { if (_id == _x select 0) exitWith {
_exists = true; _exists = true;
if (_add) then { if (_add) then {
_x set [1, _settings]; _x set [1, _settings];
} else { } else {
_map set [_forEachIndex, 0]; _map set [_forEachIndex, 0];
_map = _map - [0]; _map = _map - [0];
}; };
}; };
} forEach _map; } forEach _map;
if (!_exists && _add) then { if (!_exists && _add) then {
_map pushBack [_id, _settings]; _map pushBack [_id, _settings];
}; };
missionNamespace setVariable [QGVAR(setHearingCapabilityMap), _map]; missionNamespace setVariable [QGVAR(setHearingCapabilityMap), _map];
@ -42,7 +42,7 @@ missionNamespace setVariable [QGVAR(setHearingCapabilityMap), _map];
// find lowest volume // find lowest volume
_lowestVolume = 1; _lowestVolume = 1;
{ {
_lowestVolume = (_x select 1) min _lowestVolume; _lowestVolume = (_x select 1) min _lowestVolume;
} forEach _map; } forEach _map;
// in game sounds // in game sounds

View File

@ -13,16 +13,16 @@
private ["_unit"]; private ["_unit"];
_unit = [_this,0, ObjNull,[ObjNull]] call BIS_fnc_Param; _unit = [_this,0, ObjNull,[ObjNull]] call BIS_fnc_Param;
switch (currentWeapon _unit) do { switch (currentWeapon _unit) do {
case (primaryWeapon _unit): { case (primaryWeapon _unit): {
[_unit,"amovppnemstpsraswrfldnon"] call FUNC(localAnim); [_unit,"amovppnemstpsraswrfldnon"] call FUNC(localAnim);
}; };
case (secondaryWeapon _unit): { case (secondaryWeapon _unit): {
[_unit,"amovppnemstpsraswlnrdnon"] call FUNC(localAnim); [_unit,"amovppnemstpsraswlnrdnon"] call FUNC(localAnim);
}; };
case (handgunWeapon _unit): { case (handgunWeapon _unit): {
[_unit,"AmovPpneMstpSrasWpstDnon"] call FUNC(localAnim); [_unit,"AmovPpneMstpSrasWpstDnon"] call FUNC(localAnim);
}; };
default { default {
[_unit,"amovppnemstpsnonwnondnon"] call FUNC(localAnim); [_unit,"amovppnemstpsnonwnondnon"] call FUNC(localAnim);
}; };
}; };

View File

@ -14,13 +14,13 @@ private ["_unit", "_animState", "_dAnim"];
_unit = _this select 0; _unit = _this select 0;
if !([_unit] call FUNC(canGoUnconsciousState)) exitwith{ if !([_unit] call FUNC(canGoUnconsciousState)) exitwith{
[format["Exit setUnconscious: %1", _this]] call FUNC(debug); [format["Exit setUnconscious: %1", _this]] call FUNC(debug);
}; };
// We only want this function to work on local machines // We only want this function to work on local machines
if (!local _unit) exitwith { if (!local _unit) exitwith {
[[_unit], QUOTE(FUNC(setUnconsciousState)), _unit, false] call EFUNC(common,execRemoteFnc); [[_unit], QUOTE(FUNC(setUnconsciousState)), _unit, false] call EFUNC(common,execRemoteFnc);
[format["Exit setUnconscious: %1", _this]] call FUNC(debug); [format["Exit setUnconscious: %1", _this]] call FUNC(debug);
}; };
// get rid of the object we are carrying, before we go unconscious. // get rid of the object we are carrying, before we go unconscious.
@ -41,13 +41,13 @@ _originalPos = unitPos _unit;
// Handle the on screen effects // Handle the on screen effects
if (isPlayer _unit) then { if (isPlayer _unit) then {
[] call FUNC(closeAllDialogs_f); [] call FUNC(closeAllDialogs_f);
[true] call EFUNC(GUI,effectBlackOut); [true] call EFUNC(GUI,effectBlackOut);
["unconscious", true] call FUNC(setDisableUserInputStatus); ["unconscious", true] call FUNC(setDisableUserInputStatus);
[false] call FUNC(setVolume_f); [false] call FUNC(setVolume_f);
} else { } else {
_unit setUnitPos "DOWN"; _unit setUnitPos "DOWN";
[_unit, true] call FUNC(disableAI_F); [_unit, true] call FUNC(disableAI_F);
}; };
// So the AI does not get stuck, we are moving the unit to a temp group on its own. // So the AI does not get stuck, we are moving the unit to a temp group on its own.
@ -64,78 +64,78 @@ _startingTime = time;
_minWaitingTime = (round(random(10)+5)); _minWaitingTime = (round(random(10)+5));
[{ [{
private ["_unit", "_vehicleOfUnit","_lockSwitch","_minWaitingTime", "_oldAnimation", "_captiveSwitch"]; private ["_unit", "_vehicleOfUnit","_lockSwitch","_minWaitingTime", "_oldAnimation", "_captiveSwitch"];
_args = _this select 0; _args = _this select 0;
_unit = _args select 0; _unit = _args select 0;
_oldAnimation = _args select 1; _oldAnimation = _args select 1;
_captiveSwitch = _args select 2; _captiveSwitch = _args select 2;
_originalPos = _args select 3; _originalPos = _args select 3;
_startingTime = _args select 4; _startingTime = _args select 4;
_minWaitingTime = _args select 5; _minWaitingTime = _args select 5;
// Since the unit is no longer alive, get rid of this PFH. // Since the unit is no longer alive, get rid of this PFH.
if (!alive _unit) exitwith { if (!alive _unit) exitwith {
[format["%1 Unit no longer alive, exiting"], _unit] call FUNC(debug); [format["%1 Unit no longer alive, exiting"], _unit] call FUNC(debug);
// EXIT PFH // EXIT PFH
[(_this select 1)] call cba_fnc_removePerFrameHandler; [(_this select 1)] call cba_fnc_removePerFrameHandler;
[[_unit, false],"setUnconsciousState"] call FUNC(raiseScriptedEvent_f); [[_unit, false],"setUnconsciousState"] call FUNC(raiseScriptedEvent_f);
}; };
// In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation // In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation
if !([_unit] call FUNC(isUnconscious)) exitwith { if !([_unit] call FUNC(isUnconscious)) exitwith {
[format["%1 Unit no longer unconscious, handling exit and animation"], _unit] call FUNC(debug); [format["%1 Unit no longer unconscious, handling exit and animation"], _unit] call FUNC(debug);
// Wait until the unit isn't being carried anymore, so we won't end up with wierd animations // Wait until the unit isn't being carried anymore, so we won't end up with wierd animations
if !([_unit] call FUNC(beingCarried)) then { if !([_unit] call FUNC(beingCarried)) then {
if (vehicle _unit == _unit) then { if (vehicle _unit == _unit) then {
[_unit,"amovppnemstpsnonwnondnon", 1] call FUNC(doAnimation); [_unit,"amovppnemstpsnonwnondnon", 1] call FUNC(doAnimation);
} else { } else {
// Switch to the units original animation, assuming // Switch to the units original animation, assuming
// TODO: what if the unit switched vehicle? // TODO: what if the unit switched vehicle?
[_unit, _oldAnimation, 1] call FUNC(doAnimation); [_unit, _oldAnimation, 1] call FUNC(doAnimation);
}; };
// EXIT PFH // EXIT PFH
[(_this select 1)] call cba_fnc_removePerFrameHandler; [(_this select 1)] call cba_fnc_removePerFrameHandler;
[[_unit, false],"setUnconsciousState"] call FUNC(raiseScriptedEvent_f); [[_unit, false],"setUnconsciousState"] call FUNC(raiseScriptedEvent_f);
}; };
}; };
// Ensure we are waiting at least a minimum period before checking if we can wake up the unit again, allows for temp knock outs // Ensure we are waiting at least a minimum period before checking if we can wake up the unit again, allows for temp knock outs
if ((time - _startingTime) >= _minWaitingTime) exitwith { if ((time - _startingTime) >= _minWaitingTime) exitwith {
// Wait until the unit is no longer unconscious // Wait until the unit is no longer unconscious
if (!([_unit] call FUNC(getUnconsciousCondition))) then { if (!([_unit] call FUNC(getUnconsciousCondition))) then {
[format["%1 No unconscious condition valid anymore, moving uit out of unconsciousState"], _unit] call FUNC(debug); [format["%1 No unconscious condition valid anymore, moving uit out of unconsciousState"], _unit] call FUNC(debug);
// Reset the unit back to the previous captive state. // Reset the unit back to the previous captive state.
if (_captiveSwitch) then { if (_captiveSwitch) then {
[_unit, false] call FUNC(setCaptiveSwitch); [_unit, false] call FUNC(setCaptiveSwitch);
}; };
_unit setUnconscious false; _unit setUnconscious false;
// Swhich the unit back to its original group // Swhich the unit back to its original group
[_unit, false, "ACE_isUnconscious", side group _unit] call FUNC(switchToGroupSide_f); [_unit, false, "ACE_isUnconscious", side group _unit] call FUNC(switchToGroupSide_f);
// Reset any visual and audio effects for players, or enable everything again for AI. // Reset any visual and audio effects for players, or enable everything again for AI.
if (isPlayer _unit) then { if (isPlayer _unit) then {
[false] call EFUNC(GUI,effectBlackOut); [false] call EFUNC(GUI,effectBlackOut);
[true] call FUNC(setVolume_f); [true] call FUNC(setVolume_f);
["unconscious", false] call FUNC(setDisableUserInputStatus); ["unconscious", false] call FUNC(setDisableUserInputStatus);
} else { } else {
[_unit, false] call FUNC(disableAI_F); [_unit, false] call FUNC(disableAI_F);
_unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP) _unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP)
}; };
// Move unit out of unconscious state // Move unit out of unconscious state
_unit setvariable ["ACE_isUnconscious", false, true]; _unit setvariable ["ACE_isUnconscious", false, true];
[format["%1 Unit no longer unconsicous"], _unit] call FUNC(debug); [format["%1 Unit no longer unconsicous"], _unit] call FUNC(debug);
}; };
}; };
// A check to ensure that the animation is being played properly. // A check to ensure that the animation is being played properly.
// TODO: Might no longer be necessary: Have to test this in MP. // TODO: Might no longer be necessary: Have to test this in MP.
if (vehicle _unit == _unit && {animationState _unit != "deadState" && animationState _unit != "unconscious"} && {(isNull ([_unit] call FUNC(getCarriedBy)))} && (time - _startingTime >= 0.5)) then { if (vehicle _unit == _unit && {animationState _unit != "deadState" && animationState _unit != "unconscious"} && {(isNull ([_unit] call FUNC(getCarriedBy)))} && (time - _startingTime >= 0.5)) then {
[_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation); // Reset animations if unit starts doing wierd things. [_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation); // Reset animations if unit starts doing wierd things.
[format["%1 Had to reset an animation for unconscious"], _unit] call FUNC(debug); [format["%1 Had to reset an animation for unconscious"], _unit] call FUNC(debug);
}; };
}, 0.1, [_unit,_animState, _captiveSwitch, _originalPos, _startingTime, _minWaitingTime] ] call CBA_fnc_addPerFrameHandler; }, 0.1, [_unit,_animState, _captiveSwitch, _originalPos, _startingTime, _minWaitingTime] ] call CBA_fnc_addPerFrameHandler;

View File

@ -12,36 +12,36 @@
#define MUTED_LEVEL 0.2 #define MUTED_LEVEL 0.2
#define NORMAL_LEVEL 1 #define NORMAL_LEVEL 1
#define NO_SOUND 0 #define NO_SOUND 0
private ["_setVolume"]; private ["_setVolume"];
_setVolume = [_this, 0, false, [false]] call BIS_fnc_Param; _setVolume = [_this, 0, false, [false]] call BIS_fnc_Param;
if (_setVolume) then { if (_setVolume) then {
// Vanilla Game // Vanilla Game
2 fadeSound NORMAL_LEVEL; 2 fadeSound NORMAL_LEVEL;
// TFAR // TFAR
player setVariable ["tf_voiceVolume", NORMAL_LEVEL, true]; player setVariable ["tf_voiceVolume", NORMAL_LEVEL, true];
player setVariable ["tf_globalVolume", NORMAL_LEVEL]; player setVariable ["tf_globalVolume", NORMAL_LEVEL];
player setVariable ["tf_unable_to_use_radio", false]; player setVariable ["tf_unable_to_use_radio", false];
// ACRE2 // ACRE2
player setVariable ["acre_sys_core_globalVolume", NORMAL_LEVEL]; player setVariable ["acre_sys_core_globalVolume", NORMAL_LEVEL];
player setVariable ["acre_sys_core_isDisabled", false, true]; player setVariable ["acre_sys_core_isDisabled", false, true];
} else { } else {
// Vanilla Game // Vanilla Game
2 fadeSound MUTED_LEVEL; 2 fadeSound MUTED_LEVEL;
// TFAR // TFAR
player setVariable ["tf_voiceVolume", NO_SOUND, true]; player setVariable ["tf_voiceVolume", NO_SOUND, true];
player setVariable ["tf_globalVolume", MUTED_LEVEL]; player setVariable ["tf_globalVolume", MUTED_LEVEL];
player setVariable ["tf_unable_to_use_radio", true]; player setVariable ["tf_unable_to_use_radio", true];
// ACRE2 // ACRE2
player setVariable ["acre_sys_core_globalVolume", MUTED_LEVEL]; player setVariable ["acre_sys_core_globalVolume", MUTED_LEVEL];
player setVariable ["acre_sys_core_isDisabled", true, true]; player setVariable ["acre_sys_core_isDisabled", true, true];
}; };

View File

@ -14,25 +14,25 @@ private ["_unit"];
_unit = _this select 0; _unit = _this select 0;
if ((vehicle _unit) isKindOf "StaticWeapon") then { if ((vehicle _unit) isKindOf "StaticWeapon") then {
moveOut _unit; moveOut _unit;
unassignVehicle _unit; unassignVehicle _unit;
//unassignVehicle _unit; //unassignVehicle _unit;
//_unit action ["eject", vehicle _unit]; //_unit action ["eject", vehicle _unit];
}; };
if (vehicle _unit == _unit) then { if (vehicle _unit == _unit) then {
if (currentWeapon _unit == secondaryWeapon _unit) then { if (currentWeapon _unit == secondaryWeapon _unit) then {
reload _unit; reload _unit;
}; };
}; };
if (animationState _unit in ["ladderriflestatic","laddercivilstatic"]) then { if (animationState _unit in ["ladderriflestatic","laddercivilstatic"]) then {
_unit action ["ladderOff", (nearestBuilding _unit)]; _unit action ["ladderOff", (nearestBuilding _unit)];
}; };
if (vehicle _unit == _unit) then { if (vehicle _unit == _unit) then {
if (currentWeapon _unit == secondaryWeapon _unit) then { if (currentWeapon _unit == secondaryWeapon _unit) then {
_unit selectWeapon (primaryWeapon _unit); _unit selectWeapon (primaryWeapon _unit);
_unit switchMove ""; _unit switchMove "";
_unit playmoveNow ""; _unit playmoveNow "";
}; };
}; };

View File

@ -18,27 +18,27 @@ _indexes = [];
_elements = []; _elements = [];
{ {
_theElement = toArray (_x select _elementN); _theElement = toArray (_x select _elementN);
_indexes pushback _foreachIndex; _indexes pushback _foreachIndex;
_elements pushback _theElement; _elements pushback _theElement;
}foreach _array; }foreach _array;
for "_i" from 1 to (count _elements) - 1 do { for "_i" from 1 to (count _elements) - 1 do {
_tmp = _elements select _i; _tmp = _elements select _i;
_tempIndex = _indexes select _i; _tempIndex = _indexes select _i;
_j = _i; _j = _i;
while {_j >= 1 && {_tmp < _elements select (_j - 1)}} do { while {_j >= 1 && {_tmp < _elements select (_j - 1)}} do {
_elements set [_j, _elements select (_j - 1)]; _elements set [_j, _elements select (_j - 1)];
_indexes set [_j, _indexes select (_j - 1)]; _indexes set [_j, _indexes select (_j - 1)];
_j = _j - 1; _j = _j - 1;
}; };
_elements set[_j, _tmp]; _elements set[_j, _tmp];
_indexes set [_j, _tempIndex]; _indexes set [_j, _tempIndex];
}; };
_returnArray = []; _returnArray = [];
{ {
_returnArray pushback (_array select _x); _returnArray pushback (_array select _x);
}foreach _indexes; }foreach _indexes;
_returnArray; _returnArray;

View File

@ -26,8 +26,8 @@ _targetIterator = 0;
_searchIterator = 0; _searchIterator = 0;
while {(_searchIterator < _sizeSearchTerm) && (_targetIterator < _sizeString)} do { // Prevents us from going out of bounds while {(_searchIterator < _sizeSearchTerm) && (_targetIterator < _sizeString)} do { // Prevents us from going out of bounds
if ((_arraySearchTerm select _searchIterator) == (_arrayString select _targetIterator)) then { // If we have a match, start looking for the next character in the search term if ((_arraySearchTerm select _searchIterator) == (_arrayString select _targetIterator)) then { // If we have a match, start looking for the next character in the search term
_matchingCharacters = _matchingCharacters + 1; _matchingCharacters = _matchingCharacters + 1;
_searchIterator = _searchIterator + 1 _searchIterator = _searchIterator + 1
}; };
_targetIterator = _targetIterator + 1; // Look at the next character in the string _targetIterator = _targetIterator + 1; // Look at the next character in the string
}; };

View File

@ -18,49 +18,49 @@ _side = [_this, 3, side _unit,[west]] call BIS_fnc_Param;
_previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo_F),[]]; _previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo_F),[]];
if (_switch) then { if (_switch) then {
// go forward // go forward
_previousGroup = group _unit; _previousGroup = group _unit;
_originalSide = side group _unit; _originalSide = side group _unit;
if (count units _previousGroup == 1 && _originalSide == _side) exitwith { if (count units _previousGroup == 1 && _originalSide == _side) exitwith {
[format["Current group has only 1 member and is of same side as switch. Not switching unit %1", _id]] call FUNC(debug); [format["Current group has only 1 member and is of same side as switch. Not switching unit %1", _id]] call FUNC(debug);
}; };
_newGroup = createGroup _side; _newGroup = createGroup _side;
[_unit] joinSilent _newGroup; [_unit] joinSilent _newGroup;
_previousGroupsList pushback [_previousGroup, _originalSide, _id, true]; _previousGroupsList pushback [_previousGroup, _originalSide, _id, true];
_unit setvariable [QGVAR(previousGroupSwitchTo_F), _previousGroupsList, true]; _unit setvariable [QGVAR(previousGroupSwitchTo_F), _previousGroupsList, true];
} else { } else {
// go one back // go one back
{ {
if (_id == (_x select 2)) exitwith { if (_id == (_x select 2)) exitwith {
_x set [ 3, false]; _x set [ 3, false];
_previousGroupsList set [_foreachIndex, _x]; _previousGroupsList set [_foreachIndex, _x];
[format["found group with ID: %1", _id]] call FUNC(debug); [format["found group with ID: %1", _id]] call FUNC(debug);
}; };
}foreach _previousGroupsList; }foreach _previousGroupsList;
reverse _previousGroupsList; reverse _previousGroupsList;
{ {
if (_x select 3) exitwith {}; // stop at first id set to true if (_x select 3) exitwith {}; // stop at first id set to true
if !(_x select 3) then { if !(_x select 3) then {
_currentGroup = group _unit; _currentGroup = group _unit;
if (!isNull (_x select 0)) then { if (!isNull (_x select 0)) then {
[_unit] joinSilent (_x select 0); [_unit] joinSilent (_x select 0);
} else { } else {
_newGroup = createGroup (_x select 1); _newGroup = createGroup (_x select 1);
[_unit] joinSilent _newGroup; [_unit] joinSilent _newGroup;
}; };
if (count units _currentGroup == 0) then { if (count units _currentGroup == 0) then {
deleteGroup _currentGroup; deleteGroup _currentGroup;
}; };
_previousGroupsList set [_foreachIndex, ObjNull]; _previousGroupsList set [_foreachIndex, ObjNull];
}; };
}foreach _previousGroupsList; }foreach _previousGroupsList;
_previousGroupsList = _previousGroupsList - [objNull]; _previousGroupsList = _previousGroupsList - [objNull];
reverse _previousGroupsList; // we have to reverse again, to ensure the list is in the right order. reverse _previousGroupsList; // we have to reverse again, to ensure the list is in the right order.
_unit setvariable [QGVAR(previousGroupSwitchTo_F), _previousGroupsList, true]; _unit setvariable [QGVAR(previousGroupSwitchTo_F), _previousGroupsList, true];
}; };
[[_unit, _switch, _id, _side],"switchToGroupSide"] call FUNC(raiseScriptedEvent_f); [[_unit, _switch, _id, _side],"switchToGroupSide"] call FUNC(raiseScriptedEvent_f);

View File

@ -15,10 +15,10 @@ _array = _this select 0;
_result = []; _result = [];
{ {
_value = _x; _value = _x;
if ({_x isEqualTo _value} count _result == 0) then { if ({_x isEqualTo _value} count _result == 0) then {
_result pushback _x; _result pushback _x;
}; };
}foreach _array; }foreach _array;
_result; _result;

View File

@ -24,7 +24,7 @@ if (!([_caller] call FUNC(isAwake))) exitwith{false;};
moveOut _unit; moveOut _unit;
unassignVehicle _unit; unassignVehicle _unit;
if (!alive _unit) then { if (!alive _unit) then {
_unit action ["Eject", vehicle _unit]; _unit action ["Eject", vehicle _unit];
}; };
[_unit, false, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide_f); [_unit, false, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide_f);
@ -34,26 +34,26 @@ _loaded = _loaded - [_unit];
_vehicle setvariable [QGVAR(loaded_persons_F),_loaded,true]; _vehicle setvariable [QGVAR(loaded_persons_F),_loaded,true];
if (!([_unit] call FUNC(isAwake))) then { if (!([_unit] call FUNC(isAwake))) then {
_handle = [_unit,_vehicle] spawn { _handle = [_unit,_vehicle] spawn {
private ["_unit","_vehicle"]; private ["_unit","_vehicle"];
_unit = _this select 0; _unit = _this select 0;
_vehicle = _this select 1; _vehicle = _this select 1;
waituntil {vehicle _unit != _vehicle}; waituntil {vehicle _unit != _vehicle};
[_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation); [_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation);
[format["Unit should move into death anim: %1", _unit]] call FUNC(debug); [format["Unit should move into death anim: %1", _unit]] call FUNC(debug);
}; };
} else { } else {
if ([_unit] call FUNC(isArrested)) then { if ([_unit] call FUNC(isArrested)) then {
_handle = [_unit,_vehicle] spawn { _handle = [_unit,_vehicle] spawn {
_unit = _this select 0; _unit = _this select 0;
_vehicle = _this select 1; _vehicle = _this select 1;
waituntil {vehicle _unit != _vehicle}; waituntil {vehicle _unit != _vehicle};
[_unit,"UnaErcPoslechVelitele2", 1] call FUNC(doAnimation); [_unit,"UnaErcPoslechVelitele2", 1] call FUNC(doAnimation);
[format["Unit should move into arrested anim: %1", _unit]] call FUNC(debug); [format["Unit should move into arrested anim: %1", _unit]] call FUNC(debug);
}; };
} else { } else {
[format["Unit should move into normal anim: %1", _unit]] call FUNC(debug); [format["Unit should move into normal anim: %1", _unit]] call FUNC(debug);
}; };
}; };
true; true;

View File

@ -17,18 +17,18 @@ _vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param;
_return = false; _return = false;
if (!_vehicleUsage) then { if (!_vehicleUsage) then {
if (_item != "") then { if (_item != "") then {
if (_item in (items _unit)) then { if (_item in (items _unit)) then {
_unit removeItem _item; _unit removeItem _item;
_return = true; _return = true;
} else { } else {
if (_item in (assignedItems _unit)) then { if (_item in (assignedItems _unit)) then {
_unit unassignItem _item; _unit unassignItem _item;
_unit removeItem _item; _unit removeItem _item;
_return = true; _return = true;
}; };
}; };
}; };
}; };
// TODO implement shared item functionality for with vehicles. // TODO implement shared item functionality for with vehicles.

View File

@ -16,15 +16,15 @@ _magazine = _this select 1;
_vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param; _vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param;
if (!_vehicleUsage) then { if (!_vehicleUsage) then {
if (_magazine != "") then { if (_magazine != "") then {
_unit removeMagazine _magazine; _unit removeMagazine _magazine;
_return = true; _return = true;
} else { } else {
_return = false; _return = false;
}; };
[format["fnc_useMagazine: %1 | %2",_this,_return]] call FUNC(debug); [format["fnc_useMagazine: %1 | %2",_this,_return]] call FUNC(debug);
_return _return
} else } else
{ {
// TODO implement shared magazine functionality // TODO implement shared magazine functionality
}; };