Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: ACE3 Rearm box in Logistic Point menu #91

Merged
merged 10 commits into from
Apr 3, 2016
180 changes: 105 additions & 75 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ if (isServer) then {
btc_type_pallet = ["Land_Pallets_stack_F","Land_Pallets_F","Land_Pallet_F"];
btc_type_box = ["Box_East_Wps_F","Box_East_WpsSpecial_F","Box_East_Ammo_F"];


//Vehs
btc_vehicles = [btc_veh_1,btc_veh_2,btc_veh_3,btc_veh_4,btc_veh_5,btc_veh_6,btc_veh_7,btc_veh_8,btc_veh_9,btc_veh_10,btc_veh_11,btc_veh_12,btc_veh_13,btc_veh_14];
btc_helo = [btc_helo_1];
};

//City
Expand Down Expand Up @@ -171,87 +171,117 @@ btc_info_hideout_radius = 4000;
btc_supplies_mat ="Land_Cargo20_red_F";

//Log
btc_construction_array =
[
[
"Fortifications",
"Static",
"Ammobox",
"Containers",
"Supplies",
"FOB"
],
if (isServer) then {
_btc_rearming_vehicles = (btc_vehicles + btc_helo) apply {typeOf _x};
{
_btc_rearming_vehicles = _btc_rearming_vehicles - [_x];
if (count (configFile >> "CfgVehicles" >> _x >> "Turrets") > 0) then {
_btc_rearming_vehicles pushBack _x;
};
} forEach _btc_rearming_vehicles;

#define REARM_TURRET_PATHS [[-1], [0], [0,0], [0,1], [1], [2], [0,2]]
btc_construction_array =
[
[
//"Fortifications"
"Land_BagBunker_Small_F",
"Land_BagFence_Corner_F",
"Land_BagFence_End_F",
"Land_BagFence_Long_F",
"Land_BagFence_Round_F",
"Land_BagFence_Short_F",
"Land_HBarrier_1_F",
"Land_HBarrier_3_F",
"Land_HBarrier_5_F",
"Land_HBarrierBig_F",
"Land_Razorwire_F",
"Land_CncBarrier_F",
"Land_CncBarrierMedium_F",
"Land_CncBarrierMedium4_F",
"Land_CncWall1_F",
"Land_CncWall4_F",
"Land_Mil_ConcreteWall_F",
"Land_Mil_WallBig_4m_F",
"Land_Mil_WallBig_Corner_F",
"Land_PortableLight_double_F"
],
[
//"Static"
"B_static_AT_F",
"B_static_AA_F",
"B_GMG_01_A_F",
"B_GMG_01_high_F",
"B_GMG_01_F",
"B_HMG_01_A_F",
"B_HMG_01_high_F",
"B_HMG_01_F",
"B_Mortar_01_F"
],
"Fortifications",
"Static",
"Ammobox",
"Containers",
"Supplies",
"FOB",
"Vehicle Logistic"
] + (_btc_rearming_vehicles apply {getText (configFile >> "cfgVehicles" >> _x >> "displayName")}),
[
//"Ammobox"
"rhsusf_mags_crate",
"Box_NATO_Ammo_F",
"Box_NATO_Support_F",
"ACE_medicalSupplyCrate_advanced",
"ACE_medicalSupplyCrate",
"B_supplyCrate_F",
"B_CargoNet_01_ammo_F",
"ACE_Wheel",
"ACE_Track",
"FlexibleTank_01_forest_F",
"Box_NATO_AmmoVeh_F"

],
[
//"Containers"
"Land_Cargo20_military_green_F",
"Land_Cargo40_military_green_F"
[
//"Fortifications"
"Land_BagBunker_Small_F",
"Land_BagFence_Corner_F",
"Land_BagFence_End_F",
"Land_BagFence_Long_F",
"Land_BagFence_Round_F",
"Land_BagFence_Short_F",
"Land_HBarrier_1_F",
"Land_HBarrier_3_F",
"Land_HBarrier_5_F",
"Land_HBarrierBig_F",
"ACE_ConcertinaWireCoil",
"Land_CncBarrier_F",
"Land_CncBarrierMedium_F",
"Land_CncBarrierMedium4_F",
"Land_CncWall1_F",
"Land_CncWall4_F",
"Land_Mil_ConcreteWall_F",
"Land_Mil_WallBig_4m_F",
"Land_Mil_WallBig_Corner_F",
"Land_PortableLight_double_F"
],
[
//"Static"
"B_static_AT_F",
"B_static_AA_F",
"B_GMG_01_A_F",
"B_GMG_01_high_F",
"B_GMG_01_F",
"B_HMG_01_A_F",
"B_HMG_01_high_F",
"B_HMG_01_F",
"B_Mortar_01_F"
],
[
//"Ammobox"
"rhsusf_mags_crate",
"Box_NATO_Ammo_F",
"Box_NATO_Support_F",
"ACE_medicalSupplyCrate_advanced",
"ACE_medicalSupplyCrate",
"B_supplyCrate_F",
"B_CargoNet_01_ammo_F"
],
[
//"Containers"
"Land_Cargo20_military_green_F",
"Land_Cargo40_military_green_F"

],
[
//"Supplies"
btc_supplies_mat
],
[
//"FOB"
btc_fob_mat
],
[
//"Vehicle logistic"
"ACE_Wheel",
"ACE_Track"
]
] + (_btc_rearming_vehicles apply {
_vehicles = _x;
_magazines = [];
{
_magazines append (([_vehicles,_x] call btc_fnc_log_getconfigmagazines));
} forEach REARM_TURRET_PATHS;
{
_magazines = _magazines - [_x];
_magazines pushBack _x;
} forEach _magazines;
_magazines
})
];
} else {
btc_int_ask_data = nil;
// [[7,nil,player],"btc_fnc_int_ask_var",false] spawn BIS_fnc_MP;
[7,nil,player] remoteExec ["btc_fnc_int_ask_var",2];

],
[
//"Supplies"
btc_supplies_mat
],
[
//FOB
btc_fob_mat
]
]
];
waitUntil {sleep 0.5; !(isNil "btc_int_ask_data")};
btc_construction_array = btc_int_ask_data;
};

