mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2497 from acemod/commoncleanup2
common code cleanup part 2
This commit is contained in:
commit
dee025bbea
@ -1,20 +1,29 @@
|
|||||||
//fnc__handleNetEvent.sqf
|
/*
|
||||||
// internal handler for net events
|
* Author: jaynus
|
||||||
|
* Internal net event handler.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_eventName", "_eventArgs", "_eventNames", "_eventIndex", "_eventTargets", "_sentEvents", "_owner", "_serverFlagged", "_events"];
|
params ["_eventType", "_event"];
|
||||||
//IGNORE_PRIVATE_WARNING("_handleNetEvent");
|
|
||||||
|
|
||||||
|
|
||||||
PARAMS_2(_eventType,_event);
|
|
||||||
|
|
||||||
if (_eventType == "ACEg") then {
|
if (_eventType == "ACEg") then {
|
||||||
_eventName = _event select 0;
|
_event params ["_eventName", "_eventArgs"];
|
||||||
_eventArgs = _event select 1;
|
|
||||||
|
private ["_eventNames", "_eventIndex"];
|
||||||
|
|
||||||
_eventNames = GVAR(events) select 0;
|
_eventNames = GVAR(events) select 0;
|
||||||
_eventIndex = _eventNames find _eventName;
|
_eventIndex = _eventNames find _eventName;
|
||||||
|
|
||||||
if (_eventIndex != -1) then {
|
if (_eventIndex != -1) then {
|
||||||
|
private "_events";
|
||||||
_events = (GVAR(events) select 1) select _eventIndex;
|
_events = (GVAR(events) select 1) select _eventIndex;
|
||||||
|
|
||||||
#ifdef DEBUG_EVENTS
|
#ifdef DEBUG_EVENTS
|
||||||
@ -35,9 +44,9 @@ if (_eventType == "ACEg") then {
|
|||||||
|
|
||||||
if (_eventType == "ACEc") then {
|
if (_eventType == "ACEc") then {
|
||||||
if (isServer) then {
|
if (isServer) then {
|
||||||
_eventName = _event select 0;
|
_event params ["_eventName", "_eventTargets", "_eventArgs"];
|
||||||
_eventTargets = _event select 1;
|
|
||||||
_eventArgs = _event select 2;
|
private ["_sentEvents", "_owner", "_serverFlagged"];
|
||||||
|
|
||||||
_sentEvents = [];
|
_sentEvents = [];
|
||||||
if (!IS_ARRAY(_eventTargets)) then {
|
if (!IS_ARRAY(_eventTargets)) then {
|
||||||
@ -45,7 +54,7 @@ if (_eventType == "ACEc") then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//If not multiplayer, and there are targets, then just run localy
|
//If not multiplayer, and there are targets, then just run localy
|
||||||
if ((!isMultiplayer) && {(count _eventTargets) > 0}) exitWith {
|
if (!isMultiplayer && {count _eventTargets > 0}) exitWith {
|
||||||
ACEg = [_eventName, _eventArgs];
|
ACEg = [_eventName, _eventArgs];
|
||||||
["ACEg", ACEg] call FUNC(_handleNetEvent);
|
["ACEg", ACEg] call FUNC(_handleNetEvent);
|
||||||
};
|
};
|
||||||
@ -56,9 +65,10 @@ if (_eventType == "ACEc") then {
|
|||||||
if (IS_OBJECT(_x)) then {
|
if (IS_OBJECT(_x)) then {
|
||||||
_owner = owner _x;
|
_owner = owner _x;
|
||||||
};
|
};
|
||||||
if (!(_owner in _sentEvents)) then {
|
if !(_owner in _sentEvents) then {
|
||||||
PUSH(_sentEvents, _owner);
|
_sentEvents pushBack _owner;
|
||||||
ACEg = [_eventName, _eventArgs];
|
ACEg = [_eventName, _eventArgs];
|
||||||
|
|
||||||
if (isDedicated || {_x != ACE_player}) then {
|
if (isDedicated || {_x != ACE_player}) then {
|
||||||
if (isDedicated && {local _x} && {!_serverFlagged}) then {
|
if (isDedicated && {local _x} && {!_serverFlagged}) then {
|
||||||
_serverFlagged = true;
|
_serverFlagged = true;
|
||||||
|
@ -1,25 +1,26 @@
|
|||||||
/*
|
/*
|
||||||
* Author: jaynus
|
* Author: jaynus
|
||||||
*
|
|
||||||
* Handles a server-side request for synchronization ALL events on JIP to a client.
|
* Handles a server-side request for synchronization ALL events on JIP to a client.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: client (object)
|
* 0: client <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Boolean of success
|
* Event is successed <BOOL>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
//#define DEBUG_MODE_FULL
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
PARAMS_1(_client);
|
|
||||||
|
params ["_client"];
|
||||||
|
|
||||||
{
|
{
|
||||||
private["_eventName", "_eventEntry", "_eventLog"];
|
private ["_eventEntry", "_eventLog"];
|
||||||
_eventName = _x;
|
|
||||||
_eventEntry = HASH_GET(GVAR(syncedEvents),_eventName);
|
_eventEntry = HASH_GET(GVAR(syncedEvents),_x);
|
||||||
_eventLog = _eventEntry select 1;
|
_eventLog = _eventEntry select 1;
|
||||||
|
|
||||||
["SEH_s", _client, [_eventName, _eventLog] ] call FUNC(targetEvent);
|
["SEH_s", _client, [_x, _eventLog]] call FUNC(targetEvent);
|
||||||
} forEach (GVAR(syncedEvents) select 0);
|
} forEach (GVAR(syncedEvents) select 0);
|
||||||
|
|
||||||
true
|
true
|
@ -1,47 +1,48 @@
|
|||||||
/*
|
/*
|
||||||
* Author: jaynus
|
* Author: jaynus
|
||||||
*
|
|
||||||
* Receives either requests for synchronization from clients, or the synchronization data from the server.
|
* Receives either requests for synchronization from clients, or the synchronization data from the server.
|
||||||
*
|
*
|
||||||
* Arguments [Client] :
|
* Arguments [Client] :
|
||||||
* 0: eventName (String)
|
* 0: eventName <STRING>
|
||||||
* 1: eventLog (Array)
|
* 1: eventLog <ARRAY>
|
||||||
*
|
*
|
||||||
* Arguments [Server] :
|
* Arguments [Server] :
|
||||||
* 0: eventName (String)
|
* 0: eventName <STRING>
|
||||||
* 1: client (Object)
|
* 1: client <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Boolean of success
|
* Event is successed <BOOL>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
//#define DEBUG_MODE_FULL
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
//IGNORE_PRIVATE_WARNING("_handleSyncedEvent");
|
|
||||||
|
|
||||||
//SEH_s
|
//SEH_s
|
||||||
if (isServer) then {
|
if (isServer) then {
|
||||||
// Find the event name, and shovel out the events to the client
|
// Find the event name, and shovel out the events to the client
|
||||||
PARAMS_2(_eventName,_client);
|
params ["_eventName", "_client"];
|
||||||
private["_eventEntry", "_eventLog"];
|
|
||||||
|
|
||||||
if (!HASH_HASKEY(GVAR(syncedEvents),_eventName)) exitWith {
|
if (!HASH_HASKEY(GVAR(syncedEvents),_eventName)) exitWith {
|
||||||
ACE_LOGERROR("Request for synced event - key not found.");
|
ACE_LOGERROR("Request for synced event - key not found.");
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private ["_eventEntry", "_eventLog"];
|
||||||
|
|
||||||
_eventEntry = HASH_GET(GVAR(syncedEvents),_eventName);
|
_eventEntry = HASH_GET(GVAR(syncedEvents),_eventName);
|
||||||
_eventLog = _eventEntry select 1;
|
_eventLog = _eventEntry select 1;
|
||||||
|
|
||||||
["SEH_s", _client, [_eventName, _eventLog]] call FUNC(targetEvent);
|
["SEH_s", _client, [_eventName, _eventLog]] call FUNC(targetEvent);
|
||||||
} else {
|
} else {
|
||||||
PARAMS_2(_eventName,_eventLog);
|
params ["_eventName", "_eventLog"];
|
||||||
private ["_eventArgs"];
|
|
||||||
// This is the client handling the response from the server
|
// This is the client handling the response from the server
|
||||||
// Start running the events
|
// Start running the events
|
||||||
{
|
{
|
||||||
_eventArgs = _x select 1;
|
_x params ["", "_eventArgs","_ttl"];
|
||||||
[_eventName, _eventArgs, (_x select 2)] call FUNC(_handleSyncedEvent);
|
[_eventName, _eventArgs, _ttl] call FUNC(_handleSyncedEvent);
|
||||||
} forEach _eventLog;
|
} forEach _eventLog;
|
||||||
|
|
||||||
ACE_LOGINFO_1("[%1] synchronized",_eventName);
|
ACE_LOGINFO_1("[%1] synchronized",_eventName);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,32 +1,36 @@
|
|||||||
/*
|
/*
|
||||||
* Author: jaynus
|
* Author: jaynus
|
||||||
*
|
|
||||||
* Handles synced events being received. Server will log them, and server/client will execute them.
|
* Handles synced events being received. Server will log them, and server/client will execute them.
|
||||||
*
|
*
|
||||||
* Arguments [Client] :
|
* Arguments [Client] :
|
||||||
* 0: eventName (String)
|
* 0: eventName <STRING>
|
||||||
* 1: arguments (Array)
|
* 1: arguments <ARRAY>
|
||||||
* 2: ttl (Scalar)
|
* 2: ttl <SCALAR>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Boolean of success
|
* Boolean of success <BOOL>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
//#define DEBUG_MODE_FULL
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
PARAMS_3(_name,_args,_ttl);
|
|
||||||
private["_internalData", "_eventLog", "_eventCode"];
|
params ["_name", "_args", "_ttl"];
|
||||||
|
|
||||||
if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
|
if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
|
||||||
ACE_LOGERROR("Synced event key not found.");
|
ACE_LOGERROR("Synced event key not found.");
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private ["_internalData", "_eventCode"];
|
||||||
|
|
||||||
_internalData = HASH_GET(GVAR(syncedEvents),_name);
|
_internalData = HASH_GET(GVAR(syncedEvents),_name);
|
||||||
|
|
||||||
if (isServer) then {
|
if (isServer) then {
|
||||||
// Server needs to internally log it for synchronization
|
// Server needs to internally log it for synchronization
|
||||||
if (_ttl > -1) then {
|
if (_ttl > -1) then {
|
||||||
_internalData = HASH_GET(GVAR(syncedEvents),_name);
|
_internalData = HASH_GET(GVAR(syncedEvents),_name);
|
||||||
|
|
||||||
|
private "_eventLog";
|
||||||
_eventLog = _internalData select 1;
|
_eventLog = _internalData select 1;
|
||||||
_eventLog pushback [ACE_diagTime, _args, _ttl];
|
_eventLog pushback [ACE_diagTime, _args, _ttl];
|
||||||
};
|
};
|
||||||
|
@ -1,26 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Add an addAction event to a unit. Used to handle multiple addAction events. Global arguments, local effects. Does only work for player controlled units.
|
* Add an addAction event to a unit. Used to handle multiple addAction events. Global arguments, local effects. Does only work for player controlled units.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Unit the action should be assigned to (Object)
|
* 0: Unit the action should be assigned to <OBJECT>
|
||||||
* 1: Name of the action, e.g. "DefaultAction" (String)
|
* 1: Name of the action, e.g. "DefaultAction" <STRING>
|
||||||
* 2: Condition (Code or String)
|
* 2: Condition <CODE, STRING>
|
||||||
* 3: Code to execute (Code or String)
|
* 3: Code to execute <CODE, STRING>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* ID of the action (used to remove it later).
|
* ID of the action (used to remove it later) <NUMBER>
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_unit", "_action", "_condition", "_statement", "_name", "_actionsVar", "_actionID", "_actions", "_id", "_actionIDs"];
|
params ["_unit", "_action", "_condition", "_statement"];
|
||||||
//IGNORE_PRIVATE_WARNING("_count", "_index", "_return", "_target");
|
|
||||||
|
|
||||||
_unit = _this select 0;
|
|
||||||
_action = _this select 1;
|
|
||||||
_condition = _this select 2;
|
|
||||||
_statement = _this select 3;
|
|
||||||
|
|
||||||
if (typeName _condition == "STRING") then {
|
if (typeName _condition == "STRING") then {
|
||||||
_condition = compile _condition;
|
_condition = compile _condition;
|
||||||
@ -30,20 +23,19 @@ if (typeName _statement == "STRING") then {
|
|||||||
_statement = compile _statement;
|
_statement = compile _statement;
|
||||||
};
|
};
|
||||||
|
|
||||||
_name = format ["ACE_Action_%1", _action];
|
private ["_name", "_actionsVar"];
|
||||||
|
|
||||||
|
_name = format ["ACE_Action_%1", _action];
|
||||||
_actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]];
|
_actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]];
|
||||||
|
|
||||||
if (_unit != _actionsVar select 2) then { // check if the unit is still valid, fixes respawn issues
|
if (_unit != _actionsVar select 2) then { // check if the unit is still valid, fixes respawn issues
|
||||||
_actionsVar = [-1, [-1, [], []], objNull];
|
_actionsVar = [-1, [-1, [], []], objNull];
|
||||||
};
|
};
|
||||||
|
|
||||||
_actionID = _actionsVar select 0;
|
_actionsVar params ["_actionID", "_actionsArray"];
|
||||||
_actions = _actionsVar select 1;
|
_actionsArray params ["_id", "_actionIDs", "_actions"];
|
||||||
|
|
||||||
_id = (_actions select 0) + 1;
|
_id = _id + 1;
|
||||||
_actionIDs = _actions select 1;
|
|
||||||
_actions = _actions select 2;
|
|
||||||
|
|
||||||
_actionIDs pushBack _id;
|
_actionIDs pushBack _id;
|
||||||
_actions pushBack [_condition, _statement];
|
_actions pushBack [_condition, _statement];
|
||||||
@ -51,7 +43,6 @@ _actions pushBack [_condition, _statement];
|
|||||||
// first action to add, unit needs addAction command
|
// first action to add, unit needs addAction command
|
||||||
if (_actionID == -1) then {
|
if (_actionID == -1) then {
|
||||||
private "_addAction";
|
private "_addAction";
|
||||||
|
|
||||||
_addAction = call compile format [
|
_addAction = call compile format [
|
||||||
"[
|
"[
|
||||||
'',
|
'',
|
||||||
|
@ -1,29 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Add an addAction event to a unit. Used to handle multiple addAction events and add a action to the mouse wheel menu. Global arguments, local effects. Does only work for player controlled units.
|
* Add an addAction event to a unit. Used to handle multiple addAction events and add a action to the mouse wheel menu. Global arguments, local effects. Does only work for player controlled units.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Unit the action should be assigned to (Object)
|
* 0: Unit the action should be assigned to <OBJECT>
|
||||||
* 1: Menu title of the action (String)
|
* 1: Menu title of the action <STRING>
|
||||||
* 2: Name of the action, e.g. "DefaultAction" (String)
|
* 2: Name of the action, e.g. "DefaultAction" <STRING>
|
||||||
* 3: Condition (Code or String)
|
* 3: Condition <CODE, STRING>
|
||||||
* 4: Code to execute by the action (Code or String)
|
* 4: Code to execute by the action <CODE, STRING>
|
||||||
* 5: Condition for the menu action (Code or String)
|
* 5: Condition for the menu action <CODE, STRING>
|
||||||
* 6: Code to execute from the menu (Code or String)
|
* 6: Code to execute from the menu <CODE, STRING>
|
||||||
* 7: Priority of the action (Number, optional default: 0)
|
* 7: Priority of the action (default: 0) <NUMBER>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* ID of the action (used to remove it later).
|
* ID of the action (used to remove it later) <NUMBER>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_name", "_actionsVar", "_id", "_actionIDs", "_actions", "_nameVar", "_addAction", "_actionID"];
|
params ["_unit", "_displayName", "_action", "_condition", "_statement", "_condition2", "_statement2", ["_priority", 0]];
|
||||||
//IGNORE_PRIVATE_WARNING("_target");
|
|
||||||
|
|
||||||
PARAMS_8(_unit,_displayName,_action,_condition,_statement,_condition2,_statement2,_priority);
|
|
||||||
|
|
||||||
if (isNil "_priority") then {_priority = 0};
|
|
||||||
|
|
||||||
if (typeName _condition == "STRING") then {
|
if (typeName _condition == "STRING") then {
|
||||||
_condition = compile _condition;
|
_condition = compile _condition;
|
||||||
@ -41,13 +37,16 @@ if (typeName _statement2 == "STRING") then {
|
|||||||
_statement2 = compile _statement2;
|
_statement2 = compile _statement2;
|
||||||
};
|
};
|
||||||
|
|
||||||
_name = format ["ACE_ActionMenu_%1", _action];
|
private ["_name", "_actionsVar"];
|
||||||
|
|
||||||
|
_name = format ["ACE_ActionMenu_%1", _action];
|
||||||
_actionsVar = _unit getVariable [_name, [-1, [], []]];
|
_actionsVar = _unit getVariable [_name, [-1, [], []]];
|
||||||
|
|
||||||
_id = (_actionsVar select 0) + 1;
|
_actionsVar params ["_id", "_actionIDs", "_actions"];
|
||||||
_actionIDs = _actionsVar select 1;
|
|
||||||
_actions = _actionsVar select 2;
|
_id = _id + 1;
|
||||||
|
|
||||||
|
private ["_nameVar", "_addAction", "_actionID"];
|
||||||
|
|
||||||
_nameVar = format ["%1_ID%2", _name, _id];
|
_nameVar = format ["%1_ID%2", _name, _id];
|
||||||
missionNamespace setVariable [_nameVar, [_condition, _statement, _condition2, _statement2]];
|
missionNamespace setVariable [_nameVar, [_condition, _statement, _condition2, _statement2]];
|
||||||
|
@ -1,31 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Add a condition that gets checked by ace_common_fnc_canInteractWith.
|
* Add a condition that gets checked by ace_common_fnc_canInteractWith.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: The conditions id. Used to remove later or as exception name. An already existing name overwrites. (String)
|
* 0: The conditions id. Used to remove later or as exception name. An already existing name overwrites. <STRING>
|
||||||
* 1: The condition to check. format of "_this" is "[_player, _target]". (Code)
|
* 1: The condition to check. format of "_this" is "[_player, _target]". <CODE>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Unit can interact?
|
* None
|
||||||
*
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_conditionName", "_conditionFunc"];
|
params ["_conditionName", "_conditionFunc"];
|
||||||
//IGNORE_PRIVATE_WARNING("_player", "_target");
|
|
||||||
|
|
||||||
|
_conditionName = toLower _conditionName;
|
||||||
|
|
||||||
_conditionName = toLower (_this select 0);
|
private "_conditions";
|
||||||
_conditionFunc = _this select 1;
|
|
||||||
|
|
||||||
private ["_conditions", "_conditionNames", "_conditionFuncs"];
|
|
||||||
|
|
||||||
_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
|
_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
|
||||||
|
_conditions params ["_conditionNames", "_conditionFuncs"];
|
||||||
_conditionNames = _conditions select 0;
|
|
||||||
_conditionFuncs = _conditions select 1;
|
|
||||||
|
|
||||||
private "_index";
|
private "_index";
|
||||||
_index = _conditionNames find _conditionName;
|
_index = _conditionNames find _conditionName;
|
||||||
@ -37,4 +31,4 @@ if (_index == -1) then {
|
|||||||
_conditionNames set [_index, _conditionName];
|
_conditionNames set [_index, _conditionName];
|
||||||
_conditionFuncs set [_index, _conditionFunc];
|
_conditionFuncs set [_index, _conditionFunc];
|
||||||
|
|
||||||
GVAR(InteractionConditions) = [_conditionNames, _conditionFuncs];
|
GVAR(InteractionConditions) = _conditions;
|
||||||
|
@ -1,9 +1,19 @@
|
|||||||
// by commy2
|
/*
|
||||||
|
* Author: commy2
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* Display where the Unload event was added <DISPLAY>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private "_dlg";
|
|
||||||
|
|
||||||
disableSerialization;
|
disableSerialization;
|
||||||
|
|
||||||
|
private "_dlg";
|
||||||
_dlg = ctrlParent _this;
|
_dlg = ctrlParent _this;
|
||||||
|
|
||||||
_dlg displayAddEventHandler ["unload", {
|
_dlg displayAddEventHandler ["unload", {
|
||||||
|
@ -1,33 +1,34 @@
|
|||||||
/*
|
/*
|
||||||
* Author: Nou
|
* Author: Nou
|
||||||
|
* Add an event handler.
|
||||||
*
|
*
|
||||||
* Add a event handler.
|
* Arguments:
|
||||||
|
* 0: Event name <STRING>
|
||||||
|
* 1: Event code <CODE>
|
||||||
*
|
*
|
||||||
* Argument:
|
* Return Value:
|
||||||
* 0: Event name (string)
|
* Event handler ID number (for use with fnc_removeEventHandler) <NUMBER>
|
||||||
* 1: Event code (code)
|
|
||||||
*
|
*
|
||||||
* Return value:
|
* Public: Yes
|
||||||
* Event handler ID number (for use with fnc_removeEventHandler)
|
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_eventNames", "_eventFunctions", "_eventNameCount", "_eventIndex", "_eventFunctionCount"];
|
params ["_eventName", "_eventCode"];
|
||||||
|
|
||||||
PARAMS_2(_eventName,_eventCode);
|
private ["_eventNames", "_eventFunctions", "_eventIndex"];
|
||||||
|
|
||||||
_eventNames = GVAR(events) select 0;
|
_eventNames = GVAR(events) select 0;
|
||||||
_eventFunctions = [];
|
_eventFunctions = [];
|
||||||
_eventIndex = _eventNames find _eventName;
|
_eventIndex = _eventNames find _eventName;
|
||||||
|
|
||||||
if (_eventIndex != -1) then {
|
if (_eventIndex != -1) then {
|
||||||
_eventFunctions = (GVAR(events) select 1) select _eventIndex;
|
_eventFunctions = (GVAR(events) select 1) select _eventIndex;
|
||||||
} else {
|
} else {
|
||||||
|
private "_eventNameCount";
|
||||||
_eventNameCount = count _eventNames;
|
_eventNameCount = count _eventNames;
|
||||||
|
|
||||||
_eventNames set [_eventNameCount, _eventName];
|
_eventNames set [_eventNameCount, _eventName];
|
||||||
(GVAR(events) select 1) set [_eventNameCount, _eventFunctions];
|
(GVAR(events) select 1) set [_eventNameCount, _eventFunctions];
|
||||||
};
|
};
|
||||||
|
|
||||||
_eventFunctionCount = count _eventFunctions;
|
_eventFunctions pushBack _eventCode // Return event function count
|
||||||
_eventFunctions set [_eventFunctionCount, _eventCode];
|
|
||||||
|
|
||||||
_eventFunctionCount;
|
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Author: esteldunedain
|
* Author: esteldunedain
|
||||||
*
|
|
||||||
* Add line to draw on debug
|
* Add line to draw on debug
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Start point ASL (Array)
|
* 0: Start point ASL <ARRAY>
|
||||||
* 1: End point ASL (Array)
|
* 1: End point ASL <ARRAY>
|
||||||
* 2: Color (Array)
|
* 2: Color <ARRAY>
|
||||||
*
|
*
|
||||||
* Return value:
|
* None
|
||||||
*
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Add a map marker creation event handler.
|
* Add a map marker creation event handler.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Code to execute (Code or String)
|
* 0: Code to execute <CODE, STRING>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* ID of the event script (used to remove it later).
|
* ID of the event script (used to remove it later). <NUMBER>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_actionsVar", "_id", "_actionIDs", "_actions"];
|
params ["_statement"];
|
||||||
|
|
||||||
PARAMS_1(_statement);
|
|
||||||
|
|
||||||
if (typeName _statement == "STRING") then {
|
if (typeName _statement == "STRING") then {
|
||||||
_statement = compile _statement;
|
_statement = compile _statement;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private "_actionsVar";
|
||||||
_actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]];
|
_actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]];
|
||||||
|
|
||||||
_id = (_actionsVar select 0) + 1;
|
_actionsVar params ["_id", "_actionIDs", "_actions"];
|
||||||
_actionIDs = _actionsVar select 1;
|
|
||||||
_actions = _actionsVar select 2;
|
_id = _id + 1;
|
||||||
|
|
||||||
if (_id == 0) then {
|
if (_id == 0) then {
|
||||||
uiNamespace setVariable ["ACE_EventHandler_MapMarker", count allMapMarkers];
|
uiNamespace setVariable ["ACE_EventHandler_MapMarker", count allMapMarkers];
|
||||||
|
@ -1,29 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
|
* Add an event handler that executes every ACE_time the scroll wheel is used. This is needed, because adding a MouseZ display event handler to display 46 will break in save games.
|
||||||
|
* _this will be [Interval] where 'Interval' is a number.
|
||||||
*
|
*
|
||||||
* Add an event handler that executes every ACE_time the scroll wheel is used. This is needed, because adding a MouseZ display event handler to display 46 will break in save games. Argument will be [Interval] where 'Interval' is a number.
|
* Arguments:
|
||||||
|
* 0: Code to execute <CODE, STRING>
|
||||||
*
|
*
|
||||||
* Argument:
|
* Return Value:
|
||||||
* 0: Code to execute (Code or String)
|
* ID of the event script (used to remove it later). <NUMBER>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Public: Yes
|
||||||
* ID of the event script (used to remove it later).
|
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_actionsVar", "_id", "_actionIDs", "_actions"];
|
params ["_statement"];
|
||||||
|
|
||||||
PARAMS_1(_statement);
|
|
||||||
|
|
||||||
if (typeName _statement == "STRING") then {
|
if (typeName _statement == "STRING") then {
|
||||||
_statement = compile _statement;
|
_statement = compile _statement;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private "_actionsVar";
|
||||||
_actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]];
|
_actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]];
|
||||||
|
|
||||||
_id = (_actionsVar select 0) + 1;
|
_actionsVar params ["_id", "_actionIDs", "_actions"];
|
||||||
_actionIDs = _actionsVar select 1;
|
|
||||||
_actions = _actionsVar select 2;
|
_id = _id + 1;
|
||||||
|
|
||||||
_actionIDs pushBack _id;
|
_actionIDs pushBack _id;
|
||||||
_actions pushBack _statement;
|
_actions pushBack _statement;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* 4: localizedDescription <STRING>
|
* 4: localizedDescription <STRING>
|
||||||
* 5: possibleValues <ARRAY>
|
* 5: possibleValues <ARRAY>
|
||||||
* 6: isForced <BOOL>
|
* 6: isForced <BOOL>
|
||||||
* 7: defaultValue (Any)
|
* 7: defaultValue <ANY>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -20,10 +20,9 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_8(_name,_typeName,_isClientSetable,_localizedName,_localizedDescription,_possibleValues,_isForced,_value);
|
params ["_name", "", "", "", "", "", "", "_value"]; //["_name", "_typeName", "_isClientSetable", "_localizedName", "_localizedDescription", "_possibleValues", "_isForced", "_value"];
|
||||||
|
|
||||||
private ["_settingData"];
|
|
||||||
|
|
||||||
|
private "_settingData";
|
||||||
_settingData = [_name] call FUNC(getSettingData);
|
_settingData = [_name] call FUNC(getSettingData);
|
||||||
|
|
||||||
// Exit if the setting already exists
|
// Exit if the setting already exists
|
||||||
|
@ -1,34 +1,29 @@
|
|||||||
/*
|
/*
|
||||||
* Author: jaynus
|
* Author: jaynus
|
||||||
*
|
|
||||||
* Register an event handler for an ACE synced event
|
* Register an event handler for an ACE synced event
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Name (String)
|
* 0: Name <STRING>
|
||||||
* 1: Handler (Code)
|
* 1: Handler <CODE>
|
||||||
* 2: TTL (Number or Code) [Optional]
|
* 2: TTL (optional: 0) <NUMBER, CODE>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Boolean of success
|
* Boolean of success <BOOL>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
//#define DEBUG_MODE_FULL
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
//IGNORE_PRIVATE_WARNING("_handleSyncedEvent");
|
|
||||||
|
|
||||||
PARAMS_2(_name,_handler);
|
params ["_name", "_handler", ["_ttl", 0]];
|
||||||
|
|
||||||
private["_ttl", "_eventId", "_data"];
|
|
||||||
if( (count _this) > 2) then {
|
|
||||||
_ttl = _this select 2;
|
|
||||||
} else {
|
|
||||||
_ttl = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
|
if (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
|
||||||
ACE_LOGERROR("Duplicate synced event creation.");
|
ACE_LOGERROR("Duplicate synced event creation.");
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private ["_eventId", "_data"];
|
||||||
|
|
||||||
_eventId = [_name, FUNC(_handleSyncedEvent)] call FUNC(addEventHandler);
|
_eventId = [_name, FUNC(_handleSyncedEvent)] call FUNC(addEventHandler);
|
||||||
_data = [_handler, [], _ttl, _eventId];
|
_data = [_handler, [], _ttl, _eventId];
|
||||||
|
|
||||||
HASH_SET(GVAR(syncedEvents),_name,_data);
|
HASH_SET(GVAR(syncedEvents),_name,_data);
|
||||||
|
@ -1,95 +1,141 @@
|
|||||||
/*
|
/*
|
||||||
* Author: Garth 'L-H' de Wet
|
* Author: Garth 'L-H' de Wet
|
||||||
* Adds an item,weapon,magazine to the unit's inventory
|
* Adds an item, weapon, or magazine to the unit's inventory or places it in a weaponHolder if no space.
|
||||||
* or places it in a weaponHolder if no space.
|
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
* 1: Classname <STRING>
|
* 1: Classname <STRING>
|
||||||
* 2: Container (uniform, vest, backpack) <STRING><OPTIONAL>
|
* 2: Container (uniform, vest, backpack) (default: "") <STRING>
|
||||||
* 3: Magazine Ammo Count <NUMBER><OPTIONAL>
|
* 3: Magazine Ammo Count (default: -1) <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Array:
|
* 0: Added to player <BOOL>
|
||||||
* 0: Added to player (Bool)
|
* 1: weaponholder <OBJECT>
|
||||||
* 1: weaponholder (OBJECT)
|
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
//#define DEBUG_MODE_FULL
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_2(_unit,_classname);
|
params ["_unit", "_classname", ["_container", ""], ["_ammoCount", -1]];
|
||||||
DEFAULT_PARAM(2,_container,"");
|
|
||||||
DEFAULT_PARAM(3,_ammoCount,-1);
|
|
||||||
|
|
||||||
private ["_addedToPlayer", "_canAdd", "_type", "_pos"];
|
private ["_type", "_canAdd", "_addedToUnit"];
|
||||||
|
|
||||||
_canAdd = false;
|
_type = [_classname] call FUNC(getItemType);
|
||||||
_addedToPlayer = true;
|
|
||||||
|
|
||||||
_type = [_classname] call EFUNC(common,getItemType);
|
|
||||||
|
|
||||||
switch (_container) do {
|
switch (_container) do {
|
||||||
case "vest": { _canAdd = _unit canAddItemToVest _classname; };
|
case "vest": {
|
||||||
case "backpack": { _canAdd = _unit canAddItemToBackpack _classname; };
|
_canAdd = _unit canAddItemToVest _classname;
|
||||||
case "uniform": { _canAdd = _unit canAddItemToUniform _classname; };
|
};
|
||||||
default {_canAdd = _unit canAdd _classname;};
|
case "backpack": {
|
||||||
|
_canAdd = _unit canAddItemToBackpack _classname;
|
||||||
|
};
|
||||||
|
case "uniform": {
|
||||||
|
_canAdd = _unit canAddItemToUniform _classname;
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
_canAdd = _unit canAdd _classname;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
switch ((_type select 0)) do {
|
switch (_type select 0) do {
|
||||||
case "weapon": {
|
case "weapon": {
|
||||||
if (_canAdd) then {
|
if (_canAdd) then {
|
||||||
|
_addedToUnit = true;
|
||||||
|
|
||||||
switch (_container) do {
|
switch (_container) do {
|
||||||
case "vest": { (vestContainer _unit) addWeaponCargoGlobal [_classname, 1]; };
|
case "vest": {
|
||||||
case "backpack": { (backpackContainer _unit) addWeaponCargoGlobal [_classname, 1]; };
|
(vestContainer _unit) addWeaponCargoGlobal [_classname, 1];
|
||||||
case "uniform": { (uniformContainer _unit) addWeaponCargoGlobal [_classname, 1]; };
|
};
|
||||||
default { _unit addWeaponGlobal _classname; };
|
case "backpack": {
|
||||||
|
(backpackContainer _unit) addWeaponCargoGlobal [_classname, 1];
|
||||||
|
};
|
||||||
|
case "uniform": {
|
||||||
|
(uniformContainer _unit) addWeaponCargoGlobal [_classname, 1];
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
_unit addWeaponGlobal _classname;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
_addedToPlayer = false;
|
_addedToUnit = false;
|
||||||
|
|
||||||
|
private "_pos";
|
||||||
_pos = _unit modelToWorldVisual [0,1,0.05];
|
_pos = _unit modelToWorldVisual [0,1,0.05];
|
||||||
|
|
||||||
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
|
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
|
||||||
_unit addWeaponCargoGlobal [_classname, 1];
|
_unit addWeaponCargoGlobal [_classname, 1];
|
||||||
_unit setPosATL _pos;
|
_unit setPosATL _pos;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
case "magazine": {
|
case "magazine": {
|
||||||
if (_ammoCount == -1) then {_ammoCount = getNumber (configFile >> "CfgMagazines" >> _classname >> "count");};
|
if (_ammoCount == -1) then {
|
||||||
|
_ammoCount = getNumber (configFile >> "CfgMagazines" >> _classname >> "count");
|
||||||
|
};
|
||||||
|
|
||||||
if (_canAdd) then {
|
if (_canAdd) then {
|
||||||
|
_addedToUnit = true;
|
||||||
|
|
||||||
switch (_container) do {
|
switch (_container) do {
|
||||||
case "vest": { (vestContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; };
|
case "vest": {
|
||||||
case "backpack": { (backpackContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; };
|
(vestContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
|
||||||
case "uniform": { (uniformContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; };
|
};
|
||||||
default {_unit addMagazine [_classname, _ammoCount]; };
|
case "backpack": {
|
||||||
|
(backpackContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
|
||||||
|
};
|
||||||
|
case "uniform": {
|
||||||
|
(uniformContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
_unit addMagazine [_classname, _ammoCount];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
_addedToPlayer = false;
|
_addedToUnit = false;
|
||||||
|
|
||||||
|
private "_pos";
|
||||||
_pos = _unit modelToWorldVisual [0,1,0.05];
|
_pos = _unit modelToWorldVisual [0,1,0.05];
|
||||||
|
|
||||||
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
|
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
|
||||||
_unit addMagazineCargoGlobal [_classname, _ammoCount];
|
_unit addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
|
||||||
_unit setPosATL _pos;
|
_unit setPosATL _pos;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
case "item": {
|
case "item": {
|
||||||
if (_canAdd) then {
|
if (_canAdd) then {
|
||||||
|
_addedToUnit = true;
|
||||||
|
|
||||||
switch (_container) do {
|
switch (_container) do {
|
||||||
case "vest": { _unit addItemToVest _classname; };
|
case "vest": {
|
||||||
case "backpack": { _unit addItemToBackpack _classname; };
|
_unit addItemToVest _classname;
|
||||||
case "uniform": { _unit addItemToUniform _classname; };
|
};
|
||||||
default { _unit addItem _classname; };
|
case "backpack": {
|
||||||
|
_unit addItemToBackpack _classname;
|
||||||
|
};
|
||||||
|
case "uniform": {
|
||||||
|
_unit addItemToUniform _classname;
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
_unit addItem _classname;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
_addedToPlayer = false;
|
_addedToUnit = false;
|
||||||
|
|
||||||
|
private "_pos";
|
||||||
_pos = _unit modelToWorldVisual [0,1,0.05];
|
_pos = _unit modelToWorldVisual [0,1,0.05];
|
||||||
|
|
||||||
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
|
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
|
||||||
_unit addItemCargoGlobal [_classname, 1];
|
_unit addItemCargoGlobal [_classname, 1];
|
||||||
_unit setPosATL _pos;
|
_unit setPosATL _pos;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
default {
|
default {
|
||||||
|
_addedToUnit = false;
|
||||||
ACE_LOGWARNING_2("Incorrect item type passed to %1, passed: %2",QFUNC(AddToInventory),_type);
|
ACE_LOGWARNING_2("Incorrect item type passed to %1, passed: %2",QFUNC(AddToInventory),_type);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
[_addedToPlayer,_unit]
|
[_addedToUnit, _unit]
|
||||||
|
@ -3,11 +3,13 @@
|
|||||||
*
|
*
|
||||||
* Returns a brightness value depending on the sun and moon state. Ranges from 0 to 1 (dark ... bright).
|
* Returns a brightness value depending on the sun and moon state. Ranges from 0 to 1 (dark ... bright).
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* None.
|
* None
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Ambient brightness (Number)
|
* Ambient brightness <NUMBER>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
@ -1,25 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
Name: FUNC(applyForceWalkStatus)
|
* Author: Pabst Mirror
|
||||||
|
* Applys the forceWalk status of an unit. Called from Extended_InitPost_EventHandlers.
|
||||||
Author: Pabst Mirror
|
*
|
||||||
|
* Arguments:
|
||||||
Description:
|
* 0: Unit <OBJECT>
|
||||||
Applys the forceWalk status of an unit. Called from Extended_InitPost_EventHandlers.
|
*
|
||||||
|
* Return Value:
|
||||||
Parameters:
|
* None
|
||||||
0: OBJECT - Unit
|
*
|
||||||
|
* Example:
|
||||||
Returns:
|
* [ACE_Player] call FUNC(applyForceWalkStatus)
|
||||||
None
|
*
|
||||||
|
* Public: No
|
||||||
Example:
|
|
||||||
[ACE_Player] call FUNC(applyForceWalkStatus)
|
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_forceWalkNumber"];
|
params ["_unit"];
|
||||||
|
|
||||||
PARAMS_1(_unit);
|
private "_forceWalkNumber";
|
||||||
_forceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
|
_forceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
|
||||||
|
|
||||||
_unit forceWalk (_forceWalkNumber > 0);
|
_unit forceWalk (_forceWalkNumber > 0);
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Get a binary equivalent of a decimal number.
|
* Get a binary equivalent of a decimal number.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: Decimal Number (Number)
|
* 0: Decimal Number <NUMBER>
|
||||||
* 1: Minimum length of the returned Array, note: returned array can be larger (Number, optional default 8)
|
* 1: Minimum length of the returned Array, note: returned array can be larger (default: 8) <NUMBER>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Booleans (Array)
|
* Booleans <ARRAY>
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_number", "_minLength", "_array", "_index", "_rest"];
|
params ["_number", ["_minLength", 8]];
|
||||||
|
|
||||||
_number = round (_this select 0);
|
_number = round _number;
|
||||||
_minLength = _this select 1;
|
|
||||||
|
|
||||||
if (isNil "_minLength") then {_minLength = 8};
|
private ["_array", "_index", "_rest"];
|
||||||
|
|
||||||
_array = [];
|
_array = [];
|
||||||
_array resize _minLength;
|
_array resize _minLength;
|
||||||
@ -35,4 +35,5 @@ while {_number > 0} do {
|
|||||||
_array set [_index, _rest == 1];
|
_array set [_index, _rest == 1];
|
||||||
_index = _index + 1;
|
_index = _index + 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
_array
|
_array
|
||||||
|
@ -1,30 +1,33 @@
|
|||||||
/**
|
/*
|
||||||
* fn_gui_blurScreen.sqf
|
* Author: Glowbal
|
||||||
* @Descr:
|
|
||||||
* @Author: Glowbal
|
|
||||||
*
|
*
|
||||||
* @Arguments: []
|
* Arguments:
|
||||||
* @Return:
|
* 0: ID <NUMBER>
|
||||||
* @PublicAPI: true
|
* 1: Show? <BOOL, NUMBER>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
if (!hasInterface) exitWith {};
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
private ["_show"];
|
params ["_id", ["_show", false]];
|
||||||
PARAMS_1(_id);
|
|
||||||
_show = if (count _this > 1) then {_this select 1} else {false};
|
if (typeName _show == "SCALAR") then {
|
||||||
|
_show = _show == 1;
|
||||||
|
};
|
||||||
|
|
||||||
if (isNil QGVAR(SHOW_BLUR_SCREEN_COLLECTION)) then {
|
if (isNil QGVAR(SHOW_BLUR_SCREEN_COLLECTION)) then {
|
||||||
GVAR(SHOW_BLUR_SCREEN_COLLECTION) = [];
|
GVAR(SHOW_BLUR_SCREEN_COLLECTION) = [];
|
||||||
};
|
};
|
||||||
if (typeName _show == typeName 0) then {
|
|
||||||
_show = (_show == 1);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_show) then {
|
if (_show) then {
|
||||||
GVAR(SHOW_BLUR_SCREEN_COLLECTION) pushback _id;
|
GVAR(SHOW_BLUR_SCREEN_COLLECTION) pushBack _id;
|
||||||
|
|
||||||
// show blur
|
// show blur
|
||||||
if (isnil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then {
|
if (isnil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then {
|
||||||
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = ppEffectCreate ["DynamicBlur", 102];
|
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = ppEffectCreate ["DynamicBlur", 102];
|
||||||
@ -34,9 +37,10 @@ if (_show) then {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
GVAR(SHOW_BLUR_SCREEN_COLLECTION) = GVAR(SHOW_BLUR_SCREEN_COLLECTION) - [_id];
|
GVAR(SHOW_BLUR_SCREEN_COLLECTION) = GVAR(SHOW_BLUR_SCREEN_COLLECTION) - [_id];
|
||||||
|
|
||||||
if (GVAR(SHOW_BLUR_SCREEN_COLLECTION) isEqualTo []) then {
|
if (GVAR(SHOW_BLUR_SCREEN_COLLECTION) isEqualTo []) then {
|
||||||
// hide blur
|
// hide blur
|
||||||
if (!isnil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then {
|
if (!isNil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then {
|
||||||
ppEffectDestroy GVAR(MENU_ppHandle_GUI_BLUR_SCREEN);
|
ppEffectDestroy GVAR(MENU_ppHandle_GUI_BLUR_SCREEN);
|
||||||
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = nil;
|
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = nil;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user