manual merge

This commit is contained in:
commy2 2016-08-09 18:28:42 +02:00
commit 9228bb9349
98 changed files with 765 additions and 555 deletions

View File

@ -11,7 +11,7 @@ class Cfg3DEN {
expression = QUOTE(if (_value) then {[ARR_3(objNull,[_this],true)] call FUNC(moduleHandcuffed)}); expression = QUOTE(if (_value) then {[ARR_3(objNull,[_this],true)] call FUNC(moduleHandcuffed)});
typeName = "BOOL"; typeName = "BOOL";
condition = "objectBrain"; condition = "objectBrain";
defaultValue = false; defaultValue = "(false)";
}; };
class ace_isSurrendered { class ace_isSurrendered {
property = QUOTE(ace_isSurrendered); property = QUOTE(ace_isSurrendered);
@ -21,7 +21,7 @@ class Cfg3DEN {
expression = QUOTE(if (_value) then {[ARR_3(objNull,[_this],true)] call FUNC(moduleSurrender)}); expression = QUOTE(if (_value) then {[ARR_3(objNull,[_this],true)] call FUNC(moduleSurrender)});
typeName = "BOOL"; typeName = "BOOL";
condition = "objectBrain"; condition = "objectBrain";
defaultValue = false; defaultValue = "(false)";
}; };
}; };
}; };

View File

@ -67,4 +67,9 @@ class Extended_InitPost_EventHandlers {
init = QUOTE(_this call DFUNC(initObject)); init = QUOTE(_this call DFUNC(initObject));
}; };
}; };
class StaticWeapon {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
}; };

View File

@ -62,12 +62,10 @@ PREP(getMapPosFromGrid);
PREP(getMarkerType); PREP(getMarkerType);
PREP(getMGRSdata); PREP(getMGRSdata);
PREP(getName); PREP(getName);
PREP(getNumberFromMissionSQM);
PREP(getNumberMagazinesIn); PREP(getNumberMagazinesIn);
PREP(getPitchBankYaw); PREP(getPitchBankYaw);
PREP(getSettingData); PREP(getSettingData);
PREP(getStaminaBarControl); PREP(getStaminaBarControl);
PREP(getStringFromMissionSQM);
PREP(getTargetAzimuthAndInclination); PREP(getTargetAzimuthAndInclination);
PREP(getTargetDistance); PREP(getTargetDistance);
PREP(getTargetObject); PREP(getTargetObject);
@ -95,7 +93,6 @@ PREP(hideUnit);
PREP(insertionSort); PREP(insertionSort);
PREP(interpolateFromArray); PREP(interpolateFromArray);
PREP(inTransitionAnim); PREP(inTransitionAnim);
PREP(isAutoWind);
PREP(isAwake); PREP(isAwake);
PREP(isEngineer); PREP(isEngineer);
PREP(isEOD); PREP(isEOD);
@ -264,8 +261,3 @@ PREP(hashSet);
PREP(hashGet); PREP(hashGet);
PREP(hashHasKey); PREP(hashHasKey);
PREP(hashRem); PREP(hashRem);
PREP(hashListCreateList);
PREP(hashListCreateHash);
PREP(hashListSelect);
PREP(hashListSet);
PREP(hashListPush);

View File

@ -266,8 +266,8 @@ enableCamShake true;
//FUNC(showHud) needs to be refreshed if it was set during mission init //FUNC(showHud) needs to be refreshed if it was set during mission init
["ace_infoDisplayChanged", { ["ace_infoDisplayChanged", {
GVAR(showHudHash) params ["", "_masks"]; GVAR(showHudHash) params ["", "", "_masks"];
if (!(_masks isEqualTo [])) then { if !(_masks isEqualTo []) then {
[] call FUNC(showHud); [] call FUNC(showHud);
}; };
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;

View File

@ -5,8 +5,8 @@ ADDON = false;
#include "XEH_PREP.hpp" #include "XEH_PREP.hpp"
GVAR(syncedEvents) = HASH_CREATE; GVAR(syncedEvents) = [] call CBA_fnc_hashCreate;
GVAR(showHudHash) = [] call FUNC(hashCreate); GVAR(showHudHash) = [] call CBA_fnc_hashCreate;
GVAR(settingsInitFinished) = false; GVAR(settingsInitFinished) = false;
GVAR(runAtSettingsInitialized) = []; GVAR(runAtSettingsInitialized) = [];

View File

@ -14,12 +14,11 @@
params ["_client"]; params ["_client"];
{ [GVAR(syncedEvents), {
private _eventEntry = HASH_GET(GVAR(syncedEvents),_x); _value params ["", "_eventLog"];
_eventEntry params ["", "_eventLog"];
["ACEs", [_x, _eventLog], _client] call CBA_fnc_targetEvent; ["ACEs", [_key, _eventLog], _client] call CBA_fnc_targetEvent;
false false
} count (GVAR(syncedEvents) select 0); }] call CBA_fnc_hashEachPair;
true true

View File

@ -22,12 +22,12 @@ 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 ["_eventName", "_client"]; params ["_eventName", "_client"];
if (!HASH_HASKEY(GVAR(syncedEvents),_eventName)) exitWith { if !([GVAR(syncedEvents), _eventName] call CBA_fnc_hashHasKey) exitWith {
ACE_LOGERROR_1("Request for synced event - key [%1] not found.", _eventName); ACE_LOGERROR_1("Request for synced event - key [%1] not found.", _eventName);
false false
}; };
private _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName); private _eventEntry = [GVAR(syncedEvents), _eventName] call CBA_fnc_hashGet;
_eventEntry params ["", "_eventLog"]; _eventEntry params ["", "_eventLog"];
["ACEs", [_eventName, _eventLog], _client] call CBA_fnc_targetEvent; ["ACEs", [_eventName, _eventLog], _client] call CBA_fnc_targetEvent;

View File

@ -16,22 +16,19 @@
params ["_name", "_args", "_ttl"]; params ["_name", "_args", "_ttl"];
if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { if !([GVAR(syncedEvents), _name] call CBA_fnc_hashHasKey) exitWith {
ACE_LOGERROR_1("Synced event key [%1] not found (_handleSyncedEvent).", _name); ACE_LOGERROR_1("Synced event key [%1] not found (_handleSyncedEvent).", _name);
false false
}; };
private _internalData = HASH_GET(GVAR(syncedEvents),_name); private _internalData = [GVAR(syncedEvents), _name] call CBA_fnc_hashGet;
_internalData params ["_eventCode", "_eventLog"];
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 params ["", "_eventLog"];
_eventLog pushBack [diag_tickTime, _args, _ttl]; _eventLog pushBack [diag_tickTime, _args, _ttl];
}; };
}; };
_internalData params ["_eventCode"];
_args call _eventCode; _args call _eventCode;

View File

