Epoch/Sources/epoch_code/compile/EPOCH_UnisexCheck.sqf

85 lines
2.3 KiB
Plaintext
Raw Normal View History

2015-12-07 16:24:52 +00:00
/*
Author: Aaron Clark - EpochMod.com
Contributors:
Description:
Unisex check for vests, gives swing ammo and performs radio changed check
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/compile/EPOCH_UnisexCheck.sqf
*/
2015-09-14 20:55:36 +00:00
private ["_femaleVariant","_vest","_class","_config","_woman","_maleVariant"];
_woman = getNumber(configFile >> "CfgVehicles" >> (typeOf player) >> "woman");
_class = _this select 2;
_config = configfile >> "cfgweapons" >> _class;
_mags = (magazines player) + (handgunMagazine player);
// TODO optimize
if (_class in ["Hatchet","CrudeHatchet"]) then {
if !("Hatchet_swing" in _mags) then {
player addMagazine "Hatchet_swing";
};
};
2015-09-30 20:16:59 +00:00
if (_class in ["MeleeSledge","MeleeMaul","MeleeSword"]) then {
2015-09-14 20:55:36 +00:00
if !("sledge_swing" in _mags) then {
player addMagazine "sledge_swing";
};
};
2015-09-30 20:16:59 +00:00
if (_class in ["WoodClub","Plunger","MeleeRod"]) then {
2015-09-14 20:55:36 +00:00
if !("stick_swing" in _mags) then {
player addMagazine "stick_swing";
};
};
//Radio Check
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _class)) == "ItemRadio") then {
if (_class in(assignedItems player)) then {
//diag_log "EQUPPED RADIO";
EPOCH_equippedItem_PVS = [_class,true,player];
};
};
if (_woman == 1) then {
if (isClass _config) then {
//diag_log format["DEBUG EPOCH_UnisexCheck: %1", _this];
if (isText (_config >> "femaleVest")) then {
_femaleVariant = getText (_config >> "femaleVest");
_vest = vest player;
if (_class == _vest) then {
if (_femaleVariant != _vest) then {
2016-01-19 18:34:31 +00:00
// get items in existing vest
_vestItems = vestItems player;
// remove vest
2015-09-14 20:55:36 +00:00
removeVest player;
2016-01-19 18:34:31 +00:00
// replace with female variant
2015-09-14 20:55:36 +00:00
player addVest _femaleVariant;
2016-01-19 18:34:31 +00:00
// readd items to players vest
{player addItemToVest _x} forEach _vestItems;
2015-09-14 20:55:36 +00:00
};
};
};
};
} else {
if (isClass _config) then {
//diag_log format["DEBUG EPOCH_UnisexCheck: %1", _this];
if (isText (_config >> "maleVest")) then {
_maleVariant = getText (_config >> "maleVest");
_vest = vest player;
if (_class == _vest) then {
if (_maleVariant != _vest) then {
removeVest player;
player addVest _maleVariant;
};
};
};
};
};