_c_array = btc_construction_array select 1;
btc_log_def_draggable = (_c_array select 1) + (_c_array select 2);
btc_log_def_loadable = (_c_array select 0) + (_c_array select 1) + (_c_array select 2) + (_c_array select 3) + (_c_array select 4) + (_c_array select 5);
btc_log_def_loadable = (_c_array select 0) + (_c_array select 1) + (_c_array select 2) + (_c_array select 3) + (_c_array select 4) + (_c_array select 5) + (_c_array select 6) + (["ace_rearm_defaultCarriedObject", "ace_rearm_Bo_Mk82","ace_rearm_Bomb_04_F","ace_rearm_Bo_GBU12_LGB","ace_rearm_Bomb_03_F","ace_rearm_Missile_AA_03_F","ace_rearm_Missile_AGM_02_F","ace_rearm_Missile_AGM_01_F","ace_rearm_Rocket_03_AP_F","ace_rearm_R_80mm_HE","ace_rearm_R_60mm_HE","ace_rearm_Rocket_04_HE_F","ace_rearm_R_Hydra_HE","ace_rearm_Missile_AA_04_F","ace_rearm_M_PG_AT","ace_rearm_R_230mm_HE","ace_rearm_Rocket_03_HE_F","ace_rearm_Rocket_04_AP_F","ace_rearm_R_230mm_fly"]);
btc_log_def_can_load = (_c_array select 3);
btc_log_def_placeable = (_c_array select 0) + (_c_array select 3) + (_c_array select 4) + (_c_array select 5);
btc_log_max_distance_load = 15;
Expand Down
3 changes: 3 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/compile.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ if (isServer) then {
btc_fnc_side_civtreatment = compile preprocessFileLineNumbers "core\fnc\side\civtreatment.sqf";
btc_fnc_side_tower = compile preprocessFileLineNumbers "core\fnc\side\tower.sqf";
btc_fnc_side_checkpoint = compile preprocessFileLineNumbers "core\fnc\side\checkpoint.sqf";

//LOG
btc_fnc_log_getconfigmagazines = compile preprocessFile "core\fnc\log\getconfigmagazines.sqf";
};
/////////////////////CLIENT AND SERVER\\\\\\\\\\\\\\\\\\\\\

