Skip to content

Commit

Permalink
Merge pull request #29 from MisterHLunaticwraith/DevBranch
Browse files Browse the repository at this point in the history
v.1.17.5
  • Loading branch information
MisterHLunaticwraith authored Sep 22, 2019
2 parents 7f132ed + e44cb14 commit 9bd6798
Show file tree
Hide file tree
Showing 22 changed files with 381 additions and 6 deletions.
31 changes: 31 additions & 0 deletions .github/changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
Changelog:
MRH Milsim Tools version : v.1.17.5
- Core :
* Added setting to disable loading of personal loadouts in Ace Arsenal
* Added attributes checkbox to allow a full zeus for unit (no need to add the module etc.)
* Added utility function to generate ace default loadouts:
>Function name:MRH_fnc_MilsimTools_Core_generateAceDefaultLoadOuts
Description: Generates a ready to paste file to run from mission or addon's init that will set Ace default loadouts for the ace arsenal tab.
HOW TO: create your loadouts on different units placed in the editor, give each unit a variable name that corresponds to the loadout (it will be the loadout name). When you're done, run the function. Paste the results to your mission's init.sqf (or any other sqf filled executed from init.sqf).

The result file also contains a list of the objetcs to allow for the arsenal box if you want a limited arsenal as well as a how to. (see comments at the bottom of the generated file)

Alternatively for sexier loadout names you can set them in the roledescription field of the unit and call the function with true as a parameter (but it will only grab playable units)
Return value: file to paste from clipboard
Public: Yes
Parameters:
0- <BOOL> (optional) to use roledescription instead of variable name
Example(s):
call MRH_fnc_MilsimTools_Core_generateAceDefaultLoadOuts; //will use allunits and variable names
or
true call MRH_fnc_MilsimTools_Core_generateAceDefaultLoadOuts; // will grab only playable units and use role descriptions

- Zeus modules
* Added module to grant any player zeus powers

