Vehicle upgrade system 1
This commit is contained in:
vbawol 2017-07-08 11:55:05 -05:00 committed by GitHub
commit 2c7bf2e87c
23 changed files with 860 additions and 309 deletions

View File

@ -308,7 +308,18 @@ switch _interactOption do {
["Unpacked backpack", 5] call Epoch_message;
};
};
case 15: { // Read
_msg = getArray(missionConfigFile >> "CfgReadingDocuments" >> _item >> "displayMessage");
if!(_msg isEqualTo [])then{
{
[_x,5] call Epoch_message;
}forEach _msg;
}else{
["This document can't be read yet. Blame DirtySanchez!",5] call Epoch_message;
};
};
default {
["Found nothing", 5] call Epoch_message;
};

View File

@ -37,4 +37,7 @@ if ([_item, "CfgVehicles"] call EPOCH_fnc_isAny) then {
};
};
};
if (_return isequalto "") then {
_return = _item;
};
_return;

View File

@ -60,6 +60,23 @@ if (isClass (_config >> _data)) then {
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 {
_display = ctrlParent (_this select 0);
_pos = getMousePosition;

View File

@ -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];

View File

@ -149,6 +149,7 @@ class CfgClientFunctions
class client_lockVehicle {};
class client_fillVehicle {};
class client_gearVehicle {};
class client_upgradeVehicle {};
};
class missions
{

View File

@ -540,7 +540,7 @@ class CfgItemInteractions
class ItemKeyYellow : ItemKey {};
class ItemDoc1 : Default
{
interactAction = -1;
interactAction = 15;
interactText = "READ";
};
class ItemDoc2 : ItemDoc1 {};
@ -554,6 +554,18 @@ class CfgItemInteractions
class ItemVehDoc2 : ItemDoc1 {};
class ItemVehDoc3 : ItemDoc1 {};
class ItemVehDoc4 : ItemDoc1 {};
class KitVehicleUpgradeI_100_EPOCH : ItemDoc1 {};
class KitVehicleUpgradeI_200_EPOCH : ItemDoc1 {};
class KitVehicleUpgradeI_300_EPOCH : ItemDoc1 {};
class KitVehicleUpgradeII_100_EPOCH : ItemDoc1 {};
class KitVehicleUpgradeII_200_EPOCH : ItemDoc1 {};
class KitVehicleUpgradeII_300_EPOCH : ItemDoc1 {};
class KitVehicleUpgradeIII_100_EPOCH : ItemDoc1 {};
class KitVehicleUpgradeIII_200_EPOCH : ItemDoc1 {};
class KitVehicleUpgradeIII_300_EPOCH : ItemDoc1 {};
class KitVehicleUpgradeIV_100_EPOCH : ItemDoc1 {};
class KitVehicleUpgradeIV_200_EPOCH : ItemDoc1 {};
class KitVehicleUpgradeIV_300_EPOCH : ItemDoc1 {};
class ItemBulb : Default {};
class ItemBurlap : Default {};
class ItemBriefcaseE : Default {};

View File

@ -4006,6 +4006,11 @@ class CfgPricing
{
price = 750;
};
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_Offroad_01_EPOCH5: C_Offroad_01_EPOCH{};
class C_Quadbike_01_EPOCH
{
price = 500;
@ -4014,14 +4019,26 @@ class CfgPricing
{
price = 750;
};
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_Hatchback_02_EPOCH
{
price = 1000;
};
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_SUV_01_EPOCH
{
price = 750;
};
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_Rubberboat_EPOCH
{
price = 500;
@ -4078,6 +4095,10 @@ class CfgPricing
{
price = 2500;
};
class B_G_Offroad_01_armed_EPOCH1: B_G_Offroad_01_armed_EPOCH{};
class B_G_Offroad_01_armed_EPOCH2: B_G_Offroad_01_armed_EPOCH{};
class B_G_Offroad_01_armed_EPOCH3: B_G_Offroad_01_armed_EPOCH{};
class B_G_Offroad_01_armed_EPOCH4: B_G_Offroad_01_armed_EPOCH{};
class B_Truck_01_transport_EPOCH
{
price = 1000;

View File

@ -0,0 +1,70 @@
/*
@author = "Aaron Clark - https://EpochMod.com";
@contributors[] = {"DirtySanchez"};
@description = "Readable Document Message Configs";
@licence = "Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike";
@github = "";
*/
class CfgReadingDocuments
{
class ItemVehDoc1
{
displayMessage[] = {"Max Speed, Terrain Coef, Gears and more were edited","Upgrade your vehicle's Speed and Offroad Performance"};
};
class KitVehicleUpgradeI_100_EPOCH: ItemVehDoc1{};
class KitVehicleUpgradeI_200_EPOCH: ItemVehDoc1{};
class KitVehicleUpgradeI_300_EPOCH: ItemVehDoc1{};
class ItemVehDoc2
{
displayMessage[] = {"Upgrade your vehicle's body, wheels and windows with armor strength"};
};
class KitVehicleUpgradeII_100_EPOCH: ItemVehDoc2{};
class KitVehicleUpgradeII_200_EPOCH: ItemVehDoc2{};
class KitVehicleUpgradeII_300_EPOCH: ItemVehDoc2{};
class ItemVehDoc3
{
displayMessage[] = {"Increase your vehicle's inventory capacity for items, magazines, weapons and more"};
};
class KitVehicleUpgradeIII_100_EPOCH: ItemVehDoc3{};
class KitVehicleUpgradeIII_200_EPOCH: ItemVehDoc3{};
class KitVehicleUpgradeIII_300_EPOCH: ItemVehDoc3{};
class ItemVehDoc4
{
displayMessage[] = {"Increase your fuel capacity for those long hauls across your favorite ISLANDS"};
};
class KitVehicleUpgradeIV_100_EPOCH: ItemVehDoc1{};
class KitVehicleUpgradeIV_200_EPOCH: ItemVehDoc1{};
class KitVehicleUpgradeIV_300_EPOCH: ItemVehDoc1{};
class ItemDoc1
{
displayMessage[] = {"It was a beautiful day on Johnny's block","While Johnny was watching his father take all he could","Daddy's Roommate by Will Michoite"};
};
class ItemDoc2
{
displayMessage[] = {"An elaborate story on a small town kid with big town mommies, I mean tittied.","Heather has TWO Mommies by Leslea Newman and Diana Solza"};
};
class ItemDoc3
{
displayMessage[] = {"Look its todays edition and OH crap you die today, nvm thats O'Tool whom died","Trade City Obituaries by Your Fellow Community Members and AI"};
};
class ItemDoc4
{
displayMessage[] = {"As you open the manilla folder you see pictures of your mom..."};
};
class ItemDoc5
{
displayMessage[] = {"First you have no liquor and then you get slapped by a woman. This is not your day..."};
};
class ItemDoc6
{
displayMessage[] = {"Wooden Ramp for DUMMIES volume 3"};
};
class ItemDoc7
{
displayMessage[] = {"Swap the Deck, a seductive tale so bad the author couldnt put his name on it!"};
};
class ItemDoc8
{
displayMessage[] = {"'He Touch Me, He Touch Me NOT is Back' raves Cherno Shmerno!","#1 Bestseller throughout Arma 2 DayZ Epoch"};
};
};

View File

@ -297,6 +297,11 @@ class CfgRemoteExec
jip = 0;
};
class EPOCH_server_makeSP
{
allowedTargets = 2;
jip = 0;
};
class EPOCH_server_upgrade_vehicle
{
allowedTargets = 2;
jip = 0;

View File

@ -0,0 +1,314 @@
/*
@author = "Aaron Clark - https://EpochMod.com";
@contributors[] = {"DirtySanchez"};
@description = "Vehicle Upgrade configs";
@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_config/Configs/CfgItemInteractions.hpp";
*/
class CfgVehicleUpgrades
{
class ItemVehDoc1
{
class C_Hatchback_01_EPOCH
{
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 B_MRAP_01_EPOCH: C_Hatchback_01_EPOCH { upgradeToVehicle = "B_MRAP_01_EPOCH1"; };
class O_MRAP_02_EPOCH: C_Hatchback_01_EPOCH { upgradeToVehicle = "O_MRAP_02_EPOCH1"; };
class I_MRAP_03_EPOCH: C_Hatchback_01_EPOCH { upgradeToVehicle = "I_MRAP_03_EPOCH1"; };
};
class KitVehicleUpgradeI_100_EPOCH
{
class C_Hatchback_01_EPOCH
{
ReqMaterials[] = {{1,"KitVehicleUpgradeI_100_EPOCH"}};
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 B_MRAP_01_EPOCH: C_Hatchback_01_EPOCH { upgradeToVehicle = "B_MRAP_01_EPOCH1"; };
class O_MRAP_02_EPOCH: C_Hatchback_01_EPOCH { upgradeToVehicle = "O_MRAP_02_EPOCH1"; };
class I_MRAP_03_EPOCH: C_Hatchback_01_EPOCH { upgradeToVehicle = "I_MRAP_03_EPOCH1"; };
};
class KitVehicleUpgradeI_200_EPOCH
{
class C_Hatchback_01_EPOCH
{
ReqMaterials[] = {{1,"KitVehicleUpgradeI_200_EPOCH"}};
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 B_MRAP_01_EPOCH: C_Hatchback_01_EPOCH { upgradeToVehicle = "B_MRAP_01_EPOCH1"; };
class O_MRAP_02_EPOCH: C_Hatchback_01_EPOCH { upgradeToVehicle = "O_MRAP_02_EPOCH1"; };
class I_MRAP_03_EPOCH: C_Hatchback_01_EPOCH { upgradeToVehicle = "I_MRAP_03_EPOCH1"; };
};
class KitVehicleUpgradeI_300_EPOCH
{
class C_Hatchback_01_EPOCH
{
ReqMaterials[] = {{1,"KitVehicleUpgradeI_300_EPOCH"}};
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 B_MRAP_01_EPOCH: C_Hatchback_01_EPOCH { upgradeToVehicle = "B_MRAP_01_EPOCH1"; };
class O_MRAP_02_EPOCH: C_Hatchback_01_EPOCH { upgradeToVehicle = "O_MRAP_02_EPOCH1"; };
class I_MRAP_03_EPOCH: C_Hatchback_01_EPOCH { upgradeToVehicle = "I_MRAP_03_EPOCH1"; };
};
class ItemVehDoc2
{
class C_Hatchback_01_EPOCH1
{
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 B_MRAP_01_EPOCH1: C_Hatchback_01_EPOCH1 { upgradeToVehicle = "B_MRAP_01_EPOCH2"; };
class O_MRAP_02_EPOCH1: C_Hatchback_01_EPOCH1 { upgradeToVehicle = "O_MRAP_02_EPOCH2"; };
class I_MRAP_03_EPOCH1: C_Hatchback_01_EPOCH1 { upgradeToVehicle = "I_MRAP_03_EPOCH2"; };
};
class KitVehicleUpgradeII_100_EPOCH
{
class C_Hatchback_01_EPOCH1
{
ReqMaterials[] = {{1,"KitVehicleUpgradeII_100_EPOCH"}};
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 B_MRAP_01_EPOCH1: C_Hatchback_01_EPOCH1 { upgradeToVehicle = "B_MRAP_01_EPOCH2"; };
class O_MRAP_02_EPOCH1: C_Hatchback_01_EPOCH1 { upgradeToVehicle = "O_MRAP_02_EPOCH2"; };
class I_MRAP_03_EPOCH1: C_Hatchback_01_EPOCH1 { upgradeToVehicle = "I_MRAP_03_EPOCH2"; };
};
class KitVehicleUpgradeII_200_EPOCH
{
class C_Hatchback_01_EPOCH1
{
ReqMaterials[] = {{1,"KitVehicleUpgradeII_200_EPOCH"}};
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 B_MRAP_01_EPOCH1: C_Hatchback_01_EPOCH1 { upgradeToVehicle = "B_MRAP_01_EPOCH2"; };
class O_MRAP_02_EPOCH1: C_Hatchback_01_EPOCH1 { upgradeToVehicle = "O_MRAP_02_EPOCH2"; };
class I_MRAP_03_EPOCH1: C_Hatchback_01_EPOCH1 { upgradeToVehicle = "I_MRAP_03_EPOCH2"; };
};
class KitVehicleUpgradeII_300_EPOCH
{
class C_Hatchback_01_EPOCH1
{
ReqMaterials[] = {{1,"KitVehicleUpgradeII_300_EPOCH"}};
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 B_MRAP_01_EPOCH1: C_Hatchback_01_EPOCH1 { upgradeToVehicle = "B_MRAP_01_EPOCH2"; };
class O_MRAP_02_EPOCH1: C_Hatchback_01_EPOCH1 { upgradeToVehicle = "O_MRAP_02_EPOCH2"; };
class I_MRAP_03_EPOCH1: C_Hatchback_01_EPOCH1 { upgradeToVehicle = "I_MRAP_03_EPOCH2"; };
};
class ItemVehDoc3
{
class C_Hatchback_01_EPOCH2
{
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 B_MRAP_01_EPOCH2: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "B_MRAP_01_EPOCH3"; };
class O_MRAP_02_EPOCH2: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "O_MRAP_02_EPOCH3"; };
class I_MRAP_03_EPOCH2: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "I_MRAP_03_EPOCH3"; };
class C_Van_01_box_EPOCH: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "C_Van_01_box_EPOCH3"; };
class C_Van_01_transport_EPOCH: C_Hatchback_01_EPOCH2
{
ReqMaterials[] = {{1,"ItemVehDoc3"},{5,"ItemCorrugatedLg"},{8,"ItemPipe"},{4,"KitShelf"}};
upgradeToVehicle = "C_Van_01_transport_EPOCH3";
};
class O_Truck_02_covered_EPOCH: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "O_Truck_02_covered_EPOCH3"; };
class O_Truck_02_transport_EPOCH: C_Hatchback_01_EPOCH2
{
ReqMaterials[] = {{1,"ItemVehDoc3"},{6,"ItemBurlap"},{6,"ItemPipe"},{4,"KitShelf"}};
upgradeToVehicle = "O_Truck_02_transport_EPOCH3";
};
};
class KitVehicleUpgradeIII_100_EPOCH
{
class C_Hatchback_01_EPOCH2
{
ReqMaterials[] = {{1,"KitVehicleUpgradeIII_100_EPOCH"}};
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 B_MRAP_01_EPOCH2: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "B_MRAP_01_EPOCH3"; };
class O_MRAP_02_EPOCH2: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "O_MRAP_02_EPOCH3"; };
class I_MRAP_03_EPOCH2: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "I_MRAP_03_EPOCH3"; };
class C_Van_01_box_EPOCH: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "C_Van_01_box_EPOCH3"; };
class C_Van_01_transport_EPOCH: C_Hatchback_01_EPOCH2
{
ReqMaterials[] = {{1,"KitVehicleUpgradeIII_100_EPOCH"},{5,"ItemCorrugatedLg"},{6,"ItemPipe"},{2,"KitShelf"}};
upgradeToVehicle = "C_Van_01_transport_EPOCH3";
};
class O_Truck_02_covered_EPOCH: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "O_Truck_02_covered_EPOCH3"; };
class O_Truck_02_transport_EPOCH: C_Hatchback_01_EPOCH2
{
ReqMaterials[] = {{1,"KitVehicleUpgradeIII_100_EPOCH"},{6,"ItemBurlap"},{4,"ItemPipe"},{2,"KitShelf"}};
upgradeToVehicle = "O_Truck_02_transport_EPOCH3";
};
};
class KitVehicleUpgradeIII_200_EPOCH
{
class C_Hatchback_01_EPOCH2
{
ReqMaterials[] = {{1,"KitVehicleUpgradeIII_200_EPOCH"}};
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 B_MRAP_01_EPOCH2: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "B_MRAP_01_EPOCH3"; };
class O_MRAP_02_EPOCH2: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "O_MRAP_02_EPOCH3"; };
class I_MRAP_03_EPOCH2: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "I_MRAP_03_EPOCH3"; };
class C_Van_01_box_EPOCH: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "C_Van_01_box_EPOCH3"; };
class C_Van_01_transport_EPOCH: C_Hatchback_01_EPOCH2
{
ReqMaterials[] = {{1,"KitVehicleUpgradeIII_200_EPOCH"},{5,"ItemCorrugatedLg"},{6,"ItemPipe"},{2,"KitShelf"}};
upgradeToVehicle = "C_Van_01_transport_EPOCH3";
};
class O_Truck_02_covered_EPOCH: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "O_Truck_02_covered_EPOCH3"; };
class O_Truck_02_transport_EPOCH: C_Hatchback_01_EPOCH2
{
ReqMaterials[] = {{1,"KitVehicleUpgradeIII_100_EPOCH"},{6,"ItemBurlap"},{4,"ItemPipe"},{2,"KitShelf"}};
upgradeToVehicle = "O_Truck_02_transport_EPOCH3";
};
};
class KitVehicleUpgradeIII_300_EPOCH
{
class C_Hatchback_01_EPOCH2
{
ReqMaterials[] = {{1,"KitVehicleUpgradeIII_300_EPOCH"}};
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 B_MRAP_01_EPOCH2: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "B_MRAP_01_EPOCH3"; };
class O_MRAP_02_EPOCH2: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "O_MRAP_02_EPOCH3"; };
class I_MRAP_03_EPOCH2: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "I_MRAP_03_EPOCH3"; };
class C_Van_01_box_EPOCH: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "C_Van_01_box_EPOCH3"; };
class C_Van_01_transport_EPOCH: C_Hatchback_01_EPOCH2
{
ReqMaterials[] = {{1,"KitVehicleUpgradeIII_300_EPOCH"},{5,"ItemCorrugatedLg"},{6,"ItemPipe"},{2,"KitShelf"}};
upgradeToVehicle = "C_Van_01_transport_EPOCH3";
};
class O_Truck_02_covered_EPOCH: C_Hatchback_01_EPOCH2 { upgradeToVehicle = "O_Truck_02_covered_EPOCH3"; };
class O_Truck_02_transport_EPOCH: C_Hatchback_01_EPOCH2
{
ReqMaterials[] = {{1,"KitVehicleUpgradeIII_100_EPOCH"},{6,"ItemBurlap"},{4,"ItemPipe"},{2,"KitShelf"}};
upgradeToVehicle = "O_Truck_02_transport_EPOCH3";
};
};
class ItemVehDoc4
{
class C_Hatchback_01_EPOCH3
{
ReqMaterials[] = {{1,"ItemVehDoc3"},{1,"CircuitParts"},{2,"ItemScraps"},{2,"jerrycan_epoch"}};
upgradeToVehicle = "C_Hatchback_01_EPOCH4";
};
class C_Hatchback_02_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Hatchback_02_EPOCH4"; };
class C_Offroad_01_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Offroad_01_EPOCH4"; };
class C_SUV_01_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_SUV_01_EPOCH4"; };
class B_MRAP_01_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "B_MRAP_01_EPOCH4"; };
class O_MRAP_02_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "O_MRAP_02_EPOCH4"; };
class I_MRAP_03_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "I_MRAP_03_EPOCH4"; };
class C_Van_01_box_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Van_01_box_EPOCH4"; };
class C_Van_01_transport_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Van_01_transport_EPOCH4"; };
class O_Truck_02_covered_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "O_Truck_02_covered_EPOCH4"; };
class O_Truck_02_transport_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "O_Truck_02_transport_EPOCH4"; };
};
class KitVehicleUpgradeIV_100_EPOCH
{
class C_Hatchback_01_EPOCH3
{
ReqMaterials[] = {{1,"KitVehicleUpgradeIV_100_EPOCH"}};
upgradeToVehicle = "C_Hatchback_01_EPOCH4";
};
class C_Hatchback_02_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Hatchback_02_EPOCH4"; };
class C_Offroad_01_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Offroad_01_EPOCH4"; };
class C_SUV_01_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_SUV_01_EPOCH4"; };
class B_MRAP_01_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "B_MRAP_01_EPOCH4"; };
class O_MRAP_02_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "O_MRAP_02_EPOCH4"; };
class I_MRAP_03_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "I_MRAP_03_EPOCH4"; };
class C_Van_01_box_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Van_01_box_EPOCH4"; };
class C_Van_01_transport_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Van_01_transport_EPOCH4"; };
class O_Truck_02_covered_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "O_Truck_02_covered_EPOCH4"; };
class O_Truck_02_transport_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "O_Truck_02_transport_EPOCH4"; };
};
class KitVehicleUpgradeIV_200_EPOCH
{
class C_Hatchback_01_EPOCH3
{
ReqMaterials[] = {{1,"KitVehicleUpgradeIV_200_EPOCH"}};
upgradeToVehicle = "C_Hatchback_01_EPOCH4";
};
class C_Hatchback_02_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Hatchback_02_EPOCH4"; };
class C_Offroad_01_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Offroad_01_EPOCH4"; };
class C_SUV_01_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_SUV_01_EPOCH4"; };
class B_MRAP_01_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "B_MRAP_01_EPOCH4"; };
class O_MRAP_02_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "O_MRAP_02_EPOCH4"; };
class I_MRAP_03_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "I_MRAP_03_EPOCH4"; };
class C_Van_01_box_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Van_01_box_EPOCH4"; };
class C_Van_01_transport_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Van_01_transport_EPOCH4"; };
class O_Truck_02_covered_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "O_Truck_02_covered_EPOCH4"; };
class O_Truck_02_transport_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "O_Truck_02_transport_EPOCH4"; };
};
class KitVehicleUpgradeIV_300_EPOCH
{
class C_Hatchback_01_EPOCH3
{
ReqMaterials[] = {{1,"KitVehicleUpgradeIV_300_EPOCH"}};
upgradeToVehicle = "C_Hatchback_01_EPOCH4";
};
class C_Hatchback_02_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Hatchback_02_EPOCH4"; };
class C_Offroad_01_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Offroad_01_EPOCH4"; };
class C_SUV_01_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_SUV_01_EPOCH4"; };
class B_MRAP_01_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "B_MRAP_01_EPOCH4"; };
class O_MRAP_02_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "O_MRAP_02_EPOCH4"; };
class I_MRAP_03_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "I_MRAP_03_EPOCH4"; };
class C_Van_01_box_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Van_01_box_EPOCH4"; };
class C_Van_01_transport_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "C_Van_01_transport_EPOCH4"; };
class O_Truck_02_covered_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "O_Truck_02_covered_EPOCH4"; };
class O_Truck_02_transport_EPOCH3: C_Hatchback_01_EPOCH3 { upgradeToVehicle = "O_Truck_02_transport_EPOCH4"; };
};
class ItemVehDocRara
{
class K01
{
ReqMaterials[] = {{1,"ItemVehDocRara"},{2,"PaintCanOra"},{4,"ItemPipe"},{2,"jerrycan_epoch"}};
upgradeToVehicle = "mosquito_epoch";
};
class K02: K01{};
class K03: K01{};
class K04: K01{};
};
class C_Offroad_01_EPOCH4
{
ReqMaterials[] = {{1,"ItemVehDocRara"},{1,"PaintCanBlu"},{1,"PaintCanRed"},{1,"CircuitParts"},{1,"ItemBattery"}};
upgradeToVehicle = "C_Offroad_01_EPOCH5";
};
};

