mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
More upgrades and new functions
This commit is contained in:
parent
44eb34445d
commit
e906d29c9c
@ -308,49 +308,6 @@ switch _interactOption do {
|
|||||||
["Unpacked backpack", 5] call Epoch_message;
|
["Unpacked backpack", 5] call Epoch_message;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
case 15: { // Vehicle Upgrade
|
|
||||||
_canUpgrade = true;
|
|
||||||
_nearveh = nearestObjects[player,["Car","Truck","Heli","Boat","Plane"],15];
|
|
||||||
if (_nearveh isequalto []) exitwith {
|
|
||||||
["No Vehicle for upgrade found",5] call Epoch_message;_canUpgrade = false;
|
|
||||||
};
|
|
||||||
_veh = _nearveh select 0;
|
|
||||||
_vehType = typeOf _veh;
|
|
||||||
_classUpgrade = isClass(missionConfigFile >> "CfgVehicleUpgrades" >> _vehType);
|
|
||||||
if!(_classUpgrade)exitWith{
|
|
||||||
["Vehicle can't be upgraded",5] call Epoch_message;_canUpgrade = false;
|
|
||||||
};
|
|
||||||
_reqMaterials = getArray(missionConfigFile >> "CfgVehicleUpgrades" >> _vehType >> "ReqMaterials");
|
|
||||||
_crypto = 0;
|
|
||||||
if(_reqMaterials isEqualTo [])exitWith{
|
|
||||||
["Required Materials list not found, report this error to an admin",5] call Epoch_message;_canUpgrade = false;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
if((_x select 1) isEqualTo "Crypto")then{
|
|
||||||
_crypto = _x select 0;
|
|
||||||
if(EPOCH_playerCrypto < _crypto)exitWith{
|
|
||||||
[format["You need %1 crypto to upgrade your %2", _crypto, _vehType],5] call Epoch_message;_canUpgrade = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if(!((_x select 1) in (magazines player)) && !((_x select 1) isEqualTo "Crypto"))exitWith{
|
|
||||||
[format["You do not have %1 to upgrade your %2", (_x select 1), _vehType],5] call Epoch_message;_canUpgrade = false;
|
|
||||||
};
|
|
||||||
}forEach _reqMaterials;
|
|
||||||
if(_canUpgrade)then{
|
|
||||||
{
|
|
||||||
_count = _x select 0;
|
|
||||||
_upgradeItem = _x select 1;
|
|
||||||
for "_i" from 1 to _count do{
|
|
||||||
if!(_upgradeItem isEqualTo "Crypto")then{
|
|
||||||
player removeItem _upgradeItem;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}forEach _reqMaterials;
|
|
||||||
_upgradeToVeh = getText(missionConfigFile >> "CfgVehicleUpgrades" >> _vehType >> "upgradeToVehicle");
|
|
||||||
[[_veh,_upgradeToVeh,_crypto],player,Epoch_personalToken] remoteExec ["EPOCH_server_upgrade_vehicle",2];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
default {
|
default {
|
||||||
["Found nothing", 5] call Epoch_message;
|
["Found nothing", 5] call Epoch_message;
|
||||||
|
@ -37,4 +37,7 @@ if ([_item, "CfgVehicles"] call EPOCH_fnc_isAny) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
if (_return isequalto "") then {
|
||||||
|
_return = _item;
|
||||||
|
};
|
||||||
_return;
|
_return;
|
||||||
|
@ -60,6 +60,23 @@ if (isClass (_config >> _data)) then {
|
|||||||
EPOCH_CraftingItem = "";
|
EPOCH_CraftingItem = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_config = 'CfgVehicleUpgrades' call EPOCH_returnConfig;
|
||||||
|
if (isClass (_config >> _data)) then {
|
||||||
|
{
|
||||||
|
if (isclass (_config >> _data >> (typeof _x))) exitwith {
|
||||||
|
EPOCH_UpgradeVehicle = [_data,_x];
|
||||||
|
_reqMaterials = getArray (_config >> _data >> (typeof _x) >> "ReqMaterials");
|
||||||
|
_itemtxt = "required: ";
|
||||||
|
{
|
||||||
|
_itemtxt = _itemtxt + str (_x select 0) + ((_x select 1) call EPOCH_itemDisplayName) + ", ";
|
||||||
|
} foreach _reqMaterials;
|
||||||
|
_txt1 = format ["Upgrade %1", (typeof _x) call EPOCH_itemDisplayName];
|
||||||
|
_txt2 = "EPOCH_UpgradeVehicle call EPOCH_Client_UpgradeVehicle;";
|
||||||
|
_button_texts pushBack [_txt1,_txt2];
|
||||||
|
};
|
||||||
|
} foreach (nearestobjects [player,["Landvehicle","SHIP","AIR","TANK"],10]);
|
||||||
|
};
|
||||||
|
|
||||||
if !(_button_texts isEqualTo []) then {
|
if !(_button_texts isEqualTo []) then {
|
||||||
_display = ctrlParent (_this select 0);
|
_display = ctrlParent (_this select 0);
|
||||||
_pos = getMousePosition;
|
_pos = getMousePosition;
|
||||||
|
@ -0,0 +1,65 @@
|
|||||||
|
if (isnil 'EPOCH_UpgradeVehicle') exitwith {
|
||||||
|
["Upgrade failed - Error",5] call Epoch_message;
|
||||||
|
};
|
||||||
|
|
||||||
|
EPOCH_UpgradeVehicle params ["_data",["_veh",objnull]];
|
||||||
|
EPOCH_UpgradeVehicle = nil;
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
if !(local _veh) exitwith {
|
||||||
|
["Upgrade failed - Go in as Driver first",5] call Epoch_message;
|
||||||
|
};
|
||||||
|
if !(crew _veh isequalto []) exitwith {
|
||||||
|
["Upgrade failed - All passengers must leave the Vehicle",5] call Epoch_message;
|
||||||
|
};
|
||||||
|
|
||||||
|
_vehType = typeOf _veh;
|
||||||
|
|
||||||
|
_config = 'CfgVehicleUpgrades' call EPOCH_returnConfig;
|
||||||
|
_classUpgrade = gettext (_config >> _data >> _vehType >> "upgradeToVehicle");
|
||||||
|
_reqMaterials = getArray (_config >> _data >> _vehType >> "ReqMaterials");
|
||||||
|
|
||||||
|
_crypto = 0;
|
||||||
|
if(_reqMaterials isEqualTo [])exitWith{
|
||||||
|
["Required Materials list not found, report this error to an admin",5] call Epoch_message;
|
||||||
|
};
|
||||||
|
_hasall = true;
|
||||||
|
_missing = [];
|
||||||
|
{
|
||||||
|
_x params ["_count","_item"];
|
||||||
|
_has = 0;
|
||||||
|
if (_item isequalto "Crypto") then {
|
||||||
|
_has = Epoch_Playercrypto;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_has = {_x == _item} count ((magazines player)+(items player));
|
||||||
|
};
|
||||||
|
if (_has < _count) then {
|
||||||
|
_missing pushback [_count-_has,_item];
|
||||||
|
_hasall = false
|
||||||
|
};
|
||||||
|
}forEach _reqMaterials;
|
||||||
|
if (!_hasall) exitwith {
|
||||||
|
_msg = 'Missing:';
|
||||||
|
{
|
||||||
|
_msg = _msg + format [' %1 %2,', _x select 0, (_x select 1) call EPOCH_itemDisplayName];
|
||||||
|
} foreach _missing;
|
||||||
|
[_msg,5] call Epoch_message;
|
||||||
|
};
|
||||||
|
{
|
||||||
|
_x params ["_count","_item"];
|
||||||
|
if (_item isequalto "Crypto") then {
|
||||||
|
_crypto = _crypto + _count;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for "_i" from 1 to _count do{
|
||||||
|
player removeItem _item;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _reqMaterials;
|
||||||
|
[[_veh,_classUpgrade,_crypto],player,Epoch_personalToken] remoteExec ["EPOCH_server_upgrade_vehicle",2];
|
@ -149,6 +149,7 @@ class CfgClientFunctions
|
|||||||
class client_lockVehicle {};
|
class client_lockVehicle {};
|
||||||
class client_fillVehicle {};
|
class client_fillVehicle {};
|
||||||
class client_gearVehicle {};
|
class client_gearVehicle {};
|
||||||
|
class client_upgradeVehicle {};
|
||||||
};
|
};
|
||||||
class missions
|
class missions
|
||||||
{
|
{
|
||||||
|
@ -550,14 +550,10 @@ class CfgItemInteractions
|
|||||||
class ItemDoc6 : ItemDoc1 {};
|
class ItemDoc6 : ItemDoc1 {};
|
||||||
class ItemDoc7 : ItemDoc1 {};
|
class ItemDoc7 : ItemDoc1 {};
|
||||||
class ItemDoc8 : ItemDoc1 {};
|
class ItemDoc8 : ItemDoc1 {};
|
||||||
class ItemVehDoc1
|
class ItemVehDoc1 : ItemDoc1 {};
|
||||||
{
|
class ItemVehDoc2 : ItemDoc1 {};
|
||||||
interactAction = 15;
|
class ItemVehDoc3 : ItemDoc1 {};
|
||||||
interactText = "UPGRADE";
|
class ItemVehDoc4 : ItemDoc1 {};
|
||||||
};
|
|
||||||
class ItemVehDoc2 : ItemVehDoc1 {};
|
|
||||||
class ItemVehDoc3 : ItemVehDoc1 {};
|
|
||||||
class ItemVehDoc4 : ItemVehDoc1 {};
|
|
||||||
class ItemBulb : Default {};
|
class ItemBulb : Default {};
|
||||||
class ItemBurlap : Default {};
|
class ItemBurlap : Default {};
|
||||||
class ItemBriefcaseE : Default {};
|
class ItemBriefcaseE : Default {};
|
||||||
|
@ -7,104 +7,84 @@
|
|||||||
*/
|
*/
|
||||||
class CfgVehicleUpgrades
|
class CfgVehicleUpgrades
|
||||||
{
|
{
|
||||||
class C_Hatchback_01_EPOCH
|
class ItemVehDoc1
|
||||||
{
|
{
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc1"},{1,"ItemCables"},{1,"CircuitParts"},{2,"VehicleRepairLg"}};
|
class C_Hatchback_01_EPOCH
|
||||||
upgradeToVehicle = "C_Hatchback_01_EPOCH1";
|
{
|
||||||
|
ReqMaterials[] = {{1,"ItemVehDoc1"},{1,"ItemCables"},{1,"CircuitParts"},{2,"VehicleRepairLg"}};
|
||||||
|
upgradeToVehicle = "C_Hatchback_01_EPOCH1";
|
||||||
|
};
|
||||||
|
class C_Hatchback_02_EPOCH: C_Hatchback_01_EPOCH
|
||||||
|
{
|
||||||
|
upgradeToVehicle = "C_Hatchback_02_EPOCH1";
|
||||||
|
};
|
||||||
|
class C_Offroad_01_EPOCH: C_Hatchback_01_EPOCH
|
||||||
|
{
|
||||||
|
upgradeToVehicle = "C_Offroad_01_EPOCH1";
|
||||||
|
};
|
||||||
|
class C_SUV_01_EPOCH: C_Hatchback_01_EPOCH
|
||||||
|
{
|
||||||
|
upgradeToVehicle = "C_SUV_01_EPOCH1";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
class C_Hatchback_01_EPOCH1
|
class ItemVehDoc2
|
||||||
{
|
{
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc2"},{2,"SpareTire"},{2,"KitTankTrap"}};
|
class C_Hatchback_01_EPOCH1
|
||||||
upgradeToVehicle = "C_Hatchback_01_EPOCH2";
|
{
|
||||||
|
ReqMaterials[] = {{1,"ItemVehDoc2"},{2,"SpareTire"},{2,"KitTankTrap"}};
|
||||||
|
upgradeToVehicle = "C_Hatchback_01_EPOCH2";
|
||||||
|
};
|
||||||
|
class C_Hatchback_02_EPOCH1: C_Hatchback_01_EPOCH1
|
||||||
|
{
|
||||||
|
upgradeToVehicle = "C_Hatchback_02_EPOCH2";
|
||||||
|
};
|
||||||
|
class C_Offroad_01_EPOCH1: C_Hatchback_01_EPOCH1
|
||||||
|
{
|
||||||
|
upgradeToVehicle = "C_Offroad_01_EPOCH2";
|
||||||
|
};
|
||||||
|
class C_SUV_01_EPOCH1: C_Hatchback_01_EPOCH1
|
||||||
|
{
|
||||||
|
upgradeToVehicle = "C_SUV_01_EPOCH2";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
class C_Hatchback_01_EPOCH2
|
class ItemVehDoc3
|
||||||
{
|
{
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc3"},{2,"ItemPipe"},{2,"KitShelf"}};
|
class C_Hatchback_01_EPOCH2
|
||||||
upgradeToVehicle = "C_Hatchback_01_EPOCH3";
|
{
|
||||||
|
ReqMaterials[] = {{1,"ItemVehDoc3"},{2,"ItemPipe"},{2,"KitShelf"}};
|
||||||
|
upgradeToVehicle = "C_Hatchback_01_EPOCH3";
|
||||||
|
};
|
||||||
|
class C_Hatchback_02_EPOCH2: C_Hatchback_01_EPOCH2
|
||||||
|
{
|
||||||
|
upgradeToVehicle = "C_Hatchback_02_EPOCH3";
|
||||||
|
};
|
||||||
|
class C_Offroad_01_EPOCH2: C_Hatchback_01_EPOCH2
|
||||||
|
{
|
||||||
|
upgradeToVehicle = "C_Offroad_01_EPOCH3";
|
||||||
|
};
|
||||||
|
class C_SUV_01_EPOCH2: C_Hatchback_01_EPOCH2
|
||||||
|
{
|
||||||
|
upgradeToVehicle = "C_SUV_01_EPOCH3";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
class C_Hatchback_01_EPOCH3
|
class ItemVehDoc4
|
||||||
{
|
{
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc4"},{1,"CircuitParts"},{2,"ItemScraps"},{1,"jerrycan_epoch"}};
|
class C_Hatchback_01_EPOCH3
|
||||||
upgradeToVehicle = "C_Hatchback_01_EPOCH4";
|
{
|
||||||
};
|
ReqMaterials[] = {{1,"ItemVehDoc3"},{2,"ItemPipe"},{2,"KitShelf"}};
|
||||||
class C_Hatchback_02_EPOCH
|
upgradeToVehicle = "C_Hatchback_01_EPOCH4";
|
||||||
{
|
};
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc1"},{1,"ItemCables"},{1,"CircuitParts"},{2,"VehicleRepairLg"}};
|
class C_Hatchback_02_EPOCH3: C_Hatchback_01_EPOCH3
|
||||||
upgradeToVehicle = "C_Hatchback_02_EPOCH1";
|
{
|
||||||
};
|
upgradeToVehicle = "C_Hatchback_02_EPOCH4";
|
||||||
class C_Hatchback_02_EPOCH1
|
};
|
||||||
{
|
class C_Offroad_01_EPOCH3: C_Hatchback_01_EPOCH3
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc2"},{2,"SpareTire"},{2,"KitTankTrap"}};
|
{
|
||||||
upgradeToVehicle = "C_Hatchback_02_EPOCH2";
|
upgradeToVehicle = "C_Offroad_01_EPOCH4";
|
||||||
};
|
};
|
||||||
class C_Hatchback_02_EPOCH2
|
class C_SUV_01_EPOCH3: C_Hatchback_01_EPOCH3
|
||||||
{
|
{
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc3"},{2,"ItemPipe"},{2,"KitShelf"}};
|
upgradeToVehicle = "C_SUV_01_EPOCH4";
|
||||||
upgradeToVehicle = "C_Hatchback_02_EPOCH3";
|
};
|
||||||
};
|
|
||||||
class C_Hatchback_02_EPOCH3
|
|
||||||
{
|
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc4"},{1,"CircuitParts"},{2,"ItemScraps"},{1,"jerrycan_epoch"}};
|
|
||||||
upgradeToVehicle = "C_Hatchback_02_EPOCH4";
|
|
||||||
};
|
|
||||||
class C_Offroad_01_EPOCH
|
|
||||||
{
|
|
||||||
upgradeReqItems[] = {{1,"ItemVehDoc1"},{1,"ItemCables"},{1,"CircuitParts"},{2,"VehicleRepairLg"}};
|
|
||||||
upgradeToVehicle = "C_Offroad_01_EPOCH1";
|
|
||||||
};
|
|
||||||
class C_Offroad_01_EPOCH1
|
|
||||||
{
|
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc2"},{2,"SpareTire"},{2,"KitTankTrap"}};
|
|
||||||
upgradeToVehicle = "C_Offroad_01_EPOCH2";
|
|
||||||
};
|
|
||||||
class C_Offroad_01_EPOCH2
|
|
||||||
{
|
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc3"},{2,"ItemPipe"},{2,"KitShelf"}};
|
|
||||||
upgradeToVehicle = "C_Offroad_01_EPOCH3";
|
|
||||||
};
|
|
||||||
class C_Offroad_01_EPOCH3
|
|
||||||
{
|
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc4"},{1,"CircuitParts"},{2,"ItemScraps"},{1,"jerrycan_epoch"}};
|
|
||||||
upgradeToVehicle = "C_Offroad_01_EPOCH4";
|
|
||||||
};
|
|
||||||
class C_SUV_01_EPOCH
|
|
||||||
{
|
|
||||||
upgradeReqItems[] = {{1,"ItemVehDoc1"},{1,"ItemCables"},{1,"CircuitParts"},{2,"VehicleRepairLg"}};
|
|
||||||
upgradeToVehicle = "C_SUV_01_EPOCH1";
|
|
||||||
};
|
|
||||||
class C_SUV_01_EPOCH1
|
|
||||||
{
|
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc2"},{2,"SpareTire"},{2,"KitTankTrap"}};
|
|
||||||
upgradeToVehicle = "C_SUV_01_EPOCH2";
|
|
||||||
};
|
|
||||||
class C_SUV_01_EPOCH2
|
|
||||||
{
|
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc3"},{2,"ItemPipe"},{2,"KitShelf"}};
|
|
||||||
upgradeToVehicle = "C_SUV_01_EPOCH3";
|
|
||||||
};
|
|
||||||
class C_SUV_01_EPOCH3
|
|
||||||
{
|
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc4"},{1,"CircuitParts"},{2,"ItemScraps"},{1,"jerrycan_epoch"}};
|
|
||||||
upgradeToVehicle = "C_SUV_01_EPOCH4";
|
|
||||||
};
|
|
||||||
class B_G_Offroad_01_armed_EPOCH
|
|
||||||
{
|
|
||||||
upgradeReqItems[] = {{1,"ItemVehDoc1"},{1,"ItemCables"},{1,"CircuitParts"},{2,"VehicleRepairLg"}};
|
|
||||||
upgradeToVehicle = "B_G_Offroad_01_armed_EPOCH1";
|
|
||||||
};
|
|
||||||
class B_G_Offroad_01_armed_EPOCH1
|
|
||||||
{
|
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc2"},{2,"SpareTire"},{2,"KitTankTrap"}};
|
|
||||||
upgradeToVehicle = "B_G_Offroad_01_armed_EPOCH2";
|
|
||||||
};
|
|
||||||
class B_G_Offroad_01_armed_EPOCH2
|
|
||||||
{
|
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc3"},{2,"ItemPipe"},{2,"KitShelf"}};
|
|
||||||
upgradeToVehicle = "B_G_Offroad_01_armed_EPOCH3";
|
|
||||||
};
|
|
||||||
class B_G_Offroad_01_armed_EPOCH3
|
|
||||||
{
|
|
||||||
ReqMaterials[] = {{1,"ItemVehDoc4"},{1,"CircuitParts"},{2,"ItemScraps"},{1,"jerrycan_epoch"}};
|
|
||||||
upgradeToVehicle = "B_G_Offroad_01_armed_EPOCH4";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
@ -73,9 +73,12 @@ if (_slot != -1) then {
|
|||||||
if (_playerNetID == (owner _vehicle)) then {
|
if (_playerNetID == (owner _vehicle)) then {
|
||||||
|
|
||||||
_vehSlot = _vehicle getVariable["VEHICLE_SLOT", "ABORT"];
|
_vehSlot = _vehicle getVariable["VEHICLE_SLOT", "ABORT"];
|
||||||
if (!_vehicleSold && _vehSlot != "ABORT") then {
|
if (!_vehicleSold && _vehSlot != "ABORT") then {
|
||||||
|
_BaseClass = _vehicle getvariable ["VEHICLE_BaseClass",""];
|
||||||
removeFromRemainsCollector[_vehicle];
|
if !(_BaseClass isequalto "") then {
|
||||||
|
_item = _BaseClass;
|
||||||
|
};
|
||||||
|
removeFromRemainsCollector[_vehicle];
|
||||||
deleteVehicle _vehicle;
|
deleteVehicle _vehicle;
|
||||||
_vehicleSold = true;
|
_vehicleSold = true;
|
||||||
|
|
||||||
|
@ -138,93 +138,7 @@ for "_i" from 1 to _maxStorageLimit do {
|
|||||||
clearItemCargoGlobal _vehicle;
|
clearItemCargoGlobal _vehicle;
|
||||||
|
|
||||||
if !(_inventory isEqualTo []) then {
|
if !(_inventory isEqualTo []) then {
|
||||||
{
|
[_vehicle,_inventory] call EPOCH_server_CargoFill;
|
||||||
_objType = _forEachIndex;
|
|
||||||
|
|
||||||
_objTypes = _x;
|
|
||||||
_objQty = [];
|
|
||||||
|
|
||||||
if (_objType in [1, 2, 3]) then {
|
|
||||||
_objTypes = _x select 0;
|
|
||||||
_objQty = _x select 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
{
|
|
||||||
switch _objType do {
|
|
||||||
// Weapon cargo
|
|
||||||
case 0: {
|
|
||||||
if (_x isEqualType []) then {
|
|
||||||
if ((count _x) >= 4) then {
|
|
||||||
_vehicle addWeaponCargoGlobal[_x deleteAt 0, 1];
|
|
||||||
|
|
||||||
_attachments = [];
|
|
||||||
_wMags = false;
|
|
||||||
_wMagsArray = [];
|
|
||||||
// suppressor, laser, optics, magazines(array), bipods
|
|
||||||
{
|
|
||||||
// magazines
|
|
||||||
if (_x isEqualType []) then{
|
|
||||||
_wMags = true;
|
|
||||||
_wMagsArray = _x;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// attachments
|
|
||||||
if (_x != "") then{
|
|
||||||
_attachments pushBack _x;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} forEach _x;
|
|
||||||
|
|
||||||
// add all attachments to vehicle
|
|
||||||
// TODO replace with adding attachments directly to gun (Arma feature dependant)
|
|
||||||
{
|
|
||||||
_vehicle addItemCargoGlobal[_x, 1];
|
|
||||||
} forEach _attachments;
|
|
||||||
|
|
||||||
if (_wMags) then{
|
|
||||||
if (_wMagsArray isEqualType [] && (count _wMagsArray) >= 2) then{
|
|
||||||
_vehicle addMagazineAmmoCargo[_wMagsArray select 0, 1, _wMagsArray select 1];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
// Magazine cargo
|
|
||||||
case 1: {
|
|
||||||
_magazineName = _x;
|
|
||||||
_magazineSize = _objQty select _forEachIndex;
|
|
||||||
|
|
||||||
if ((_magazineName isEqualType "STRING") && (_magazineSize isEqualType 0)) then {
|
|
||||||
_magazineSizeMax = getNumber (configFile >> "CfgMagazines" >> _magazineName >> "count");
|
|
||||||
if (_magazineSizeMax >= 1) then {
|
|
||||||
// Add full magazines cargo
|
|
||||||
_vehicle addMagazineAmmoCargo [_magazineName, floor (_magazineSize / _magazineSizeMax), _magazineSizeMax];
|
|
||||||
|
|
||||||
// Add last non full magazine
|
|
||||||
if ((_magazineSize % _magazineSizeMax) > 0) then {
|
|
||||||
_vehicle addMagazineAmmoCargo [_magazineName, 1, floor (_magazineSize % _magazineSizeMax)];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
// Backpack cargo
|
|
||||||
case 2: {
|
|
||||||
if (_x isEqualType "STRING") then {
|
|
||||||
_qty = _objQty select _forEachIndex;
|
|
||||||
_vehicle addBackpackCargoGlobal [_x, _qty];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
// Item cargo
|
|
||||||
case 3: {
|
|
||||||
if (_x isEqualType "STRING") then {
|
|
||||||
_qty = _objQty select _forEachIndex;
|
|
||||||
_vehicle addItemCargoGlobal [_x, _qty];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}forEach _objTypes;
|
|
||||||
}forEach _inventory;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (EPOCH_DEBUG_VEH) then {
|
if (EPOCH_DEBUG_VEH) then {
|
||||||
|
@ -13,12 +13,12 @@
|
|||||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf
|
||||||
*/
|
*/
|
||||||
//[[[cog import generate_private_arrays ]]]
|
//[[[cog import generate_private_arrays ]]]
|
||||||
private ["_actualHitpoints","_allHitpoints","_allVehicles","_allowDamage","_arr","_arrNum","_attachments","_availableColorsConfig","_cfgEpochVehicles","_class","_color","_colors","_config","_count","_damage","_dataFormat","_dataFormatCount","_diag","_dmg","_found","_hitpoints","_immuneIfStartInBase","_jammerOwner","_jammerRange","_jammers","_location","_lockedOwner","_magazineName","_magazineSize","_magazineSizeMax","_mags","_marker","_nearestJammer","_objQty","_objType","_objTypes","_qty","_removemagazinesturret","_removeweapons","_response","_selections","_serverSettingsConfig","_simulationHandler","_textureSelectionIndex","_textures","_vehHiveKey","_vehLockHiveKey","_vehicle","_vehicleDamages","_vehicleSlotIndex","_wMags","_wMagsArray","_worldspace"];
|
private ["_actualHitpoints","_allHitpoints","_allVehicles","_allowDamage","_arr","_arrNum","_attachments","_availableColorsConfig","_cfgEpochVehicles","_class","_color","_colors","_config","_count","_damage","_dataFormat","_dataFormatCount","_diag","_dmg","_found","_hitpoints","_immuneIfStartInBase","_jammerOwner","_jammerRange","_jammers","_location","_lockedOwner","_magazineName","_magazineSize","_magazineSizeMax","_mags","_marker","_nearestJammer","_objQty","_objType","_objTypes","_qty","_removemagazinesturret","_removeweapons","_response","_selections","_serverSettingsConfig","_simulationHandler","_textureSelectionIndex","_textures","_vehHiveKey","_vehLockHiveKey","_vehicle","_vehicleDamages","_vehicleSlotIndex","_wMags","_wMagsArray","_worldspace","_baseClass"];
|
||||||
//[[[end]]]
|
//[[[end]]]
|
||||||
params [["_maxVehicleLimit",0]];
|
params [["_maxVehicleLimit",0]];
|
||||||
|
|
||||||
_diag = diag_tickTime;
|
_diag = diag_tickTime;
|
||||||
_dataFormat = ["", [], 0, [], 0, [], [], 0];
|
_dataFormat = ["", [], 0, [], 0, [], [], 0, ""];
|
||||||
_dataFormatCount = count _dataFormat;
|
_dataFormatCount = count _dataFormat;
|
||||||
EPOCH_VehicleSlots = [];
|
EPOCH_VehicleSlots = [];
|
||||||
_allVehicles = [];
|
_allVehicles = [];
|
||||||
@ -110,6 +110,10 @@ for "_i" from 1 to _maxVehicleLimit do {
|
|||||||
} forEach _selections;
|
} forEach _selections;
|
||||||
_vehicle setVariable ["VEHICLE_TEXTURE", _color];
|
_vehicle setVariable ["VEHICLE_TEXTURE", _color];
|
||||||
};
|
};
|
||||||
|
_baseClass = _arr select 8;
|
||||||
|
if !(_baseClass isequalto "") then {
|
||||||
|
_vehicle setvariable ["VEHICLE_BASECLASS",_baseClass];
|
||||||
|
};
|
||||||
// disable thermal imaging equipment
|
// disable thermal imaging equipment
|
||||||
_vehicle disableTIEquipment true;
|
_vehicle disableTIEquipment true;
|
||||||
// lock all vehicles
|
// lock all vehicles
|
||||||
@ -131,83 +135,8 @@ for "_i" from 1 to _maxVehicleLimit do {
|
|||||||
} foreach _removemagazinesturret;
|
} foreach _removemagazinesturret;
|
||||||
};
|
};
|
||||||
|
|
||||||
{
|
// utilize He-Man's new Cargo functions
|
||||||
_objType = _forEachIndex;
|
[_vehicle,_arr select 5] call EPOCH_server_CargoFill;
|
||||||
_objTypes = _x;
|
|
||||||
_objQty = [];
|
|
||||||
if (_objType in [1, 2, 3]) then {
|
|
||||||
_objTypes = _x select 0;
|
|
||||||
_objQty = _x select 1;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
switch _objType do {
|
|
||||||
// Weapon cargo
|
|
||||||
case 0: {
|
|
||||||
if (_x isEqualType []) then {
|
|
||||||
if ((count _x) >= 4) then {
|
|
||||||
_vehicle addWeaponCargoGlobal[_x deleteAt 0, 1];
|
|
||||||
_attachments = [];
|
|
||||||
_wMags = false;
|
|
||||||
_wMagsArray = [];
|
|
||||||
// suppressor, laser, optics, magazines(array), bipods
|
|
||||||
{
|
|
||||||
// magazines
|
|
||||||
if (_x isEqualType []) then{
|
|
||||||
_wMags = true;
|
|
||||||
_wMagsArray = _x;
|
|
||||||
} else {
|
|
||||||
// attachments
|
|
||||||
if (_x != "") then{
|
|
||||||
_attachments pushBack _x;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} forEach _x;
|
|
||||||
// add all attachments to vehicle
|
|
||||||
// TODO replace with adding attachments directly to gun (Arma feature dependant)
|
|
||||||
{
|
|
||||||
_vehicle addItemCargoGlobal[_x, 1];
|
|
||||||
} forEach _attachments;
|
|
||||||
if (_wMags) then{
|
|
||||||
if (_wMagsArray isEqualType [] && (count _wMagsArray) >= 2) then{
|
|
||||||
_vehicle addMagazineAmmoCargo[_wMagsArray select 0, 1, _wMagsArray select 1];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
// Magazine cargo
|
|
||||||
case 1: {
|
|
||||||
_magazineName = _x;
|
|
||||||
_magazineSize = _objQty select _forEachIndex;
|
|
||||||
if ((_magazineName isEqualType "STRING") && (_magazineSize isEqualType 0)) then {
|
|
||||||
_magazineSizeMax = getNumber (configFile >> "CfgMagazines" >> _magazineName >> "count");
|
|
||||||
if (_magazineSizeMax >= 1) then {
|
|
||||||
// Add full magazines cargo
|
|
||||||
_vehicle addMagazineAmmoCargo [_magazineName, floor (_magazineSize / _magazineSizeMax), _magazineSizeMax];
|
|
||||||
// Add last non full magazine
|
|
||||||
if ((_magazineSize % _magazineSizeMax) > 0) then {
|
|
||||||
_vehicle addMagazineAmmoCargo [_magazineName, 1, floor (_magazineSize % _magazineSizeMax)];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
// Backpack cargo
|
|
||||||
case 2: {
|
|
||||||
if (_x isEqualType "STRING") then {
|
|
||||||
_qty = _objQty select _forEachIndex;
|
|
||||||
_vehicle addBackpackCargoGlobal [_x, _qty];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
// Item cargo
|
|
||||||
case 3: {
|
|
||||||
if (_x isEqualType "STRING") then {
|
|
||||||
_qty = _objQty select _forEachIndex;
|
|
||||||
_vehicle addItemCargoGlobal [_x, _qty];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} forEach _objTypes;
|
|
||||||
} forEach (_arr select 5);
|
|
||||||
|
|
||||||
// remove and add back magazines
|
// remove and add back magazines
|
||||||
if !((_arr select 6) isequalto []) then {
|
if !((_arr select 6) isequalto []) then {
|
||||||
|
@ -0,0 +1,78 @@
|
|||||||
|
params [["_vehicle",objnull],["_items",[]]];
|
||||||
|
{
|
||||||
|
_objType = _forEachIndex;
|
||||||
|
_objTypes = _x;
|
||||||
|
_objQty = [];
|
||||||
|
if (_objType in [1, 2, 3]) then {
|
||||||
|
_objTypes = _x select 0;
|
||||||
|
_objQty = _x select 1;
|
||||||
|
};
|
||||||
|
{
|
||||||
|
switch _objType do {
|
||||||
|
// Weapon cargo
|
||||||
|
case 0: {
|
||||||
|
if (_x isEqualType []) then {
|
||||||
|
if ((count _x) >= 4) then {
|
||||||
|
_vehicle addWeaponCargoGlobal[_x deleteAt 0, 1];
|
||||||
|
_attachments = [];
|
||||||
|
_wMags = false;
|
||||||
|
_wMagsArray = [];
|
||||||
|
// suppressor, laser, optics, magazines(array), bipods
|
||||||
|
{
|
||||||
|
// magazines
|
||||||
|
if (_x isEqualType []) then{
|
||||||
|
_wMags = true;
|
||||||
|
_wMagsArray = _x;
|
||||||
|
} else {
|
||||||
|
// attachments
|
||||||
|
if (_x != "") then{
|
||||||
|
_attachments pushBack _x;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _x;
|
||||||
|
// add all attachments to vehicle
|
||||||
|
// TODO replace with adding attachments directly to gun (Arma feature dependant)
|
||||||
|
{
|
||||||
|
_vehicle addItemCargoGlobal[_x, 1];
|
||||||
|
} forEach _attachments;
|
||||||
|
if (_wMags) then{
|
||||||
|
if (_wMagsArray isEqualType [] && (count _wMagsArray) >= 2) then{
|
||||||
|
_vehicle addMagazineAmmoCargo[_wMagsArray select 0, 1, _wMagsArray select 1];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
// Magazine cargo
|
||||||
|
case 1: {
|
||||||
|
_magazineName = _x;
|
||||||
|
_magazineSize = _objQty select _forEachIndex;
|
||||||
|
if ((_magazineName isEqualType "STRING") && (_magazineSize isEqualType 0)) then {
|
||||||
|
_magazineSizeMax = getNumber (configFile >> "CfgMagazines" >> _magazineName >> "count");
|
||||||
|
if (_magazineSizeMax >= 1) then {
|
||||||
|
// Add full magazines cargo
|
||||||
|
_vehicle addMagazineAmmoCargo [_magazineName, floor (_magazineSize / _magazineSizeMax), _magazineSizeMax];
|
||||||
|
// Add last non full magazine
|
||||||
|
if ((_magazineSize % _magazineSizeMax) > 0) then {
|
||||||
|
_vehicle addMagazineAmmoCargo [_magazineName, 1, floor (_magazineSize % _magazineSizeMax)];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
// Backpack cargo
|
||||||
|
case 2: {
|
||||||
|
if (_x isEqualType "STRING") then {
|
||||||
|
_qty = _objQty select _forEachIndex;
|
||||||
|
_vehicle addBackpackCargoGlobal [_x, _qty];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
// Item cargo
|
||||||
|
case 3: {
|
||||||
|
if (_x isEqualType "STRING") then {
|
||||||
|
_qty = _objQty select _forEachIndex;
|
||||||
|
_vehicle addItemCargoGlobal [_x, _qty];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _objTypes;
|
||||||
|
} forEach _items;
|
@ -0,0 +1,66 @@
|
|||||||
|
params [["_vehicle",objnull]];
|
||||||
|
// may not be needed but should prevent <null> in DB.
|
||||||
|
_wepsItemsCargo = weaponsItemsCargo _vehicle;
|
||||||
|
if (isNil "_wepsItemsCargo") then {
|
||||||
|
_wepsItemsCargo = [];
|
||||||
|
};
|
||||||
|
_magsAmmoCargo = magazinesAmmoCargo _vehicle;
|
||||||
|
if (isNil "_magsAmmoCargo") then {
|
||||||
|
_magsAmmoCargo = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
{
|
||||||
|
_cargo = _x select 1;
|
||||||
|
_magsAmmoCargox = magazinesAmmoCargo _cargo;
|
||||||
|
{
|
||||||
|
_magsAmmoCargo pushback _x;
|
||||||
|
} foreach _magsAmmoCargox;
|
||||||
|
_wepsItemsCargox = weaponsItemsCargo _cargo;
|
||||||
|
{
|
||||||
|
_wepsItemsCargo pushback _x;
|
||||||
|
} foreach _wepsItemsCargox;
|
||||||
|
} foreach everycontainer _vehicle;
|
||||||
|
|
||||||
|
// minimize magazine ammo cargo
|
||||||
|
_magsAmmoCargoMinimized = [[],[]];
|
||||||
|
{
|
||||||
|
// find cargo in temp var
|
||||||
|
_cargoIndex = _magsAmmoCargoMinimized find (_x select 0);
|
||||||
|
if (_cargoIndex >= 0) then {
|
||||||
|
(_magsAmmoCargoMinimized select 1) set [_cargoIndex, ((_magsAmmoCargoMinimized select 1) select _cargoIndex) + (_x select 1)]; // get count & add current
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(_magsAmmoCargoMinimized select 0) pushBack (_x select 0); // classname
|
||||||
|
(_magsAmmoCargoMinimized select 1) pushBack (_x select 1); // count
|
||||||
|
};
|
||||||
|
} forEach _magsAmmoCargo;
|
||||||
|
|
||||||
|
// convert and normalize
|
||||||
|
_wepsItemsCargoNormalized = [];
|
||||||
|
{
|
||||||
|
_selectedWeaponComponents = _x;
|
||||||
|
_selectedWeapon = _selectedWeaponComponents deleteAt 0;
|
||||||
|
// find actual weapon components - todo this BIS call maybe slow
|
||||||
|
_weaponComponents = _selectedWeapon call BIS_fnc_weaponComponents;
|
||||||
|
// base weapon (without attachments)
|
||||||
|
_weapon = _weaponComponents deleteAt 0;
|
||||||
|
_newComponents = [];
|
||||||
|
{
|
||||||
|
// remove attachments that are already linked via config
|
||||||
|
if (_x isEqualType "" && {(tolower _x) in _weaponComponents}) then {
|
||||||
|
_newComponents pushBack "";
|
||||||
|
//diag_log format ["DEBUG: suppressed saving of %1 for weapon %2 config %3", _x, [_selectedWeapon,_selectedWeaponComponents],[_weapon,_weaponComponents]];
|
||||||
|
} else {
|
||||||
|
_newComponents pushBack _x;
|
||||||
|
};
|
||||||
|
} forEach _selectedWeaponComponents;
|
||||||
|
_wepsItemsCargoNormalized pushBack ([_selectedWeapon] + _newComponents);
|
||||||
|
} forEach _wepsItemsCargo;
|
||||||
|
|
||||||
|
_inventory = [
|
||||||
|
_wepsItemsCargoNormalized,
|
||||||
|
_magsAmmoCargoMinimized,
|
||||||
|
getBackpackCargo _vehicle,
|
||||||
|
getItemCargo _vehicle
|
||||||
|
];
|
||||||
|
_inventory
|
@ -28,72 +28,8 @@ if (!isNull _vehicle) then {
|
|||||||
_vehicle setDamage 0;
|
_vehicle setDamage 0;
|
||||||
_vehiclePos = getposATL _vehicle;
|
_vehiclePos = getposATL _vehicle;
|
||||||
|
|
||||||
// may not be needed but should prevent <null> in DB.
|
_inventory = _vehicle call EPOCH_server_CargoSave;
|
||||||
_wepsItemsCargo = weaponsItemsCargo _vehicle;
|
|
||||||
if (isNil "_wepsItemsCargo") then {
|
|
||||||
_wepsItemsCargo = [];
|
|
||||||
};
|
|
||||||
_magsAmmoCargo = magazinesAmmoCargo _vehicle;
|
|
||||||
if (isNil "_magsAmmoCargo") then {
|
|
||||||
_magsAmmoCargo = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
{
|
|
||||||
_cargo = _x select 1;
|
|
||||||
_magsAmmoCargox = magazinesAmmoCargo _cargo;
|
|
||||||
{
|
|
||||||
_magsAmmoCargo pushback _x;
|
|
||||||
} foreach _magsAmmoCargox;
|
|
||||||
|
|
||||||
_wepsItemsCargox = weaponsItemsCargo _cargo;
|
|
||||||
{
|
|
||||||
_wepsItemsCargo pushback _x;
|
|
||||||
} foreach _wepsItemsCargox;
|
|
||||||
} foreach everycontainer _vehicle;
|
|
||||||
|
|
||||||
// minimize magazine ammo cargo
|
|
||||||
_magsAmmoCargoMinimized = [[],[]];
|
|
||||||
{
|
|
||||||
// find cargo in temp var
|
|
||||||
_cargoIndex = _magsAmmoCargoMinimized find (_x select 0);
|
|
||||||
if (_cargoIndex >= 0) then {
|
|
||||||
(_magsAmmoCargoMinimized select 1) set [_cargoIndex, ((_magsAmmoCargoMinimized select 1) select _cargoIndex) + (_x select 1)]; // get count & add current
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
(_magsAmmoCargoMinimized select 0) pushBack (_x select 0); // classname
|
|
||||||
(_magsAmmoCargoMinimized select 1) pushBack (_x select 1); // count
|
|
||||||
};
|
|
||||||
} forEach _magsAmmoCargo;
|
|
||||||
|
|
||||||
// convert and normalize
|
|
||||||
_wepsItemsCargoNormalized = [];
|
|
||||||
{
|
|
||||||
_selectedWeaponComponents = _x;
|
|
||||||
_selectedWeapon = _selectedWeaponComponents deleteAt 0;
|
|
||||||
// find actual weapon components - todo this BIS call maybe slow
|
|
||||||
_weaponComponents = _selectedWeapon call BIS_fnc_weaponComponents;
|
|
||||||
// base weapon (without attachments)
|
|
||||||
_weapon = _weaponComponents deleteAt 0;
|
|
||||||
_newComponents = [];
|
|
||||||
{
|
|
||||||
// remove attachments that are already linked via config
|
|
||||||
if (_x isEqualType "" && {(tolower _x) in _weaponComponents}) then {
|
|
||||||
_newComponents pushBack "";
|
|
||||||
//diag_log format ["DEBUG: suppressed saving of %1 for weapon %2 config %3", _x, [_selectedWeapon,_selectedWeaponComponents],[_weapon,_weaponComponents]];
|
|
||||||
} else {
|
|
||||||
_newComponents pushBack _x;
|
|
||||||
};
|
|
||||||
} forEach _selectedWeaponComponents;
|
|
||||||
_wepsItemsCargoNormalized pushBack ([_selectedWeapon] + _newComponents);
|
|
||||||
} forEach _wepsItemsCargo;
|
|
||||||
|
|
||||||
_inventory = [
|
|
||||||
_wepsItemsCargoNormalized,
|
|
||||||
_magsAmmoCargoMinimized,
|
|
||||||
getBackpackCargo _vehicle,
|
|
||||||
getItemCargo _vehicle
|
|
||||||
];
|
|
||||||
|
|
||||||
_colorSlot = _vehicle getVariable ["STORAGE_TEXTURE",0];
|
_colorSlot = _vehicle getVariable ["STORAGE_TEXTURE",0];
|
||||||
_storageOwners = _vehicle getVariable["STORAGE_OWNERS",[]];
|
_storageOwners = _vehicle getVariable["STORAGE_OWNERS",[]];
|
||||||
_locked = if (_vehicle getVariable["EPOCH_Locked", true]) then {1} else {-1};
|
_locked = if (_vehicle getVariable["EPOCH_Locked", true]) then {1} else {-1};
|
||||||
|
@ -27,77 +27,11 @@ if (!isNull _vehicle) then {
|
|||||||
|
|
||||||
_hitpoints = (getAllHitPointsDamage _vehicle) param [2,[]];
|
_hitpoints = (getAllHitPointsDamage _vehicle) param [2,[]];
|
||||||
|
|
||||||
// may not be needed but should prevent <null> in DB.
|
_inventory = _vehicle call EPOCH_server_CargoSave;
|
||||||
_wepsItemsCargo = weaponsItemsCargo _vehicle;
|
|
||||||
if (isNil "_wepsItemsCargo") then {
|
|
||||||
_wepsItemsCargo = [];
|
|
||||||
};
|
|
||||||
_magsAmmoCargo = magazinesAmmoCargo _vehicle;
|
|
||||||
if (isNil "_magsAmmoCargo") then {
|
|
||||||
_magsAmmoCargo = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
{
|
|
||||||
_cargo = _x select 1;
|
|
||||||
_magsAmmoCargox = magazinesAmmoCargo _cargo;
|
|
||||||
{
|
|
||||||
_magsAmmoCargo pushback _x;
|
|
||||||
} foreach _magsAmmoCargox;
|
|
||||||
_wepsItemsCargox = weaponsItemsCargo _cargo;
|
|
||||||
{
|
|
||||||
_wepsItemsCargo pushback _x;
|
|
||||||
} foreach _wepsItemsCargox;
|
|
||||||
} foreach everycontainer _vehicle;
|
|
||||||
|
|
||||||
// minimize magazine ammo cargo
|
|
||||||
_magsAmmoCargoMinimized = [[],[]];
|
|
||||||
{
|
|
||||||
// find cargo in temp var
|
|
||||||
_cargoIndex = _magsAmmoCargoMinimized find (_x select 0);
|
|
||||||
if (_cargoIndex >= 0) then {
|
|
||||||
(_magsAmmoCargoMinimized select 1) set [_cargoIndex, ((_magsAmmoCargoMinimized select 1) select _cargoIndex) + (_x select 1)]; // get count & add current
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
(_magsAmmoCargoMinimized select 0) pushBack (_x select 0); // classname
|
|
||||||
(_magsAmmoCargoMinimized select 1) pushBack (_x select 1); // count
|
|
||||||
};
|
|
||||||
} forEach _magsAmmoCargo;
|
|
||||||
|
|
||||||
// convert and normalize
|
|
||||||
_startTime = diag_tickTime;
|
|
||||||
//diag_log format ["DEBUG: BIS_fnc_weaponComponents start %1", _startTime];
|
|
||||||
_wepsItemsCargoNormalized = [];
|
|
||||||
{
|
|
||||||
_selectedWeaponComponents = _x;
|
|
||||||
_selectedWeapon = _selectedWeaponComponents deleteAt 0;
|
|
||||||
// find actual weapon components - todo this BIS call maybe slow
|
|
||||||
_weaponComponents = _selectedWeapon call BIS_fnc_weaponComponents;
|
|
||||||
//diag_log format ["DEBUG: BIS_fnc_weaponComponents end %1", diag_tickTime - _startTime];
|
|
||||||
// base weapon (without attachments)
|
|
||||||
_weapon = _weaponComponents deleteAt 0;
|
|
||||||
_newComponents = [];
|
|
||||||
{
|
|
||||||
// remove attachments that are already linked via config
|
|
||||||
if (_x isEqualType "" && {(tolower _x) in _weaponComponents}) then {
|
|
||||||
_newComponents pushBack "";
|
|
||||||
//diag_log format ["DEBUG: suppressed saving of %1 for weapon %2 config %3", _x, [_selectedWeapon,_selectedWeaponComponents],[_weapon,_weaponComponents]];
|
|
||||||
} else {
|
|
||||||
_newComponents pushBack _x;
|
|
||||||
};
|
|
||||||
} forEach _selectedWeaponComponents;
|
|
||||||
_wepsItemsCargoNormalized pushBack ([_selectedWeapon] + _newComponents);
|
|
||||||
} forEach _wepsItemsCargo;
|
|
||||||
// diag_log format ["DEBUG: convert and normalize end %1", diag_tickTime - _startTime];
|
|
||||||
|
|
||||||
_inventory = [
|
|
||||||
_wepsItemsCargoNormalized,
|
|
||||||
_magsAmmoCargoMinimized,
|
|
||||||
getBackpackCargo _vehicle,
|
|
||||||
getItemCargo _vehicle
|
|
||||||
];
|
|
||||||
_colorSlot = _vehicle getVariable ["VEHICLE_TEXTURE",0];
|
_colorSlot = _vehicle getVariable ["VEHICLE_TEXTURE",0];
|
||||||
|
_baseType = _vehicle getVariable ["VEHICLE_BASECLASS",""];
|
||||||
_VAL = [typeOf _vehicle,[(getposATL _vehicle call EPOCH_precisionPos),vectordir _vehicle,vectorup _vehicle],damage _vehicle,_hitpoints,fuel _vehicle,_inventory,[true,magazinesAllTurrets _vehicle],_colorSlot];
|
_VAL = [typeOf _vehicle,[(getposATL _vehicle call EPOCH_precisionPos),vectordir _vehicle,vectorup _vehicle],damage _vehicle,_hitpoints,fuel _vehicle,_inventory,[true,magazinesAllTurrets _vehicle],_colorSlot,_baseType];
|
||||||
["Vehicle", _vehHiveKey, EPOCH_expiresVehicle, _VAL] call EPOCH_fnc_server_hiveSETEX;
|
["Vehicle", _vehHiveKey, EPOCH_expiresVehicle, _VAL] call EPOCH_fnc_server_hiveSETEX;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -24,21 +24,82 @@ if (_UpgradeVeh isequalto "") exitwith {
|
|||||||
diag_log "No Upgrade Vehicle Class";
|
diag_log "No Upgrade Vehicle Class";
|
||||||
};
|
};
|
||||||
if !(_removeCrypto isequalto []) && !(_removeCrypto isEqualTo 0) then {
|
if !(_removeCrypto isequalto []) && !(_removeCrypto isEqualTo 0) then {
|
||||||
[_player,-_removeCrypto] remoteExec ["EPOCH_server_effectCrypto",2];
|
[_player,-_removeCrypto] call EPOCH_server_effectCrypto;
|
||||||
};
|
};
|
||||||
_slot = _veh getvariable ["vehicle_slot","-1"];
|
_slot = _veh getvariable ["vehicle_slot","-1"];
|
||||||
if (_slot isequalto "-1") exitwith {
|
if (_slot isequalto "-1") exitwith {
|
||||||
diag_log "Vehicle has no Slot";
|
diag_log "Vehicle has no Slot";
|
||||||
};
|
};
|
||||||
|
|
||||||
_pos = getposasl _veh;
|
_pos = getposasl _veh;
|
||||||
_dir = getdir _veh;
|
_dir = getdir _veh;
|
||||||
|
_cargo = _veh call EPOCH_server_CargoSave;
|
||||||
|
_damage = damage _veh;
|
||||||
|
_hitPoints = getAllHitPointsDamage _veh;
|
||||||
|
_baseVeh = _veh getVariable ["VEHICLE_BASECLASS",""];
|
||||||
|
_typeVeh = typeOf _veh;
|
||||||
|
_colorVeh = _veh getVariable ["VEHICLE_TEXTURE",""];
|
||||||
|
_fuel = fuel _veh;
|
||||||
deletevehicle _veh;
|
deletevehicle _veh;
|
||||||
waituntil {isnull _veh};
|
waituntil {isnull _veh};
|
||||||
_pos set [2,(_pos select 2)+0.5];
|
_pos set [2,(_pos select 2)+0.5];
|
||||||
_veh = createVehicle [_UpgradeVeh, [random 500, random 500,500], [], 0, "CAN_COLLIDE"];
|
_newVeh = createVehicle [_UpgradeVeh, [random 500, random 500,500], [], 0, "CAN_COLLIDE"];
|
||||||
_veh setVariable ["VEHICLE_SLOT", _slot, true];
|
_newVeh setVariable ["VEHICLE_SLOT", _slot, true];
|
||||||
_veh call EPOCH_server_setVToken;
|
if!(_baseVeh isEqualTo "")then
|
||||||
_veh call EPOCH_server_vehicleInit;
|
{
|
||||||
_veh setdir _dir;
|
_newVeh setVariable["VEHICLE_BASECLASS", _baseVeh];
|
||||||
_veh setposasl _pos;
|
}else{
|
||||||
|
_newVeh setVariable["VEHICLE_BASECLASS", _typeVeh];
|
||||||
|
};
|
||||||
|
_newVeh call EPOCH_server_setVToken;
|
||||||
|
_newVeh call EPOCH_server_vehicleInit;
|
||||||
|
_newVeh setdir _dir;
|
||||||
|
_newVeh setposasl _pos;
|
||||||
|
|
||||||
|
// set fuel level
|
||||||
|
_newVeh setFuel _fuel;
|
||||||
|
|
||||||
|
// apply persistent textures
|
||||||
|
_cfgEpochVehicles = 'CfgEpochVehicles' call EPOCH_returnConfig;
|
||||||
|
_newbaseVeh = _veh getVariable ["VEHICLE_BASECLASS",""];
|
||||||
|
_availableColorsConfig = (_cfgEpochVehicles >> _newbaseVeh >> "availableColors");
|
||||||
|
if (isArray(_availableColorsConfig)) then {
|
||||||
|
_color = _colorVeh;
|
||||||
|
_colors = getArray(_availableColorsConfig);
|
||||||
|
_textureSelectionIndex = (_cfgEpochVehicles >> _newbaseVeh >> "textureSelectionIndex");
|
||||||
|
_selections = if (isArray(_textureSelectionIndex)) then { getArray(_textureSelectionIndex) } else { [0] };
|
||||||
|
_count = (count _colors) - 1;
|
||||||
|
{
|
||||||
|
_textures = _colors select 0;
|
||||||
|
if (_count >= _forEachIndex) then {
|
||||||
|
_textures = _colors select _forEachIndex;
|
||||||
|
};
|
||||||
|
_newVeh setObjectTextureGlobal [_x, _textures select _color];
|
||||||
|
} forEach _selections;
|
||||||
|
_newVeh setVariable ["VEHICLE_TEXTURE", _color];
|
||||||
|
};
|
||||||
|
|
||||||
|
// disable thermal imaging equipment
|
||||||
|
_newVeh disableTIEquipment true;
|
||||||
|
|
||||||
|
// set damage and hitpoints
|
||||||
|
_newVeh setDamage _damage;
|
||||||
|
_allHitpoints = getAllHitPointsDamage _newVeh;
|
||||||
|
if !(_allHitpoints isEqualTo []) then{
|
||||||
|
_actualHitpoints = _allHitpoints select 0;
|
||||||
|
if ((count _actualHitpoints) == (count _hitpoints)) then{
|
||||||
|
{
|
||||||
|
_dmg = _hitpoints param [_forEachIndex,0];
|
||||||
|
if (_x in ["HitFuel", "HitEngine"]) then {
|
||||||
|
_dmg = _dmg min 0.9;
|
||||||
|
};
|
||||||
|
_newVeh setHitIndex [_forEachIndex, _dmg];
|
||||||
|
} forEach _actualHitpoints;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// add back old inventory
|
||||||
|
[_newveh,_cargo] call EPOCH_server_CargoFill;
|
||||||
|
|
||||||
|
// save new vehicle to db
|
||||||
|
_newveh call EPOCH_Server_Save_Vehicle;
|
@ -95,6 +95,8 @@ class CfgServerFunctions
|
|||||||
class server_packJack {};
|
class server_packJack {};
|
||||||
class spawn_vehicle {};
|
class spawn_vehicle {};
|
||||||
class server_upgrade_vehicle {};
|
class server_upgrade_vehicle {};
|
||||||
|
class server_CargoSave {};
|
||||||
|
class server_CargoFill {};
|
||||||
};
|
};
|
||||||
class epoch_server {
|
class epoch_server {
|
||||||
class weightedArray {};
|
class weightedArray {};
|
||||||
|
@ -163,7 +163,7 @@ diag_log "Epoch: Spawning vehicles";
|
|||||||
_allowedVehiclesListArray = [];
|
_allowedVehiclesListArray = [];
|
||||||
{
|
{
|
||||||
_x params ["_vehClass","_velimit"];
|
_x params ["_vehClass","_velimit"];
|
||||||
_vehicleCount = {typeOf _x == _vehClass} count vehicles;
|
_vehicleCount = {(_x getvariable ["VEHICLE_BaseClass",typeOf _x]) == _vehClass} count vehicles;
|
||||||
|
|
||||||
// Load how many of this vehicle are in stock at any trader.
|
// Load how many of this vehicle are in stock at any trader.
|
||||||
_indexStock = EPOCH_traderStoredVehicles find _vehClass;
|
_indexStock = EPOCH_traderStoredVehicles find _vehClass;
|
||||||
|
@ -18,14 +18,26 @@ class CfgEpochVehicles
|
|||||||
textureSelectionIndex[] = {0};
|
textureSelectionIndex[] = {0};
|
||||||
availableColors[] = {{ "\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE01_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE02_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE03_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE04_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE05_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE06_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE07_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE08_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE09_CO.paa" }};
|
availableColors[] = {{ "\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE01_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE02_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE03_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE04_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE05_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE06_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE07_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE08_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE09_CO.paa" }};
|
||||||
};
|
};
|
||||||
|
class C_Hatchback_01_EPOCH1: C_Hatchback_01_EPOCH{};
|
||||||
|
class C_Hatchback_01_EPOCH2: C_Hatchback_01_EPOCH{};
|
||||||
|
class C_Hatchback_01_EPOCH3: C_Hatchback_01_EPOCH{};
|
||||||
|
class C_Hatchback_01_EPOCH4: C_Hatchback_01_EPOCH{};
|
||||||
class C_Offroad_01_EPOCH {
|
class C_Offroad_01_EPOCH {
|
||||||
textureSelectionIndex[] = {0,1};
|
textureSelectionIndex[] = {0,1};
|
||||||
availableColors[] = {{ "\A3\soft_F\Offroad_01\Data\Offroad_01_ext_co.paa","\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE01_CO.paa","\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE02_CO.paa","\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE03_CO.paa","\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE04_CO.paa","\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE05_CO.paa" }};
|
availableColors[] = {{ "\A3\soft_F\Offroad_01\Data\Offroad_01_ext_co.paa","\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE01_CO.paa","\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE02_CO.paa","\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE03_CO.paa","\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE04_CO.paa","\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE05_CO.paa" }};
|
||||||
};
|
};
|
||||||
|
class C_Offroad_01_EPOCH1: C_Offroad_01_EPOCH{};
|
||||||
|
class C_Offroad_01_EPOCH2: C_Offroad_01_EPOCH{};
|
||||||
|
class C_Offroad_01_EPOCH3: C_Offroad_01_EPOCH{};
|
||||||
|
class C_Offroad_01_EPOCH4: C_Offroad_01_EPOCH{};
|
||||||
class C_SUV_01_EPOCH {
|
class C_SUV_01_EPOCH {
|
||||||
textureSelectionIndex[] = {0};
|
textureSelectionIndex[] = {0};
|
||||||
availableColors[] = {{ "\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_CO.paa","\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_02_CO.paa","\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_03_CO.paa","\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_04_CO.paa" }};
|
availableColors[] = {{ "\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_CO.paa","\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_02_CO.paa","\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_03_CO.paa","\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_04_CO.paa" }};
|
||||||
};
|
};
|
||||||
|
class C_SUV_01_EPOCH1: C_SUV_01_EPOCH{};
|
||||||
|
class C_SUV_01_EPOCH2: C_SUV_01_EPOCH{};
|
||||||
|
class C_SUV_01_EPOCH3: C_SUV_01_EPOCH{};
|
||||||
|
class C_SUV_01_EPOCH4: C_SUV_01_EPOCH{};
|
||||||
class C_Van_01_transport_EPOCH {
|
class C_Van_01_transport_EPOCH {
|
||||||
textureSelectionIndex[] = {0};
|
textureSelectionIndex[] = {0};
|
||||||
availableColors[] = {{ "\A3\soft_f_gamma\van_01\Data\van_01_ext_CO.paa","\A3\soft_f_gamma\van_01\Data\van_01_ext_red_CO.paa" }};
|
availableColors[] = {{ "\A3\soft_f_gamma\van_01\Data\van_01_ext_CO.paa","\A3\soft_f_gamma\van_01\Data\van_01_ext_red_CO.paa" }};
|
||||||
@ -34,6 +46,10 @@ class CfgEpochVehicles
|
|||||||
textureSelectionIndex[] = {0};
|
textureSelectionIndex[] = {0};
|
||||||
availableColors[] = {{ "\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_SPORT01_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_SPORT02_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_SPORT03_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_SPORT04_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_SPORT05_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_SPORT06_CO.paa" }};
|
availableColors[] = {{ "\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_SPORT01_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_SPORT02_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_SPORT03_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_SPORT04_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_SPORT05_CO.paa","\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_SPORT06_CO.paa" }};
|
||||||
};
|
};
|
||||||
|
class C_Hatchback_02_EPOCH1: C_Hatchback_02_EPOCH{};
|
||||||
|
class C_Hatchback_02_EPOCH2: C_Hatchback_02_EPOCH{};
|
||||||
|
class C_Hatchback_02_EPOCH3: C_Hatchback_02_EPOCH{};
|
||||||
|
class C_Hatchback_02_EPOCH4: C_Hatchback_02_EPOCH{};
|
||||||
class C_Quadbike_01_EPOCH {
|
class C_Quadbike_01_EPOCH {
|
||||||
textureSelectionIndex[] = {0,1};
|
textureSelectionIndex[] = {0,1};
|
||||||
availableColors[] = {{ "\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_CIV_BLACK_CO.paa","\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_CIV_BLUE_CO.paa","\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_CIV_RED_CO.paa","\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_CIV_WHITE_CO.paa" },{ "\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_wheel_CIVBLACK_CO.paa","\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_wheel_CIVBLUE_CO.paa","\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_wheel_CIVRED_CO.paa","\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_wheel_CIVWHITE_CO.paa" }};
|
availableColors[] = {{ "\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_CIV_BLACK_CO.paa","\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_CIV_BLUE_CO.paa","\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_CIV_RED_CO.paa","\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_CIV_WHITE_CO.paa" },{ "\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_wheel_CIVBLACK_CO.paa","\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_wheel_CIVBLUE_CO.paa","\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_wheel_CIVRED_CO.paa","\A3\Soft_F_Beta\Quadbike_01\Data\Quadbike_01_wheel_CIVWHITE_CO.paa" }};
|
||||||
|
Loading…
Reference in New Issue
Block a user