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

Small logistics overhaul #3103

Draft
wants to merge 13 commits into
base: unstable
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions A3A/addons/logistics/Cargo/CUP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class CUP_Weapons_CUP_Weapons_StaticWeapons_DShKM_CUP_DShKM_mg_p3d : TRIPLES(ADD
size = 4;
recoil = 100;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class CUP_Weapons_CUP_Weapons_StaticWeapons_KORD_CUP_KORD_6u16sp_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -14,6 +15,7 @@ class CUP_Weapons_CUP_Weapons_StaticWeapons_KORD_CUP_KORD_6u16sp_p3d : TRIPLES(A
size = 4;
recoil = 200;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class CUP_Weapons_CUP_Weapons_StaticWeapons_ZU23_CUP_zu23_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -23,6 +25,7 @@ class CUP_Weapons_CUP_Weapons_StaticWeapons_ZU23_CUP_zu23_p3d : TRIPLES(ADDON,Ca
size = 7;
recoil = 1000;
isWeapon = 1;
weaponType = TYPE_AA ;
};

class CUP_Weapons_CUP_Weapons_StaticWeapons_SPG9_CUP_spg9_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -32,6 +35,7 @@ class CUP_Weapons_CUP_Weapons_StaticWeapons_SPG9_CUP_spg9_p3d : TRIPLES(ADDON,Ca
size = 4;
recoil = 250;
isWeapon = 1;
weaponType = TYPE_AT ;
};

class CUP_Weapons_CUP_Weapons_StaticWeapons_M2_CUP_m2_mg_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -41,6 +45,7 @@ class CUP_Weapons_CUP_Weapons_StaticWeapons_M2_CUP_m2_mg_p3d : TRIPLES(ADDON,Car
size = 4;
recoil = 100;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class CUP_Weapons_CUP_Weapons_StaticWeapons_IglaPod_CUP_igla_AA_pod_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -50,6 +55,7 @@ class CUP_Weapons_CUP_Weapons_StaticWeapons_IglaPod_CUP_igla_AA_pod_p3d : TRIPLE
size = 4;
recoil = 250;
isWeapon = 1;
weaponType = TYPE_AA ;
};

class CUP_Weapons_CUP_Weapons_StaticWeapons_FIM92Pod_CUP_FIM92_AA_Pod_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -59,6 +65,7 @@ class CUP_Weapons_CUP_Weapons_StaticWeapons_FIM92Pod_CUP_FIM92_AA_Pod_p3d : TRIP
size = 4;
recoil = 250;
isWeapon = 1;
weaponType = TYPE_AA ;
};

class CUP_Weapons_CUP_Weapons_StaticWeapons_M252_CUP_81Mortar_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -68,6 +75,7 @@ class CUP_Weapons_CUP_Weapons_StaticWeapons_M252_CUP_81Mortar_p3d : TRIPLES(ADDO
size = 2;
recoil = 2000;
isWeapon = 1;
weaponType = TYPE_MORTAR ;
};

class CUP_Weapons_CUP_Weapons_StaticWeapons_TOW_CUP_TOW_static_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -77,6 +85,7 @@ class CUP_Weapons_CUP_Weapons_StaticWeapons_TOW_CUP_TOW_static_p3d : TRIPLES(ADD
size = 4;
recoil = 250;
isWeapon = 1;
weaponType = TYPE_AT ;
};

class CUP_Weapons_CUP_Weapons_StaticWeapons_Kornet_CUP_Kornet_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -86,6 +95,7 @@ class CUP_Weapons_CUP_Weapons_StaticWeapons_Kornet_CUP_Kornet_p3d : TRIPLES(ADDO
size = 4;
recoil = 250;
isWeapon = 1;
weaponType = TYPE_AT ;
};

class CUP_Weapons_CUP_Weapons_StaticWeapons_Podnos_CUP_podnos_2b14_82mm_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -95,6 +105,7 @@ class CUP_Weapons_CUP_Weapons_StaticWeapons_Podnos_CUP_podnos_2b14_82mm_p3d : TR
size = 2;
recoil = 2000;
isWeapon = 1;
weaponType = TYPE_MORTAR ;
};

