mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2501 from acemod/commoncleanup4
common code cleanup part 4
This commit is contained in:
commit
a53d158a89
@ -19,7 +19,6 @@ PREP(binarizeNumber);
|
||||
PREP(blurScreen);
|
||||
PREP(cachedCall);
|
||||
PREP(canGetInPosition);
|
||||
PREP(canInteract);
|
||||
PREP(canInteractWith);
|
||||
PREP(canUseWeapon);
|
||||
PREP(changeProjectileDirection);
|
||||
@ -114,7 +113,6 @@ PREP(interpolateFromArray);
|
||||
PREP(inTransitionAnim);
|
||||
PREP(inWater);
|
||||
PREP(isAlive);
|
||||
PREP(isArrested);
|
||||
PREP(isAutoWind);
|
||||
PREP(isAwake);
|
||||
PREP(isEngineer);
|
||||
@ -160,8 +158,6 @@ PREP(runAfterSettingsInit);
|
||||
PREP(sanitizeString);
|
||||
PREP(sendRequest);
|
||||
PREP(serverLog);
|
||||
PREP(setArrestState);
|
||||
PREP(setCanInteract);
|
||||
PREP(setCaptivityStatus);
|
||||
PREP(setDefinedVariable);
|
||||
PREP(setDisableUserInputStatus);
|
||||
@ -235,10 +231,6 @@ PREP(getTurretsOther);
|
||||
PREP(exportConfig);
|
||||
PREP(getChildren);
|
||||
PREP(getDisplayConfigName);
|
||||
PREP(log);
|
||||
PREP(logControls);
|
||||
PREP(logDisplays);
|
||||
PREP(logModEntries);
|
||||
PREP(monitor);
|
||||
PREP(showUser);
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Check if unit can interact with enviroment. Unit has to be awake and not be in arrested state.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit that try to Interact <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can interact with enviroment <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*
|
||||
* Deprecated
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
(_unit getvariable [QGVAR(canInteract),0]) < 1 && [_unit] call FUNC(isAwake) && !([_unit] call FUNC(isArrested))
|
@ -2,7 +2,7 @@
|
||||
* Author: commy2
|
||||
* Removes the brackets around a code and returns the code as a string. It does nothing if the code is already a string.
|
||||
*
|
||||
* Argument:
|
||||
* Arguments:
|
||||
* 0: Code <CODE, STRING>
|
||||
*
|
||||
* Return value:
|
||||
|
@ -2,8 +2,8 @@
|
||||
* Author: esteldunedain
|
||||
* Returns a orthonormal system of reference aligned with the supplied vector
|
||||
*
|
||||
* Argument:
|
||||
* Vector to align the coordinate system with (Array)
|
||||
* Arguments:
|
||||
* Vector to align the coordinate system with <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: Vector Normalized <ARRAY>
|
||||
|
@ -1,25 +1,25 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi
|
||||
*
|
||||
* Returns the Hadamard Product of two vectors.
|
||||
* (x hadamard y) = [x1*y1, x2*y2, x3*y3]
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Vector 1
|
||||
* 1: Vector 2
|
||||
* 0: Vector 1 <ARRAY>
|
||||
* 1: Vector 2 <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* Hadamard Product
|
||||
* Hadamard Product <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_vector1,_vector2);
|
||||
|
||||
private ["_newVector", "_i"];
|
||||
params ["_vector1", "_vector2"];
|
||||
|
||||
private "_newVector";
|
||||
_newVector = [];
|
||||
|
||||
for "_i" from 0 to (((count _vector1) min (count _vector2)) - 1) do {
|
||||
for "_i" from 0 to ((count _vector1 min count _vector2) - 1) do {
|
||||
_newVector pushBack ((_vector1 select _i) * (_vector2 select _i));
|
||||
};
|
||||
|
||||
|
@ -1,42 +1,49 @@
|
||||
/**
|
||||
* fnc_headbugfix.sqf
|
||||
* @Descr: Fixes animation issues that may get you stuck
|
||||
* @Author: rocko
|
||||
/*
|
||||
* Author: rocko
|
||||
* Fixes animation issues that may get you stuck
|
||||
*
|
||||
* @Arguments:
|
||||
* @Return: nil
|
||||
* @PublicAPI: true
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*
|
||||
* Note: Has to be spawned not called
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
private ["_pos","_dir","_anim"];
|
||||
|
||||
_anim = animationState ACE_player;
|
||||
private ["_unit", "_anim", "_pos", "_dir", "_dummy"];
|
||||
|
||||
_unit = ACE_player;
|
||||
_anim = animationState _unit;
|
||||
|
||||
["HeadbugFixUsed", [profileName, _anim]] call FUNC(serverEvent);
|
||||
["HeadbugFixUsed", [profileName, _anim]] call FUNC(localEvent);
|
||||
|
||||
if (ACE_player != vehicle ACE_player || { !([ACE_player, objNull, ["isNotSitting"]] call FUNC(canInteractWith)) } ) exitWith {false};
|
||||
if (_unit != vehicle _unit || {!([_unit, objNull, ["isNotSitting"]] call FUNC(canInteractWith))}) exitWith {false};
|
||||
|
||||
_pos = getposATL ACE_player;
|
||||
_dir = getDir ACE_player;
|
||||
_pos = getPosATL _unit;
|
||||
_dir = getDir _unit;
|
||||
|
||||
titleCut ["", "BLACK"];
|
||||
[ACE_Player, "headBugFix"] call FUNC(hideUnit);
|
||||
[_unit, "headBugFix"] call FUNC(hideUnit);
|
||||
|
||||
// create invisible headbug fix vehicle
|
||||
_ACE_HeadbugFix = "ACE_Headbug_Fix" createVehicleLocal _pos;
|
||||
_ACE_HeadbugFix setDir _dir;
|
||||
ACE_player moveInAny _ACE_HeadbugFix;
|
||||
_dummy = createVehicle ["ACE_Headbug_Fix", _pos, [], 0, "NONE"];
|
||||
_dummy setDir _dir;
|
||||
_unit moveInAny _dummy;
|
||||
sleep 0.1;
|
||||
|
||||
unassignVehicle ACE_player;
|
||||
ACE_player action ["Eject", vehicle ACE_player];
|
||||
ACE_player setDir _dir;
|
||||
ACE_player setposATL _pos;
|
||||
unassignVehicle _unit;
|
||||
_unit action ["Eject", vehicle _unit];
|
||||
_unit setDir _dir;
|
||||
_unit setPosATL _pos;
|
||||
sleep 1.0;
|
||||
|
||||
deleteVehicle _ACE_HeadbugFix;
|
||||
deleteVehicle _dummy;
|
||||
|
||||
[ACE_Player, "headBugFix"] call FUNC(unhideUnit);
|
||||
[_unit, "headBugFix"] call FUNC(unhideUnit);
|
||||
titleCut ["", "PLAIN"];
|
||||
true
|
||||
|
@ -14,10 +14,9 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_reason);
|
||||
params ["_unit", "_reason"];
|
||||
|
||||
if (isNull _unit) exitWith {};
|
||||
|
||||
@ -29,6 +28,6 @@ if !(_reason in _setHiddenReasons) then {
|
||||
_unit setVariable [QGVAR(setHiddenReasons), _setHiddenReasons, true];
|
||||
};
|
||||
|
||||
//if !(isObjectHidden _unit) then { (Uncomment when isObjectHidden hits stable branch)
|
||||
["hideObjectGlobal",[_unit,true]] call FUNC(serverEvent);
|
||||
//};
|
||||
if !(isObjectHidden _unit) then {
|
||||
["hideObjectGlobal", [_unit, true]] call FUNC(serverEvent);
|
||||
};
|
||||
|
@ -1,4 +1,15 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
* Check if given unit is in a transitional animation
|
||||
*
|
||||
* Arguments:
|
||||
* 0: A soldier <Object>
|
||||
*
|
||||
* Return Value:
|
||||
* <Bool>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "looped") == 0
|
||||
|
@ -1,25 +1,29 @@
|
||||
/**
|
||||
* fn_inWater_f.sqf
|
||||
* @Descr: Check if unit is underwater
|
||||
* @Author: Glowbal
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Check if unit is underwater
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: BOOL True if unit is in the water
|
||||
* @PublicAPI: true
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* if unit is in the water (BOOLEAN)
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_return","_aslPos"];
|
||||
params ["_unit"];
|
||||
|
||||
PARAMS_1(_unit);
|
||||
private "_return";
|
||||
_return = false;
|
||||
|
||||
if ((surfaceIsWater getPos _unit)) then {
|
||||
_aslPos = _unit modelToWorldVisual (_unit selectionPosition "head");
|
||||
if ((_aslPos select 2) <= 0) then {
|
||||
if (surfaceIsWater getPosASL _unit) then {
|
||||
private "_pos";
|
||||
_pos = _unit modelToWorldVisual (_unit selectionPosition "head");
|
||||
|
||||
if (_pos select 2 < 0) then {
|
||||
_return = true;
|
||||
};
|
||||
};
|
||||
|
||||
_return;
|
||||
_return
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Check if the object still exists and is alive. This function exists because 'alive objNull' actually returns true.
|
||||
*
|
||||
* Argument:
|
||||
@ -8,6 +7,10 @@
|
||||
*
|
||||
* Return value:
|
||||
* The object exists and is alive (Bool).
|
||||
*
|
||||
* Public: Yes
|
||||
*
|
||||
* Deprecated
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
/**
|
||||
* fn_isArrested.sqf
|
||||
* @Descr: Check if unit is in arrested state
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: BOOL Returns true if unit or object is in arrest state
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
((_this select 0) getvariable [QGVAR(StateArrested),false])
|
@ -1,45 +1,55 @@
|
||||
/**
|
||||
* fn_loadPerson_f.sqf
|
||||
* @Descr: Loads a specified unit into any nearby vehicle
|
||||
* @Author: Glowbal
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Loads a specified unit into any nearby vehicle
|
||||
*
|
||||
* @Arguments: [caller OBJECT, unitToBeLoaded OBJECT]
|
||||
* @Return: OBJECT Returns the vehicle that the unitToBeloaded has been loaded in. Returns ObjNull if function failed
|
||||
* @PublicAPI: true
|
||||
* Arguments:
|
||||
* 0: Unit that will load <OBJECT>
|
||||
* 1: Unit to be loaded <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* the vehicle that the unitToBeloaded has been loaded in. Returns ObjNull if function failed <OBJECT>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson))
|
||||
|
||||
private ["_caller", "_unit","_vehicle", "_loadcar", "_loadhelicopter", "_loadtank","_loadboat"];
|
||||
_caller = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_unit = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_vehicle = ObjNull;
|
||||
params ["_caller", "_unit"];
|
||||
|
||||
private ["_vehicle", "_loadcar", "_loadair", "_loadtank", "_loadboat"];
|
||||
|
||||
_vehicle = objNull;
|
||||
|
||||
if (!([_caller] call FUNC(canInteract)) || {_caller == _unit}) exitwith {_vehicle};
|
||||
|
||||
_loadcar = nearestObject [_unit, "car"];
|
||||
_loadcar = nearestObject [_unit, "Car"];
|
||||
|
||||
if (_unit distance _loadcar <= 10) then {
|
||||
_vehicle = _loadcar;
|
||||
} else {
|
||||
_loadhelicopter = nearestObject [_unit, "air"];
|
||||
if (_unit distance _loadhelicopter <= 10) then {
|
||||
_vehicle = _loadhelicopter;
|
||||
_loadair = nearestObject [_unit, "Air"];
|
||||
|
||||
if (_unit distance _loadair <= 10) then {
|
||||
_vehicle = _loadair;
|
||||
} else {
|
||||
_loadtank = nearestObject [_unit, "tank"];
|
||||
_loadtank = nearestObject [_unit, "Tank"];
|
||||
|
||||
if (_unit distance _loadtank <= 10) then {
|
||||
_vehicle = _loadtank;
|
||||
} else {
|
||||
_loadboat = nearestObject [_unit, "ship"];
|
||||
_loadboat = nearestObject [_unit, "Ship_F"];
|
||||
|
||||
if (_unit distance _loadboat <= 10) then {
|
||||
_vehicle = _loadboat;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (!isNull _vehicle) then {
|
||||
[_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide);
|
||||
[[_unit, _vehicle,_caller], QUOTE(FUNC(loadPersonLocal)), _unit, false] call EFUNC(common,execRemoteFnc);
|
||||
[[_unit, _vehicle, _caller], QFUNC(loadPersonLocal), _unit, false] call FUNC(execRemoteFnc);
|
||||
};
|
||||
_vehicle
|
||||
|
||||
_vehicle
|
||||
|
@ -1,25 +1,28 @@
|
||||
/**
|
||||
* fn_loadPersonLocal_f.sqf
|
||||
* @Descr: Load a person, local
|
||||
* @Author: Glowbal
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Load a person, local
|
||||
*
|
||||
* @Arguments: [unit OBJECT, vehicle OBJECT, caller OBJECT]
|
||||
* @Return: void
|
||||
* @PublicAPI: false
|
||||
* Arguments:
|
||||
* 0: unit to be loaded <OBJECT>
|
||||
* 1: vehicle that will beloaded <OBJECT>
|
||||
* 2: caller that will load <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_vehicle","_caller","_handle","_loaded","_slotsOpen"];
|
||||
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_vehicle = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_caller = [_this, 2, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_slotsOpen = false;
|
||||
params ["_unit", "_vehicle", "_caller"];
|
||||
|
||||
if (!alive _unit) then {
|
||||
_unit = [_unit,_caller] call FUNC(makeCopyOfBody);
|
||||
_unit = [_unit, _caller] call FUNC(makeCopyOfBody);
|
||||
};
|
||||
|
||||
private "_slotsOpen";
|
||||
|
||||
_slotsOpen = false;
|
||||
|
||||
if (_vehicle emptyPositions "cargo" > 0) then {
|
||||
_unit moveInCargo _vehicle;
|
||||
@ -32,26 +35,30 @@ if (_vehicle emptyPositions "cargo" > 0) then {
|
||||
};
|
||||
|
||||
if (_slotsOpen) then {
|
||||
_loaded = _vehicle getvariable [QGVAR(loaded_persons),[]];
|
||||
_loaded pushback _unit;
|
||||
_vehicle setvariable [QGVAR(loaded_persons),_loaded,true];
|
||||
if (!([_unit] call FUNC(isAwake))) then {
|
||||
_handle = [_unit,_vehicle] spawn {
|
||||
private ["_unit","_vehicle"];
|
||||
_unit = _this select 0;
|
||||
_vehicle = _this select 1;
|
||||
waituntil {vehicle _unit == _vehicle};
|
||||
sleep 0.5;
|
||||
private "_loaded";
|
||||
_loaded = _vehicle getVariable [QGVAR(loaded_persons),[]];
|
||||
_loaded pushBack _unit;
|
||||
|
||||
//Save the "awake" animation before applying the death animation
|
||||
if (vehicle _unit == _vehicle) then {
|
||||
_unit setVariable [QEGVAR(medical,vehicleAwakeAnim), [_vehicle, (animationState _unit)]];
|
||||
_vehicle setVariable [QGVAR(loaded_persons), _loaded, true];
|
||||
|
||||
// @todo never used. Remove?
|
||||
/*if !([_unit] call FUNC(isAwake)) then {
|
||||
[{
|
||||
(_this select 0) params ["_unit", "_vehicle"];
|
||||
|
||||
// wait until the unit is in the vehicle
|
||||
if (vehicle _unit != _vehicle) exitWith {
|
||||
// kill this pfh if either one is deleted
|
||||
if (isNull _unit || isNull _vehicle) then {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
};
|
||||
[_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation);
|
||||
};
|
||||
} else {
|
||||
if ([_unit] call FUNC(isArrested)) then {
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
_unit setVariable [QEGVAR(medical,vehicleAwakeAnim), [_vehicle, animationState _unit]];
|
||||
|
||||
[_unit, [_unit] call FUNC(getDeathAnim), 1, true] call FUNC(doAnimation);
|
||||
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
}, 0.5, [_unit, _vehicle]] call CBA_fnc_addPerFrameHandler;
|
||||
};*/
|
||||
};
|
||||
|
@ -13,28 +13,26 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_name", "_isClientSetable", "_isForced", "_profileValue"];
|
||||
|
||||
// Iterate through settings
|
||||
{
|
||||
_name = _x select 0;
|
||||
_isClientSetable = _x select 2;
|
||||
_isForced = _x select 6;
|
||||
_x params ["_name", "", "_isClientSetable", "", "", "", "_isForced"];
|
||||
|
||||
// If setting is user setable
|
||||
if (_isClientSetable) then {
|
||||
// If setting is not forced
|
||||
if !(_isForced) then {
|
||||
_profileValue = profileNamespace getvariable _name;
|
||||
private "_profileValue";
|
||||
_profileValue = profileNamespace getVariable _name;
|
||||
|
||||
// If the setting is stored on the profile
|
||||
if !(isNil "_profileValue") then {
|
||||
// If the profile variable has the correct type
|
||||
if (typeName _profileValue == typeName (missionNamespace getvariable _name)) then {
|
||||
if (typeName _profileValue == typeName (missionNamespace getVariable _name)) then {
|
||||
// Load the setting from the profile
|
||||
missionNamespace setvariable [_name, _profileValue];
|
||||
missionNamespace setVariable [_name, _profileValue];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
} forEach GVAR(settings);
|
||||
false
|
||||
} count GVAR(settings);
|
||||
|
@ -13,24 +13,26 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_parseConfigForSettings"];
|
||||
|
||||
GVAR(settings) = [];
|
||||
|
||||
_parseConfigForSettings = {
|
||||
private ["_config", "_countOptions", "_optionEntry", "_index"];
|
||||
private "_fnc_parseConfigForSettings";
|
||||
_fnc_parseConfigForSettings = {
|
||||
private ["_config", "_countOptions", "_optionEntry"];
|
||||
|
||||
_config = _this select 0;
|
||||
_countOptions = count _config;
|
||||
|
||||
for "_index" from 0 to (_countOptions - 1) do {
|
||||
_optionEntry = _config select _index;
|
||||
[_optionEntry] call FUNC(setSettingFromConfig);
|
||||
};
|
||||
|
||||
// Check if all settings should be forced
|
||||
if (GVAR(forceAllSettings)) then {
|
||||
{
|
||||
_x set [6, true];
|
||||
} forEach GVAR(settings);
|
||||
false
|
||||
} count GVAR(settings);
|
||||
};
|
||||
};
|
||||
|
||||
@ -41,17 +43,18 @@ _parseConfigForSettings = {
|
||||
// This ensures that all settings are of their correct type, in case an outdated or corrupt server config is used , as well as have their correct localized display name and description
|
||||
|
||||
// Regular config
|
||||
[configFile >> "ACE_Settings"] call _parseConfigForSettings;
|
||||
[configFile >> "ACE_Settings"] call _fnc_parseConfigForSettings;
|
||||
|
||||
// Server config
|
||||
[configFile >> "ACE_ServerSettings"] call _parseConfigForSettings;
|
||||
[configFile >> "ACE_ServerSettings"] call _fnc_parseConfigForSettings;
|
||||
|
||||
// mission side settings
|
||||
[missionConfigFile >> "ACE_Settings"] call _parseConfigForSettings;
|
||||
[missionConfigFile >> "ACE_Settings"] call _fnc_parseConfigForSettings;
|
||||
|
||||
// Publish all settings data
|
||||
publicVariable QGVAR(settings);
|
||||
// Publish all setting values
|
||||
{
|
||||
publicVariable (_x select 0);
|
||||
} forEach GVAR(settings);
|
||||
false
|
||||
} count GVAR(settings);
|
||||
|
@ -3,31 +3,37 @@
|
||||
*
|
||||
* Execute a local event on this client only.
|
||||
*
|
||||
* Argument:
|
||||
* Arguments:
|
||||
* 0: Event name (string)
|
||||
* 1: Event args (any)
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_eventName,_eventArgs);
|
||||
params ["_eventName", "_eventArgs"];
|
||||
|
||||
private["_eventIndex", "_eventNames", "_events"];
|
||||
GVAR(events) params ["_eventNames", "_eventArray"];
|
||||
|
||||
_eventNames = GVAR(events) select 0;
|
||||
private "_eventIndex";
|
||||
_eventIndex = _eventNames find _eventName;
|
||||
if(_eventIndex != -1) then {
|
||||
_events = (GVAR(events) select 1) select _eventIndex;
|
||||
|
||||
if (_eventIndex != -1) then {
|
||||
private "_events";
|
||||
_events = _eventArray select _eventIndex;
|
||||
|
||||
#ifdef DEBUG_EVENTS
|
||||
ACE_LOGINFO_1("* Local Event: %1",_eventName);
|
||||
ACE_LOGINFO_1(" args=%1",_eventArgs);
|
||||
#endif
|
||||
|
||||
{
|
||||
if(!isNil "_x") then {
|
||||
_eventArgs call CALLSTACK_NAMED(_x, FORMAT_2("Local Event %1 ID: %2",_eventName,_forEachIndex));
|
||||
if (!isNil "_x") then {
|
||||
_eventArgs call CALLSTACK_NAMED(_x,FORMAT_2("Local Event %1 ID: %2",_eventName,_forEachIndex));
|
||||
|
||||
#ifdef DEBUG_EVENTS_CALLSTACK
|
||||
ACE_LOGINFO_1(" ID: %1",_forEachIndex);
|
||||
#endif
|
||||
|
@ -1,25 +0,0 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
if ((_this select 0) in (missionNamespace getVariable ["ACE_Debug", []])) then {
|
||||
_this resize 4;
|
||||
|
||||
PARAMS_4(_type,_argument,_function,_showInGame);
|
||||
|
||||
if (isNil "_function") then {
|
||||
_function = {_this};
|
||||
};
|
||||
|
||||
if (isNil "_showInGame") then {
|
||||
_showInGame = true;
|
||||
};
|
||||
|
||||
private "_result";
|
||||
_result = _argument call _function;
|
||||
|
||||
if (_showInGame) then {
|
||||
systemChat format ["%1", _result];
|
||||
};
|
||||
|
||||
diag_log text format ["[ACE] Debug: %1 : %2 - %3 : %4", _type, diag_frameno, _fnc_scriptNameParent, _result];
|
||||
};
|
@ -1,4 +0,0 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
[allControls findDisplay _this, {ctrlIDC _this}] call FUNC(map)
|
@ -1,4 +0,0 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
[allDisplays, {ctrlIDD _this}] call FUNC(map)
|
@ -1,18 +0,0 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_configs", "_entries", "_name"];
|
||||
|
||||
_configs = "true" configClasses (configFile >> _this);
|
||||
|
||||
_entries = [];
|
||||
|
||||
{
|
||||
{
|
||||
_name = toLower configName _x;
|
||||
if !(_name in _entries) then {
|
||||
diag_log text _name;
|
||||
_entries pushBack _name;
|
||||
};
|
||||
} forEach configProperties [_x, "toLower configName _x find 'ace' == 0", false];
|
||||
} forEach _configs;
|
@ -1,44 +0,0 @@
|
||||
/**
|
||||
* fn_setArrestState.sqf
|
||||
* @Descr: Set a unit in arrest state
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unitToBeArrested OBJECT, setArrested BOOL]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_setArrest"];
|
||||
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param;
|
||||
_setArrest = [_this, 1, false, [false]] call BIS_fnc_Param;
|
||||
|
||||
if (_setArrest) then {
|
||||
[_unit, QGVAR(StateArrested), true] call FUNC(setDefinedVariable);
|
||||
|
||||
if ([_unit] call FUNC(isAwake)) then {
|
||||
if (vehicle _unit == _unit) then {
|
||||
[_unit,"UnaErcPoslechVelitele2",1] call FUNC(doAnimation);
|
||||
};
|
||||
};
|
||||
if (IsPlayer _unit) then {
|
||||
[["arrested", true],QUOTE(FUNC(setDisableUserInputStatus)),_unit,false] call EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
_unit disableAI "Move";
|
||||
_unit disableAI "ANIM";
|
||||
} else {
|
||||
[_unit, QGVAR(StateArrested), false] call FUNC(setDefinedVariable);
|
||||
|
||||
if ([_unit] call FUNC(isAwake)) then {
|
||||
if (vehicle _unit == _unit) then {
|
||||
[_unit,"",1] call FUNC(doAnimation);
|
||||
};
|
||||
_unit enableAI "Move";
|
||||
_unit enableAI "ANIM";
|
||||
};
|
||||
if (IsPlayer _unit) then {
|
||||
[["arrested", false],QUOTE(FUNC(setDisableUserInputStatus)),_unit,false] call EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
};
|
||||
|
@ -1,30 +0,0 @@
|
||||
/**
|
||||
* fn_setCanInteract.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_to","_return"];
|
||||
|
||||
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
|
||||
_to = _this select 1;
|
||||
_return = false;
|
||||
|
||||
if (((typeName _to) == "SCALAR")) then {
|
||||
if (_to <-1) then {
|
||||
_to = -1;
|
||||
} else {
|
||||
if (_to > 1) then {
|
||||
_to = 1;
|
||||
};
|
||||
};
|
||||
_unit setvariable [QGVAR(canInteract), ([_unit] call FUNC(getCanInteract)) + _to,false];
|
||||
_return = true;
|
||||
};
|
||||
_return
|
@ -10,23 +10,26 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson))
|
||||
|
||||
private ["_vehicle","_emptyPos"];
|
||||
PARAMS_1(_unit);
|
||||
params ["_unit"];
|
||||
|
||||
private "_vehicle";
|
||||
_vehicle = vehicle _unit;
|
||||
|
||||
if (_vehicle == _unit) exitwith {false;};
|
||||
if !(speed _vehicle <1 && (((getpos _vehicle) select 2) < 2)) exitwith {false;};
|
||||
if (_vehicle == _unit) exitWith {false};
|
||||
|
||||
_emptyPos = ((getPos _vehicle) findEmptyPosition [0, 10, typeof _unit]);
|
||||
if (count _emptyPos == 0) exitwith {false};
|
||||
if (speed _vehicle > 1 || getPos _vehicle select 2 > 2) exitWith {false};
|
||||
|
||||
private "_emptyPos";
|
||||
_emptyPos = (getPos _vehicle) findEmptyPosition [0, 10, typeof _unit]; // @todo to small?
|
||||
|
||||
if (count _emptyPos == 0) exitWith {false};
|
||||
|
||||
if (!isNull _vehicle) then {
|
||||
[[_unit], QUOTE(FUNC(unloadPersonLocal)), _unit, false] call EFUNC(common,execRemoteFnc);
|
||||
[[_unit], QUOTE(FUNC(unloadPersonLocal)), _unit, false] call FUNC(execRemoteFnc);
|
||||
};
|
||||
|
||||
true;
|
||||
true
|
||||
|
@ -10,34 +10,48 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson))
|
||||
|
||||
private ["_loaded", "_emptyPos","_validVehiclestate"];
|
||||
PARAMS_2(_unit,_vehicle);
|
||||
params ["_unit", "_vehicle"];
|
||||
|
||||
private ["_validVehiclestate", "_emptyPos", "_loaded"];
|
||||
|
||||
_validVehiclestate = true;
|
||||
|
||||
if (_vehicle isKindOf "Ship" ) then {
|
||||
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
|
||||
TRACE_1("SHIP Ground Check", getPosATL _vehicle );
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeof _unit]); // TODO: if spot is underwater pick another spot.
|
||||
if (_vehicle isKindOf "Ship") then {
|
||||
if (speed _vehicle > 1 || {getPos _vehicle select 2 > 2}) then {
|
||||
_validVehiclestate = false;
|
||||
};
|
||||
|
||||
TRACE_1("SHIP Ground Check",getPos _vehicle);
|
||||
|
||||
_emptyPos = (ASLToAGL getPosASL _vehicle) findEmptyPosition [0, 13, typeof _unit]; // TODO: if spot is underwater pick another spot.
|
||||
} else {
|
||||
if (_vehicle isKindOf "Air" ) then {
|
||||
if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false};
|
||||
TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle);
|
||||
_emptyPos = (getPosASL _vehicle) call EFUNC(common,ASLtoPosition);
|
||||
_emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ];
|
||||
if (_vehicle isKindOf "Air") then {
|
||||
if (speed _vehicle > 1 || {isTouchingGround _vehicle}) then {
|
||||
_validVehiclestate = false;
|
||||
};
|
||||
|
||||
TRACE_1("Vehicle Ground Check",isTouchingGround _vehicle);
|
||||
|
||||
_emptyPos = ASLToAGL getPosASL _vehicle;
|
||||
_emptyPos = _emptyPos vectorAdd [random 10 - 5, random 10 - 5, 0];
|
||||
} else {
|
||||
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
|
||||
if (speed _vehicle > 1 || {getPos _vehicle select 2 > 2}) then {
|
||||
_validVehiclestate = false;
|
||||
};
|
||||
|
||||
TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle);
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeof _unit]);
|
||||
|
||||
_emptyPos = (ASLToAGL getPosASL _vehicle) findEmptyPosition [0, 13, typeof _unit];
|
||||
};
|
||||
};
|
||||
|
||||
TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle);
|
||||
if (!_validVehiclestate) exitwith {
|
||||
|
||||
if !(_validVehiclestate) exitwith {
|
||||
ACE_LOGWARNING_4("Unable to unload patient because invalid (%1) vehicle state. Either moving or Not close enough on the ground. position: %2 isTouchingGround: %3 Speed: %4",_vehicle,getPos _vehicle,isTouchingGround _vehicle,speed _vehicle);
|
||||
false
|
||||
};
|
||||
@ -47,36 +61,45 @@ if (count _emptyPos == 0) exitwith {
|
||||
false
|
||||
}; //consider displaying text saying there are no safe places to exit the vehicle
|
||||
|
||||
|
||||
unassignVehicle _unit;
|
||||
[_unit] orderGetIn false;
|
||||
|
||||
TRACE_1("Ejecting", alive _unit);
|
||||
|
||||
_unit action ["Eject", vehicle _unit];
|
||||
[ {
|
||||
private "_anim";
|
||||
PARAMS_2(_unit,_emptyPos);
|
||||
_unit setPosASL (_emptyPos call EFUNC(common,PositiontoASL));
|
||||
if (!([_unit] call FUNC(isAwake))) then {
|
||||
|
||||
[{
|
||||
params ["_unit", "_emptyPos"];
|
||||
|
||||
_unit setPosASL AGLToASL _emptyPos;
|
||||
|
||||
// @todo never used. Remove?
|
||||
/*if !([_unit] call FUNC(isAwake)) then {
|
||||
|
||||
TRACE_1("Check if isAwake", [_unit] call FUNC(isAwake));
|
||||
|
||||
if (driver _unit == _unit) then {
|
||||
_anim = [_unit] call EFUNC(common,getDeathAnim);
|
||||
[_unit, _anim, 1, true] call EFUNC(common,doAnimation);
|
||||
private "_anim";
|
||||
_anim = [_unit] call FUNC(getDeathAnim);
|
||||
|
||||
[_unit, _anim, 1, true] call FUNC(doAnimation);
|
||||
|
||||
[{
|
||||
_unit = _this select 0;
|
||||
_anim = _this select 1;
|
||||
if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then {
|
||||
[_unit, _anim, 2, true] call EFUNC(common,doAnimation);
|
||||
[_unit, _anim, 2, true] call FUNC(doAnimation);
|
||||
};
|
||||
}, [_unit, _anim], 0.5, 0] call EFUNC(common,waitAndExecute);
|
||||
}, [_unit, _anim], 0.5, 0] call FUNC(waitAndExecute);
|
||||
};
|
||||
};
|
||||
},[_unit,_emptyPos], 0.5, 0] call EFUNC(common,waitAndExecute);
|
||||
|
||||
};*/
|
||||
}, [_unit, _emptyPos], 0.5, 0] call FUNC(waitAndExecute);
|
||||
|
||||
[_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide);
|
||||
|
||||
_loaded = _vehicle getvariable [QGVAR(loaded_persons),[]];
|
||||
_loaded = _loaded - [_unit];
|
||||
_vehicle setvariable [QGVAR(loaded_persons),_loaded,true];
|
||||
_loaded deleteAt (_loaded find _unit);
|
||||
|
||||
_vehicle setvariable [QGVAR(loaded_persons), _loaded, true];
|
||||
|
||||
true
|
||||
|
Loading…
Reference in New Issue
Block a user