Expand Down
11 changes: 7 additions & 4 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/db/load.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,9 @@ diag_log format ["5: %1",(_x select 5)];
private ["_type","_cargo_obj","_obj","_weap_obj","_mags_obj","_items_obj"];
//{_cargo pushBack [(typeOf _x),[getWeaponCargo _x,getMagazineCargo _x,getItemCargo _x]]} foreach (_x getVariable ["cargo",[]]);
_type = _x select 0;
_cargo_obj = _x select 1;
_cargo_obj = _x select 2;
_obj = _type createVehicle [0,0,0];
if ((_x select 1) != "") then {_obj setVariable ["ace_rearm_magazineClass",(_x select 1),true]};
btc_log_obj_created = btc_log_obj_created + [_obj];
btc_curator addCuratorEditableObjects [[_obj], false];
clearWeaponCargoGlobal _obj;clearItemCargoGlobal _obj;clearMagazineCargoGlobal _obj;
Expand Down Expand Up @@ -277,6 +278,7 @@ _objs = profileNamespace getVariable [format ["btc_hm_%1_objs",_name],[]];
btc_curator addCuratorEditableObjects [[_obj], false];
_obj setDir (_x select 2);
_obj setPosASL (_x select 1);
if ((_x select 3) != "") then {_obj setVariable ["ace_rearm_magazineClass",(_x select 3),true]};
{
/*private "_l";
_l = _x createVehicle [0,0,0];
Expand All @@ -287,8 +289,9 @@ _objs = profileNamespace getVariable [format ["btc_hm_%1_objs",_name],[]];
private ["_type","_cargo_obj","_l","_weap_obj","_mags_obj","_items_obj"];
//{_cargo pushBack [(typeOf _x),[getWeaponCargo _x,getMagazineCargo _x,getItemCargo _x]]} foreach (_x getVariable ["cargo",[]]);
_type = _x select 0;
_cargo_obj = _x select 1;
_cargo_obj = _x select 2;
_l = _type createVehicle [0,0,0];
if ((_x select 1) != "") then {_l setVariable ["ace_rearm_magazineClass",(_x select 1),true]};
btc_log_obj_created = btc_log_obj_created + [_l];
btc_curator addCuratorEditableObjects [[_l], false];
clearWeaponCargoGlobal _l;clearItemCargoGlobal _l;clearMagazineCargoGlobal _l;
Expand All @@ -311,8 +314,8 @@ _objs = profileNamespace getVariable [format ["btc_hm_%1_objs",_name],[]];
};
};
[_l,_obj] call btc_fnc_log_server_load;
} foreach (_x select 3);
_cont = (_x select 4);
} foreach (_x select 4);
_cont = (_x select 5);
clearWeaponCargoGlobal _obj;clearItemCargoGlobal _obj;clearMagazineCargoGlobal _obj;
_weap = _cont select 0;
if (count _weap > 0) then {
Expand Down
7 changes: 4 additions & 3 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/db/save.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ _array_veh = [];
_data pushBack (fuel _x);
_data pushBack (damage _x);
_cargo = [];
{_cargo pushBack [(typeOf _x),[getWeaponCargo _x,getMagazineCargo _x,getItemCargo _x]]} foreach (_x getVariable ["cargo",[]]);
{_cargo pushBack [(typeOf _x),(_x getVariable ["ace_rearm_magazineClass",""]),[getWeaponCargo _x,getMagazineCargo _x,getItemCargo _x]]} foreach (_x getVariable ["cargo",[]]);
_data pushBack _cargo;
_cont = [getWeaponCargo _x,getMagazineCargo _x,getItemCargo _x];
_data pushBack _cont;
Expand All @@ -125,12 +125,13 @@ _array_obj = [];
_data pushBack (typeOf _x);
_data pushBack (getPosASL _x);
_data pushBack (getDir _x);
_data pushBack (_x getVariable ["ace_rearm_magazineClass",""]);
_cargo = [];
{_cargo pushBack [(typeOf _x),[getWeaponCargo _x,getMagazineCargo _x,getItemCargo _x]]} foreach (_x getVariable ["cargo",[]]);
{_cargo pushBack [(typeOf _x),(_x getVariable ["ace_rearm_magazineClass",""]),[getWeaponCargo _x,getMagazineCargo _x,getItemCargo _x]]} foreach (_x getVariable ["cargo",[]]);
_data pushBack _cargo;
_cont = [getWeaponCargo _x,getMagazineCargo _x,getItemCargo _x];
_data pushBack _cont;

_array_obj pushBack _data;
};
} foreach btc_log_obj_created;
Expand Down
1 change: 1 addition & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/int/ask_var.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ switch (_id) do {
case 4 : {_data = _target getVariable ["tow",objNull];};
case 5 : {_data = btc_side_jip_data;};
case 6 : {_data = btc_fobs;};
case 7 : {_data = btc_construction_array;};
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ _cargo = btc_int_ask_data;
_text = ("Vehicle: " + getText (configFile >> "cfgVehicles" >> typeof _veh >> "displayName") + format [" CC: %1/%2",[_veh,_cargo] call btc_fnc_log_check_cc,[_veh] call btc_fnc_log_get_cc]);

(_ui displayCtrl 990) ctrlSetText _text;

{
private ["_index","_displayName"];
_displayName = getText (configFile >> "cfgVehicles" >> typeof _x >> "displayName");
if (_displayName isEqualTo "ace_rearm_dummy_obj") then {_displayName = getText (configfile >> "CfgMagazines" >> (_x getVariable "ace_rearm_magazineClass") >> "displayName");
};
_index = lbAdd [ 991, _displayName ];
lbSetData [ 991, _index, typeOf _x ];
lbSetTooltip [ 991, _index, _displayName ];
lbSetTooltip [ 991, _index, _displayName ];
} foreach _cargo;

lbSetCurSel [ 991, 0 ];
Expand Down
14 changes: 12 additions & 2 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/create.sqf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

private ["_new","_class","_selected"];

closeDialog 0;

btc_log_create_obj = _this select 0;
Expand All @@ -16,7 +18,11 @@ call btc_fnc_log_create_load;
//_class = lbText [72,lbCurSel 72];
_class = lbData [72, lbCurSel 72];
_selected = _class;
_new = _class createVehicleLocal [getpos btc_log_create_obj select 0,getpos btc_log_create_obj select 1,0];
if (getText (configFile >> "cfgVehicles" >> _selected >> "displayName") isEqualTo "") then {
_new = "Box_NATO_Ammo_F" createVehicleLocal [getpos btc_log_create_obj select 0,getpos btc_log_create_obj select 1,0];
} else {
_new = _class createVehicleLocal [getpos btc_log_create_obj select 0,getpos btc_log_create_obj select 1,0];
};
while {dialog} do
{
//if (_class != lbData [72, 1]) then
Expand All @@ -26,7 +32,11 @@ while {dialog} do
_class = lbData [72, lbCurSel 72];
//_class = lbText [72,lbCurSel 72];
_selected = _class;
_new = _class createVehicleLocal [getpos btc_log_create_obj select 0,getpos btc_log_create_obj select 1,0];
if (getText (configFile >> "cfgVehicles" >> _selected >> "displayName") isEqualTo "") then {
_new = "Box_NATO_Ammo_F" createVehicleLocal [getpos btc_log_create_obj select 0,getpos btc_log_create_obj select 1,0];
} else {
_new = _class createVehicleLocal [getpos btc_log_create_obj select 0,getpos btc_log_create_obj select 1,0];
};
_new setDir (getDir btc_log_create_obj);
_new setPos [getpos btc_log_create_obj select 0,getpos btc_log_create_obj select 1,0];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ for "_i" from 0 to ((count _category) - 1) do
private ["_class","_display","_index"];
_class = (_category select _i);
_display = getText (configFile >> "cfgVehicles" >> _class >> "displayName");
if (_display isEqualTo "") then {
_display = getText (configfile >> "CfgMagazines" >> _class >> "displayName");
};
//_lb = lbAdd [72,_display];
_index = lbAdd [72,_display];
lbSetData [72, _index, _class];
Expand Down
6 changes: 5 additions & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/create_s.sqf
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
private "_obj";
_obj = _this createVehicle [getpos btc_create_object_point select 0,getpos btc_create_object_point select 1,0];
if (getText (configFile >> "cfgVehicles" >> _this >> "displayName") isEqualTo "") then {
_obj = [btc_create_object_point,_this] call ace_rearm_fnc_createDummy;
} else {
_obj = _this createVehicle [getpos btc_create_object_point select 0,getpos btc_create_object_point select 1,0];
};
btc_log_obj_created = btc_log_obj_created + [_obj];
btc_curator addCuratorEditableObjects [[_obj], false];
Loading