class CUP_Weapons_CUP_Weapons_StaticWeapons_M2_CUP_L111A1_mg_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -104,6 +115,7 @@ class CUP_Weapons_CUP_Weapons_StaticWeapons_M2_CUP_L111A1_mg_p3d : TRIPLES(ADDON
size = 4;
recoil = 100;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class CUP_Weapons_CUP_Weapons_StaticWeapons_Metis_CUP_metis_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -113,6 +125,7 @@ class CUP_Weapons_CUP_Weapons_StaticWeapons_Metis_CUP_metis_p3d : TRIPLES(ADDON,
size = 4;
recoil = 250;
isWeapon = 1;
weaponType = TYPE_AT ;
};

class CUP_Weapons_CUP_Weapons_StaticWeapons_RBS70_CUP_RBS70_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -122,4 +135,5 @@ class CUP_Weapons_CUP_Weapons_StaticWeapons_RBS70_CUP_RBS70_p3d : TRIPLES(ADDON,
size = 4;
recoil = 250;
isWeapon = 1;
weaponType = TYPE_AT ;
};
8 changes: 8 additions & 0 deletions A3A/addons/logistics/Cargo/GM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class gm_gm_weapons_gm_machineguns_gm_mg3_gm_mg3_aatripod : TRIPLES(ADDON,Cargo,
size = 3;
recoil = 100;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class gm_gm_weapons_gm_machineguns_gm_dshkm_gm_dshkm_aatripod : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -14,6 +15,7 @@ class gm_gm_weapons_gm_machineguns_gm_dshkm_gm_dshkm_aatripod : TRIPLES(ADDON,Ca
size = 3;
recoil = 100;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class gm_gm_weapons_gm_launchers_gm_milan_gm_milan_launcher_tripod : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -23,6 +25,8 @@ class gm_gm_weapons_gm_launchers_gm_milan_gm_milan_launcher_tripod : TRIPLES(ADD
size = 4;
recoil = 200;
isWeapon = 1;
isLow = 1;
weaponType = TYPE_AT ;
blackList[] = {"\gm\gm_vehicles\gm_land\gm_wheeled\gm_kat1\gm_kat1_452_container","\gm\gm_vehicles\gm_land\gm_wheeled\gm_kat1\gm_kat1_451_container","\gm\gm_vehicles\gm_land\gm_wheeled\gm_kat1\gm_kat1_454_cargo"};
};

Expand All @@ -33,6 +37,8 @@ class gm_gm_weapons_gm_launchers_gm_spg9_gm_spg9_tripod : TRIPLES(ADDON,Cargo,Ba
size = 4;
recoil = 200;
isWeapon = 1;
isLow = 1;
weaponType = TYPE_AT ;
blackList[] = {"\gm\gm_vehicles\gm_land\gm_wheeled\gm_kat1\gm_kat1_452_container","\gm\gm_vehicles\gm_land\gm_wheeled\gm_kat1\gm_kat1_451_container","\gm\gm_vehicles\gm_land\gm_wheeled\gm_kat1\gm_kat1_454_cargo"};
};

Expand All @@ -43,5 +49,7 @@ class gm_gm_weapons_gm_launchers_gm_fagot_gm_fagot_launcher_tripod : TRIPLES(ADD
size = 4;
recoil = 200;
isWeapon = 1;
weaponType = TYPE_AT ;
isLow = 1;
blackList[] = {"\gm\gm_vehicles\gm_land\gm_wheeled\gm_kat1\gm_kat1_452_container","\gm\gm_vehicles\gm_land\gm_wheeled\gm_kat1\gm_kat1_451_container","\gm\gm_vehicles\gm_land\gm_wheeled\gm_kat1\gm_kat1_454_cargo"};
};
16 changes: 16 additions & 0 deletions A3A/addons/logistics/Cargo/RHS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class rhsusf_addons_rhsusf_heavyweapons_TOW_TOW_static : TRIPLES(ADDON,Cargo,Bas
size = 4;
recoil = 250;
isWeapon = 1;
weaponType = TYPE_AT ;
};

class rhsusf_addons_rhsusf_heavyweapons_m2_mg : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -14,6 +15,7 @@ class rhsusf_addons_rhsusf_heavyweapons_m2_mg : TRIPLES(ADDON,Cargo,Base)
size = 4;
recoil = 100;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class rhsusf_addons_rhsusf_heavyweapons_m2_mg2 : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -23,6 +25,7 @@ class rhsusf_addons_rhsusf_heavyweapons_m2_mg2 : TRIPLES(ADDON,Cargo,Base)
size = 4;
recoil = 100;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class rhsusf_addons_rhsusf_heavyweapons_Mk19_minitripod_mk19_stat : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -32,6 +35,7 @@ class rhsusf_addons_rhsusf_heavyweapons_Mk19_minitripod_mk19_stat : TRIPLES(ADDO
size = 4;
recoil = 100;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class rhsafrf_addons_rhs_heavyweapons_DShKM_DShKM_mg : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -41,6 +45,7 @@ class rhsafrf_addons_rhs_heavyweapons_DShKM_DShKM_mg : TRIPLES(ADDON,Cargo,Base)
size = 4;
recoil = 100;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class rhsafrf_addons_rhs_heavyweapons_DShKM_DShKM_mg2 : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -50,6 +55,7 @@ class rhsafrf_addons_rhs_heavyweapons_DShKM_DShKM_mg2 : TRIPLES(ADDON,Cargo,Base
size = 4;
recoil = 100;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class rhsafrf_addons_rhs_heavyweapons_mg_bis_kord_KORD_6u16sp : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -59,6 +65,7 @@ class rhsafrf_addons_rhs_heavyweapons_mg_bis_kord_KORD_6u16sp : TRIPLES(ADDON,Ca
size = 4;
recoil = 150;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class rhsafrf_addons_rhs_heavyweapons_mg_bis_kord_kord : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -68,6 +75,7 @@ class rhsafrf_addons_rhs_heavyweapons_mg_bis_kord_kord : TRIPLES(ADDON,Cargo,Bas
size = 4;
recoil = 150;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class rhsafrf_addons_rhs_heavyweapons_mg_rhs_nsv_tripod : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -77,6 +85,7 @@ class rhsafrf_addons_rhs_heavyweapons_mg_rhs_nsv_tripod : TRIPLES(ADDON,Cargo,Ba
size = 4;
recoil = 150;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class rhsafrf_addons_rhs_heavyweapons_kornet_kornet_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -86,6 +95,7 @@ class rhsafrf_addons_rhs_heavyweapons_kornet_kornet_p3d : TRIPLES(ADDON,Cargo,Ba
size = 4;
recoil = 250;
isWeapon = 1;
weaponType = TYPE_AT ;
};

class rhsafrf_addons_rhs_heavyweapons_spg9_spg9_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -95,6 +105,7 @@ class rhsafrf_addons_rhs_heavyweapons_spg9_spg9_p3d : TRIPLES(ADDON,Cargo,Base)
size = 4;
recoil = 250;
isWeapon = 1;
weaponType = TYPE_AT ;
};

class rhsafrf_addons_rhs_heavyweapons_AGS30_AGS_static : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -104,6 +115,7 @@ class rhsafrf_addons_rhs_heavyweapons_AGS30_AGS_static : TRIPLES(ADDON,Cargo,Bas
size = 4;
recoil = 100;
isWeapon = 1;
weaponType = TYPE_MG ;
};

class rhsafrf_addons_rhs_heavyweapons_igla_igla_AA_pod : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -113,6 +125,7 @@ class rhsafrf_addons_rhs_heavyweapons_igla_igla_AA_pod : TRIPLES(ADDON,Cargo,Bas
size = 4;
recoil = 250;
isWeapon = 1;
weaponType = TYPE_AA ;
};

class rhsafrf_addons_rhs_heavyweapons_ZU23_rhs_zu23 : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -123,6 +136,7 @@ class rhsafrf_addons_rhs_heavyweapons_ZU23_rhs_zu23 : TRIPLES(ADDON,Cargo,Base)
recoil = 250;
isWeapon = 1;
blackList[] = {"\rhsusf\addons\rhsusf_HEMTT_A4\M977A4_wd","\rhsusf\addons\rhsusf_hemtt_a4\M977A4_WD_APK","\rhsusf\addons\rhsusf_hemtt_a4\M977A4_WD_APK_M2"};
weaponType = TYPE_AA ;
};

class rhsafrf_addons_rhs_heavyweapons_podnos_2b14_82mm_podnos_2b14_82mm : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -133,6 +147,7 @@ class rhsafrf_addons_rhs_heavyweapons_podnos_2b14_82mm_podnos_2b14_82mm : TRIPLE
recoil = 2000;
isWeapon = 1;
blackList[] = {"\A3\boat_f_gamma\Boat_Civil_01\Boat_Civil_01_F","\A3\boat_f\Boat_Transport_01\Boat_Transport_01_F.p3d","\A3\Boat_F_Exp\Boat_Transport_02\Boat_Transport_02_F.p3d"};
weaponType = TYPE_MORTAR ;
};

class rhsusf_addons_rhsusf_m252_rhs_mortar_m252_p3d : TRIPLES(ADDON,Cargo,Base)
Expand All @@ -143,4 +158,5 @@ class rhsusf_addons_rhsusf_m252_rhs_mortar_m252_p3d : TRIPLES(ADDON,Cargo,Base)
recoil = 2000;
isWeapon = 1;
blackList[] = {"\A3\boat_f_gamma\Boat_Civil_01\Boat_Civil_01_F","\A3\boat_f\Boat_Transport_01\Boat_Transport_01_F.p3d","\A3\Boat_F_Exp\Boat_Transport_02\Boat_Transport_02_F.p3d"};
weaponType = TYPE_MORTAR ;
};
1 change: 1 addition & 0 deletions A3A/addons/logistics/Cargo/WS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ class lxws_vehicles_f_lxws_zu23_zu23_lxws_p3d : TRIPLES(ADDON,Cargo,Base)
size = 6;
recoil = 250;
isWeapon = 1;
weaponType = TYPE_AA ;
};
1 change: 1 addition & 0 deletions A3A/addons/logistics/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class CfgFunctions {
class convertNodesToNew {};
class generateCargoOffset {};
class generateHardPoints {};
class getCargoClassName {};
};

class Public {
Expand Down
6 changes: 6 additions & 0 deletions A3A/addons/logistics/CfgLogistics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ class DOUBLES(ADDON,Nodes)
{
class Nodes {};
canLoadWeapon = 1; //if the vehicle can load weapons
weaponBlackList = __EVAL(16); //blacklist Weaponstypes (Bitwise 16 - everything allowed, 1 - mortar, 2 - MG, 4 - AT, 8 - AA) )
targetingsnake marked this conversation as resolved.
Show resolved Hide resolved
canLoadLowWeapons = 1; //if the vehicle can load weapons with a low profile (e.g. M2 Low Mount)
isBoat = 0; //if the vehicle is a boat
targetingsnake marked this conversation as resolved.
Show resolved Hide resolved
};

#include "Nodes\3CBBAF.hpp"
Expand Down Expand Up @@ -32,6 +35,9 @@ class DOUBLES(ADDON,Cargo)
recoil = 0; //the recoil a weapon impacts on the vehicle when fired (per projectile)
isWeapon = 0; //if the cargo is a weapon (needed for proper handling of mounted weapon)
blackList[] = {}; //specific vehicles or models to blacklist from loading this weapon/cargo
isLow = 0; // if the weapon has low silohuette (e.g. M2 Low Mount)
disallowOnBoat = 0; // if the weapon is allowed in boats (0 - default behaviour, 1 - explizit allow)
targetingsnake marked this conversation as resolved.
Show resolved Hide resolved
weaponType = 0; // defines type of weapon if it is an weapon ( 0 - undefined, 1 - mortar, 2 - MG, 3 - AT, 4 - AA)
};

#include "Cargo\3CBFactions.hpp"
Expand Down
29 changes: 29 additions & 0 deletions A3A/addons/logistics/Dev/fn_getCargoClassName.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
Author: [Targetingsnake]
[Description]
Gets you the classname of the vehicle given to the script based on the the generateCargoOffset script

Arguments:
0. <Object> Vehicle which would be cargo
3. <Bool> definition if model instead of class based (default modelbased)

Return Value:
<Array> vehicle hardpoint point [model, node array]

Scope: Clients
Environment: unscheduled
Public: [Yes]
Dependencies:

Example: [cursorTarget, true] call A3A_Logistics_fnc_getCargoClassName;
*/

params [
["_cargo",objNull, [objNull]]
, ["_modelBased", true, [true]]
];


private _className = if (_modelBased) then { ( (getText ((configOf _cargo)/"model")) splitString "\.") joinString "_" } else {typeOf _cargo};

_className
17 changes: 17 additions & 0 deletions A3A/addons/logistics/Private/fn_canLoad.sqf
targetingsnake marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,23 @@ private _weapon = 1 == getNumber (_cargoConfig/"isWeapon");
private _allowed = if (!_weapon) then {true} else {
if (0 == getNumber (_vehConfig/"canLoadWeapon")) exitWith {false};

// check wepon allow more
private _weaponType = (getNumber (_cargoConfig/"weaponType")) - 1 ;

// generally disallow mortars on boats
if (1 == getNumber(_vehConfig/"isBoat") && 0 == _weaponType) exitWith {false};

private _typeAllowed = if (_weaponType isNotEqualTo -1) then {
!( _weaponType in (getNumber (_vehConfig/"weaponBlackList") call BIS_fnc_decodeFlags))
} else { true };
if (!_typeAllowed) exitwith {false};

// check if weapon is allowed on boat
if (1 == getNumber(_vehConfig/"isBoat") && 1 == getNumber(_cargoConfig/"disallowOnBoat")) exitWith {false};
// check if weapon is low and if the vehicle can then load it
if (0 == getNumber(_vehConfig/"canLoadLowWeapons") && 1 == getNumber(_cargoConfig/"isLow")) exitWith {false};

// could be obsolete once all logistic stuff is converted
private _vehModel = getText (configFile/"CfgVehicles"/typeOf _vehicle/"model");
private _blackList = getArray (_cargoConfig/"blackList");
!(
Expand Down
28 changes: 28 additions & 0 deletions A3A/addons/logistics/script_component.hpp
targetingsnake marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,31 @@

//get and format model path to class friendly name for lookup
#define modelOfClass(class) (((getText (configFile/"CfgVehicles"/class/"model")) splitString "\.") joinString "_")

#define TYPE_MORTAR 1
#define TYPE_MG 2
#define TYPE_AT 3
#define TYPE_AA 4

//Basic Variantes
#define BL_MG __EVAL(2)
#define BL_AT __EVAL(4)
#define BL_AA __EVAL(8)
#define BL_MORTAR __EVAL(1)

// Variants with 2 Blacklisted weapon types
#define BL_MORTAR_MG __EVAL(1+2)
#define BL_MORTAR_AT __EVAL(1+4)
#define BL_MORTAR_AA __EVAL(1+8)
#define BL_MG_AT __EVAL(2+4)
#define BL_MG_AA __EVAL(2+8)
#define BL_AT_AA __EVAL(4+8)

// Variants with 3 Blacklisted Weapon Types
#define BL_MORTAR_MG_AT __EVAL(1+2+4)
#define BL_MORTAR_MG_AA __EVAL(1+2+8)
#define BL_MORTAR_AT_AA __EVAL(1+4+8)
#define BL_MG_AT_AA __EVAL(2+4+8)

// Variants with 4 Blacklisted Weapon Types
#define BL_MORTAR_MG_AT_AA __EVAL(1+2+4+8)