@ -19,7 +19,7 @@
params ["_name", "_handler", ["_ttl", 0]]; params ["_name", "_handler", ["_ttl", 0]];
if (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { if ([GVAR(syncedEvents), _name] call CBA_fnc_hashHasKey) exitWith {
ACE_LOGERROR_1("Duplicate synced event [%1] creation.",_name); ACE_LOGERROR_1("Duplicate synced event [%1] creation.",_name);
false false
}; };
@ -27,4 +27,4 @@ if (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
private _eventId = [_name, FUNC(_handleSyncedEvent)] call CBA_fnc_addEventHandler; private _eventId = [_name, FUNC(_handleSyncedEvent)] call CBA_fnc_addEventHandler;
private _data = [_handler, [], _ttl, _eventId]; private _data = [_handler, [], _ttl, _eventId];
HASH_SET(GVAR(syncedEvents),_name,_data); [GVAR(syncedEvents), _name, _data] call CBA_fnc_hashSet;

View File

@ -30,7 +30,7 @@ if !([_unit] call EFUNC(common,isPlayer)) then {
} else { } else {
//Sanity check to make sure we don't enable unconsious AI //Sanity check to make sure we don't enable unconsious AI
if (_unit getVariable ["ace_isunconscious", false] && alive _unit) exitWith { if (_unit getVariable ["ace_isunconscious", false] && alive _unit) exitWith {
ERROR("Enabling AI for unconsious unit"); ACE_LOGERROR("Enabling AI for unconsious unit");
}; };
_unit enableAI "MOVE"; _unit enableAI "MOVE";

View File

@ -19,7 +19,7 @@
params ["_inputString", ["_getCenterOfGrid", true]]; params ["_inputString", ["_getCenterOfGrid", true]];
if (count GVAR(mapGridData) == 0) exitWith { if (count GVAR(mapGridData) == 0) exitWith {
ERROR("Map has bad data, falling back to BIS_fnc_gridToPos"); ACE_LOGERROR("Map has bad data, falling back to BIS_fnc_gridToPos");
(_this call BIS_fnc_gridToPos) select 0 (_this call BIS_fnc_gridToPos) select 0
}; };

View File

@ -1,16 +0,0 @@
/*
* Author: commy2
* Get a number from the mission.sqm file. Mission has to be saved in the Editor.
* On non-existing entries, it might return 0 or the value of an entry with the same name of another calss.
*
* Arguments:
* 0: Path of the entry in the mission.sqm <ARRAY>
*
* Return Value:
* Entry value <NUMBER>
*
* Public: No
*/
#include "script_component.hpp"
parseNumber (_this call FUNC(getStringFromMissionSQM)) // return

View File

@ -1,66 +0,0 @@
/*
* Author: commy2
* Get a string from the mission.sqm file. Mission has to be saved in the Editor.
* The string cannot contain the ; character.
* If the entry does not exist, it might return an empty string or an entry with the same name of another class!
*
* Arguments:
* 0: Path of the entry in the mission.sqm <ARRAY>
*
* Return Value:
* Value of the entry. <STRING>
*
* Public: No
*/
#include "script_component.hpp"
[_this] params ["_path", [], [[]]];
if (missionName == "") exitWith {""};
private _mission = toArray toLower loadFile "mission.sqm";
_mission resize 65536;
{
if (_x < 33) then {
_mission set [_forEachIndex, -1];
}
} forEach _mission;
_mission = toString (_mission - [-1]);
{_path set [_forEachIndex, toLower _x]} forEach _path;
for "_a" from 0 to (count _path - 2) do {
private _class = format ["class%1{", _path select _a];
private _index = _mission find _class;
private _array = toArray _mission;
for "_b" from 0 to (_index + count toArray _class - 1) do {
_array set [_b, -1];
};
_array = _array - [-1];
_mission = toString _array;
};
private _entry = format ["%1=", _path select (count _path - 1)];
_index = _mission find _entry;
if (_index == -1) exitWith {""};
_array = toArray _mission;
for "_b" from 0 to (_index + count toArray _entry - 1) do {
_array set [_b, -1];
};
_mission = toString (_array - [-1]);
_index = _mission find ";";
_mission = toArray _mission;
_mission resize _index;
format ["%1", toString _mission] // return

View File

@ -12,4 +12,6 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
ACE_DEPRECATED(QFUNC(hashCreate),"3.8.0","CBA_fnc_hashCreate");
[[],[]] [[],[]]

View File

@ -13,6 +13,8 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
ACE_DEPRECATED(QFUNC(hashGet),"3.8.0","CBA_fnc_hashGet");
params ["_hash", "_key"]; params ["_hash", "_key"];
ERRORDATA(2); ERRORDATA(2);

View File

@ -12,6 +12,8 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
ACE_DEPRECATED(QFUNC(hashHasKey),"3.8.0","CBA_fnc_hashHasKey");
// diag_log text format["%1 HASH HAS KEY: %2", diag_tickTime, _this]; // diag_log text format["%1 HASH HAS KEY: %2", diag_tickTime, _this];
params ["_hash", "_key"]; params ["_hash", "_key"];

View File

@ -1,28 +0,0 @@
/*
* Author: ?
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
params ["_hashList"];
ERRORDATA(1);
private _hashKeys = [];
try {
if(VALIDHASH(_hashList)) then {
_hashKeys = (_hashList select 0);
} else {
ERROR("Input hashlist is not valid");
};
} catch {
HANDLECATCH;
};
[_hashKeys, []];

View File

@ -1,17 +0,0 @@
/*
* Author: ?
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
params ["_keys"];
[_keys,[]];

View File

@ -1,26 +0,0 @@
/*
* Author: ?
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
params ["_hashList", "_value"];
ERRORDATA(2);
try {
if(VALIDHASH(_hashList)) then {
[_hashList, (count (_hashList select 1)), _value] call FUNC(hashListSet);
} else {
ERROR("Input hashlist in push not valid");
};
} catch {
HANDLECATCH;
};

View File

@ -1,38 +0,0 @@
/*
* Author: ?
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
params ["_hashList", "_index"];
ERRORDATA(2);
private _hash = nil;
try {
if(VALIDHASH(_hashList)) then {
_hashList params ["_keys", "_hashes"];
if(_index < (count _hashes)) then {
private _values = _hashes select _index;
_hash = [_keys, _values, 1];
} else {
ERROR("Index of hashlist is out of range");
};
} else {
ERROR("Input hashlist is not valid");
};
} catch {
HANDLECATCH;
};
if (isNil "_hash") exitWith { nil };
_hash;

View File

@ -1,32 +0,0 @@
/*
* Author: ?
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
params ["_hashList", "_index", "_value"];
ERRORDATA(3);
try {
if(VALIDHASH(_hashList)) then {
if(VALIDHASH(_value)) then {
_value params ["", "_vals"];
(_hashList select 1) set[_index, _vals];
} else {
ERROR("Set hash in hashlist is not valid");
};
} else {
ERROR("Input hashlist is not valid");
};
} catch {
HANDLECATCH;
};

View File

@ -12,6 +12,8 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
ACE_DEPRECATED(QFUNC(hashRem),"3.8.0","CBA_fnc_hashRem");
params ["_hash", "_key"]; params ["_hash", "_key"];
ERRORDATA(2); ERRORDATA(2);

View File

@ -12,6 +12,8 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
ACE_DEPRECATED(QFUNC(hashSet),"3.8.0","CBA_fnc_hashSet");
// diag_log text format["%1 HASH SET: %2", diag_tickTime, _this]; // diag_log text format["%1 HASH SET: %2", diag_tickTime, _this];
params ["_hash", "_key", "_val"]; params ["_hash", "_key", "_val"];

View File

@ -1,15 +0,0 @@
/*
* Author: commy2
* Check if wind is set on auto.
*
* Arguments
* None
*
* Return Value:
* This mission has automatic wind? <BOOL>
*
* Public: Yes
*/
#include "script_component.hpp"
["Mission", "Intel", "windForced"] call FUNC(getNumberFromMissionSQM) != 1 // return

View File

@ -14,13 +14,13 @@
params ["_name"]; params ["_name"];
if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { if !([GVAR(syncedEvents), _name] call CBA_fnc_hashHasKey) exitWith {
ACE_LOGERROR_1("Synced event key [%1] not found (removeSyncedEventHandler).", _name); ACE_LOGERROR_1("Synced event key [%1] not found (removeSyncedEventHandler).", _name);
false false
}; };
private _data = HASH_GET(GVAR(syncedEvents),_name); private _data = [GVAR(syncedEvents), _name] call CBA_fnc_hashGet;
_data params ["", "", "", "_eventId"]; _data params ["", "", "", "_eventId"];
[_eventId] call CBA_fnc_removeEventHandler; [_eventId] call CBA_fnc_removeEventHandler;
HASH_REM(GVAR(syncedEvents),_name); [GVAR(syncedEvents), _name] call CBA_fnc_hashRem;

View File

@ -40,14 +40,14 @@ if (_reason != "") then {
_reason = toLower _reason; _reason = toLower _reason;
if (_mask isEqualTo []) then { if (_mask isEqualTo []) then {
TRACE_2("Setting", _reason, _mask); TRACE_2("Setting", _reason, _mask);
[GVAR(showHudHash), _reason] call FUNC(hashRem); [GVAR(showHudHash), _reason] call CBA_fnc_hashRem;
} else { } else {
TRACE_2("Removing", _reason, _mask); TRACE_2("Removing", _reason, _mask);
[GVAR(showHudHash), _reason, _mask] call FUNC(hashSet); [GVAR(showHudHash), _reason, _mask] call CBA_fnc_hashSet;
}; };
}; };
GVAR(showHudHash) params ["_reasons", "_masks"]; GVAR(showHudHash) params ["", "_reasons", "_masks"];
private _resultMask = []; private _resultMask = [];
for "_index" from 0 to 7 do { for "_index" from 0 to 7 do {

View File

@ -1,13 +1,15 @@
/* /*
* Author: Glowbal * Author: Glowbal
* Removes white spaces from string * Removes whitespace from a string.
* *
* Arguments: * Arguments:
* 0: stringA <STRING> * 0: String <STRING>
* 1: stringB <STRING>
* *
* Return Value: * Return Value:
* copy of string <STRING> * String Without Whitespace <STRING>
*
* Example:
* _stringWithoutWhitespace = ["String with whitespace"] call ace_common_fnc_stringRemoveWhiteSpace
* *
* Public: Yes * Public: Yes
*/ */

View File

@ -16,7 +16,7 @@
params ["_name", "_args", ["_ttl", 0]]; params ["_name", "_args", ["_ttl", 0]];
if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { if !([GVAR(syncedEvents), _name] call CBA_fnc_hashHasKey) exitWith {
ACE_LOGERROR_1("Synced event key [%1] not found (syncedEvent).", _name); ACE_LOGERROR_1("Synced event key [%1] not found (syncedEvent).", _name);
false false
}; };

View File

@ -18,11 +18,8 @@ if (!isServer) exitWith {false};
// Walk through the local synced events and clean up anything thats already EOL // Walk through the local synced events and clean up anything thats already EOL
// @TODO: This should be iteration limited to prevent FPS lag // @TODO: This should be iteration limited to prevent FPS lag
{ [GVAR(syncedEvents), {
private _name = _x; _value params ["_eventTime", "_eventLog", "_globalEventTTL"];
private _data = HASH_GET(GVAR(syncedEvents),_name);
_data params ["_eventTime", "_eventLog", "_globalEventTTL"];
private _newEventLog = []; private _newEventLog = [];
@ -55,8 +52,8 @@ if (!isServer) exitWith {false};
false false
} count _eventLog; } count _eventLog;
_data set [1, _newEventLog]; _value set [1, _newEventLog];
false false
} count (GVAR(syncedEvents) select 0); }] call CBA_fnc_hashEachPair;
// @TODO: Next, detect if we had a new request from a JIP player, and we need to continue syncing events // @TODO: Next, detect if we had a new request from a JIP player, and we need to continue syncing events

View File

@ -0,0 +1 @@
z\ace\addons\dogtags

View File

@ -4,8 +4,8 @@ class RscStructuredText;
class RscTitles { class RscTitles {
class GVAR(singleTag) { class GVAR(singleTag) {
idd = -1; idd = -1;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(tag)),_this select 0)]); onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(tag),_this select 0)]);
onUnload = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(tag)),nil)]); onUnload = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(tag),nil)]);
movingEnable = false; movingEnable = false;
duration = 5; duration = 5;
fadeIn = 0.2; fadeIn = 0.2;
@ -49,8 +49,8 @@ class RscTitles {
}; };
class GVAR(doubleTag): GVAR(singleTag) { class GVAR(doubleTag): GVAR(singleTag) {
idd = -1; idd = -1;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(tag)),_this select 0)]); onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(tag),_this select 0)]);
onUnload = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(tag)),nil)]); onUnload = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(tag),nil)]);
class controls: controls { class controls: controls {
class background: background { class background: background {

View File

@ -9,3 +9,4 @@ Adds options to check and take dog tag from dead or unconscious units
The people responsible for merging changes to this component or answering potential questions. The people responsible for merging changes to this component or answering potential questions.
- [SzwedzikPL](https://github.com/SzwedzikPL) - [SzwedzikPL](https://github.com/SzwedzikPL)
- [esteldunedain](https://github.com/esteldunedain)

View File

@ -2,12 +2,14 @@
class CfgPatches { class CfgPatches {
class ADDON { class ADDON {
name = COMPONENT_NAME;
units[] = {}; units[] = {};
weapons[] = {}; weapons[] = {};
requiredVersion = REQUIRED_VERSION; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"}; requiredAddons[] = {"ace_common"};
author[] = {"SzwedzikPL"}; author = ECSTRING(common,ACETeam);
authorUrl = "https://github.com/SzwedzikPL/"; authors[] = {"SzwedzikPL"};
url = ECSTRING(main,URL);
VERSION_CONFIG; VERSION_CONFIG;
}; };
}; };

View File

@ -9,6 +9,9 @@
* Return Value: * Return Value:
* Children actions <ARRAY> * Children actions <ARRAY>
* *
* Example:
* _childrenActions = [unit, player] call ace_dogtags_fnc_addDogtagActions
*
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -1,6 +1,6 @@
/* /*
* Author: SzwedzikPL * Author: SzwedzikPL
* Adds dogtag item to unit (triggered by server) * Adds dogtag item to unit (triggered by server).
* *
* Arguments: * Arguments:
* 0: Item class <STRING> * 0: Item class <STRING>
@ -9,6 +9,9 @@
* Return Value: * Return Value:
* None * None
* *
* Example:
* ["itemClass", ["name", "610-27-5955", "A POS"]] call ace_dogtags_fnc_addDogtagItem
*
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -8,6 +8,9 @@
* Return Value: * Return Value:
* A random blood type <STRING> * A random blood type <STRING>
* *
* Example:
* _bloodType = ["name"] call ace_dogtags_fnc_bloodType
*
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -9,6 +9,9 @@
* Return Value: * Return Value:
* True if dogtag can be checked <BOOL> * True if dogtag can be checked <BOOL>
* *
* Example:
* _canCheck = [player, unit] call ace_dogtags_fnc_canCheckDogtag
*
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -9,6 +9,9 @@
* Return Value: * Return Value:
* True if dogtag can be taken <BOOL> * True if dogtag can be taken <BOOL>
* *
* Example:
* _canTake = [player, unit] call ace_dogtags_fnc_canTakeDogtag
*
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -1,6 +1,6 @@
/* /*
* Author: SzwedzikPL * Author: SzwedzikPL
* Checks unit dogtag * Checks unit dogtag.
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Player <OBJECT>
@ -9,6 +9,9 @@
* Return Value: * Return Value:
* None * None
* *
* Example:
* [player, unit] call ace_dogtags_fnc_checkDogtag
*
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -1,6 +1,6 @@
/* /*
* Author: SzwedzikPL * Author: SzwedzikPL
* Check dogtag self menu action * Check dogtag self menu action.
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Player <OBJECT>
@ -8,7 +8,10 @@
* 2: Item class <STRING> * 2: Item class <STRING>
* *
* Return Value: * Return Value:
* Mone * None
*
* Example:
* [player, unit, "itemClass"] call ace_dogtags_fnc_checkDogtagItem
* *
* Public: No * Public: No
*/ */

View File

@ -1,12 +1,18 @@
/* /*
* Author: esteldunedain * Author: esteldunedain
* Get unit dogtag data * Get unit dogtag data.
* *
* Arguments: * Arguments:
* 0: Target <OBJECT> * 0: Target <OBJECT>
* *
* Return Value: * Return Value:
* None * Dogtag Data <ARRAY>
* 0: Name <STRING>
* 1: SSN <STRING>
* 2: Blood Type <STRING>
*
* Example:
* _dogtagData = [unit, player] call ace_dogtags_fnc_getDogtagData
* *
* Public: No * Public: No
*/ */

View File

@ -1,6 +1,6 @@
/* /*
* Author: SzwedzikPL * Author: SzwedzikPL
* Server: creates new dogtag item and send it to client * Server: creates new dogtag item and send it to client.
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Player <OBJECT>
@ -9,6 +9,9 @@
* Return Value: * Return Value:
* None * None
* *
* Example:
* [player, unit] call ace_dogtags_fnc_getDogtagItem
*
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -1,6 +1,6 @@
/* /*
* Author: SzwedzikPL * Author: SzwedzikPL
* Server: returns to client data on given dogtag * Server: returns to client data on given dogtag.
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Player <OBJECT>
@ -9,11 +9,14 @@
* Return Value: * Return Value:
* None * None
* *
* Example:
* [player, unit] call ace_dogtags_fnc_sendDogtagData
*
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
if(!isServer) exitWith {}; if (!isServer) exitWith {};
params ["_target", "_item"]; params ["_target", "_item"];
TRACE_2("sendDogtagData",_target,_item); TRACE_2("sendDogtagData",_target,_item);

View File

@ -1,14 +1,17 @@
/* /*
* Author: SzwedzikPL * Author: SzwedzikPL
* Shows dogtag * Shows dogtag.
* *
* Arguments: * Arguments:
* 0: Dog tag data <ARRAY> * 0: Dogtag data <ARRAY>
* 1: Display as double tag <BOOLEAN> * 1: Display as double tag <BOOLEAN>
* *
* Return Value: * Return Value:
* None * None
* *
* Example:
* [["name", "610-27-5955", "A POS"], true] call ace_dogtags_fnc_showDogtag
*
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -9,7 +9,7 @@
* A random three/two/four format social security number <STRING> * A random three/two/four format social security number <STRING>
* *
* Example: * Example:
* ["AAA"] call ace_dogtags_fnc_ssn * _ssn = ["AAA"] call ace_dogtags_fnc_ssn
* *
* Public: No * Public: No
*/ */

View File

@ -1,7 +1,7 @@
/* /*
* Author: SzwedzikPL * Author: SzwedzikPL
* If dogtag is not already taken triggers event on server * If dogtag is not already taken triggers event on server.
* If dogtag already taken displays info about it * If dogtag already taken displays info about it.
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Player <OBJECT>
@ -10,6 +10,9 @@
* Return Value: * Return Value:
* None * None
* *
* Example:
* [player, unit] call ace_dogtags_fnc_takeDogtag
*
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -1,4 +1,5 @@
#define COMPONENT dogtags #define COMPONENT dogtags
#define COMPONENT_BEAUTIFIED Dogtags
#include "\z\ace\addons\main\script_mod.hpp" #include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL // #define DEBUG_MODE_FULL

View File

@ -48,14 +48,6 @@ class Extended_Killed_EventHandlers {
}; };
}; };
class Extended_AnimChanged_EventHandlers {
class CAManBase {
class ADDON {
animChanged = QUOTE(_this call DFUNC(handleAnimChanged));
};
};
};
class Extended_DisplayLoad_EventHandlers { class Extended_DisplayLoad_EventHandlers {
class RscDisplayMission { class RscDisplayMission {
ADDON = QUOTE(_this call COMPILE_FILE(XEH_missionDisplayLoad)); ADDON = QUOTE(_this call COMPILE_FILE(XEH_missionDisplayLoad));

View File

@ -20,9 +20,9 @@ if (isNil "ACE_maxWeightCarry") then {
["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition); ["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition);
// release object on player change. This does work when returning to lobby, but not when hard disconnecting. // release object on player change. This does work when returning to lobby, but not when hard disconnecting.
["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addEventHandler; ["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler;
["vehicle", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call CBA_fnc_addEventHandler; ["vehicle", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call CBA_fnc_addPlayerEventHandler;
["weapon", FUNC(handlePlayerWeaponChanged)] call CBA_fnc_addEventHandler; ["weapon", FUNC(handlePlayerWeaponChanged)] call CBA_fnc_addPlayerEventHandler;
// handle waking up dragged unit and falling unconscious while dragging // handle waking up dragged unit and falling unconscious while dragging
["ace_unconscious", {_this call FUNC(handleUnconscious)}] call CBA_fnc_addEventHandler; ["ace_unconscious", {_this call FUNC(handleUnconscious)}] call CBA_fnc_addEventHandler;

View File

@ -56,6 +56,9 @@ _unit setVariable [QGVAR(ReleaseActionID), [
{[_this select 0, (_this select 0) getVariable [QGVAR(carriedObject), objNull]] call FUNC(dropObject_carry)} {[_this select 0, (_this select 0) getVariable [QGVAR(carriedObject), objNull]] call FUNC(dropObject_carry)}
] call EFUNC(common,addActionEventHandler)]; ] call EFUNC(common,addActionEventHandler)];
// add anim changed EH
[_unit, "AnimChanged", FUNC(handleAnimChanged), [_unit]] call CBA_fnc_addBISEventHandler;
// show mouse hint // show mouse hint
if (_target isKindOf "CAManBase") then { if (_target isKindOf "CAManBase") then {
[localize LSTRING(Drop), "", ""] call EFUNC(interaction,showMouseHint); [localize LSTRING(Drop), "", ""] call EFUNC(interaction,showMouseHint);

View File

@ -49,6 +49,9 @@ _unit setVariable [QGVAR(ReleaseActionID), [
{[_this select 0, (_this select 0) getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject)} {[_this select 0, (_this select 0) getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject)}
] call EFUNC(common,addActionEventHandler)]; ] call EFUNC(common,addActionEventHandler)];
// add anim changed EH
[_unit, "AnimChanged", FUNC(handleAnimChanged), [_unit]] call CBA_fnc_addBISEventHandler;
// show mouse hint // show mouse hint
[localize LSTRING(Drop), ""] call EFUNC(interaction,showMouseHint); [localize LSTRING(Drop), ""] call EFUNC(interaction,showMouseHint);

View File

@ -17,6 +17,13 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_unit", "_anim"]; params ["_unit", "_anim"];
_thisArgs params ["_realUnit"];
TRACE_4("params",_unit,_anim,_realUnit,_thisID);
if (_unit != _realUnit) exitWith {
TRACE_2("respawn (unit changed) - remove EH",_unit,_realUnit);
_unit removeEventHandler ["AnimChanged", _thisID];
};
if (_unit getVariable [QGVAR(isDragging), false]) then { if (_unit getVariable [QGVAR(isDragging), false]) then {
@ -25,19 +32,25 @@ if (_unit getVariable [QGVAR(isDragging), false]) then {
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
if (!isNull _draggedObject) then { if (!isNull _draggedObject) then {
TRACE_2("stop drag",_unit,_draggedObject);
[_unit, _draggedObject] call FUNC(dropObject); [_unit, _draggedObject] call FUNC(dropObject);
}; };
}; };
}; } else {
if (_unit getVariable [QGVAR(isCarrying), false]) then { if (_unit getVariable [QGVAR(isCarrying), false]) then {
// drop carried object when not standing; also some exceptions when picking up crate // drop carried object when not standing; also some exceptions when picking up crate
if (stance _unit != "STAND" && {_anim != "amovpercmstpsnonwnondnon"}) then { if (stance _unit != "STAND" && {_anim != "amovpercmstpsnonwnondnon"}) then {
private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
if (!isNull _carriedObject) then { if (!isNull _carriedObject) then {
[_unit, _carriedObject] call FUNC(dropObject_carry); TRACE_2("stop carry",_unit,_carriedObject);
[_unit, _carriedObject] call FUNC(dropObject_carry);
};
}; };
} else {
TRACE_1("not drag/carry - remove EH",_unit);
_unit removeEventHandler ["AnimChanged", _thisID];
}; };
}; };

View File

@ -60,6 +60,13 @@ class CfgVehicles {
icon = QPATHTOF(UI\Defuse_ca.paa); icon = QPATHTOF(UI\Defuse_ca.paa);
}; };
}; };
};
class ACE_DefuseObject_Large: ACE_DefuseObject {
class ACE_Actions: ACE_Actions {
class ACE_Defuse: ACE_Defuse {
distance = 1.5;
};
};
}; };
class ACE_Explosives_Place: Items_base_F { class ACE_Explosives_Place: Items_base_F {

View File

@ -35,7 +35,6 @@ if (!("ACE_DefusalKit" in (items ACE_player))) exitWith {};
{deleteVehicle _x;} forEach _addedDefuseHelpers; {deleteVehicle _x;} forEach _addedDefuseHelpers;
[_pfID] call CBA_fnc_removePerFrameHandler; [_pfID] call CBA_fnc_removePerFrameHandler;
} else { } else {
private ["_defuseHelper"];
// Prevent Rare Error when ending mission with interact key down: // Prevent Rare Error when ending mission with interact key down:
if (isNull ace_player) exitWith {}; if (isNull ace_player) exitWith {};
@ -43,8 +42,12 @@ if (!("ACE_DefusalKit" in (items ACE_player))) exitWith {};
if (((getPosASL ace_player) distance _setPosition) > 5) then { if (((getPosASL ace_player) distance _setPosition) > 5) then {
{ {
if (((_x distance ACE_player) < 15) && {!(_x in _minesHelped)}) then { if (((_x distance ACE_player) < 15) && {!(_x in _minesHelped)}) then {
TRACE_2("Making Defuse Helper",(_x),(typeOf _x)); TRACE_3("Making Defuse Helper",(_x),(typeOf _x),(_x isKindOf "UnderwaterMine_Range_Ammo"));
_defuseHelper = "ACE_DefuseObject" createVehicleLocal (getPos _x); private _defuseHelper = if (_x isKindOf "UnderwaterMine_Range_Ammo") then {
"ACE_DefuseObject_Large" createVehicleLocal (getPos _x);
} else {
"ACE_DefuseObject" createVehicleLocal (getPos _x);
};
private _config = configFile >> "CfgAmmo" >> typeOf _x; private _config = configFile >> "CfgAmmo" >> typeOf _x;

View File

@ -2,14 +2,15 @@
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
GVAR(lastFPTime) = -1;
GVAR(fingersHash) = HASH_CREATE;
GVAR(pfeh_id) = -1;
["ace_settingsInitialized", { ["ace_settingsInitialized", {
//If not enabled, dont't bother adding eventhandler //If not enabled, dont't bother adding eventhandler
TRACE_1("ace_settingsInitialized eh", GVAR(enabled)); TRACE_1("ace_settingsInitialized eh", GVAR(enabled));
if (!GVAR(enabled)) exitWith {}; if (!GVAR(enabled)) exitWith {};
GVAR(lastFPTime) = -1;
GVAR(fingersHash) = [] call CBA_fnc_hashCreate;
GVAR(pfeh_id) = -1;
[QGVAR(fingered), {_this call FUNC(incomingFinger)}] call CBA_fnc_addEventHandler; [QGVAR(fingered), {_this call FUNC(incomingFinger)}] call CBA_fnc_addEventHandler;
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;

View File

@ -28,8 +28,9 @@ private _fingerPos = if (_sourceUnit == ACE_player) then {
TRACE_3("incoming finger:", _sourceUnit, _fingerPosPrecise, _fingerPos); TRACE_3("incoming finger:", _sourceUnit, _fingerPosPrecise, _fingerPos);
private _data = [diag_tickTime, _fingerPos, ([_sourceUnit, false, true] call EFUNC(common,getName))]; private _data = [diag_tickTime, _fingerPos, ([_sourceUnit, false, true] call EFUNC(common,getName))];
HASH_SET(GVAR(fingersHash), _sourceUnit, _data); [GVAR(fingersHash), _sourceUnit, _data] call CBA_fnc_hashSet;
if (GVAR(pfeh_id) == -1) then { if (GVAR(pfeh_id) == -1) then {
GVAR(pfeh_id) = [DFUNC(perFrameEH), 0, []] call CBA_fnc_addPerFrameHandler; GVAR(pfeh_id) = [DFUNC(perFrameEH), 0, []] call CBA_fnc_addPerFrameHandler;
TRACE_1("Started PFEH", GVAR(pfeh_id));
}; };

View File

@ -15,20 +15,19 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
if (!alive ACE_player) then {GVAR(fingersHash) = HASH_CREATE;}; if (!alive ACE_player) then {GVAR(fingersHash) = [] call CBA_fnc_hashCreate;};
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, ACE_player, ["isNotInside"]] call EFUNC(common,canInteractWith)) then {GVAR(fingersHash) = HASH_CREATE;}; if !([ACE_player, ACE_player, ["isNotInside"]] call EFUNC(common,canInteractWith)) then {GVAR(fingersHash) = [] call CBA_fnc_hashCreate;};
// Make sure player is dismounted or in a static weapon: // Make sure player is dismounted or in a static weapon:
if ((ACE_player != vehicle ACE_player) && {!((vehicle ACE_player) isKindOf "StaticWeapon")}) then {GVAR(fingersHash) = HASH_CREATE;}; if ((ACE_player != vehicle ACE_player) && {!((vehicle ACE_player) isKindOf "StaticWeapon")}) then {GVAR(fingersHash) = [] call CBA_fnc_hashCreate;};
private _iconSize = BASE_SIZE * 0.10713 * (call EFUNC(common,getZoom)); private _iconSize = BASE_SIZE * 0.10713 * (call EFUNC(common,getZoom));
{ [+GVAR(fingersHash), {
private _data = HASH_GET(GVAR(fingersHash), _x); _value params ["_lastTime", "_pos", "_name"];
_data params ["_lastTime", "_pos", "_name"];
private _timeLeftToShow = _lastTime + FP_TIMEOUT - diag_tickTime; private _timeLeftToShow = _lastTime + FP_TIMEOUT - diag_tickTime;
if (_timeLeftToShow <= 0) then { if (_timeLeftToShow <= 0) then {
HASH_REM(GVAR(fingersHash), _x); [GVAR(fingersHash), _key] call CBA_fnc_hashRem;
} else { } else {
private _drawColor = + GVAR(indicatorColor); private _drawColor = + GVAR(indicatorColor);
// Fade out: // Fade out:
@ -36,9 +35,10 @@ private _iconSize = BASE_SIZE * 0.10713 * (call EFUNC(common,getZoom));
drawIcon3D [QPATHTOF(UI\fp_icon2.paa), _drawColor, ASLtoAGL _pos, _iconSize, _iconSize, 0, _name, 1, 0.03, "RobotoCondensed"]; drawIcon3D [QPATHTOF(UI\fp_icon2.paa), _drawColor, ASLtoAGL _pos, _iconSize, _iconSize, 0, _name, 1, 0.03, "RobotoCondensed"];
}; };
} count (GVAR(fingersHash) select 0); }] call CBA_fnc_hashEachPair;
if ((count (GVAR(fingersHash) select 0)) == 0) then { if ((GVAR(fingersHash) select 1) isEqualTo []) then {
TRACE_1("Ending PFEH", GVAR(pfeh_id));
[GVAR(pfeh_id)] call CBA_fnc_removePerFrameHandler; [GVAR(pfeh_id)] call CBA_fnc_removePerFrameHandler;
GVAR(pfeh_id) = -1; GVAR(pfeh_id) = -1;
}; };

View File

@ -9,7 +9,6 @@ PREP(collectActiveActionTree);
PREP(createAction); PREP(createAction);
PREP(ctrlSetParsedTextCached); PREP(ctrlSetParsedTextCached);
PREP(findActionNode); PREP(findActionNode);
PREP(handlePlayerChanged);
PREP(isSubPath); PREP(isSubPath);
PREP(keyDown); PREP(keyDown);
PREP(keyUp); PREP(keyUp);

View File

@ -3,6 +3,8 @@
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
GVAR(blockDefaultActions) = [];
GVAR(cachedBuildingTypes) = []; GVAR(cachedBuildingTypes) = [];
GVAR(cachedBuildingActionPairs) = []; GVAR(cachedBuildingActionPairs) = [];
@ -53,9 +55,6 @@ GVAR(ParsedTextCached) = [];
[GVAR(openedMenuType), false] call FUNC(keyUp); [GVAR(openedMenuType), false] call FUNC(keyUp);
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;
// disable firing while the interact menu is is is opened
["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler;
// background options // background options
["ace_interactMenuOpened", { ["ace_interactMenuOpened", {
if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), true] call EFUNC(common,blurScreen);}; if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), true] call EFUNC(common,blurScreen);};

View File

@ -1,30 +0,0 @@
/*
* Author: commy2
* Disables firing while the menu is opened. Called from playerChanged eh.
*
* Arguments:
* 0: New unit to add the addAction eh <OBJECT>
* 1: Old unit to remove the addAction eh <STRING>
*
* Return Value:
* None
*/
#include "script_component.hpp"
params ["_newUnit", "_oldUnit"];
// add to new unit
private _ehid = [_newUnit, "DefaultAction", {GVAR(openedMenuType) >= 0}, {
if (!GVAR(actionOnKeyRelease) && GVAR(actionSelected)) then {
[GVAR(openedMenuType),true] call FUNC(keyUp);
};
}] call EFUNC(common,addActionEventHandler);
_newUnit setVariable [QGVAR(AAEHID), _ehid];
// remove from old unit
_ehid = _oldUnit getVariable [QGVAR(AAEHID), -1];
[_oldUnit, "DefaultAction", _ehid] call EFUNC(common,removeActionEventHandler);
_oldUnit setVariable [QGVAR(AAEHID), -1];

View File

@ -104,4 +104,22 @@ if (GVAR(openedMenuType) == 0) then {
["ace_interactMenuOpened", [_menuType]] call CBA_fnc_localEvent; ["ace_interactMenuOpened", [_menuType]] call CBA_fnc_localEvent;
//Remove the old "DefaultAction" action event handler if it already exists
GVAR(blockDefaultActions) params [["_player", objNull], ["_ehid", -1]];
TRACE_2("blockDefaultActions",_player,_ehid);
if (!isNull _player) then {
[_player, "DefaultAction", _ehid] call EFUNC(common,removeActionEventHandler);
GVAR(blockDefaultActions) = [];
};
//Add the "DefaultAction" action event handler
if (alive ACE_player) then {
private _ehid = [ACE_player, "DefaultAction", {GVAR(openedMenuType) >= 0}, {
if (!GVAR(actionOnKeyRelease) && GVAR(actionSelected)) then {
[GVAR(openedMenuType),true] call FUNC(keyUp);
};
}] call EFUNC(common,addActionEventHandler);
TRACE_2("Added",ACE_player,_ehid);
GVAR(blockDefaultActions) = [ACE_player, _ehid];
};
true true

View File

@ -46,6 +46,14 @@ if(GVAR(actionSelected)) then {
["ace_interactMenuClosed", [GVAR(openedMenuType)]] call CBA_fnc_localEvent; ["ace_interactMenuClosed", [GVAR(openedMenuType)]] call CBA_fnc_localEvent;
//Remove the "DefaultAction" action event handler
GVAR(blockDefaultActions) params [["_player", objNull], ["_ehid", -1]];
TRACE_2("blockDefaultActions",_player,_ehid);
if (!isNull _player) then {
[_player, "DefaultAction", _ehid] call EFUNC(common,removeActionEventHandler);
GVAR(blockDefaultActions) = [];
};
GVAR(keyDown) = false; GVAR(keyDown) = false;
GVAR(keyDownSelfAction) = false; GVAR(keyDownSelfAction) = false;
GVAR(openedMenuType) = -1; GVAR(openedMenuType) = -1;

View File

@ -11,6 +11,6 @@ ACE_DEFAULT_LASER_CODE = 1001;
ACE_DEFAULT_LASER_WAVELENGTH = 1550; ACE_DEFAULT_LASER_WAVELENGTH = 1550;
ACE_DEFAULT_LASER_BEAMSPREAD = 1; ACE_DEFAULT_LASER_BEAMSPREAD = 1;
GVAR(laserEmitters) = HASH_CREATE; GVAR(laserEmitters) = [] call CBA_fnc_hashCreate;
ADDON = true; ADDON = true;

View File

@ -5,5 +5,5 @@ ACE_LOGINFO("Laser Emitter Dump");
{ {
ACE_LOGINFO_1(" %1", _x); ACE_LOGINFO_1(" %1", _x);
ACE_LOGINFO_1(" %1",HASH_GET(GVAR(laserEmitters),_x)); ACE_LOGINFO_1(" %1",[ARR_2(GVAR(laserEmitters),_x)] call CBA_fnc_hashGet);
} forEach GVAR(laserEmitters) select 0; } forEach (GVAR(laserEmitters) select 1);

View File

@ -3,6 +3,6 @@
private ["_uuid"]; private ["_uuid"];
_uuid = _this select 0; _uuid = _this select 0;
if(HASH_HASKEY(GVAR(laserEmitters), _uuid)) then { if ([GVAR(laserEmitters), _uuid] call CBA_fnc_hashHasKey) then {
HASH_REM(GVAR(laserEmitters), _uuid); [GVAR(laserEmitters), _uuid] call CBA_fnc_hashRem;
}; };

View File

@ -4,4 +4,4 @@
private ["_uuid", "_args"]; private ["_uuid", "_args"];
_uuid = _this select 0; _uuid = _this select 0;
_args = _this select 1; _args = _this select 1;
HASH_SET(GVAR(laserEmitters), _uuid, _args); [GVAR(laserEmitters), _uuid, _args] call CBA_fnc_hashSet;

View File

@ -76,7 +76,7 @@ _finalOwner = nil;
} forEach (_res select 2); } forEach (_res select 2);
}; };
}; };
} forEach (GVAR(laserEmitters) select 1); } forEach (GVAR(laserEmitters) select 2);
if((count _spots) > 0) then { if((count _spots) > 0) then {
_bucketPos = nil; _bucketPos = nil;
@ -123,7 +123,7 @@ if((count _spots) > 0) then {
} forEach _buckets; } forEach _buckets;
_finalBucket = _finalBuckets select _largestIndex; _finalBucket = _finalBuckets select _largestIndex;
_owners = HASH_CREATE; _owners = [] call CBA_fnc_hashCreate;
if(count _finalBucket > 0) then { if(count _finalBucket > 0) then {
_avgX = 0; _avgX = 0;
@ -135,11 +135,11 @@ if((count _spots) > 0) then {
_avgY = _avgY + ((_x select 0) select 1); _avgY = _avgY + ((_x select 0) select 1);
_avgZ = _avgZ + ((_x select 0) select 2); _avgZ = _avgZ + ((_x select 0) select 2);
_owner = _x select 1; _owner = _x select 1;
if(HASH_HASKEY(_owners, _owner)) then { if ([_owners, _owner] call CBA_fnc_hashHasKey) then {
_count = HASH_GET(_owners, _owner); private _count = [_owners, _owner] call CBA_fnc_hashGet;
HASH_SET(_owners, _owner, _count+1); [_owners, _owner, _count + 1] call CBA_fnc_hashSet;
} else { } else {
HASH_SET(_owners, _owner, 1); [_owners, _owner, 1] call CBA_fnc_hashSet;
}; };
} forEach _finalBucket; } forEach _finalBucket;
_count = count _finalBucket; _count = count _finalBucket;

View File

@ -10,7 +10,7 @@ class CfgWeapons {
picture = QPATHTOF(ui\item_wirecutter_ca.paa); picture = QPATHTOF(ui\item_wirecutter_ca.paa);
scope = 2; scope = 2;
class ItemInfo: InventoryItem_Base_F { class ItemInfo: InventoryItem_Base_F {
mass = 65; mass = 25;
}; };
}; };
}; };