View File

@ -1021,6 +1021,42 @@ class CfgCrafting
previewScale = 0.2;
previewVector = -1.8;
};
class KitVehicleUpgradeI_100_EPOCH : Kit
{
recipe[] = { {"ItemVehDoc1",1}, {"CircuitParts",1}, {"ItemCables",1}, {"VehicleRepairLg",2} };
previewPosition[] = {0.801715,1,0.331674};
previewScale = 1.5;
previewVector = 0.3;
};
class KitVehicleUpgradeI_200_EPOCH : KitVehicleUpgradeI_100_EPOCH{};
class KitVehicleUpgradeI_300_EPOCH : KitVehicleUpgradeI_100_EPOCH{};
class KitVehicleUpgradeII_100_EPOCH : Kit
{
recipe[] = { {"ItemVehDoc2",1}, {"SpareTire",1}, {"KitTankTrap",2}, {"ItemAluminumBar10oz",2} };
previewPosition[] = {0.801715,1,0.331674};
previewScale = 1.5;
previewVector = 0.3;
};
class KitVehicleUpgradeII_200_EPOCH : KitVehicleUpgradeII_100_EPOCH{};
class KitVehicleUpgradeII_300_EPOCH : KitVehicleUpgradeII_100_EPOCH{};
class KitVehicleUpgradeIII_100_EPOCH : Kit
{
recipe[] = { {"ItemVehDoc3",1}, {"ItemPipes",2}, {"KitShelf",2}, {"ItemBurlap",2} };
previewPosition[] = {0.801715,1,0.331674};
previewScale = 1.5;
previewVector = 0.3;
};
class KitVehicleUpgradeIII_200_EPOCH : KitVehicleUpgradeIII_100_EPOCH{};
class KitVehicleUpgradeIII_300_EPOCH : KitVehicleUpgradeIII_100_EPOCH{};
class KitVehicleUpgradeIV_100_EPOCH : Kit
{
recipe[] = { {"ItemVehDoc4",1}, {"CircuitParts",1}, {"ItemScraps",2}, {"jerrycan_epoch",2} };
previewPosition[] = {0.801715,1,0.331674};
previewScale = 1.5;
previewVector = 0.3;
};
class KitVehicleUpgradeIV_200_EPOCH : KitVehicleUpgradeIV_100_EPOCH{};
class KitVehicleUpgradeIV_300_EPOCH : KitVehicleUpgradeIV_100_EPOCH{};
};
/*[[[end]]]*/

