-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from MisterHLunaticwraith/DevBranch
v.1.17.5
- Loading branch information
Showing
22 changed files
with
381 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
Addons/MRHMilsimTools/Functions/CoreFunctions/fn_MilsimTools_Core_cbaEventHandlersPlayer.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
59 changes: 59 additions & 0 deletions
59
...MRHMilsimTools/Functions/CoreFunctions/fn_MilsimTools_Core_generateAceDefaultLoadOuts.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; |
21 changes: 21 additions & 0 deletions
21
Addons/MRHMilsimTools/Functions/CoreFunctions/fn_MilsimTools_Core_isCurator.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; |
66 changes: 66 additions & 0 deletions
66
Addons/MRHMilsimTools/Functions/CoreFunctions/fn_MilsimTools_Core_serverCreateCurator.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
Addons/MRHMiscItems/Functions/fn_MilsimTools_MiscItems_binHandlers.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.