View File

@ -93,18 +93,6 @@
#define PREP_MODULE(folder) [] call compile preprocessFileLineNumbers QPATHTOF(folder\__PREP__.sqf) #define PREP_MODULE(folder) [] call compile preprocessFileLineNumbers QPATHTOF(folder\__PREP__.sqf)
#define HASH_CREATE ([] call EFUNC(common,hashCreate))
#define HASH_SET(hash, key, val) ([hash, key, val, __FILE__, __LINE__] call EFUNC(common,hashSet))
#define HASH_GET(hash, key) ([hash, key, __FILE__, __LINE__] call EFUNC(common,hashGet))
#define HASH_REM(hash, key) ([hash, key, __FILE__, __LINE__] call EFUNC(common,hashRem))
#define HASH_HASKEY(hash, key) ([hash, key, __FILE__, __LINE__] call EFUNC(common,hashHasKey))
#define HASHLIST_CREATELIST(keys) ([keys] call EFUNC(common,hashListCreateList))
#define HASHLIST_CREATEHASH(hashList) ([hashList] call EFUNC(common,hashListCreateHash))
#define HASHLIST_SELECT(hashList, index) ([hashList, index, __FILE__, __LINE__] call EFUNC(common,hashListSelect))
#define HASHLIST_SET(hashList, index, value) ([hashList, index, value, __FILE__, __LINE__] call EFUNC(common,hashListSet))
#define HASHLIST_PUSH(hashList, value) ([hashList, value, __FILE__, __LINE__] call EFUNC(common,hashListPush))
#define ACE_isHC (!hasInterface && !isDedicated) #define ACE_isHC (!hasInterface && !isDedicated)
#define IDC_STAMINA_BAR 193 #define IDC_STAMINA_BAR 193

