double dogtag support, fix addDogtagItem event in mp, unconscious units support, little cleanup

This commit is contained in:
SzwedzikPL 2016-03-19 18:12:18 +01:00
parent ca3171a33a
commit 1cdecf75da
16 changed files with 63 additions and 101 deletions

View File

@ -2,7 +2,7 @@ class RscPicture;
class RscStructuredText;
class RscTitles {
class GVAR(tag) {
class GVAR(singleTag) {
idd = -1;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(tag)),_this select 0)]);
onUnload = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(tag)),nil)]);
@ -14,14 +14,14 @@ class RscTitles {
class controls {
class background: RscPicture {
idc = 1000;
text = QUOTE(PATHTOF(data\dogtag.paa));
text = QUOTE(PATHTOF(data\dogtagSingle.paa));
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorText[] = {1, 1, 1, 1};
colorBackground[] = {0, 0, 0, 0};
x = ((safezoneX + safezoneW) - (10 * (((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 * (((safezoneW / safezoneH) min 1.2) / 40));
y = safeZoneY + 0.175 * safezoneH;
w = (8 * (((safezoneW / safezoneH) min 1.2) / 40));
h = (4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25));
h = (8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25));
font = "EtelkaMonospacePro";
};
class nickname: RscStructuredText {
@ -31,9 +31,9 @@ class RscTitles {
colorText[] = {1, 1, 1, 1};
colorBackground[] = {0, 0, 0, 0};
x = ((safezoneX + safezoneW) - (8.4 * (((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 * (((safezoneW / safezoneH) min 1.2) / 40));
y = safeZoneY + 0.2 * safezoneH;
y = safeZoneY + 0.25 * safezoneH;
w = (5.9 * (((safezoneW / safezoneH) min 1.2) / 40));
h = (4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25));
h = (3 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25));
font = "EtelkaMonospacePro";
class Attributes {
font = "EtelkaMonospacePro";
@ -47,4 +47,26 @@ class RscTitles {
};
};
};
class GVAR(doubleTag): GVAR(singleTag) {
idd = -1;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(tag)),_this select 0)]);
onUnload = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(tag)),nil)]);
class controls: controls {
class background: background {
text = QUOTE(PATHTOF(data\dogtagDouble.paa));
};
class nickname: nickname {
class Attributes: Attributes {
font = "EtelkaMonospacePro";
color = "#FFFFFF";
align = "center";
valign = "middle";
shadow = 1;
shadowColor = "#3f4345";
size = "0.85";
};
};
};
};
};

View File

