Epoch/Sources/epoch_code/compile/vehicles/EPOCH_client_upgradeVehicleCheck.sqf
He-Man 2d0ef031c6 Moved Vehicle Upgrade to DynaMenu
- Vehicle Upgrade moved to DynaMenu
- Hitpoints now also will be given to Vehicles from other BaseClasses
(controlled by HitPointNames)
- Added a security Check that Players must have a bit distance to
upgrade
- Fixed some errors in Colorscript for upgraded Vehicles. If it is only
an upgrade, same color is used. If it is another Class, a new random
color will be taken.
- Removed Upgrade Vehicle from Inventory Click
- Changed DynaMenu to make it possible to call a script to get iconpath
(use "iconcode" instead of "icon" then)
2017-08-21 14:26:13 +02:00

51 lines
1.6 KiB
Plaintext

/*
Author: He-Man
Contributors: DirtySanchez
Description:
Upgrade Vehicle 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/release/Sources/epoch_code/compile/vehicles/EPOCH_client_upgradeVehicleCheck.sqf
*/
private ["_veh","_vehType","_config","_classUpgrade","_reqMaterials","_mattxt","_displayname"];
_veh = _this;
Ignatz_VehicleUpgradeArray = [];
if (isnull _veh) exitwith {
["Upgrade failed - Vehicle not found",5] call Epoch_message;
};
if (player distance _veh > 12) exitwith {
["Upgrade failed - Vehicle to far away",5] call Epoch_message;
};
_vehType = typeOf _veh;
_config = 'CfgVehicleUpgrades' call EPOCH_returnConfig;
if !(isclass (_config >> _vehType)) exitwith {
["Vehicle not upgradeable",5] call Epoch_message;
};
_classUpgrade = getarray (_config >> _vehType >> "upgradeToVehicle");
if (_classUpgrade isequalto []) exitwith {
["Vehicle not upgradeable",5] call Epoch_message;
};
{
_classUpgrade = _x;
if (_x isequaltype []) then {
_classUpgrade = selectrandom _x;
};
if (isclass (_config >> _vehType >> _classUpgrade)) then {
_reqMaterials = getArray (_config >> _vehType >> _classUpgrade >> "ReqMaterials");
_mattxt = "Needed:";
{
_mattxt = _mattxt + format [' %1 %2,', _x select 0, (_x select 1) call EPOCH_itemDisplayName];
} forEach _reqMaterials;
_displayname = _classUpgrade call EPOCH_itemDisplayName;
Ignatz_VehicleUpgradeArray pushback [_veh,_classUpgrade,_displayname,_mattxt];
};
} foreach _classUpgrade;