View File

@ -46,8 +46,8 @@ params ["_mapHandle"];
_grpName = groupID _group; _grpName = groupID _group;
// If color settings for the group exist, then use those, otherwise fall back to the default colors // If color settings for the group exist, then use those, otherwise fall back to the default colors
_color = if (HASH_HASKEY(GVAR(GroupColorConfigurationMapping),_grpName)) then { _color = if ([GVAR(GroupColorConfigurationMapping), _grpName] call CBA_fnc_hashHasKey) then {
(GVAR(GroupColorConfigurations) select (HASH_GET(GVAR(GroupColorConfigurationMapping),_grpName))) select (_x != leader _group) (GVAR(GroupColorConfigurations) select ([GVAR(GroupColorConfigurationMapping), _grpName] call CBA_fnc_hashGet)) select (_x != leader _group)
} else { } else {
if (_x == leader _group) then {GVAR(defaultLeadColor)} else {GVAR(defaultColor)}; if (_x == leader _group) then {GVAR(defaultLeadColor)} else {GVAR(defaultColor)};
}; };

View File

@ -31,15 +31,15 @@ if (!([_color] call FUNC(isValidColorArray))) exitWith {ERROR("color is not a va
// If we already have color configurations from another source, use those, otherwise use default. // If we already have color configurations from another source, use those, otherwise use default.
_configurations = if (isNil QGVAR(GroupColorConfigurations)) then { [] } else { +GVAR(GroupColorConfigurations) }; _configurations = if (isNil QGVAR(GroupColorConfigurations)) then { [] } else { +GVAR(GroupColorConfigurations) };
_configurationGroupMappings = if(isNil QGVAR(GroupColorConfigurationMapping)) then { HASH_CREATE } else { +GVAR(GroupColorConfigurationMapping) }; _configurationGroupMappings = if(isNil QGVAR(GroupColorConfigurationMapping)) then { [] call CBA_fnc_hashCreate } else { +GVAR(GroupColorConfigurationMapping) };
// Save custom color configuration and keep the index of the entry. // Save custom color configuration and keep the index of the entry.
_configurationIndex = _configurations pushBack [_leadColor, _color]; _configurationIndex = _configurations pushBack [_leadColor, _color];
// Add all synchronized groups and reference custom configuration for them // Add all synchronized groups and reference custom configuration for them
{ {
HASH_SET(_configurationGroupMappings,groupID (group _x),_configurationIndex); [_configurationGroupMappings, groupID group _x, _configurationIndex] call CBA_fnc_hashSet;
} count _units; } forEach _units;
[QGVAR(GroupColorConfigurations), _configurations, false, true] call EFUNC(common,setSetting); [QGVAR(GroupColorConfigurations), _configurations, false, true] call EFUNC(common,setSetting);
[QGVAR(GroupColorConfigurationMapping), _configurationGroupMappings, false, true] call EFUNC(common,setSetting); [QGVAR(GroupColorConfigurationMapping), _configurationGroupMappings, false, true] call EFUNC(common,setSetting);

View File

@ -28,7 +28,7 @@ private _bloodLossOnSelection = 0;
}; };
} forEach (_target getvariable [QGVAR(openWounds), []]); } forEach (_target getvariable [QGVAR(openWounds), []]);
if (_bloodLossOnSelection >=1 ) then { if (_bloodLossOnSelection >= 0.15) then {
_actionData set [2, QPATHTOF(UI\icons\medical_crossRed.paa)]; _actionData set [2, QPATHTOF(UI\icons\medical_crossRed.paa)];
} else { } else {
if (_bloodLossOnSelection > 0 ) then { if (_bloodLossOnSelection > 0 ) then {

View File

@ -57,7 +57,10 @@ private _exit = false;
_woundEffectiveness = getNumber (_woundTreatmentConfig >> "effectiveness"); _woundEffectiveness = getNumber (_woundTreatmentConfig >> "effectiveness");
}; };
} else { } else {
ACE_LOGWARNING_2("No config for wound type [%1] config base [%2]", _className, _config); //Basic medical bandage just has a base level config (same effectivenes for all wound types)
if (_bandage != "Bandage") then {
ACE_LOGWARNING_2("No config for wound type [%1] config base [%2]", _className, _config);
};
}; };
TRACE_2("Wound classes: ", _specificClass, _classID); TRACE_2("Wound classes: ", _specificClass, _classID);
@ -105,8 +108,10 @@ if (GVAR(healHitPointAfterAdvBandage) || {GVAR(level) < 2}) then {
// Tally of unbandaged wounds to each body part. // Tally of unbandaged wounds to each body part.
private _headWounds = 0; private _headWounds = 0;
private _bodyWounds = 0; private _bodyWounds = 0;
private _legsWounds = 0; private _leftArmWounds = 0;
private _armWounds = 0; private _leftLegWounds = 0;
private _rightArmWounds = 0;
private _rightLegWounds = 0;
// Loop through all current wounds and add up the number of unbandaged wounds on each body part. // Loop through all current wounds and add up the number of unbandaged wounds on each body part.
{ {
@ -129,42 +134,52 @@ if (GVAR(healHitPointAfterAdvBandage) || {GVAR(level) < 2}) then {
// Left Arm // Left Arm
case 2: { case 2: {
_armWounds = _armWounds + (_numOpenWounds * _bloodLoss); _leftArmWounds = _leftArmWounds + (_numOpenWounds * _bloodLoss);
}; };
// Right Arm // Right Arm
case 3: { case 3: {
_armWounds = _armWounds + (_numOpenWounds * _bloodLoss); _rightArmWounds = _rightArmWounds + (_numOpenWounds * _bloodLoss);
}; };
// Left Leg // Left Leg
case 4: { case 4: {
_legsWounds = _legsWounds + (_numOpenWounds * _bloodLoss); _leftLegWounds = _leftLegWounds + (_numOpenWounds * _bloodLoss);
}; };
// Right Leg // Right Leg
case 5: { case 5: {
_legsWounds = _legsWounds + (_numOpenWounds * _bloodLoss); _rightLegWounds = _rightLegWounds + (_numOpenWounds * _bloodLoss);
}; };
}; };
} forEach _currentWounds; } forEach _currentWounds;
// ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]
private _bodyStatus = _target getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]];
// Any body part that has no wounds is healed to full health // Any body part that has no wounds is healed to full health
if (_headWounds == 0) then { if (_headWounds == 0) then {
_target setHitPointDamage ["hitHead", 0.0]; _bodyStatus set [0, 0];
}; };
if (_bodyWounds == 0) then { if (_bodyWounds == 0) then {
_target setHitPointDamage ["hitBody", 0.0]; _bodyStatus set [1, 0];
};
if (_leftArmWounds == 0) then {
_bodyStatus set [2, 0];
};
if (_rightArmWounds == 0) then {
_bodyStatus set [3, 0];
};
if (_leftLegWounds == 0) then {
_bodyStatus set [4, 0];
};
if (_rightLegWounds == 0) then {
_bodyStatus set [5, 0];
}; };
if (_armWounds == 0) then { _target setVariable [QGVAR(bodyPartStatus), _bodyStatus, true];
_target setHitPointDamage ["hitHands", 0.0];
};
if (_legsWounds == 0) then { [_target] call FUNC(handleDamage_advancedSetDamage);
_target setHitPointDamage ["hitLegs", 0.0];
};
}; };
true; true;

