Skip to content

Commit

Permalink
Merge pull request #341 from Ansible2/master
Browse files Browse the repository at this point in the history
0.8.6
  • Loading branch information
Ansible2 authored Dec 22, 2020
2 parents c0b8631 + 750e6dd commit 9597b8d
Show file tree
Hide file tree
Showing 9 changed files with 170 additions and 128 deletions.
38 changes: 19 additions & 19 deletions Functions/Init Functions/fn_prepareGlobals.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,7 @@ if (isServer) then {
/* 0 = Off */
/* 1 = Only Whitelist Items will spawn as loot */
/* 2 = Whitelist items get added to existing loot (increases the chance of loot spawning) */
BLWK_loot_whiteListMode = 0;

// loot classes
private _lootClasses = call BLWK_fnc_prepareLootClasses;

BLWK_loot_weaponClasses = []; // for getting all weapons into the same pool for spawning loot
BLWK_loot_primaryWeapons = _lootClasses select 0; // the individual split ups are for use with BLWK_fnc_randomizeWeapons
BLWK_loot_weaponClasses append BLWK_loot_primaryWeapons;
BLWK_loot_handgunWeapons = _lootClasses select 1;
BLWK_loot_weaponClasses append BLWK_loot_handgunWeapons;
BLWK_loot_launchers = _lootClasses select 2;
BLWK_loot_weaponClasses append BLWK_loot_launchers;

BLWK_loot_backpackClasses = _lootClasses select 3;
BLWK_loot_vestClasses = _lootClasses select 4;
BLWK_loot_uniformClasses = _lootClasses select 5;
BLWK_loot_headGearClasses = _lootClasses select 6;
BLWK_loot_itemClasses = _lootClasses select 7;
BLWK_loot_explosiveClasses = _lootClasses select 8;
BLWK_loot_whiteListMode = ("BLWK_loot_whiteListMode" call BIS_fnc_getParamValue);

/* LOCATION LIST OPTIONS */
BLWK_locations = nearestlocations [[0,0,0],["nameVillage","nameCity","nameCityCapital","nameMarine","Airport"],worldsize * sqrt 2];
Expand Down Expand Up @@ -138,6 +120,24 @@ if (isServer OR {!hasInterface}) then {
if (BLWK_canUseTankstDLC) then {BLWK_useableDLCs pushBack ""};
*/

// loot classes
private _lootClasses = call BLWK_fnc_prepareLootClasses;
// the headless client needs this for weapon randomization
BLWK_loot_weaponClasses = []; // for getting all weapons into the same pool for spawning loot
BLWK_loot_primaryWeapons = _lootClasses select 0; // the individual split ups are for use with BLWK_fnc_randomizeWeapons
BLWK_loot_weaponClasses append BLWK_loot_primaryWeapons;
BLWK_loot_handgunWeapons = _lootClasses select 1;
BLWK_loot_weaponClasses append BLWK_loot_handgunWeapons;
BLWK_loot_launchers = _lootClasses select 2;
BLWK_loot_weaponClasses append BLWK_loot_launchers;

BLWK_loot_backpackClasses = _lootClasses select 3;
BLWK_loot_vestClasses = _lootClasses select 4;
BLWK_loot_uniformClasses = _lootClasses select 5;
BLWK_loot_headGearClasses = _lootClasses select 6;
BLWK_loot_itemClasses = _lootClasses select 7;
BLWK_loot_explosiveClasses = _lootClasses select 8;

BLWK_enemiesPerWaveMultiplier = ("BLWK_enemiesPerWaveMultiplier" call BIS_fnc_getParamValue) / 10; // How many hostiles per wave (waveCount x BLWK_enemiesPerWaveMultiplier)
BLWK_enemiesPerPlayerMultiplier = ("BLWK_enemiesPerPlayerMultiplier" call BIS_fnc_getParamValue) / 10; // How many extra units are added per player
BLWK_maxPistolOnlyWaves = ("BLWK_maxPistolOnlyWaves" call BIS_fnc_getParamValue); //What wave enemies stop only using pistols
Expand Down
66 changes: 43 additions & 23 deletions Functions/Init Functions/fn_prepareLootClasses.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,44 @@ Author(s):
Hilltop(Willtop) & omNomios,
Modified by: Ansible2 // Cipher
---------------------------------------------------------------------------- */
if (!isServer) exitWith {false};
if (!isServer AND {hasInterface}) exitWith {false};

// get white and black lists for loot
#include "..\..\Headers\Loot Lists.hpp"

// in order to make use of the "in" command, using toLower to avoid case sensetive issues
BLWK_lootBlacklist = [];
private _blackList = [missionConfigFile >> "BLWK_lootLists" >> "lootBlacklist"] call BIS_fnc_getCfgDataArray;
if !(_blackList isEqualTo []) then {
private _class = "";
_blackList apply {
_class = toLower _x;
BLWK_lootBlacklist pushBack _class;
};
};

private _whitelist_primaries = [missionConfigFile >> "BLWK_lootLists" >> "lootWhitelist_primaries"] call BIS_fnc_getCfgDataArray;
private _whitelist_handguns = [missionConfigFile >> "BLWK_lootLists" >> "lootWhitelist_handguns"] call BIS_fnc_getCfgDataArray;
private _whitelist_launchers = [missionConfigFile >> "BLWK_lootLists" >> "lootWhitelist_launchers"] call BIS_fnc_getCfgDataArray;
private _whitelist_backpacks = [missionConfigFile >> "BLWK_lootLists" >> "lootWhitelist_backpacks"] call BIS_fnc_getCfgDataArray;
private _whitelist_vests = [missionConfigFile >> "BLWK_lootLists" >> "lootWhitelist_vests"] call BIS_fnc_getCfgDataArray;
private _whitelist_uniforms = [missionConfigFile >> "BLWK_lootLists" >> "lootWhitelist_uniforms"] call BIS_fnc_getCfgDataArray;
private _whitelist_headgear = [missionConfigFile >> "BLWK_lootLists" >> "lootWhitelist_headgear"] call BIS_fnc_getCfgDataArray;
private _whitelist_items = [missionConfigFile >> "BLWK_lootLists" >> "lootWhitelist_items"] call BIS_fnc_getCfgDataArray;
private _whitelist_explosives = [missionConfigFile >> "BLWK_lootLists" >> "lootWhitelist_explosives"] call BIS_fnc_getCfgDataArray;


// Check if we are in whitelisted items only mode
if (BLWK_loot_whiteListMode isEqualTo 1) exitWith {
[
WHITELIST_PRIMARY_WEAPONS,
WHITELIST_HANDGUN_WEAPONS,
WHITELIST_LAUNCHERS,
WHITELIST_BACKPACKS,
WHITELIST_VESTS,
WHITELIST_UNIFORMS,
WHITELIST_HEADGEAR,
WHITELIST_ITEMS,
WHITELIST_EXPLOSIVES
_whitelist_primaries,
_whitelist_handguns,
_whitelist_launchers,
_whitelist_backpacks,
_whitelist_vests,
_whitelist_uniforms,
_whitelist_headgear,
_whitelist_items,
_whitelist_explosives
]
};

Expand Down Expand Up @@ -123,7 +144,7 @@ private _fn_sortMagazines = {
private _fn_sortType = {
// get the class name of the item and check if it is in the blacklist
_tempClass = configName (_this select 0);
if (_tempClass in LOOT_BLACKLIST) exitWith {};
if (_tempClass in BLWK_lootBlacklist) exitWith {};

// CIPHER COMMENT: DLC check is awaiting 2.0 release for getAssetDLCInfo command
/*
Expand Down Expand Up @@ -170,19 +191,18 @@ _publicMagazineConfigs apply {

// check white list mode to see if we should add whitelisted items to arrays
if (BLWK_loot_whiteListMode isEqualTo 2) then {
_backpackClasses append WHITELIST_BACKPACKS;
_explosiveClasses append WHITELIST_EXPLOSIVES;
_itemClasses append WHITELIST_ITEMS;
_uniformClasses append WHITELIST_UNIFORMS;
_vestClasses append WHITELIST_VESTS;
_headgearClasses append WHITELIST_HEADGEAR;
_primaryWeaponClasses append WHITELIST_PRIMARY_WEAPONS;
_handgunWeaponClasses append WHITELIST_HANDGUN_WEAPONS;
_launcherClasses append WHITELIST_LAUNCHERS;
_backpackClasses append _whitelist_backpacks;
_explosiveClasses append _whitelist_explosives;
_itemClasses append _whitelist_items;
_uniformClasses append _whitelist_uniforms;
_vestClasses append _whitelist_vests;
_headgearClasses append _whitelist_headgear;
_primaryWeaponClasses append _whitelist_primaries;
_handgunWeaponClasses append _whitelist_handguns;
_launcherClasses append _whitelist_launchers;
};



// return
[
_primaryWeaponClasses,
_handgunWeaponClasses,
Expand Down
6 changes: 3 additions & 3 deletions Functions/Other/fn_getFriendlyVehicleClass.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ params ["_typeId",["_randomIndex",true]];
/*
#define DEFAULT_VEHICLE_CLASSES \
[\
["B_LSV_01_armed_F"],\ 0 // light car
["B_MRAP_01_hmg_F"],\ 1 // heavy car
["B_LSV_01_armed_F"],\ 0 // light car
["B_MRAP_01_hmg_F"],\ 1 // heavy car
["B_APC_Wheeled_01_cannon_F"],\ 2 // light armour
["B_MBT_01_cannon_F"],\ 3 // heavy armour
["B_Heli_Transport_01_F"],\ 4 // transport aircraft
["B_T_VTOL_01_vehicle_F"],\ 5 // cargo aircraft
["B_Plane_CAS_01_dynamicLoadout_F"],\ 6 // CAS plane
["B_Plane_CAS_01_dynamicLoadout_F"],\ 6 // CAS plane
["B_Heli_Attack_01_dynamicLoadout_F"],\ 7 // attack helicopter
["B_T_VTOL_01_armed_F"]\ 8 // gunship (ac130 type aircraft)
]
Expand Down
2 changes: 1 addition & 1 deletion Functions/Supports/fn_callingForSupportMaster.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ if (CHECK_SUPPORT_CLASS(TURRET_DOOR_GUNNER_CLASS)) exitWith {
};
if (CHECK_SUPPORT_CLASS(TURRET_ATTACK_HELI_GUNNER_CLASS)) exitWith {
if !(missionNamespace getVariable ["BLWK_heliGunnerInUse",false]) then {
private _friendlyAttackHeliClass = [7,false] call BLWK_fnc_getFriendlyVehicleClass;
private _friendlyAttackHeliClass = [7] call BLWK_fnc_getFriendlyVehicleClass;
TURRET_EXPRESSION(_friendlyAttackHeliClass,400,550,"B_Heli_Attack_01_dynamicLoadout_F","BLWK_heliGunnerInUse")
} else {
hint "Only one helicopter gunner support may be active at a time.";
Expand Down
37 changes: 32 additions & 5 deletions Functions/Waves/fn_spawnLoot.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,27 @@ BLWK_spawnedLoot pushBack BLWK_moneyPile;
Everything else
---------------------------------------------------------------------------- */
private _fn_findAMagazine = {
params ["_weaponClass"];

private _magArray = [configFile >> "CfgWeapons" >> _weaponClass >> "magazines"] call BIS_fnc_getCfgDataArray;
// if no mags are found
if (_magArray isEqualTo []) exitWith {""};

_magArray = [_magArray] call CBAP_fnc_shuffle;

private _index = _magArray findIf {
!((toLower _x) in BLWK_lootBlacklist)
};

// if a mag is found
if (_index != -1) then {
_magArray select _index
} else { // if a mag is not found
""
};
};

private _fn_addLoot = {
params ["_holder"];

Expand Down Expand Up @@ -195,17 +216,24 @@ private _fn_addLoot = {
// weapons
if (_typeToSpawn isEqualTo 5 OR {_typeToSpawn isEqualTo 8} OR {_typeToSpawn isEqualTo 9}) exitWith { // there are three numbers here to encourage more weapon spawns
_selectedItemClass = selectRandom BLWK_loot_weaponClasses;
_magazineClass = selectRandom (getArray (configFile >> "CfgWeapons" >> _selectedItemClass >> "magazines"));
_holder addWeaponCargoGlobal [_selectedItemClass,1];
_holder addMagazineCargoGlobal [_magazineClass,round random [1,2,3]];

_magazineClass = [_selectedItemClass] call _fn_findAMagazine;
// if weapon has mags capable of spawning
if (_magazineClass != "") then {
_holder addMagazineCargoGlobal [_magazineClass,round random [1,2,3]];
};

_selectedItemClass
};
// magazines
if (_typeToSpawn isEqualTo 6) exitWith {
_selectedItemClass = selectRandom BLWK_loot_weaponClasses;
_magazineClass = selectRandom (getArray (configFile >> "CfgWeapons" >> _selectedItemClass >> "magazines"));
_holder addMagazineCargoGlobal [_magazineClass,round random [1,2,3]];
_magazineClass = [_selectedItemClass] call _fn_findAMagazine;
// if weapon has mags capable of spawning
if (_magazineClass != "") then {
_holder addMagazineCargoGlobal [_magazineClass,round random [1,2,3]];
};

_magazineClass
};
Expand All @@ -221,7 +249,6 @@ private _fn_addLoot = {

_sortedPositions apply {
// in order to spawn stuff like weapons on the ground, we create holders
// CIPHER COMMENT: See if this is needed

private _holder = createVehicle ["GroundWeaponHolder_scripted", _x, [], 0, "CAN_COLLIDE"];
private _primaryLootClass = [_holder] call _fn_addLoot;
Expand Down
76 changes: 0 additions & 76 deletions Headers/Loot Lists.hpp

This file was deleted.

63 changes: 63 additions & 0 deletions Headers/descriptionEXT/Loot Lists.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
class BLWK_lootLists
{
lootBlackList[] = {
"O_Static_Designator_02_weapon_F",
"O_UAV_06_backpack_F",
"O_UAV_06_medical_backpack_F",
"O_UAV_01_backpack_F",
"B_IR_Grenade",
"O_IR_Grenade",
"I_IR_Grenade",
"TrainingMine_Mag",
"ChemicalDetector_01_watch_F",
"ChemicalDetector_01_olive_F",
"8Rnd_82mm_Mo_Flare_white",
"muzzle_antenna_01_f",
"V_Safety_yellow_F",
"muzzle_antenna_02_f",
"rhsusf_100Rnd_556x45_M200_soft_pouch_ucp",
"rhsusf_100Rnd_556x45_M200_soft_pouch_coyote",
"rhsusf_100Rnd_556x45_M200_soft_pouch",
"rhs_mag_30Rnd_556x45_M200_Stanag",
"rhs_mag_20Rnd_556x45_M200_Stanag",
"rhsusf_100Rnd_762x51_m82_blank",
"rhsusf_50Rnd_762x51_m82_blank",
"hgun_Pistol_Signal_F"
};

lootWhitelist_launchers[] = {

};

lootWhitelist_primaries[] = {

};

lootWhitelist_handguns[] = {

};

lootWhitelist_backpacks[] = {

};

lootWhitelist_vests[] = {

};

lootWhitelist_uniforms[] = {

};

lootWhitelist_headgear[] = {

};

lootWhitelist_items[] = {

};

lootWhitelist_explosives[] = {

};
};
7 changes: 7 additions & 0 deletions Headers/descriptionEXT/missionParams.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,13 @@ class BLWK_loot_roomDistribution
texts[] = {"Every location", "Every second location", "Every third location", "Every fourth location"};
GET_DEFAULT_PARAM(BLWK_loot_roomDistribution,2)
};
class BLWK_loot_whiteListMode
{
title = "Loot Whitelist Mode";
values[] = {0,1,2};
texts[] = {"OFF","Only Whitelist Items will spawn as loot","Whitelist items get added to existing loot (increases the chance of loot spawning)"};
GET_DEFAULT_PARAM(BLWK_loot_whiteListMode,0)
};
class BLWK_buildingsNearTheCrateAreIndestructable_radius
{
title = "The radius of indestructable buildings around The Crate";
Expand Down
Loading

0 comments on commit 9597b8d

Please sign in to comment.