Common Privates Redo

This commit is contained in:
PabstMirror 2015-05-14 17:12:40 -05:00
parent d9b6636221
commit c27d84e382
56 changed files with 117 additions and 82 deletions

View File

@ -1,6 +1,8 @@
// ACE - Common
#include "script_component.hpp"
//IGNORE_PRIVATE_WARNING("_handleNetEvent", "_handleRequestAllSyncedEvents", "_handleRequestSyncedEvent", "_handleSyncedEvent");
// Load settings from profile
if (hasInterface) then {
call FUNC(loadSettingsFromProfile);
@ -9,10 +11,9 @@ if (hasInterface) then {
// Listens for global "SettingChanged" events, to update the force status locally
["SettingChanged", {
PARAMS_2(_name,_value);
if !(count _this > 2) exitWith {};
private ["_force", "_settingData"];
_force = _this select 2;
if (_force) then {
_settingData = [_name] call FUNC(getSettingData);
@ -54,6 +55,7 @@ QGVAR(remoteFnc) addPublicVariableEventHandler {
[missionNamespace] call FUNC(executePersistent);
private ["_currentVersion", "_previousVersion"];
// check previous version number from profile
_currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version");
_previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""];
@ -131,6 +133,7 @@ GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
// PFH to raise varios events
[{
private ["_newCameraView", "_newInventoryDisplayIsOpen", "_newPlayerInventory", "_newPlayerTurret", "_newPlayerVehicle", "_newPlayerVisionMode", "_newPlayerWeapon", "_newZeusDisplayIsOpen"];
// "playerInventoryChanged" event
_newPlayerInventory = [ACE_player] call FUNC(getAllGear);
if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then {
@ -212,6 +215,7 @@ GVAR(OldIsCamera) = false;
[{
// "activeCameraChanged" event
private ["_isCamera"];
_isCamera = {!isNull _x} count ALL_CAMERAS > 0;
if !(_isCamera isEqualTo GVAR(OldIsCamera)) then {
// Raise ACE event locally

View File

@ -1,6 +1,8 @@
// by commy2
#include "script_component.hpp"
//IGNORE_PRIVATE_WARNING("_handleNetEvent", "_handleRequestAllSyncedEvents", "_handleRequestSyncedEvent", "_handleSyncedEvent");
ADDON = false;
// ACE Common Function
@ -170,7 +172,6 @@ PREP(sortAlphabeticallyBy);
PREP(stringCompare);
PREP(stringToColoredText);
PREP(stringRemoveWhiteSpace);
PREP(subString);
PREP(switchToGroupSide);
PREP(throttledPublicVariable);
PREP(toBin);
@ -302,6 +303,7 @@ if (hasInterface) then {
// PFH to update the ACE_player variable
[{
if !(ACE_player isEqualTo (call FUNC(player))) then {
private ["_oldPlayer"];
_oldPlayer = ACE_player;
ACE_player = call FUNC(player);

View File

@ -2,7 +2,9 @@
// internal handler for net events
#include "script_component.hpp"
private ["_eventName", "_eventArgs", "_eventNames", "_eventIndex", "_eventTargets", "_sentEvents", "_owner", "_serverFlagged"];
private ["_eventName", "_eventArgs", "_eventNames", "_eventIndex", "_eventTargets", "_sentEvents", "_owner", "_serverFlagged", "_events"];
//IGNORE_PRIVATE_WARNING("_handleNetEvent");
PARAMS_2(_eventType,_event);

View File

@ -17,6 +17,8 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
+//IGNORE_PRIVATE_WARNING("_handleSyncedEvent");
//SEH_s
if(isServer) then {
// Find the event name, and shovel out the events to the client
@ -33,6 +35,7 @@ if(isServer) then {
["SEH_s", _client, [_eventName, _eventLog] ] call FUNC(targetEvent);
} else {
PARAMS_2(_eventName,_eventLog);
private ["_eventArgs"];
// This is the client handling the response from the server
// Start running the events
{

View File

@ -15,6 +15,7 @@
#include "script_component.hpp"
private ["_unit", "_action", "_condition", "_statement", "_name", "_actionsVar", "_actionID", "_actions", "_id", "_actionIDs"];
//IGNORE_PRIVATE_WARNING("_count", "_index", "_return", "_target");
_unit = _this select 0;
_action = _this select 1;

View File

@ -19,6 +19,7 @@
#include "script_component.hpp"
private ["_name", "_actionsVar", "_id", "_actionIDs", "_actions", "_nameVar", "_addAction", "_actionID"];
//IGNORE_PRIVATE_WARNING("_target");
PARAMS_8(_unit,_displayName,_action,_condition,_statement,_condition2,_statement2,_priority);

View File

@ -14,6 +14,8 @@
#include "script_component.hpp"
private ["_conditionName", "_conditionFunc"];
//IGNORE_PRIVATE_WARNING("_player", "_target");
_conditionName = toLower (_this select 0);
_conditionFunc = _this select 1;

View File

@ -4,14 +4,14 @@
* If has only local effects.
*
* Arguments:
* 0: _name (String)
* 1: _typeName (String)
* 2: _isClientSetable (Bool)
* 3: _localizedName (String)
* 4: _localizedDescription (String)
* 5: _possibleValues (Array)
* 6: _isForced (Bool)
* 7: _defaultValue (Any)
* 0: name <STRING>
* 1: typeName <STRING>
* 2: isClientSetable <BOOL>
* 3: localizedName <STRING>
* 4: localizedDescription <STRING>
* 5: possibleValues <ARRAY>
* 6: isForced <BOOL>
* 7: defaultValue (Any)
*
* Return Value:
* None
@ -22,6 +22,8 @@
PARAMS_8(_name,_typeName,_isClientSetable,_localizedName,_localizedDescription,_possibleValues,_isForced,_value);
private ["_settingData"];
_settingData = [_name] call FUNC(getSettingData);
// Exit if the setting already exists

View File

@ -13,6 +13,8 @@
*/
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
//IGNORE_PRIVATE_WARNING("_handleSyncedEvent");
PARAMS_2(_name,_handler);
private["_ttl", "_eventId", "_data"];

View File

@ -23,9 +23,7 @@ PARAMS_2(_unit,_classname);
DEFAULT_PARAM(2,_container,"");
DEFAULT_PARAM(3,_ammoCount,-1);
private "_addedToPlayer";
private "_canAdd";
private "_type";
private ["_addedToPlayer", "_canAdd", "_type", "_pos"];
_canAdd = false;
_addedToPlayer = true;

View File

@ -19,6 +19,8 @@
PARAMS_5(_params,_function,_namespace,_uid,_duration);
//IGNORE_PRIVATE_WARNING("_eventName");
if (((_namespace getVariable [_uid, [-99999]]) select 0) < diag_tickTime) then {
_namespace setVariable [_uid, [diag_tickTime + _duration, _params call _function]];

View File

@ -14,7 +14,7 @@
*/
#include "script_component.hpp"
private ["_adjustSpeed", "_vdir", "_dir", "_up", "_l", "_r", "_vup", "_vel"];
private ["_adjustSpeed", "_vdir", "_dir", "_up", "_l", "_r", "_vup", "_vel", "_vlat"];
PARAMS_3(_projectile,_adjustDir,_adjustUp);

View File

@ -14,6 +14,8 @@
_this spawn {
PARAMS_2(_target,_ignoreDead);
private["_inVehicle", "_position", "_vehiclePlayer", "_vehicleTarget"];
if (isNil "_ignoreDead") then {_ignoreDead = false};
_vehicleTarget = vehicle _target;

View File

@ -37,6 +37,7 @@ if (_state) then {
_dlg = uiNamespace getVariable QGVAR(dlgDisableMouse);
_dlg displayAddEventHandler ["KeyDown", {
private ["_key", "_dlg", "_ctrl", "_config", "_acc", "_index"];
_key = _this select 1;
if (_key == 1 && {alive player}) then {

View File

@ -2,7 +2,7 @@
* Author: Glowbal
*
* Draw progress bar and execute given function if succesful.
* Finish/Failure/Conditional are all passed [_args, _elapsedTime, _totalTime, _errorCode]
* Finish/Failure/Conditional are all passed [args, elapsedTime, totalTime, errorCode]
*
* Argument:
* 0: icon ID <STRING>
@ -61,7 +61,7 @@ _refresh = {
_allControls = [];
private ["_ctrl", "_setting"];
private ["_ctrl", "_setting", "_position"];
_setting = missionNamespace getvariable[QGVAR(settingFeedbackIcons), 0];
if (_setting > 0) then {
{

View File

@ -9,7 +9,7 @@
private "_fnc_logEntries";
_fnc_logEntries = {
private ["_p", "_t", "_e"];
private ["_p", "_t", "_e", "_a", "_i"];
PARAMS_2(_c,_d);

View File

@ -9,7 +9,7 @@
* Nothing
*
* Example:
* [_player] call ace_common_fnc_fixLoweredRifleAnimation
* [ACE_player] call ace_common_fnc_fixLoweredRifleAnimation
*
* Public: No
*/

View File

@ -1,7 +1,7 @@
// by commy2
#include "script_component.hpp"
private ["_configName", "_index"];
private ["_configName", "_index", "_config"];
_configName = "";

View File

@ -9,7 +9,7 @@
*/
#include "script_component.hpp"
private ["_distance", "_lower", "_upper", "_mid", "_intersections", "_result"];
private ["_distance", "_lower", "_upper", "_mid", "_intersections", "_result", "_dir"];
PARAMS_3(_source,_destination,_accuracy);

View File

@ -9,7 +9,7 @@
*/
#include "script_component.hpp"
private ["_distance", "_lower", "_upper", "_mid", "_intersection", "_result"];
private ["_distance", "_lower", "_upper", "_mid", "_intersection", "_result", "_dir"];
PARAMS_3(_source,_destination,_accuracy);

View File

@ -11,7 +11,7 @@
*/
#include "script_component.hpp"
private ["_config", "_hitpoints"];
private ["_config", "_hitpoints", "_i"];
PARAMS_1(_vehicle);

View File

@ -11,7 +11,7 @@
*/
#include "script_component.hpp"
private ["_config", "_hitpoints", "_selections"];
private ["_config", "_hitpoints", "_selections", "_i"];
PARAMS_1(_vehicle);

View File

@ -16,6 +16,8 @@
PARAMS_1(_item);
private ["_cfgType"];
_cfgType = [_item] call FUNC(getConfigType);
if (_cfgType == "") exitWith {["",""]};

View File

@ -12,6 +12,8 @@
PARAMS_2(_unit,_magazine);
private ["_return"];
_return = 0;
if (_unit isKindOf "CAManBase") then {
_return = {_x == _magazine} count magazines _unit;
@ -23,4 +25,4 @@ if (_unit isKindOf "CAManBase") then {
_return = _return + ({_x == _magazine} count getMagazineCargo _unit);
};
_return
_return

View File

@ -13,7 +13,7 @@
*/
#include "script_component.hpp"
private ["_config", "_hitpoints", "_selections"];
private ["_config", "_hitpoints", "_selections", "_i"];
PARAMS_1(_vehicle);

View File

@ -12,7 +12,7 @@
*/
#include "script_component.hpp"
private ["_index", "_offset", "_config2", "_foundClasses"];
private ["_index", "_offset", "_config2", "_foundClasses", "_a"];
PARAMS_2(_config,_turretIndex);

View File

@ -13,7 +13,7 @@
#include "script_component.hpp"
PARAMS_2(_vehicle,_position);
private ["_turrets", "_turret", "_config", "_turret", "_povPos", "_povDir", "_gunBeginPos", "_gunEndPos", "_pov"];
private ["_turrets", "_turret", "_config", "_turret", "_povPos", "_povDir", "_gunBeginPos", "_gunEndPos", "_pov", "_gunBeg", "_gunEnd", "_pipDir"];
_turret = [_vehicle, _position] call CBA_fnc_getTurret;
_pov = getText (_turret >> "memoryPointGunnerOptics");

View File

@ -11,7 +11,7 @@
*/
#include "script_component.hpp"
private ["_config", "_turrets", "_fnc_addTurret"];
private ["_config", "_turrets", "_fnc_addTurret", "_varName"];
PARAMS_1(_type);

View File

@ -11,7 +11,7 @@
*/
#include "script_component.hpp"
private ["_config", "_cargo", "_codrivers"];
private ["_config", "_cargo", "_codrivers", "_index"];
PARAMS_1(_vehicle);

View File

@ -11,7 +11,7 @@
*/
#include "script_component.hpp"
private ["_config", "_cargo", "_codrivers"];
private ["_config", "_cargo", "_codrivers", "_index"];
PARAMS_1(_vehicle);

View File

@ -11,6 +11,7 @@
* Nothing
*/
#include "script_component.hpp"
//IGNORE_PRIVATE_WARNING("_handleNetEvent");
PARAMS_2(_eventName,_eventArgs);

View File

@ -13,6 +13,8 @@
PARAMS_1(_unit);
//IGNORE_PRIVATE_WARNING("_exception");
try {
if (_unit == vehicle _unit) then {
switch (currentWeapon _unit) do {

View File

@ -15,6 +15,8 @@
PARAMS_2(_vector1,_vector2);
private ["_newVector", "_i"];
_newVector = [];
for "_i" from 0 to (((count _vector1) min (count _vector2)) - 1) do {

View File

@ -16,7 +16,7 @@
BOOLEAN
Example:
_isSpecialist = [player] call FUNC(isEOD);
isSpecialist = [player] call FUNC(isEOD);
*/
#include "script_component.hpp"

View File

@ -14,6 +14,8 @@
PARAMS_2(_eventName,_eventArgs);
private["_eventIndex", "_eventNames", "_events"];
_eventNames = GVAR(events) select 0;
_eventIndex = _eventNames find _eventName;
if(_eventIndex != -1) then {

View File

@ -1,6 +1,7 @@
// by commy2
#include "script_component.hpp"
private ["_configs", "_entries"];
private ["_configs", "_entries", "_name"];
_configs = "true" configClasses (configFile >> _this);

View File

@ -13,6 +13,8 @@
PARAMS_3(_logic,_units,_activated);
private ["_mode", "_checkAll", "_whitelist"];
if !(_activated) exitWith {};
_mode = parseNumber (_logic getVariable "Action");
@ -30,6 +32,7 @@ ACE_Version_Whitelist = _whitelist;
if (!isServer) then {
[_mode, _checkAll, _whitelist] spawn {
private ["_mode", "_checkAll", "_whitelist", "_missingAddon", "_missingAddonServer", "_oldVersionClient", "_oldVersionServer", "_text", "_error", "_rscLayer", "_ctrlHint"];
_mode = _this select 0;
_checkAll = _this select 1;
_whitelist = _this select 2;

View File

@ -13,6 +13,8 @@
PARAMS_3(_logic,_units,_activated);
private["_colors", "_hSCount", "_hiddenSelections", "_i", "_index", "_vehicle"];
if !(_activated) exitWith {};
{

View File

@ -42,6 +42,7 @@ GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = _target addAction ["Decline", compile
GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = _requestID;
GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [time, _target, _requestID] spawn {
private["_id", "_t", "_requestID", "_target"];
_t = (_this select 0) + 40;
_target = _this select 1;
_requestID = _this select 2;

View File

@ -10,8 +10,11 @@
* Boolean of success
*/
#include "script_component.hpp"
PARAMS_1(_name);
private ["_data", "_eventId"];
if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
diag_log text format["[ACE] Error, synced event key not found."];
false

View File

@ -27,7 +27,7 @@ if (isPlayer _unit) then {
if !(isnil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then {
// clear all disable user input
{
[_X, false] call FUNC(setDisableUserInputStatus);
[_x, false] call FUNC(setDisableUserInputStatus);
}foreach GVAR(DISABLE_USER_INPUT_COLLECTION);
};
};

View File

@ -11,7 +11,7 @@
*/
#include "script_component.hpp"
private ["_key", "_alt", "_ctrl", "_shft"];
private ["_key", "_alt", "_ctrl", "_shift"];
PARAMS_1(_keyCode);

View File

@ -11,6 +11,7 @@
* Nothing
*/
#include "script_component.hpp"
//IGNORE_PRIVATE_WARNING("_handleNetEvent");
PARAMS_2(_eventName,_eventArgs);

View File

@ -14,7 +14,7 @@
PARAMS_1(_optionEntry);
private ["_fnc_getValueWithType", "_value","_name", "_typeName", "_settingData"];
private ["_fnc_getValueWithType", "_value","_name", "_typeName", "_settingData", "_valueConfig", "_text"];
_fnc_getValueWithType = {
EXPLODE_2_PVT(_this,_optionEntry,_typeName);
@ -58,14 +58,14 @@ if (isNil _name) then {
// Add the setting to a list on the server
// Set the variable to not forced
/*_settingData = [
_name,
_typeName,
_isClientSettable,
_localizedName,
_localizedDescription,
_possibleValues,
_isForced,
_defaultValue
name,
typeName,
isClientSettable,
localizedName,
localizedDescription,
possibleValues,
isForced,
defaultValue
];*/
_settingData = [
_name,

View File

@ -1,26 +0,0 @@
/*
* Author: KoffeinFlummi
*
* Returns a fraction of the given string, starting at a given index, with a given length.
*
* Arguments:
* 0: Source string
* 1: Starting index of new string
* 2: Length of the new string
*
* Return Value:
* String when successfull / False when not
*/
#include "script_component.hpp"
PARAMS_3(_string,_index,_length);
_array = toArray _string;
if (_index < 0 or _length < 0 or _index + _length > (count _array) + 1) exitWith {false};
_arrayNew = [];
for "_i" from _index to (_index + _length - 1) do {
_arrayNew = _arrayNew + [(_array select _i)];
};
toString _arrayNew

View File

@ -7,7 +7,7 @@ if(!isServer) exitWith { false };
// @TODO: This should be iteration limited to prevent FPS lag
private["_data"];
{
private["_data", "_ttl", "_eventLog", "_newEventLog", "_name"];
private["_data", "_ttl", "_eventLog", "_newEventLog", "_name", "_globalEventTTL"];
_name = _x;
_data = HASH_GET(GVAR(syncedEvents),_name);

View File

@ -16,6 +16,8 @@
*/
#include "script_component.hpp"
//IGNORE_PRIVATE_WARNING("_handleNetEvent");
PARAMS_3(_eventName,_eventTargets,_eventArgs);
#ifdef DEBUG_EVENTS

View File

@ -14,7 +14,7 @@
NUMBER
Example:
_number = ["102"] call FUNC(toNumber);
number = ["102"] call FUNC(toNumber);
*/
#include "script_component.hpp"

View File

@ -1,3 +1,7 @@
#include "script_component.hpp"
private["_matrix", "_object", "_offset", "_origin", "_out", "_xVec", "_y", "_yVec", "_z", "_zVec"];
_object = _this select 0;
_origin = getPosASL _object;
_matrix = _this select 1;

View File

@ -1,3 +1,7 @@
#include "script_component.hpp"
private["_matrix", "_object", "_offset", "_origin", "_out", "_xVec", "_y", "_yVec", "_z", "_zVec"];
_object = _this select 0;
_origin = getPosASL _object;
_matrix = _this select 1;

View File

@ -10,8 +10,10 @@
#include "script_component.hpp"
private ["_return"];
PARAMS_2(_unit,_item);
private ["_return", "_vehicleUsage"];
_vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param;
_return = false;

View File

@ -10,7 +10,7 @@
#include "script_component.hpp"
private ["_return"];
private ["_return", "_vehicleUsage"];
PARAMS_2(_unit,_magazine);
_vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param;

View File

@ -5,7 +5,7 @@
#include "script_component.hpp"
private ["_minX","_minY","_maxX","_maxY"];
private ["_minX","_minY","_maxX","_maxY", "_bounds", "_boundsCorners", "_boundsMax", "_boundsMaxX", "_boundsMaxY", "_boundsMaxZ", "_boundsMin", "_boundsMinX", "_boundsMinY", "_boundsMinZ"];
PARAMS_3(_object,_margins,_offsets);

View File

@ -1,6 +1,8 @@
// by commy2
#include "script_component.hpp"
private["_client", "_clientVersion", "_count", "_error", "_files", "_index", "_missingAddon", "_missingAddonServer", "_missingAddons", "_missingAddonsServer", "_oldVersionClient", "_oldVersionServer", "_oldVersionsClient", "_oldVersionsServer", "_serverFiles", "_serverVersion", "_serverVersions", "_string", "_version", "_versions"];
_files = [];
{

View File

@ -1,6 +1,8 @@
// by commy2
#include "script_component.hpp"
private ["_config"];
ACE_isMapEnabled = call {_config = missionConfigFile >> "showMap"; !isNumber _config || {getNumber _config == 1}}; // default value is 1, so do isNumber check first
ACE_isCompassEnabled = call {_config = missionConfigFile >> "showCompass"; !isNumber _config || {getNumber _config == 1}};
ACE_isWatchEnabled = call {_config = missionConfigFile >> "showWatch"; !isNumber _config || {getNumber _config == 1}};

View File

@ -4,12 +4,13 @@
GVAR(ScrollWheelFrame) = diag_frameno;
GVAR(onScrollWheel) = {
_scroll = _this select 1;
private ["_scroll"];
_scroll = _this select 1;
if (GVAR(ScrollWheelFrame) == diag_frameno) exitWith {};
GVAR(ScrollWheelFrame) = diag_frameno;
if (GVAR(ScrollWheelFrame) == diag_frameno) exitWith {};
GVAR(ScrollWheelFrame) = diag_frameno;
{
[_scroll] call _x;
} count ((missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]) select 2);
{
[_scroll] call _x;
} count ((missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]) select 2);
};