- Misc Items
* Added Magic Whellie bin:
>Anything placed in the bin wheel be deleted (when the bin's inventory tab is closed) useful if your players are the type to leave stuff everywher, the been can be carried and dragged with ace, have someone on cleanup duty!
/////////////////////////////////
Changelog:
MRH Milsim Tools version : v.1.17.4

- Heli Taxi revamped:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
Function name:MRH_fnc_MilsimTools_Core_cbaEventHandlersPlayer
Author: Mr H.
Description: Fired at player init, adds some cba handlers
Return value: none
Public: No
Parameters:none
Example(s):
call MRH_fnc_MilsimTools_Core_cbaEventHandlersPlayer;
*/
#include "MRH_C_Path.hpp"
["MRH_EventsCuratorAssigned",
{
params ["_unit"];
[_unit]FUNC(isCurator);
["MRH_Zeus_Notif",["A Zeus has granted you Zeus powers,use them wisely!"]] call BIS_fnc_showNotification;
}
] call CBA_fnc_addEventHandler;

["MRH_Events_curatorObjectCreated",
{
params ["_zeusPlayer","_zeusModule"];
_toTrace = format ["Player %1 has received zeus powers and been assigned module %2",_zeusPlayer,_zeusModule];
TRACE(_toTrace);
}
] call CBA_fnc_addEventHandler;

["ace_arsenal_loadoutsDisplayOpened",
{
params ["_display"];
if (serverCommandAvailable "#kick") exitWith {};
_hide= ["MRH_MilsimTools_hideAceMyLoadOuts"] call cba_settings_fnc_get;
if !(_hide) exitWith {};
(_display displayCtrl 401) ctrlShow false;
(_display displayCtrl 402) ctrlShow false;
[_display] spawn {
params ["_display"];
sleep 0.1; //needed because the change tab func is called to set to default after the EH is fired
[_display,(_display displayCtrl 404)] call ace_arsenal_fnc_loadoutsChangeTab;
};
}
] call CBA_fnc_addEventHandler;

TRACE("Player CBA Even tHandlers Added");
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
Function name:MRH_fnc_MilsimTools_Core_generateAceDefaultLoadOuts
Author: Mr H.
Description: Generates a ready to paste file to run from mission or addon's init that will set Ace default loadouts for the ace arsenal tab.
HOW TO: create your loadouts on different units placed in the editor, give each unit a variable name that corresponds to the loadout (it will be the loadout name). When you're done, run the function. Paste the results to your mission's init.sqf (or any other sqf filled executed from init.sqf).
The result file also contains a list of the objetcs to allow for the arsenal box if you want a limited arsenal as well as a how to. (see comments at the bottom of the generated file)
Alternatively for sexier loadout names you can set them in the roledescription field of the unit and call the function with true as a parameter (but it will only grab playable units)
Return value: file to paste from clipboard
Public: Yes
Parameters:
0- <BOOL> (optional) to use roledescription instead of variable name
Example(s):
call MRH_fnc_MilsimTools_Core_generateAceDefaultLoadOuts; //will use allunits and variable names
or
true call MRH_fnc_MilsimTools_Core_generateAceDefaultLoadOuts; // will grab only playable units and use role descriptions
*/
#include "MRH_C_Path.hpp"
params [["_useRoleDescription",false]];
_allUnits = allUnits;
if (_useRoleDescription) then {_allUnits = playableUnits};

_allLoadOuts =["[",endl,endl];
_arsenalItemsArray = [];

//---generates the objects for the arsenalVariable (Borrowed from ace 3 doc)
private _items = _allUnits apply {getUnitLoadout _x};
_items = str _items splitString "[]," joinString ",";
_items = parseSimpleArray ("[" + _items + "]");
_items = _items arrayIntersect _items select {_x isEqualType "" && {_x != ""}};

_getName = {
params ["_unit","_useRoleDescription"];
_roleDescription = roleDescription _unit;
if ((roleDescription _unit) isEqualTo "") then {_roleDescription = getText(configFile >> "CfgVehicles" >> typeOf(_unit) >> "displayName")};
[str _unit,_roleDescription] select _useRoleDescription
};

{
private _name = [_x,_useRoleDescription] call _getName;
private _toString =[endl,endl,"//-----",_name,"-----//",endl,"[","""",_name,"""",",",getUnitLoadOut _x,"]"];
_toString append ([[",",endl,endl],[endl,endl]] select (_forEachIndex isEqualTo ((count _allUnits)-1)));
_allLoadOuts append _toSTring;
}forEach _allunits;
_allLoadOuts pushBackUnique "];";

_info1 = "/*";
_info2 = "//-----NOTE-------//";
_info3 = "If you want to create an arsenal that contains only items from the above loadouts paste the following code in its init:";
_info4 ="this spawn {waitUntil{!isNil 'ACE_ArsenalAllowedItems'};[_this,ACE_ArsenalAllowedItems,true] call ace_arsenal_fnc_initBox};";
_info5 ="*/";
_script = ["//-----------Load Outs-----------//",endl,endl,"_allLoadOuts = "];
_footer = [endl,endl,"//----------LoadOuts End----------//",endl,endl,"//-------add loadouts to ace default------",endl,"{[_x select 0,_x select 1] call ace_arsenal_fnc_addDefaultLoadout}forEach _allLoadOuts;",endl,endl,"ACE_ArsenalAllowedItems =",_items,";",endl,endl,_info1,endl,_info2,endl,_info3,endl,_info4,endl,_info5];

_script append _allLoadOuts;
_script append _footer;
copyToClipboard (_script joinstring "");
hint "export complete, paste results to file";
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Function name:MRH_fnc_MilsimTools_Core_isCurator
Author: Mr H.
Description: Creates and assigns a player a zeus curator. Must be executed on player's machine
Return value: None
Public: No
Parameters:
0- <OBJECT> player object that will receive zeus powers
Example(s):
[player]call MRH_fnc_MilsimTools_Core_isCurator;
*/
#include "MRH_C_Path.hpp"
if (is3DEN) exitWith{};
_this spawn {
params ["_unit"];
waitUntil {(time>5) && (player == _unit)};
[[_unit],MRH_fnc_MilsimTools_Core_serverCreateCurator] RemoteExec ["Call",2];
_toTrace = format ["isCurator function called for %1",_unit];
TRACE(_toTrace);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
Function name:MRH_fnc_MilsimTools_Core_serverCreateCurator
Author: Mr H.
Description: Creates a new curator module for a player unit, if it already exists it reassigns the module to the unit, curator object gets a variablename based on player's variable name in format MRH_Player_Zeus_Module_ + player variable eg. zeus module for player somePlayer will be called MRH_Player_Zeus_Module_somePlayer
Return value: None
Public: No
Parameters:
0- <OBJECT> player object
Example(s):
[somePlayer]call MRH_fnc_MilsimTools_Core_serverCreateCurator;
*/
#include "MRH_C_Path.hpp"
if !(isServer) ExitWith {};
params ["_zeusPlayer"];
_name =("MRH_Player_Zeus_Module" +"_" + (str _zeusPlayer));
_PLAYERSLOT_Zeus_Module = missionNameSpace getVariable [_name,objNull];
if !(isNull _PLAYERSLOT_Zeus_Module) exitWith {_zeusPlayer assignCurator _PLAYERSLOT_Zeus_Module;};

_MRH_Zeus_logicSide = missionNamespace getVariable ["MRH_Zeus_SideLogic",objNull];
_MRH_Zeus_logicGrp = missionNamespace getVariable ["MRH_Zeus_logicGrp",objNull];

if (isNull _MRH_Zeus_LogicGrp) then {
_MRH_Zeus_logicSide = createCenter sideLogic;
missionNamespace setVariable ["MRH_Zeus_SideLogic",_MRH_Zeus_logicSide,true];
_MRH_Zeus_logicGrp = createGroup _MRH_Zeus_logicSide;
missionNamespace setVariable ["MRH_Zeus_logicGrp",_MRH_Zeus_logicGrp,true];
};



_PLAYERSLOT_Zeus_Module = _MRH_Zeus_logicGrp createUnit ["ModuleCurator_F",[2,0,0] , [], 0, ""];
_PLAYERSLOT_Zeus_Module setVariable ["showNotification", false, true];
_PLAYERSLOT_Zeus_Module setVariable ["birdType", "", true];
_PLAYERSLOT_Zeus_Module setVariable ["Owner", (str _zeusPlayer), true];
_PLAYERSLOT_Zeus_Module setVariable ["Addons", 3, true];
_PLAYERSLOT_Zeus_Module setVariable ["Forced", 0, true];
_PLAYERSLOT_Zeus_Module setVariable ["name", "Zeus joueur", true];
missionNamespace setVariable ["MRH_Player_Zeus_Module" +"_" + (str _zeusPlayer),_PLAYERSLOT_Zeus_Module,true];
_PLAYERSLOT_Zeus_Module setVehicleVarName ("MRH_Player_Zeus_Module" +"_" + (str _zeusPlayer));
_PLAYERSLOT_Zeus_Module setVariable [ "bis_fnc_initModules_disableAutoActivation", false, true ];
_PLAYERSLOT_Zeus_Module call BIS_fnc_objectVar;





_PLAYERSLOT_Zeus_Module addCuratorEditableObjects [(allMissionObjects "All"),true];
_PLAYERSLOT_Zeus_Module addEventHandler ["CuratorObjectPlaced",
{
params ["_curator", "_entity"];
{
_x addCuratorEditableObjects [[_entity],true];
} forEach allCurators;

}];
_zeusPlayer assignCurator _PLAYERSLOT_Zeus_Module;
[[_zeusPlayer],
{
params ["_zeusPlayer"];
_zeusPlayer addEventHandler ["Respawn",{params ["_unit", "_corpse"]; [_unit] call MRH_fnc_isCurator}];
}
]RemoteExec ["Call",_zeusPlayer];
_toTrace = format ["Zeus module %1 Created and assigner to %1",_zeusPlayer,_PLAYERSLOT_Zeus_Module];
TRACE(_toTrace);
["MRH_Events_curatorObjectCreated", [_zeusPlayer,_PLAYERSLOT_Zeus_Module]] call CBA_fnc_globalEvent;
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{
FUNC(InitPlayerLocal);
FUNC(initMRHPlayer);
FUNC(cbaEventHandlersPlayer);

}] call CBA_fnc_waitUntilAndExecute;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ _script Script to execute when setting is changed. (optional) <CODE>
["MRH_MilsimTools_Delete_disconnected_body", "CHECKBOX", [localize "STR_MRH_MS_CBA_CORE_REMOVEDISCONNECTEDBODYPRETTY",localize "STR_MRH_MS_CBA_CORE_REMOVEDISCONNECTEDBODYTOOLTIP"], "MRH_MilsimTools - Core settings",true,1] call cba_settings_fnc_init;
//setting to apply medic patch on ace3 medics
["MRH_MilsimTools_Core_ApplyMedicPatch", "CHECKBOX", [localize "STR_MRH_CBA_ApplyMedicPatchSetting",localize "STR_MRH_CBA_ApplyMedicPatchSettingToolTip"], "MRH_MilsimTools - Core settings",true,1] call cba_settings_fnc_init;
["MRH_MilsimTools_hideAceMyLoadOuts", "CHECKBOX", [localize "STR_MRH_CBA_DISABLEACELOADOUTS",localize "STR_MRH_CBA_DISABLEACELOADOUTSToolTip"],"MRH_MilsimTools - Core settings",false,1] call cba_settings_fnc_init;
//===Below are settings for the jip menu
//allow jip menu on startup
["MRH_MilsimTools_Jip_MenuAllow", "CHECKBOX", [localize "STR_MRH_MS_CBA_JIP_ALLOWPRETTY",localize "STR_MRH_MS_CBA_JIP_ALLOWTOOLTIP"], "MRH_MilsimTools - JIP settings",true,1] call cba_settings_fnc_init;
Expand Down
8 changes: 8 additions & 0 deletions Addons/MRHMilsimTools/Functions/cfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ class MRH // Defines the "owner"
{};
class MilsimTools_Core_lockNonCargo
{};
class MilsimTools_Core_generateAceDefaultLoadOuts
{};
class MilsimTools_Core_isCurator
{};
class MilsimTools_Core_serverCreateCurator
{};
class MilsimTools_Core_cbaEventHandlersPlayer
{};
/*
class MilsimTools_Core_
{};
Expand Down
18 changes: 17 additions & 1 deletion Addons/MRHMilsimTools/cfghpp/cfg3DEN.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,23 @@ class Cfg3DEN {
class mrhtools_attributes {
displayName = $STR_MRH_MISC_3DENattributesCat;
collapsed = 1;
class Attributes {};
class Attributes
{
class MRH_isZeus
{

displayName = $STR_MRH_MISC_isZeus3DENATT;
tooltip = $STR_MRH_MISC_isZeus3DENATTToolTip;
property = "mrh_isZeus";
control = "CheckboxState";
expression = "[_this] call MRH_fnc_MilsimTools_Core_isCurator;";
defaultValue = false;
unique = 0;
validate = "none";
condition = "objectControllable";
typeName = "BOOL";
};
};
};
};
};
Expand Down
6 changes: 3 additions & 3 deletions Addons/MRHMilsimTools/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ class CfgPatches {
weapons[] = {}; //
requiredVersion = 0.1; //
requiredAddons[] = {"cba_main"};
version = 1.17.4;
versionStr = "1.17.4";
versionAr[] = {1,17,4};
version = 1.17.5;
versionStr = "1.17.5";
versionAr[] = {1,17,5};
versionDesc = "MRH Milsim Tools";
versionAct = "call compile preProcessFileLineNumbers '\MRHMilSimTools\about.sqf'";
author = "Mr H.";
Expand Down
20 changes: 20 additions & 0 deletions Addons/MRHMilsimTools/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,26 @@
<English>Medic Shoulder Patch</English>
<French>Ecusson d'AuxSan</French>
</Key>
<Key ID="STR_MRH_MISC_isZeus3DENATT">
<Original>Assign a Zeus to this unit</Original>
<English>Assign a Zeus to this unit</English>
<French>Assigner un Zeus à cette unité</French>
</Key>
<Key ID="STR_MRH_MISC_isZeus3DENATTToolTip">
<Original>A Zeus module with full powers will be created and assigned to this unit</Original>
<English>A Zeus module with full powers will be created and assigned to this unit</English>
<French>Un module Zeus avec tous les pouvoirs sera créé et assigné à cette unité</French>
</Key>
<Key ID="STR_MRH_CBA_DISABLEACELOADOUTS">
<Original>Ace Arsenal: disable user loadouts</Original>
<English>Ace Arsenal: disable user loadouts</English>
<French>Arsenal Ace : désactiver le chargement des loadouts de l'utilisateur</French>
</Key>
<Key ID="STR_MRH_CBA_DISABLEACELOADOUTSToolTip">
<Original>If this setting is enabled, players will not be able to load/save their personnal loadouts. Can be changed at any time during the game. Doesn't affect logged in admins</Original>
<English>If this setting is enabled, players will not be able to load/save their personnal loadouts. Can be changed at any time during the game. Doesn't affect logged in admins</English>
<French>Si ce réglage est activé les joueurs ne pourront pas charger/sauver de loadouts personnels. Peut être changé en cours de partie, n'affecte pas les admins loggués.</French>
</Key>
<Key ID="STR_MRH_MISC_">
<Original></Original>
<English></English>
Expand Down
2 changes: 2 additions & 0 deletions Addons/MRHMiscItems/Functions/cfgfunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class MRH // Defines the "owner"
{};
class MilsimTools_MiscItems_LaserDesignatorUnPack
{};
class MilsimTools_MiscItems_binHandlers
{};
};

};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Function name:MRH_fnc_MilsimTools_MiscItems_
Author: Mr H.
Description:
Return value:
Public:
Parameters:
Example(s):
[cursortarget] call MRH_fnc_MilsimTools_MiscItems_binHandlers;
*/
#include "MRH_C_Path.hpp"
params ["_wheeliebin"];
if (is3DEN) exitWith {};
_wheeliebin addEventHandler ["ContainerOpened", {
params ["_container", "_unit"];
clearItemCargoGlobal _container;
clearMagazineCargoGlobal _container;
clearWeaponCargoGlobal _container;
clearBackpackCargoGlobal _container;
}];

_wheeliebin addEventHandler ["ContainerClosed", {
params ["_container", "_unit"];
clearItemCargoGlobal _container;
clearMagazineCargoGlobal _container;
clearWeaponCargoGlobal _container;
clearBackpackCargoGlobal _container;
}];
_toTrace = format ["Clear cargo handlers added to %1",_wheeliebin];
TRACE(_toTrace)
13 changes: 13 additions & 0 deletions Addons/MRHMiscItems/cfgvehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class Man;
class TransportWeapons{};
class TransportMagazines{};
class TransportItems{};
class TransportBackpacks{};
};

class MRH_emptySupplyBox : B_supplyCrate_F
Expand All @@ -98,6 +99,18 @@ class MRH_emptySupplyBox : B_supplyCrate_F
ace_cargo_size = 2;
ace_cargo_canLoad = 1;
};
class MRH_TrashBin : MRH_emptyBox
{
displayName = $STR_MRH_MRHMiscItems_wheelieBinName;
model = "\A3\Structures_F_Heli\Civ\Garbage\WheelieBin_01_F.p3d";
editorPreview = "\A3\EditorPreviews_F\Data\CfgVehicles\Land_WheelieBin_01_F.jpg";
ace_dragging_carryDirection = 180;
ace_dragging_carryPosition[] = {0,1,0.1};
ace_dragging_dragDirection = 180;
class EventHandlers {
init = "_this call MRH_fnc_MilsimTools_MiscItems_binHandlers;";
};
};

class MRH_AcexFoodSuppliesCrate : CargoNet_01_box_F
{
Expand Down
Loading

0 comments on commit 9bd6798

Please sign in to comment.