Merge branch 'dogtags_blood_type' of github.com:KoffeinFlummi/ACE3 into dogtags

# Conflicts:
#	addons/dogtags/functions/fnc_getDogtagData.sqf
This commit is contained in:
esteldunedain 2016-06-20 17:19:35 -03:00
commit 171e6b278c
3 changed files with 32 additions and 16 deletions

View File

@ -1,5 +1,6 @@
PREP(addDogtagActions); PREP(addDogtagActions);
PREP(addDogtagItem); PREP(addDogtagItem);
PREP(bloodType);
PREP(canCheckDogtag); PREP(canCheckDogtag);
PREP(canTakeDogtag); PREP(canTakeDogtag);
PREP(checkDogtag); PREP(checkDogtag);

View File

@ -0,0 +1,24 @@
/*
* Author: commy2
* Reports a blood type depending on the units name.
*
* Arguments:
* 0: Name of a unit <STRING>
*
* Return Value:
* A random blood type <STRING>
*
* Public: No
*/
#include "script_component.hpp"
#define BLOOD_TYPES ["O POS", "O NEG", "A POS", "A NEG", "B POS", "B NEG", "AB POS", "AB NEG"]
params ["_name"];
private _num = 0;
private _count = {_num = _num + _x} count toArray _name;
_num = _num + _count;
BLOOD_TYPES select (_num % count BLOOD_TYPES)

View File

@ -19,23 +19,14 @@ private _dogTagData = _target getVariable QGVAR(dogtagData);
if (!isNil "_dogTagData") exitWith {_dogTagData}; if (!isNil "_dogTagData") exitWith {_dogTagData};
// Create dog tag data once for the unit: nickname, code (eg. 135-13-900) and blood type // Create dog tag data once for the unit: nickname, code (eg. 135-13-900) and blood type
private ["_bloodTypeIndex", "_code"]; private _targetName = [_target, false, true] call EFUNC(common,getName);
if !(getplayeruid _target in ["", "_SP_AI_", "_SP_PLAYER_"]) then {
_bloodTypeIndex = (parseNumber ((getPlayerUID _target) select [0, 5])) mod 8;
_code = (getplayeruid _target) select [0, 3] + "-" +
(getplayeruid _target) select [3, 2] + "-" +
(getplayeruid _target) select [5, 3];
} else {
_bloodTypeIndex = floor random 8;
_code = str(floor random 9) + str(floor random 9) + str(floor random 9) + "-" +
str(floor random 9) + str(floor random 9) + "-" +
str(floor random 9) + str(floor random 9) + str(floor random 9);
};
private _dogTagData = [ private _dogTagData = [
[_target, false, true] call EFUNC(common,getName), _targetName,
_code, str(floor random 9) + str(floor random 9) + str(floor random 9) + "-" +
["O POS", "O NEG", "A POS", "A NEG", "B POS", "B NEG", str(floor random 9) + str(floor random 9) + "-" +
"AB POS", "AB NEG"] select _bloodTypeIndex str(floor random 9) + str(floor random 9) + str(floor random 9),
_targetName call FUNC(bloodType)
]; ];
// Store it // Store it
_target setVariable [QGVAR(dogtagData), _dogTagData, true]; _target setVariable [QGVAR(dogtagData), _dogTagData, true];