@ -1,7 +1,7 @@
ace_dogtags
==========
Adds options to check and take dog tag from dead units
Adds options to check and take dog tag from dead or unconscious units
## Maintainers

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
/*
* Author: SzwedzikPl
* Author: SzwedzikPL
* Creates one action per dogtag.
*
* Arguments:
@ -20,9 +20,9 @@ private _unitDogtags = [];
private _unitDogtagIDs = [];
{
private _id = getNumber (configFile >> "CfgWeapons" >> _x >> QGVAR(tagID));
if(_id > 0) then {
_unitDogtags pushback _x;
_unitDogtagIDs pushback _id;
if (_id > 0) then {
_unitDogtags pushBack _x;
_unitDogtagIDs pushBack _id;
};
} forEach items _player;

View File

@ -1,5 +1,5 @@
/*
* Author: SzwedzikPl
* Author: SzwedzikPL
* Adds dogtag item to unit (triggered by server)
*
* Arguments:
@ -15,7 +15,7 @@
params ["_item", "_nickname"];
if(_item == "") exitWith {};
if (_item == "") exitWith {};
[ace_player, _item] call CBA_fnc_addItem;

View File

@ -1,5 +1,5 @@
/*
* Author: SzwedzikPl
* Author: SzwedzikPL
* Checks if dogtag can be checked.
*
* Arguments:
@ -15,6 +15,6 @@
params ["_player", "_target"];
if(isNull _target) exitWith {false};
if (isNull _target) exitWith {false};
!alive _target
!alive _target || _target getVariable ["ACE_isUnconscious", false]

View File

@ -1,5 +1,5 @@
/*
* Author: SzwedzikPl
* Author: SzwedzikPL
* Checks if dogtag can be taken.
*
* Arguments:
@ -15,6 +15,6 @@
params ["_player", "_target"];
if(isNull _target) exitWith {false};
if (isNull _target) exitWith {false};
!alive _target
!alive _target || _target getVariable ["ACE_isUnconscious", false]

View File

@ -1,5 +1,5 @@
/*
* Author: SzwedzikPl
* Author: SzwedzikPL
* Checks unit dogtag
*
* Arguments:
@ -15,9 +15,6 @@
params ["_player", "_target"];
if(_target getVariable [QGVAR(dogtagTaken), false]) then {
[localize LSTRING(noDogtag)] call EFUNC(common,displayText);
} else {
private _nickname = [_target, false, true] call EFUNC(common,getName);
[QGVAR(showDogtag), [_nickname]] call EFUNC(common,localEvent);
};
private _doubleTags = !(_target getVariable [QGVAR(dogtagTaken), false]);
private _nickname = [_target, false, true] call EFUNC(common,getName);
[QGVAR(showDogtag), [_nickname, _doubleTags]] call EFUNC(common,localEvent);

View File

@ -1,5 +1,5 @@
/*
* Author: SzwedzikPl
* Author: SzwedzikPL
* Check dogtag self menu action
*
* Arguments:

View File

@ -1,5 +1,5 @@
/*
* Author: SzwedzikPl
* Author: SzwedzikPL
* Server: creates new dogtag item and send it to client
*
* Arguments:
@ -18,23 +18,23 @@ if(!isServer) exitWith {};
params ["_target", "_unit"];
TRACE_2("getDogtagItem",_target,_unit);
private _allDogtags = missionNameSpace getVariable [QGVAR(allDogtags), []];
private _allDogtagNicknames = missionNameSpace getVariable [QGVAR(allDogtagNicknames), []];
private _allDogtags = missionNamespace getVariable [QGVAR(allDogtags), []];
private _allDogtagNicknames = missionNamespace getVariable [QGVAR(allDogtagNicknames), []];
private _nextID = count _allDogtags + 1;
if(_nextID > 999) exitWith {};
if (_nextID > 999) exitWith {};
private _nickname = [_unit, false, true] call EFUNC(common,getName);
private _item = format ["ACE_dogtag_%1", _nextID];
_allDogtags pushBack _item;
_allDogtagNicknames pushBack _nickname;
missionNameSpace setVariable [QGVAR(allDogtags), _allDogtags];
missionNameSpace setVariable [QGVAR(allDogtagNicknames), _allDogtagNicknames];
missionNamespace setVariable [QGVAR(allDogtags), _allDogtags];
missionNamespace setVariable [QGVAR(allDogtagNicknames), _allDogtagNicknames];
if(isMultiplayer) then {
[QGVAR(addDogtagItem), [_target], [_item]] call EFUNC(common,targetEvent);
[QGVAR(addDogtagItem), [_target], [_item, _nickname]] call EFUNC(common,targetEvent);
} else {
[QGVAR(addDogtagItem), [_item, _nickname]] call EFUNC(common,localEvent);
};

View File

@ -1,5 +1,5 @@
/*
* Author: SzwedzikPl
* Author: SzwedzikPL
* Server: returns to client nickname on given dogtag
*
* Arguments:
@ -23,7 +23,7 @@ private _allDogtagNicknames = missionNameSpace getVariable [QGVAR(allDogtagNickn
private _nickname = "";
private _index = _allDogtags find _item;
if(_index >= 0) then {
if (_index >= 0) then {
_nickname = _allDogtagNicknames select _index;
};

View File

@ -14,12 +14,15 @@
disableSerialization;
params ["_nickname"];
params ["_nickname", ["_doubleTags", false, [false]]];
if(!hasInterface || {_nickname == ""}) exitWith {};
(QGVAR(tag) call BIS_fnc_rscLayer) cutRsc [QGVAR(tag), "PLAIN", 1, true];
if (!hasInterface || {_nickname == ""}) exitWith {};
if (_doubleTags) then {
(QGVAR(tag) call BIS_fnc_rscLayer) cutRsc [QGVAR(doubleTag), "PLAIN", 1, true];
} else {
(QGVAR(tag) call BIS_fnc_rscLayer) cutRsc [QGVAR(singleTag), "PLAIN", 1, true];
};
private _display = uiNamespace getvariable [QGVAR(tag), displayNull];
if(isNull _display) exitWith {};

View File

@ -1,5 +1,5 @@
/*
* Author: SzwedzikPl
* Author: SzwedzikPL
* If dogtag is not already taken triggers event on server
* If dogtag already taken displays info about it
*
@ -16,7 +16,7 @@
params ["_player", "_target"];
if(_target getVariable [QGVAR(dogtagTaken), false]) then {
if (_target getVariable [QGVAR(dogtagTaken), false]) then {
[localize LSTRING(dogtagAlreadyTaken)] call EFUNC(common,displayText);
} else {
_target setVariable [QGVAR(dogtagTaken), true, true];

View File

@ -3,87 +3,27 @@
<Package name="Dogtags">
<Key ID="STR_ACE_Dogtags_itemName">
<English>Dog Tag</English>
<German></German>
<French></French>
<Czech></Czech>
<Polish>Nieśmiertelnik</Polish>
<Spanish></Spanish>
<Hungarian></Hungarian>
<Russian></Russian>
<Italian></Italian>
<Portuguese></Portuguese>
</Key>
<Key ID="STR_ACE_Dogtags_checkItem">
<English>Check Dog Tag</English>
<German></German>
<French></French>
<Czech></Czech>
<Polish>Sprawdź nieśmiertelnik</Polish>
<Spanish></Spanish>
<Hungarian></Hungarian>
<Russian></Russian>
<Italian></Italian>
<Portuguese></Portuguese>
</Key>
<Key ID="STR_ACE_Dogtags_checkDogtag">
<English>Check</English>
<German></German>
<French></French>
<Czech></Czech>
<Polish>Sprawdź</Polish>
<Spanish></Spanish>
<Hungarian></Hungarian>
<Russian></Russian>
<Italian></Italian>
<Portuguese></Portuguese>
</Key>
<Key ID="STR_ACE_Dogtags_takeDogtag">
<English>Take</English>
<German></German>
<French></French>
<Czech></Czech>
<Polish>Zabierz</Polish>
<Spanish></Spanish>
<Hungarian></Hungarian>
<Russian></Russian>
<Italian></Italian>
<Portuguese></Portuguese>
</Key>
<Key ID="STR_ACE_Dogtags_takeDogtagSuccess">
<English>Dogtag taken from %1...</English>
<German></German>
<French></French>
<Czech></Czech>
<Polish>Zabrałeś nieśmiertelnik %1...</Polish>
<Spanish></Spanish>
<Hungarian></Hungarian>
<Russian></Russian>
<Italian></Italian>
<Portuguese></Portuguese>
</Key>
<Key ID="STR_ACE_Dogtags_noDogtag">
<English>I can't seem to find his dogtag!</English>
<German></German>
<French></French>
<Czech></Czech>
<Polish>Brak nieśmiertelnika</Polish>
<Spanish></Spanish>
<Hungarian></Hungarian>
<Russian></Russian>
<Italian></Italian>
<Portuguese></Portuguese>
</Key>
<Key ID="STR_ACE_Dogtags_dogtagAlreadyTaken">
<English>Somebody else has already taken the dogtag...</English>
<German></German>
<French></French>
<Czech></Czech>
<Polish>Ktoś już zabrał ten nieśmiertelnik...</Polish>
<Spanish></Spanish>
<Hungarian></Hungarian>
<Russian></Russian>
<Italian></Italian>
<Portuguese></Portuguese>
</Key>
</Package>
</Project>