View File

@ -74,6 +74,8 @@ disableRandomization[] = {"All"};
#include "Configs\CfgItemInteractions.hpp"
#include "Configs\CfgSay3Dhandler.hpp"
#include "Configs\CfgSwitchMovehandler.hpp"
#include "Configs\CfgVehicleUpgrades.hpp"
#include "Configs\CfgReadingDocuments.hpp"
// A3 specific configs
#include "Configs\CfgFunctions.hpp"

View File

@ -73,9 +73,12 @@ if (_slot != -1) then {
if (_playerNetID == (owner _vehicle)) then {
_vehSlot = _vehicle getVariable["VEHICLE_SLOT", "ABORT"];
if (!_vehicleSold && _vehSlot != "ABORT") then {
removeFromRemainsCollector[_vehicle];
if (!_vehicleSold && _vehSlot != "ABORT") then {
_BaseClass = _vehicle getvariable ["VEHICLE_BaseClass",""];
if !(_BaseClass isequalto "") then {
_item = _BaseClass;
};
removeFromRemainsCollector[_vehicle];
deleteVehicle _vehicle;
_vehicleSold = true;

View File

@ -138,93 +138,7 @@ for "_i" from 1 to _maxStorageLimit do {
clearItemCargoGlobal _vehicle;
if !(_inventory isEqualTo []) then {
{
_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;
[_vehicle,_inventory] call EPOCH_server_CargoFill;
};
if (EPOCH_DEBUG_VEH) then {

View File

@ -13,12 +13,12 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf
*/
//[[[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]]]
params [["_maxVehicleLimit",0]];
_diag = diag_tickTime;
_dataFormat = ["", [], 0, [], 0, [], [], 0];
_dataFormat = ["", [], 0, [], 0, [], [], 0, ""];
_dataFormatCount = count _dataFormat;
EPOCH_VehicleSlots = [];
_allVehicles = [];
@ -42,7 +42,17 @@ for "_i" from 1 to _maxVehicleLimit do {
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
_arr = _response select 1;
_arrNum = count _arr;
// New Upgrade System adds to DB array, check and correct older saved vehicles
if (_arrNum < _dataFormatCount) then {
{
_check = _arr select _foreachindex;
if (isnil '_check') then {
_arr pushback (_dataFormat select _foreachindex);
};
} foreach _dataFormat;
};
if (_arrNum == _dataFormatCount) then {
// Validate and replace invaild data
@ -110,6 +120,10 @@ for "_i" from 1 to _maxVehicleLimit do {
} forEach _selections;
_vehicle setVariable ["VEHICLE_TEXTURE", _color];
};
_baseClass = _arr select 8;
if !(_baseClass isequalto "") then {
_vehicle setvariable ["VEHICLE_BASECLASS",_baseClass];
};
// disable thermal imaging equipment
_vehicle disableTIEquipment true;
// lock all vehicles
@ -131,83 +145,8 @@ for "_i" from 1 to _maxVehicleLimit do {
} foreach _removemagazinesturret;
};
{
_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 (_arr select 5);
// utilize He-Man's new Cargo functions
[_vehicle,_arr select 5] call EPOCH_server_CargoFill;
// remove and add back magazines
if !((_arr select 6) isequalto []) then {

View File

@ -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;

View File

@ -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

View File

@ -28,72 +28,8 @@ if (!isNull _vehicle) then {
_vehicle setDamage 0;
_vehiclePos = getposATL _vehicle;
// 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 = _vehicle call EPOCH_server_CargoSave;
_colorSlot = _vehicle getVariable ["STORAGE_TEXTURE",0];
_storageOwners = _vehicle getVariable["STORAGE_OWNERS",[]];
_locked = if (_vehicle getVariable["EPOCH_Locked", true]) then {1} else {-1};

View File

@ -27,77 +27,11 @@ if (!isNull _vehicle) then {
_hitpoints = (getAllHitPointsDamage _vehicle) param [2,[]];
// 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
_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
];
_inventory = _vehicle call EPOCH_server_CargoSave;
_colorSlot = _vehicle getVariable ["VEHICLE_TEXTURE",0];
_VAL = [typeOf _vehicle,[(getposATL _vehicle call EPOCH_precisionPos),vectordir _vehicle,vectorup _vehicle],damage _vehicle,_hitpoints,fuel _vehicle,_inventory,[true,magazinesAllTurrets _vehicle],_colorSlot];
_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,_baseType];
["Vehicle", _vehHiveKey, EPOCH_expiresVehicle, _VAL] call EPOCH_fnc_server_hiveSETEX;
};
};

View File

@ -0,0 +1,105 @@
/*
Author: Aaron Clark - EpochMod.com
Contributors: He-Man and DirtySanchez
Description:
Upgrade vehicle
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
*/
params [["_array",[]],["_player",objnull],["_token","",[""]]];
if (_array isequalto []) exitwith {
diag_log "Array is empty";
};
if !([_player, _token] call EPOCH_server_getPToken) exitWith{
diag_log "Tokencheck failed";
};
_array params [["_veh",objnull],["_UpgradeVeh",""],["_removeCrypto",[]]];
if (isnull _veh) exitwith {
diag_log "Vehicle is null";
};
if (_UpgradeVeh isequalto "") exitwith {
diag_log "No Upgrade Vehicle Class";
};
if (!(_removeCrypto isequalto []) && !(_removeCrypto isEqualTo 0)) then {
[_player,-_removeCrypto] call EPOCH_server_effectCrypto;
};
_slot = _veh getvariable ["vehicle_slot","-1"];
if (_slot isequalto "-1") exitwith {
diag_log "Vehicle has no Slot";
};
_pos = getposasl _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;
waituntil {isnull _veh};
_pos set [2,(_pos select 2)+0.5];
_newVeh = createVehicle [_UpgradeVeh, [random 500, random 500,500], [], 0, "CAN_COLLIDE"];
_newVeh setVariable ["VEHICLE_SLOT", _slot, true];
if!(_baseVeh isEqualTo "")then
{
_newVeh setVariable["VEHICLE_BASECLASS", _baseVeh];
}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;

View File

@ -94,6 +94,9 @@ class CfgServerFunctions
class server_packStorage {};
class server_packJack {};
class spawn_vehicle {};
class server_upgrade_vehicle {};
class server_CargoSave {};
class server_CargoFill {};
};
class epoch_server {
class weightedArray {};

View File

@ -163,7 +163,7 @@ diag_log "Epoch: Spawning vehicles";
_allowedVehiclesListArray = [];
{
_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.
_indexStock = EPOCH_traderStoredVehicles find _vehClass;

View File

@ -18,14 +18,26 @@ class CfgEpochVehicles
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" }};
};
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 {
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" }};
};
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 {
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" }};
};
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 {
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" }};
@ -34,6 +46,10 @@ class CfgEpochVehicles
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" }};
};
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 {
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" }};