View File

@ -22,13 +22,11 @@ class Extended_InitPost_EventHandlers {
class Car { class Car {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(addRepairActions)); init = QUOTE(_this call DFUNC(addRepairActions));
serverInit = QUOTE([ARR_3(_this select 0,1,'ACE_Wheel')] call DFUNC(addSpareParts));
}; };
}; };
class Tank { class Tank {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(addRepairActions)); init = QUOTE(_this call DFUNC(addRepairActions));
serverInit = QUOTE([ARR_3(_this select 0,1,'ACE_Track')] call DFUNC(addSpareParts));
}; };
}; };
class Motorcycle { class Motorcycle {

View File

@ -5,3 +5,14 @@
// wheels // wheels
[QGVAR(setWheelHitPointDamage), {(_this select 0) setHitPointDamage [_this select 1, _this select 2]}] call CBA_fnc_addEventHandler; [QGVAR(setWheelHitPointDamage), {(_this select 0) setHitPointDamage [_this select 1, _this select 2]}] call CBA_fnc_addEventHandler;
if (isServer) then {
["ace_settingsInitialized", {
TRACE_1("ace_settingsInitialized eh", GVAR(addSpareParts));
if (!GVAR(addSpareParts)) exitWith {};
if (!(["ace_cargo"] call EFUNC(common,isModLoaded))) exitWith {};
["Car", "Init", {[_this select 0, 1, "ACE_Wheel"] call FUNC(addSpareParts)}, true, [], true] call CBA_fnc_addClassEventHandler;
["Tank", "Init", {[_this select 0, 1, "ACE_Track"] call FUNC(addSpareParts)}, true, [], true] call CBA_fnc_addClassEventHandler;
}] call CBA_fnc_addEventHandler;
};

View File

@ -132,9 +132,9 @@ _processedHitpoints = [];
// Tracks should always be unique // Tracks should always be unique
if (_hitpoint in _processedHitpoints) exitWith {TRACE_3("Duplicate Track",_hitpoint,_forEachIndex,_selection);}; if (_hitpoint in _processedHitpoints) exitWith {TRACE_3("Duplicate Track",_hitpoint,_forEachIndex,_selection);};
if (_hitpoint == "HitLTrack") then { if (_hitpoint == "HitLTrack") then {
_position = [-1.75, 0, -1.75]; _position = compile format ["private _return = _target selectionPosition ['%1', 'HitPoints']; _return set [1, 0]; _return", _selection];
} else { } else {
_position = [1.75, 0, -1.75]; _position = compile format ["private _return = _target selectionPosition ['%1', 'HitPoints']; _return set [1, 0]; _return", _selection];
}; };
TRACE_4("Adding RepairTrack",_hitpoint,_forEachIndex,_selection,_text); TRACE_4("Adding RepairTrack",_hitpoint,_forEachIndex,_selection,_text);
_condition = {[_this select 1, _this select 0, _this select 2 select 0, "RepairTrack"] call DFUNC(canRepair)}; _condition = {[_this select 1, _this select 0, _this select 2 select 0, "RepairTrack"] call DFUNC(canRepair)};

View File

@ -33,4 +33,6 @@ if (!EGVAR(common,settingsInitFinished)) exitWith {
if (!_force && !GVAR(addSpareParts)) exitWith {}; if (!_force && !GVAR(addSpareParts)) exitWith {};
// Load // Load
["ace_addCargo", [_part, _vehicle, _amount]] call CBA_fnc_localEvent; [{
["ace_addCargo", _this] call CBA_fnc_localEvent;
}, [_part, _vehicle, _amount]] call CBA_fnc_execNextFrame;

View File

@ -0,0 +1,11 @@
class ACE_Settings {
class GVAR(quickTag) {
category = CSTRING(Tagging);
displayName = CSTRING(QuickTag);
description = CSTRING(QuickTagDesc);
typeName = "SCALAR";
value = 1;
values[] = {ECSTRING(Common,Disabled), CSTRING(LastUsed), CSTRING(RandomX), CSTRING(Random)};
isClientSettable = 1;
};
};

View File

@ -0,0 +1,26 @@
class ACE_Tags {
class ACE_XBlack {
displayName = CSTRING(XBlack);
requiredItem = "ACE_SpraypaintBlack";
textures[] = {QPATHTOF(UI\tags\black\0.paa), QPATHTOF(UI\tags\black\1.paa), QPATHTOF(UI\tags\black\2.paa)};
icon = QPATHTOF(UI\icons\iconTaggingBlack.paa);
};
class ACE_XRed {
displayName = CSTRING(XRed);
requiredItem = "ACE_SpraypaintRed";
textures[] = {QPATHTOF(UI\tags\red\0.paa), QPATHTOF(UI\tags\red\1.paa), QPATHTOF(UI\tags\red\2.paa)};
icon = QPATHTOF(UI\icons\iconTaggingRed.paa);
};
class ACE_XGreen {
displayName = CSTRING(XGreen);
requiredItem = "ACE_SpraypaintGreen";
textures[] = {QPATHTOF(UI\tags\green\0.paa), QPATHTOF(UI\tags\green\1.paa), QPATHTOF(UI\tags\green\2.paa)};
icon = QPATHTOF(UI\icons\iconTaggingGreen.paa);
};
class ACE_XBlue {
displayName = CSTRING(XBlue);
requiredItem = "ACE_SpraypaintBlue";
textures[] = {QPATHTOF(UI\tags\blue\0.paa), QPATHTOF(UI\tags\blue\1.paa), QPATHTOF(UI\tags\blue\2.paa)};
icon = QPATHTOF(UI\icons\iconTaggingBlue.paa);
};
};

View File

@ -1,38 +1,59 @@
class CfgVehicles { class CfgVehicles {
class Man; class ACE_Module;
class CAManBase: Man { class ACE_ModuleTagging: ACE_Module {
class ACE_SelfActions { author = ECSTRING(common,ACETeam);
class ACE_Equipment { category = "ACE";
class ACE_TagBlack { displayName = CSTRING(Tagging);
displayName = CSTRING(TagBlack); function = QFUNC(moduleInit);
condition = QUOTE(('ACE_SpraypaintBlack' in items ACE_player) && {[] call FUNC(checkTaggable)}); scope = 2;
statement = QUOTE([ARR_2(ACE_player,'black' call FUNC(getTexture))] call FUNC(tag)); isGlobal = 1;
showDisabled = 0; icon = QPATHTOF(UI\Icon_Module_Tagging_ca.paa);
priority = 3; class Arguments {
icon = QPATHTOF(UI\icons\iconTaggingBlack.paa); class quickTag {
}; displayName = CSTRING(QuickTag);
class ACE_TagRed: ACE_TagBlack { description = CSTRING(QuickTagDesc);
displayName = CSTRING(TagRed); typeName = "NUMBER";
condition = QUOTE(('ACE_SpraypaintRed' in items ACE_player) && {[] call FUNC(checkTaggable)}); class values {
statement = QUOTE([ARR_2(ACE_player,'red' call FUNC(getTexture))] call FUNC(tag)); class disabled {
icon = QPATHTOF(UI\icons\iconTaggingRed.paa); name = ECSTRING(Common,Disabled);
}; value = 0;
class ACE_TagGreen: ACE_TagBlack { };
displayName = CSTRING(TagGreen); class lastUsed {
condition = QUOTE(('ACE_SpraypaintGreen' in items ACE_player) && {[] call FUNC(checkTaggable)}); name = CSTRING(LastUsed);
statement = QUOTE([ARR_2(ACE_player,'green' call FUNC(getTexture))] call FUNC(tag)); value = 1;
icon = QPATHTOF(UI\icons\iconTaggingGreen.paa); default = 1;
}; };
class ACE_TagBlue: ACE_TagBlack { class randomX {
displayName = CSTRING(TagBlue); name = CSTRING(RandomX);
condition = QUOTE(('ACE_SpraypaintBlue' in items ACE_player) && {[] call FUNC(checkTaggable)}); value = 2;
statement = QUOTE([ARR_2(ACE_player,'blue' call FUNC(getTexture))] call FUNC(tag)); };
icon = QPATHTOF(UI\icons\iconTaggingBlue.paa); class random {
name = CSTRING(Random);
value = 3;
};
}; };
}; };
}; };
class ModuleDescription {
description = CSTRING(ModuleDescription);
};
}; };
class Man;
class CAManBase: Man {
class ACE_SelfActions {
class ACE_Tags {
displayName = CSTRING(Tag);
condition = QUOTE(_player call FUNC(checkTaggable));
statement = QUOTE(_player call FUNC(quickTag));
icon = QPATHTOF(UI\icons\iconTaggingBlack.paa);
insertChildren = QUOTE(_player call FUNC(addTagActions));
};
};
};
class Item_Base_F; class Item_Base_F;
class ACE_Item_SpraypaintBlack: Item_Base_F { class ACE_Item_SpraypaintBlack: Item_Base_F {
author = "jokoho48"; author = "jokoho48";

Binary file not shown.

View File

@ -1,5 +1,10 @@
PREP(addCustomTag);
PREP(addTagActions);
PREP(applyCustomTag);
PREP(checkTaggable); PREP(checkTaggable);
PREP(compileConfigTags);
PREP(createTag); PREP(createTag);
PREP(getTexture); PREP(moduleInit);
PREP(quickTag);
PREP(tag); PREP(tag);
PREP(tagTestingThread); PREP(tagTestingThread);

View File

@ -39,6 +39,24 @@ for "_index" from 0 to (_countOptions - 1) do {
}; };
}; };
if (hasInterface) then {
// Compile and cache config tags
call FUNC(compileConfigTags);
// Scripted tag adding EH
[QGVAR(applyCustomTag), FUNC(applyCustomTag)] call CBA_fnc_addEventHandler;
// Keybind
["ACE3 Equipment", QGVAR(quickTag), localize LSTRING(QuickTag), {
// Conditions
if !(ACE_player call FUNC(checkTaggable)) exitWith {false};
// Statement
ACE_player call FUNC(quickTag);
true
}, {false}, [0, [false, false, false]], false] call CBA_fnc_addKeybind; // Unbound
};
if (!isServer) exitWith {}; if (!isServer) exitWith {};
GVAR(testingThread) = false; GVAR(testingThread) = false;

View File

@ -4,4 +4,7 @@ ADDON = false;
#include "XEH_PREP.hpp" #include "XEH_PREP.hpp"
GVAR(cachedTags) = [];
GVAR(cachedRequiredItems) = [];
ADDON = true; ADDON = true;

View File

@ -8,12 +8,14 @@ class CfgPatches {
requiredVersion = REQUIRED_VERSION; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interaction"}; requiredAddons[] = {"ace_interaction"};
author = ECSTRING(common,ACETeam); author = ECSTRING(common,ACETeam);
authors[] = {"BaerMitUmlaut","esteldunedain"}; authors[] = {"BaerMitUmlaut", "esteldunedain", "Jonpas"};
url = ECSTRING(main,URL); url = ECSTRING(main,URL);
VERSION_CONFIG; VERSION_CONFIG;
}; };
}; };
#include "ACE_Settings.hpp"
#include "ACE_Tags.hpp"
#include "CfgEventHandlers.hpp" #include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp" #include "CfgVehicles.hpp"
#include "CfgWeapons.hpp" #include "CfgWeapons.hpp"

View File

@ -0,0 +1,54 @@
/*
* Author: Jonpas
* Adds custom tag. Has to be executed on one machine only.
*
* Arguments:
* 0: Unique Identifier <STRING>
* 1: Display Name <STRING>
* 2: Required Item <STRING>
* 3: Textures Paths <ARRAY>
* 4: Icon Path <STRING> (default: "")
*
* Return Value:
* Sucessfully Added Tag <BOOL>
*
* Example:
* ["ace_victoryRed", "Victory Red", "ACE_SpraypaintRed", ["path\to\texture1.paa", "path\to\texture2.paa"], "path\to\icon.paa"] call ace_tagging_fnc_addCustomTag
*
* Public: Yes
*/
#include "script_component.hpp"
params [
["_identifier", "", [""]],
["_displayName", "", [""]],
["_requiredItem", "", [""]],
["_textures", [], [[]]],
["_icon", "", [""]]
];
// Verify
if (_identifier == "") exitWith {
ACE_LOGERROR("Failed adding custom tag - missing identifier");
};
if (_displayName == "") exitWith {
ACE_LOGERROR_1("Failed adding custom tag: %1 - missing displayName",_identifier);
};
if (_requiredItem == "") exitWith {
ACE_LOGERROR_1("Failed adding custom tag: %1 - missing requiredItem",_identifier);
};
if (!isClass (configFile >> "CfgWeapons" >> _requiredItem)) exitWith {
ACE_LOGERROR_2("Failed adding custom tag: %1 - requiredItem %2 does not exist",_identifier,_requiredItem);
};
if (_textures isEqualTo []) exitWith {
ACE_LOGERROR_1("Failed adding custom tag: %1 - missing textures",_identifier);
};
_identifier = [_identifier] call EFUNC(common,stringRemoveWhiteSpace);
_requiredItem = toLower _requiredItem;
// Add
[QGVAR(applyCustomTag), [_identifier, _displayName, _requiredItem, _textures, _icon]] call CBA_fnc_globalEventJIP;

View File

@ -0,0 +1,46 @@
/*
* Author: Jonpas
* Compiles tags from ACE_Tags and returns children actions.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [unit] call ace_tagging_fnc_addTagActions
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
private _actions = [];
{
_x params ["_class", "_displayName", "_requiredItem", "_textures", "_icon"];
_actions pushBack [
[
format ["ACE_ConfigTag_%1", _class],
_displayName,
_icon,
{
(_this select 2) params ["_unit", "_class", "_textures"];
[_unit, selectRandom _textures] call FUNC(tag);
_unit setVariable [QGVAR(lastUsedTag), _class];
},
{
(_this select 2) params ["_unit", "", "", "_requiredItem"];
_requiredItem in ((items _unit) apply {toLower _x})
},
{},
[_unit, _class, _textures, _requiredItem]
] call EFUNC(interact_menu,createAction),
[],
_unit
];
} forEach GVAR(cachedTags);
_actions

View File

@ -0,0 +1,33 @@
/*
* Author: Jonpas
* Applies custom tag to the cache.
*
* Arguments:
* 0: Unique Identifier <STRING>
* 1: Display Name <STRING>
* 2: Required Item <STRING>
* 3: Textures Paths <ARRAY>
* 4: Icon Path <STRING> (default: "")
*
* Return Value:
* None
*
* Example:
* ["ace_victoryRed", "Victory Red", "ACE_SpraypaintRed", ["path\to\texture1.paa", "path\to\texture2.paa"], "path\to\icon.paa"] call ace_tagging_fnc_addCustomTagLocal
*
* Public: No
*/
#include "script_component.hpp"
params ["_identifier", "_displayName", "_requiredItem"];
// Add only if tag not already added (compare identifiers)
if (GVAR(cachedTags) select {_x select 0 == _identifier} isEqualTo []) then {
GVAR(cachedTags) pushBack _this;
if !(_requiredItem in GVAR(cachedRequiredItems)) then {
GVAR(cachedRequiredItems) pushBack _requiredItem;
};
TRACE_1("Added custom script tag",_this);
} else {
ACE_LOGINFO_2("Tag with selected identifier already exists: %1 (%2)",_identifier,_displayName)
};

View File

@ -3,26 +3,33 @@
* Checks if there is a taggable surface within 2.5m in front of the player. * Checks if there is a taggable surface within 2.5m in front of the player.
* *
* Arguments: * Arguments:
* None * 0: Unit <OBJECT>
* *
* Return Value: * Return Value:
* Is wall taggable <BOOL> * Is surface taggable <BOOL>
* *
* Example: * Example:
* [] call ace_tagging_fnc_checkTaggable * [unit] call ace_tagging_fnc_checkTaggable
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
[[], { params ["_unit"];
private _startPosASL = eyePos ACE_player;
[[_unit], {
params ["_unit"];
// Exit if no required item in inventory
if ((GVAR(cachedRequiredItems) arrayIntersect ((items _unit) apply {toLower _x})) isEqualTo []) exitWith {false};
private _startPosASL = eyePos _unit;
private _cameraPosASL = AGLToASL positionCameraToWorld [0, 0, 0]; private _cameraPosASL = AGLToASL positionCameraToWorld [0, 0, 0];
private _cameraDir = (AGLToASL positionCameraToWorld [0, 0, 1]) vectorDiff _cameraPosASL; private _cameraDir = (AGLToASL positionCameraToWorld [0, 0, 1]) vectorDiff _cameraPosASL;
private _endPosASL = _startPosASL vectorAdd (_cameraDir vectorMultiply 2.5); private _endPosASL = _startPosASL vectorAdd (_cameraDir vectorMultiply 2.5);
private _intersections = lineIntersectsSurfaces [_startPosASL, _endPosASL, ACE_player, objNull, true, 1, "FIRE", "GEOM"]; private _intersections = lineIntersectsSurfaces [_startPosASL, _endPosASL, _unit, objNull, true, 1, "FIRE", "GEOM"];
// If there's no intersections // If there's no intersections
if (_intersections isEqualTo []) exitWith {false}; if (_intersections isEqualTo []) exitWith {false};

View File

@ -0,0 +1,53 @@
/*
* Author: Jonpas
* Compiles and caches tags from ACE_Tags config.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_tagging_fnc_compileConfigTags
*
* Public: No
*/
#include "script_component.hpp"
{
private _failure = false;
private _class = configName _x;
private _displayName = getText (_x >> "displayName");
if (_displayName == "") then {
ACE_LOGERROR_1("Failed compiling ACE_Tags for tag: %1 - missing displayName",_class);
_failure = true;
};
private _requiredItem = toLower (getText (_x >> "requiredItem"));
if (_requiredItem == "") then {
ACE_LOGERROR_1("Failed compiling ACE_Tags for tag: %1 - missing requiredItem",_class);
_failure = true;
} else {
if (!isClass (configFile >> "CfgWeapons" >> _requiredItem)) then {
ACE_LOGERROR_2("Failed compiling ACE_Tags for tag: %1 - requiredItem %2 does not exist",_class,_requiredItem);
_failure = true;
};
};
private _textures = getArray (_x >> "textures");
if (_textures isEqualTo []) then {
ACE_LOGERROR_1("Failed compiling ACE_Tags for tag: %1 - missing textures",_class);
_failure = true;
};
private _icon = getText (_x >> "icon");
if (!_failure) then {
GVAR(cachedTags) pushBack [_class, _displayName, _requiredItem, _textures, _icon];
if !(_requiredItem in GVAR(cachedRequiredItems)) then {
GVAR(cachedRequiredItems) pushBack _requiredItem;
};
};
} forEach ("true" configClasses (configFile >> "ACE_Tags"));

View File

@ -1,26 +0,0 @@
/*
* Author: BaerMitUmlaut, esteldunedain, Jonpas
* Puts together a full path to the given tag color texture. Internal ACE3 textures only.
*
* Arguments:
* 0: The colour of the tag (valid colours are black, red, green and blue) <STRING>
*
* Return Value:
* Texture (full path), "" if not found <STRING>
*
* Example:
* texture = ["blue"] call ace_tagging_fnc_getTexture
*
* Public: No
*/
#include "script_component.hpp"
params ["_color"];
if !((toLower _color) in ["black", "red", "green", "blue"]) exitWith {
ACE_LOGERROR_1("%1 is not a valid tag colour.",_color);
""
};
QUOTE(PATHTOF(UI)) + "\tags\" + _color + "\" + str (floor (random 3)) + ".paa"

View File

@ -0,0 +1,25 @@
/*
* Author: Jonpas
* Initializes the Tagging module.
*
* Arguments:
* 0: The module logic <LOGIC>
* 1: Units <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
if (!isServer) exitWith {};
params ["_logic", "", "_activated"];
if (!_activated) exitWith {};
[_logic, QGVAR(quickTag), "quickTag"] call EFUNC(common,readSettingFromModule);
ACE_LOGINFO("Tagging Module Initialized.");

View File

@ -0,0 +1,51 @@
/*
* Author: Jonpas
* Selects random tag and applies it.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player] call ace_tagging_fnc_quickTag
*
* Public: No
*/
#include "script_component.hpp"
// Exit if Quick Tag disabled
if (GVAR(quickTag) == 0) exitWith {};
params ["_unit"];
private _possibleTags = [];
// Last Used
if (GVAR(quickTag) == 1) then {
private _lastUsedTagClass = _unit getVariable [QGVAR(lastUsedTag), nil];
if (!isNil "_lastUsedTagClass") then {
private _lastUsedTag = GVAR(cachedTags) select {(_x select 0) == _lastUsedTagClass};
_possibleTags = _lastUsedTag;
};
};
// Random X
if (GVAR(quickTag == 2)) then {
private _xTags = GVAR(cachedTags) select {(_x select 0) in ["ACE_XBlack", "ACE_XRed", "ACE_XGreen", "ACE_XBlue"]};
_possibleTags = _xTags;
};
// Random
if (GVAR(quickTag) == 3) then {
_possibleTags = GVAR(cachedTags);
};
// Tag
if !(_possibleTags isEqualTo []) then {
private _availableTags = _possibleTags select {(_x select 2) in ((items _unit) apply {toLower _x})};
[_unit, selectRandom ((selectRandom _availableTags) select 3)] call FUNC(tag);
};

View File

@ -7,12 +7,12 @@
// #define CBA_DEBUG_SYNCHRONOUS // #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS // #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_BLANK #ifdef DEBUG_ENABLED_TAGGING
#define DEBUG_MODE_FULL #define DEBUG_MODE_FULL
#endif #endif
#ifdef DEBUG_SETTINGS_BLANK #ifdef DEBUG_SETTINGS_TAGGING
#define DEBUG_SETTINGS DEBUG_SETTINGS_BLANK #define DEBUG_SETTINGS DEBUG_SETTINGS_TAGGING
#endif #endif
#include "\z\ace\addons\main\script_macros.hpp" #include "\z\ace\addons\main\script_macros.hpp"

View File

@ -1,45 +1,76 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project name="ACE"> <Project name="ACE">
<Package name="Tagging"> <Package name="Tagging">
<Key ID="STR_ACE_Tagging_TagBlack"> <Key ID="STR_ACE_Tagging_Tagging">
<English>Tag black</English> <English>Tagging</English>
<German>Schwarz markieren</German>
<Spanish>Marcar en negro</Spanish>
<Polish>Oznakuj na czarno</Polish>
<French>Tag noir</French>
<Italian>Marca nero</Italian>
<Czech>Označit černě</Czech>
<Portuguese>Marcar em preto</Portuguese>
</Key> </Key>
<Key ID="STR_ACE_Tagging_TagRed"> <Key ID="STR_ACE_Tagging_ModuleDesc">
<English>Tag red</English> <English>Configure how the tagging system will operate by default.</English>
<German>Rot markieren</German>
<Spanish>Marcar en rojo</Spanish>
<Polish>Oznakuj na czerwono</Polish>
<French>Tag rouge</French>
<Italian>Marca rosso</Italian>
<Czech>Označit červeně</Czech>
<Portuguese>Marcar em vermelho</Portuguese>
</Key> </Key>
<Key ID="STR_ACE_Tagging_TagGreen"> <Key ID="STR_ACE_Tagging_QuickTag">
<English>Tag green</English> <English>Quick Tag</English>
<German>Grün markieren</German>
<Spanish>Marcar en verde</Spanish>
<Polish>Oznakuj na zielono</Polish>
<French>Tag vert</French>
<Italian>Marca verde</Italian>
<Czech>Označit zeleně</Czech>
<Portuguese>Marcar em verde</Portuguese>
</Key> </Key>
<Key ID="STR_ACE_Tagging_TagBlue"> <Key ID="STR_ACE_Tagging_QuickTagDesc">
<English>Tag blue</English> <English>Action performed on main tag interaction point.</English>
<German>Blau markieren</German> </Key>
<Spanish>Marcar en azul</Spanish> <Key ID="STR_ACE_Tagging_LastUsed">
<Polish>Oznakuj na niebiesko</Polish> <English>Last Used</English>
<French>Tag bleu</French> </Key>
<Italian>Marca blu</Italian> <Key ID="STR_ACE_Tagging_RandomX">
<Czech>Označit modře</Czech> <English>Random X</English>
<Portuguese>Marcar em azul</Portuguese> </Key>
<Key ID="STR_ACE_Tagging_Random">
<English>Random</English>
</Key>
<Key ID="STR_ACE_Tagging_Tag">
<English>Tag</English>
<German>Markieren</German>
<Spanish>Marcar</Spanish>
<Polish>Oznakuj</Polish>
<French>Tag</French>
<Italian>Marca</Italian>
<Czech>Označit</Czech>
<Portuguese>Marcar</Portuguese>
</Key>
<Key ID="STR_ACE_Tagging_XBlack">
<English>X black</English>
<German>Schwarz X</German>
<Spanish>X en negro</Spanish>
<Polish>X na czarno</Polish>
<French>X noir</French>
<Italian>X nero</Italian>
<Czech>X černě</Czech>
<Portuguese>X em preto</Portuguese>
</Key>
<Key ID="STR_ACE_Tagging_XRed">
<English>X red</English>
<German>Rot X</German>
<Spanish>X en rojo</Spanish>
<Polish>X na czerwono</Polish>
<French>X rouge</French>
<Italian>X rosso</Italian>
<Czech>X červeně</Czech>
<Portuguese>X em vermelho</Portuguese>
</Key>
<Key ID="STR_ACE_Tagging_XGreen">
<English>X green</English>
<German>Grün X</German>
<Spanish>X en verde</Spanish>
<Polish>X na zielono</Polish>
<French>X vert</French>
<Italian>X verde</Italian>
<Czech>X zeleně</Czech>
<Portuguese>X em verde</Portuguese>
</Key>
<Key ID="STR_ACE_Tagging_XBlue">
<English>X blue</English>
<German>Blau X</German>
<Spanish>X en azul</Spanish>
<Polish>X na niebiesko</Polish>
<French>X bleu</French>
<Italian>X blu</Italian>
<Czech>X modře</Czech>
<Portuguese>X em azul</Portuguese>
</Key> </Key>
<Key ID="STR_ACE_Tagging_SpraypaintBlack"> <Key ID="STR_ACE_Tagging_SpraypaintBlack">
<English>Black spray paint</English> <English>Black spray paint</English>
@ -92,4 +123,4 @@
<Portuguese>Uma lata de tinta spray para marcar paredes.</Portuguese> <Portuguese>Uma lata de tinta spray para marcar paredes.</Portuguese>
</Key> </Key>
</Package> </Package>
</Project> </Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -31,13 +31,13 @@ class CfgVehicles {
EGVAR(refuel,fuelCapacity) = 300; EGVAR(refuel,fuelCapacity) = 300;
class Turrets: Turrets { class Turrets: Turrets {
class CommanderOptics: NewTurret { class CommanderOptics: NewTurret {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
class GPMGTurret1: NewTurret { class GPMGTurret1: NewTurret {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
}; };
}; };
@ -45,10 +45,10 @@ class CfgVehicles {
EGVAR(refuel,fuelCapacity) = 460; EGVAR(refuel,fuelCapacity) = 460;
class Turrets: Turrets { class Turrets: Turrets {
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
class Com_BMP1: NewTurret { class Com_BMP1: NewTurret {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
}; };
}; };
@ -59,7 +59,7 @@ class CfgVehicles {
class MainTurret: MainTurret { class MainTurret: MainTurret {
class Turrets: Turrets { class Turrets: Turrets {
class CommanderOptics : CommanderOptics { class CommanderOptics : CommanderOptics {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
}; };
}; };
@ -69,15 +69,15 @@ class CfgVehicles {
EGVAR(refuel,fuelCapacity) = 460; EGVAR(refuel,fuelCapacity) = 460;
class Turrets: Turrets { class Turrets: Turrets {
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
class Turrets: Turrets { class Turrets: Turrets {
class CommanderOptics: CommanderOptics { class CommanderOptics: CommanderOptics {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
}; };
}; };
class GPMGTurret1: NewTurret { class GPMGTurret1: NewTurret {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
}; };
}; };
@ -85,10 +85,10 @@ class CfgVehicles {
EGVAR(refuel,fuelCapacity) = 300; EGVAR(refuel,fuelCapacity) = 300;
class Turrets: Turrets { class Turrets: Turrets {
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
class CommanderOptics: CommanderOptics { class CommanderOptics: CommanderOptics {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
}; };
}; };
@ -96,11 +96,11 @@ class CfgVehicles {
EGVAR(refuel,fuelCapacity) = 400; EGVAR(refuel,fuelCapacity) = 400;
class Turrets: Turrets { class Turrets: Turrets {
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
class Turrets: Turrets { class Turrets: Turrets {
class CommanderOptics: CommanderOptics class CommanderOptics: CommanderOptics
{ {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
}; };
}; };
@ -114,7 +114,7 @@ class CfgVehicles {
}; };
}; };
class GPMGTurret1: NewTurret { class GPMGTurret1: NewTurret {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
}; };
}; };
@ -127,7 +127,7 @@ class CfgVehicles {
}; };
class GPMGTurret1: GPMGTurret1 {}; class GPMGTurret1: GPMGTurret1 {};
class GPMGTurret2: GPMGTurret1 { class GPMGTurret2: GPMGTurret1 {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
}; };
}; };
@ -135,13 +135,13 @@ class CfgVehicles {
EGVAR(refuel,fuelCapacity) = 1200; EGVAR(refuel,fuelCapacity) = 1200;
class Turrets: Turrets { class Turrets: Turrets {
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
class Turrets: Turrets { class Turrets: Turrets {
class CommanderOptics: CommanderOptics { class CommanderOptics: CommanderOptics {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
class CommanderMG: CommanderOptics { class CommanderMG: CommanderOptics {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
}; };
}; };
@ -164,10 +164,10 @@ class CfgVehicles {
class rhs_t90_tv: rhs_t72bd_tv { class rhs_t90_tv: rhs_t72bd_tv {
class Turrets: Turrets { class Turrets: Turrets {
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
class Turrets: Turrets { class Turrets: Turrets {
class CommanderOptics: CommanderOptics { class CommanderOptics: CommanderOptics {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
}; };
}; };
@ -177,13 +177,13 @@ class CfgVehicles {
EGVAR(refuel,fuelCapacity) = 1200; EGVAR(refuel,fuelCapacity) = 1200;
class Turrets: Turrets { class Turrets: Turrets {
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
class Turrets: Turrets { class Turrets: Turrets {
class CommanderOptics: CommanderOptics { class CommanderOptics: CommanderOptics {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
class CommanderMG: CommanderOptics { class CommanderMG: CommanderOptics {
ace_fcs_Enabled = 0; EGVAR(fcs,enabled) = 0;
}; };
}; };
}; };
@ -294,9 +294,20 @@ class CfgVehicles {
EGVAR(refuel,fuelCapacity) = 78; EGVAR(refuel,fuelCapacity) = 78;
}; };
class APC_Tracked_02_base_F; class APC_Tracked_02_base_F: Tank_F {
class Turrets: Turrets {
class MainTurret: MainTurret {};
};
};
class rhs_zsutank_base : APC_Tracked_02_base_F { class rhs_zsutank_base : APC_Tracked_02_base_F {
EGVAR(refuel,fuelCapacity) = 515; EGVAR(refuel,fuelCapacity) = 515;
class Turrets: Turrets {
class MainTurret: MainTurret {
EGVAR(fcs,enabled) = 0;
};
};
}; };
class rhs_btr60_base : rhs_btr_base { class rhs_btr60_base : rhs_btr_base {