Skip to content

Commit

Permalink
Work on getting config override module in place
Browse files Browse the repository at this point in the history
  • Loading branch information
zeiktuvai committed Jan 9, 2025
1 parent da9060b commit 7cb0ff0
Show file tree
Hide file tree
Showing 11 changed files with 256 additions and 47 deletions.
8 changes: 7 additions & 1 deletion addons/fnc/MSF_Functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ class CfgFunctions
class Config
{
file = "z\msf\addons\fnc\config";
class GetDroneList {};
class GetInventoryLists {};
class GetLocalConfig {};
class GetOverrideCfg {};
class GetUnitClasses {};
class GetDroneList {};
};
class Data
{
file = "z\msf\addons\fnc\data";
class ParseValidArray {};
};
class Mission
{
Expand Down
21 changes: 21 additions & 0 deletions addons/fnc/config/fn_GetOverrideCfg.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//Returns empy array if no override; returns empty array for each type not overrided.
params [["_side", 0, [0]]];

private _cfgMods = allMissionObjects "MSF_Module_ClassOverride";
private _modules = _cfgMods select {_x getVariable "Side" == _side};
private _return = [];

if (count _modules > 0) then {
private _mod = _modules select 0;
private _errMessage = format ["Parsing MSF Class Override Module for side: %1", [_side] call BIS_fnc_sideType];

_return pushBack ([_mod, "Groups", _errMessage] call MSF_fnc_ParseValidArray);
_return pushBack ([_mod, "Vehicles", _errMessage] call MSF_fnc_ParseValidArray);
_return pushBack ([_mod, "ArmoredC", _errMessage] call MSF_fnc_ParseValidArray);
_return pushBack ([_mod, "Air", _errMessage] call MSF_fnc_ParseValidArray);
_return pushBack ([_mod, "Turrets", _errMessage] call MSF_fnc_ParseValidArray);
_return pushBack ([_mod, "Units", _errMessage] call MSF_fnc_ParseValidArray);
_return pushBack ([_mod, "VicPatrols", _errMessage] call MSF_fnc_ParseValidArray);
};

_return;
53 changes: 20 additions & 33 deletions addons/fnc/config/fn_GetUnitClasses.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

params [["_side", east, [east]]];

private ["_cfg", "_return", "_faction", "_groups", "_vics", "_armor", "_air", "_turrets", "_units", "_vicPatrol"];
_return = [];
_cfg = [] call MSF_fnc_GetLocalConfig;
private ["_faction"];
private _override = [[_side] call BIS_fnc_sideID] call MSF_fnc_GetOverrideCfg;
private _return = [];

switch (_side) do {
case east: {
Expand All @@ -24,38 +24,25 @@ switch (_side) do {
};
};


// Get default unit set
_groups = getArray (configFile >> 'MSFConfig' >> 'UnitSets' >> _faction >> 'Groups');
_vics = getArray (configFile >> 'MSFConfig' >> 'UnitSets' >> _faction >> 'Vehicles');
_armor = getArray (configFile >> 'MSFConfig' >> 'UnitSets' >> _faction >> 'Armor');
_air = getArray (configFile >> 'MSFConfig' >> 'UnitSets' >> _faction >> 'Air');
_turrets = getArray (configFile >> 'MSFConfig' >> 'UnitSets' >> _faction >> 'Turrets');
_units = getArray (configFile >> 'MSFConfig' >> 'UnitSets' >> _faction >> 'Units');
_vicPatrol = getArray (configFile >> 'MSFConfig' >> 'UnitSets' >> _faction >> 'VehiclePatrols');
private _groups = getArray (configFile >> 'MSFConfig' >> 'UnitSets' >> _faction >> 'Groups');
private _vics = getArray (configFile >> 'MSFConfig' >> 'UnitSets' >> _faction >> 'Vehicles');
private _armor = getArray (configFile >> 'MSFConfig' >> 'UnitSets' >> _faction >> 'Armor');
private _air = getArray (configFile >> 'MSFConfig' >> 'UnitSets' >> _faction >> 'Air');
private _turrets = getArray (configFile >> 'MSFConfig' >> 'UnitSets' >> _faction >> 'Turrets');
private _units = getArray (configFile >> 'MSFConfig' >> 'UnitSets' >> _faction >> 'Units');
private _vicPatrol = getArray (configFile >> 'MSFConfig' >> 'UnitSets' >> _faction >> 'VehiclePatrols');

if (!isNull _cfg) then {
if (isArray(_cfg >> 'MSF_Mission_Classes' >> 'UnitSets' >> _faction >> 'Groups')) then {
_return pushBack getArray (_cfg >> 'MSF_Mission_Classes' >> 'UnitSets' >> _faction >> 'Groups');
} else { _return pushBack _groups; };
if (isArray(_cfg >> 'MSF_Mission_Classes' >> 'UnitSets' >> _faction >> 'Vehicles')) then {
_return pushBack getArray (_cfg >> 'MSF_Mission_Classes' >> 'UnitSets' >> _faction >> 'Vehicles');
} else { _return pushBack _vics; };
if (isArray(_cfg >> 'MSF_Mission_Classes' >> 'UnitSets' >> _faction >> 'Armor')) then {
_return pushBack getArray (_cfg >> 'MSF_Mission_Classes' >> 'UnitSets' >> _faction >> 'Armor');
} else { _return pushBack _armor; };
if (isArray(_cfg >> 'MSF_Mission_Classes' >> 'UnitSets' >> _faction >> 'Air')) then {
_return pushBack getArray (_cfg >> 'MSF_Mission_Classes' >> 'UnitSets' >> _faction >> 'Air');
} else { _return pushBack _air; };
if (isArray(_cfg >> 'MSF_Mission_Classes' >> 'UnitSets' >> _faction >> 'Turrets')) then {
_return pushBack getArray (_cfg >> 'MSF_Mission_Classes' >> 'UnitSets' >> _faction >> 'Turrets');
} else { _return pushBack _turrets; };
if (isArray(_cfg >> 'MSF_Mission_Classes' >> 'UnitSets' >> _faction >> 'Units')) then {
_return pushBack getArray (_cfg >> 'MSF_Mission_Classes' >> 'UnitSets' >> _faction >> 'Units');
} else { _return pushBack _units; };
if (isArray(_cfg >> 'MSF_Mission_Classes' >> 'UnitSets' >> _faction >> 'VehiclePatrols')) then {
_return pushBack getArray (_cfg >> 'MSF_Mission_Classes' >> 'UnitSets' >> _faction >> 'VehiclePatrols');
} else { _return pushBack _vicPatrol; };
if (count _override > 0) then {
_override params ["_groupsOvr", "_vicsOvr", "_armorOvr", "_airOvr", "_turretsOvr", "_unitsOvr", "_vicPatrolOvr"];

if (count _groupsOvr > 0) then { _return pushBack _groupsOvr; } else { _return pushBack _groups; };
if (count _vicsOvr > 0) then { _return pushBack _vicsOvr; } else { _return pushBack _vics; };
if (count _armorOvr > 0) then { _return pushBack _armorOvr; } else { _return pushBack _armor; };
if (count _airOvr > 0) then { _return pushBack _airOvr; } else { _return pushBack _air; };
if (count _turretsOvr > 0) then { _return pushBack _turretsOvr; } else { _return pushBack _turrets; };
if (count _unitsOvr > 0) then { _return pushBack _unitsOvr; } else { _return pushBack _units; };
if (count _vicPatrolOvr > 0) then { _return pushBack _vicPatrolOvr; } else { _return pushBack _vicPatrol; };
}
else
{
Expand Down
16 changes: 16 additions & 0 deletions addons/fnc/data/fn_ParseValidArray.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
params [["_object", objNull, [objNull]], ["_varName", "", [""]], ["_errDetail", "", [""]]];

try
{
private _var = _object getVariable _varName;
if (_var == "") exitWith {[]};

private _val = parseSimpleArray _var;
if (count _val == 0) then { throw "Invalid Value" };
_val;
}
catch
{
["Invalid array when parsing ""%1"" in ""%2"". Additional Details: ""%2"".", _varName, typeOf _object, _errDetail] call BIS_fnc_error;
[];
};
2 changes: 1 addition & 1 deletion addons/fnc/enemy/fn_FortifyArea.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if (_armor) then {
if (_static) then {
[_trigger, _staticNum, _side, _staticTypes, _staticProb, _logicArea] spawn {
params ["_trigger", "_staticNum", "_side", "_staticTypes", "_staticProb", "_logicArea"];
[_trigger, _staticNum, _side, _staticTypes,[], 2, _staticProb, _logicArea] call MSF_fnc_CreateAreaVehicleDefense;
[_trigger, _staticNum, _side, _staticTypes, [], 2, _staticProb, _logicArea] call MSF_fnc_CreateAreaVehicleDefense;
};
};

Expand Down
138 changes: 138 additions & 0 deletions addons/main/cfg/module/MSF_Mod_Classes.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
class MSF_Module_ClassOverride : Module_F
{
scope = 2;
displayName = "Config - Override Classes";
icon = "z\msf\addons\main\ui\msf_icon.paa";
category = "MSF_Module";
function = "";
functionPriority = 1;
isGlobal = 0;
isTriggerActivated = 0;
isDisposable = 1;
is3DEN = 0;
curatorCanAttach = 0;
canSetArea = 0;
canSetAreaShape = 0;
canSetAreaHeight = 0;

class AttributeValues
{
size3[] = { 0, 0, -1 };
isRectangle = 0;
};

class Attributes : AttributesBase
{
class Side
{
displayName = "Side";
tooltip = "Faction to override spawn classes.";
control = "Combo";
expression = "_this setVariable ['%s',_value];";
property = "MSF_Mod_CO_Side";
defaultValue = 0;
typeName = "Number";
class Values
{
class East
{
name = "East";
tooltip = "OPFOR";
value = 0;
};
class Independant
{
name = "Independant";
tooltip = "Independant";
value = 2;
};
class West
{
name = "West";
tooltip = "BLUFOR";
value = 1;
};
};
};
class Groups
{
displayName = "Group Classes";
tooltip = "Array of group classes for spawning.";
property = "MSF_Mod_CO_Groups";
control = "EditCodeMulti3";
expression = "_this setVariable ['%s',_value];";
defaultValue = "''";
};
class Vehicles
{
displayName = "Vehicle Classes";
tooltip = "Array of vehicle classes for spawning.";
property = "MSF_Mod_CO_Vehicle";
control = "EditCodeMulti3";
expression = "_this setVariable ['%s',_value];";
defaultValue = "''";
};
class ArmoredC
{
displayName = "Aromored Classes";
tooltip = "Array of armor classes for spawning.";
property = "MSF_Mod_CO_Armored";
control = "EditCodeMulti3";
expression = "_this setVariable ['%s',_value];";
defaultValue = "''";
};
class Turrets
{
displayName = "Turret Classes";
tooltip = "Array of turret classes for spawning.";
property = "MSF_Mod_CO_Turret";
control = "EditCodeMulti3";
expression = "_this setVariable ['%s',_value];";
defaultValue = "''";
};
class Air
{
displayName = "Air Classes";
tooltip = "Array of air classes for spawning.";
property = "MSF_Mod_CO_Air";
control = "EditCodeMulti3";
expression = "_this setVariable ['%s',_value];";
defaultValue = "''";
};
class Units
{
displayName = "Unit Classes";
tooltip = "Array of individual unit classes for spawning.";
property = "MSF_Mod_CO_Units";
control = "EditCodeMulti3";
expression = "_this setVariable ['%s',_value];";
defaultValue = "''";
};
class VicPatrols
{
displayName = "Patrol Vehicle Classes";
tooltip = "Array of individual vehicle classes for spawning in vehicle patrols.";
property = "MSF_Mod_CO_VicPatrols";
control = "EditCodeMulti3";
expression = "_this setVariable ['%s',_value];";
defaultValue = "''";
};
class ModuleDescription : ModuleDescription {};
};

class ModuleDescription : ModuleDescription
{
description = "Use this module to override the classes MSF uses to spawn units. One of this module per side can be used.";
sync[] = { "LocationArea_F" };

class LocationArea_F
{
description[] = {};
position = 0;
direction = 0;
optional = 0;
duplicate = 0;
synced[] = { };
};
};
};
1 change: 1 addition & 0 deletions addons/main/cfg/module/MSF_Modules.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class CfgVehicles


#include "MSF_Mod_BuildingDestroy.hpp"
#include "MSF_Mod_Classes.hpp"
#include "spawn\MSF_Mod_InfantryPatrol.hpp"
#include "spawn\MSF_Mod_VehiclePatrol.hpp"
#include "spawn\MSF_Mod_Supply.hpp"
Expand Down
22 changes: 22 additions & 0 deletions addons/main/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,26 @@ class Extended_PreInit_EventHandlers
{
init = "call compile preprocessFileLineNumbers 'z\msf\addons\main\XEH_preInit.sqf'";
};
};

//Temp Triggers for compatibility
class CfgNonAIVehicles
{
class EmptyDetector;
class MSFTriggeFortify : EmptyDetector
{
scope = 0;
};
class MSFTrigger : EmptyDetector
{
scope = 0;
};
class MSFTriggerSupply : EmptyDetector
{
scope = 0;
};
class MSFTriggerWave : EmptyDetector
{
scope = 0;
};
};
2 changes: 1 addition & 1 deletion addons/main/script_version.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define MAJOR 2
#define MINOR 5
#define PATCH 2
#define BUILD 840
#define BUILD 854
18 changes: 18 additions & 0 deletions addons/sys_ofe/cfg/placeholder/MSF_Placeholder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,22 @@ class MSF_Placeholder_Armor_U : MSF_Placeholder
editorSubcategory = "MSF_OFE_Placeholder";
editorPreview = "";
scope = 2;
};

class MSF_Placeholder_Logi_Medical: MSF_Placeholder
{
displayName = "Logistics - Medical Supplies";
editorCategory = "MSF_OFE";
editorSubcategory = "MSF_OFE_Placeholder";
editorPreview = "";
scope = 2;
};

class MSF_Placeholder_Logi_Weapons: MSF_Placeholder
{
displayName = "Logistics - Weapons Crate";
editorCategory = "MSF_OFE";
editorSubcategory = "MSF_OFE_Placeholder";
editorPreview = "";
scope = 2;
};
22 changes: 11 additions & 11 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ date
hemtt build

rm -r "$DEV_MOD_PATH"@MSF-Dev/*
rm -r ~/Arma_Dev/@MSF-Dev/*
rm -r ~/Arma_Dev/mods/@MSF-Dev/*
/bin/cp -rfp .hemttout/build/* "$DEV_MOD_PATH"@MSF-Dev/
/bin/cp -rfp .hemttout/build/* ~/Arma_Dev/@MSF-Dev/
/bin/cp -rfp .hemttout/build/* ~/Arma_Dev/mods/@MSF-Dev/

while getopts ":s" option; do
# while getopts ":s" option; do

case $option in
s)
# copy to server
ssh $ARMA_DEV_SRV 'powershell rm -recurse C:\Servers\arma3-dev\@MSF\*'
scp -r .hemttout/build/* $ARMA_DEV_SRV:/C:/Servers/arma3-dev/@MSF
exit;;
esac
done
# case $option in
# s)
# # copy to server
# ssh $ARMA_DEV_SRV 'powershell rm -recurse C:\Servers\arma3-dev\@MSF\*'
# scp -r .hemttout/build/* $ARMA_DEV_SRV:/C:/Servers/arma3-dev/@MSF
# exit;;
# esac
# done

0 comments on commit 7cb0ff0

Please sign in to comment.