more common code cleanup

This commit is contained in:
commy2 2015-09-19 20:34:07 +02:00
parent 1636e3976d
commit 3ddaa5ed4a
5 changed files with 70 additions and 54 deletions

View File

@ -1,26 +1,27 @@
/*
* Author: Nou
*
* Execute a event only on the server.
*
* Argument:
* 0: Event name (string)
* 1: Event args (any)
* 0: Event name <STRING>
* 1: Event args <ANY>
*
* Return value:
* Nothing
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
//IGNORE_PRIVATE_WARNING("_handleNetEvent");
PARAMS_2(_eventName,_eventArgs);
params ["_eventName", "_eventArgs"];
#ifdef DEBUG_EVENTS
ACE_LOGINFO_1("* Server Event: %1",_eventName);
ACE_LOGINFO_1(" args=%1",_eventArgs);
#endif
#ifdef DEBUG_EVENTS
ACE_LOGINFO_1("* Server Event: %1",_eventName);
ACE_LOGINFO_1(" args=%1",_eventArgs);
#endif
ACEg = [_eventName, _eventArgs];
if (!isServer) then {
publicVariableServer "ACEg";
} else {

View File

@ -1,8 +1,19 @@
// by esteldunedain
/*
* Author: esteldunedain
* ?
*
* Arguments:
* ?
*
* Return Value:
* None
*
* Public: no
*/
#include "script_component.hpp"
if (isServer) then {
diag_log _this;
} else {
[_this, QUOTE(FUNC(serverLog)), 1] call FUNC(execRemoteFnc);
[_this, QFUNC(serverLog), 1] call FUNC(execRemoteFnc);
};

View File

@ -1,21 +1,22 @@
/*
* Author: commy2
*
* Set the captivity status of an unit. This allows the handling of more than one reason to set a unit captive.
*
* Argument:
* 0: Unit (Object)
* 1: The reason of the captivity (String)
* 2: Is the reason still valid? True for setting this reason, false for removing it (Bool)
* Arguments:
* 0: Unit <OBJECT>
* 1: The reason of the captivity <STRING>
* 2: Is the reason still valid? True for setting this reason, false for removing it <BOOL>
*
* Return value:
* None.
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_captivityReasons", "_unitCaptivityReasons", "_captivityReasonsBooleans", "_bitmask"];
params ["_unit", "_reason", "_status"];
PARAMS_3(_unit,_reason,_status);
private ["_captivityReasons", "_unitCaptivityReasons", "_captivityReasonsBooleans", "_bitmask"];
_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];

View File

@ -1,31 +1,30 @@
/**
* fn_setVariable.sqf
* @Descr: Setvariable value
* @Author: Glowbal
/*
* Author: Glowbal
* Setvariable value
*
* @Arguments: [unit OBJECT, variableName STRING, value ANY]
* @Return: void
* @PublicAPI: true
* Arguments:
* 0: Unit <OBJECT>
* 1: variableName <STRING>
* 2: value <ANY>
*
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_global","_definedVariable"];
params ["_unit", "_variable", "_value", "_global"];
PARAMS_3(_unit,_variable,_value);
if (isNil "_global") then {
private "_definedVariable";
_definedVariable = [_variable] call FUNC(getDefinedVariableInfo);
_global = false;
if (count _this > 3) then {
_global = _this select 3;
} else {
_definedVariable = ([_variable] call FUNC(getDefinedVariableInfo));
if (count _definedVariable > 2) then {
_global = _definedVariable select 2;
};
_definedVariable params ["", "", ["_global", false]];
};
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

@ -1,26 +1,30 @@
/**
* fn_setDisableUserInputStatus.sqf
* @Descr: Disables the user input. Works stacked.
* @Author: Glowbal
/*
* Author: Glowbal
* Disables the user input. Works stacked.
*
* @Arguments: [id STRING, disable BOOL]
* @Return: void
* @PublicAPI: true
* Arguments:
* 0: id <STRING>
* 1: disable <BOOL>
*
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
PARAMS_2(_id,_disable);
params ["_id", "_disable"];
if (isnil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then {
if (isNil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then {
GVAR(DISABLE_USER_INPUT_COLLECTION) = [];
};
if (_disable) then {
GVAR(DISABLE_USER_INPUT_COLLECTION) pushback _id;
GVAR(DISABLE_USER_INPUT_COLLECTION) pushBack _id;
[true] call FUNC(disableUserInput);
} else {
GVAR(DISABLE_USER_INPUT_COLLECTION) = GVAR(DISABLE_USER_INPUT_COLLECTION) - [_id];
if (GVAR(DISABLE_USER_INPUT_COLLECTION) isEqualTo []) then {
[false] call FUNC(disableUserInput);
};
};
};