Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion src/addons/ares_zeusExtensions/cfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Ares // This bit will be prefixed when actually calling the function (e.g.
class ShowZeusMessage;
class StringContains;
class TeleportPlayers;
class TransferGroupsToServer;
class WaitForZeus;
class ZenOccupyHouse;
};
Expand All @@ -58,7 +59,7 @@ class Ares // This bit will be prefixed when actually calling the function (e.g.
file = "\ares_zeusExtensions\modules";
class Empty;
};

#include "cfgFunctionsBehaviour.hpp"
#include "cfgFunctionsEquipment.hpp"
#include "cfgFunctionsReinforcements.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
Transfers ownership for all groups to the server

Parameters:
0: Specific group or objNull for all groups (default objNull)
1: Bool - show debug output (optional, default false)
*/
params[["_group", grpNull, [grpNull]], ["_debugOn", false, [false]]];

// Require this function
if (isNil "Ares_ChangeOwnerToServerFunction") then
{
Ares_ChangeOwnerToServerFunction =
{
params[["_groups", grpNull, [grpNull]], ["_debugOn", false, [false]]];

if (isNull _groups) then
{
_groups = allGroups;
}
else
{
_groups = [_groups]; // Make an array of this one
};

// Loop all groups
{
// Check if group is owned by the server or not
if ((groupOwner _x) != 2) then
{
_playerInGroup = false;
{
if (isPlayer _x) exitWith { _playerInGroup = true; };
} forEach (units _x);

// Transfer group if no players are part of the group
if (!_playerInGroup) then
{
_x setGroupOwner 2;
if (_debugOn) then
{
_debugTxt = format ["[ARES] Changing owner to server for %1", _x];
if (isDedicated) then
{
diag_log _debugTxt;
}
else
{
systemChat _debugTxt;
};
};
};
};
} foreach _groups;
};
publicVariable "Ares_ChangeOwnerToServerFunction";
};

[[_group, _debugOn], "Ares_ChangeOwnerToServerFunction", false] call BIS_fnc_MP;
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
"Util",
"Transfer to server",
{
private ["_unitUnderCursor"];
_unitUnderCursor = _this select 1;
if (not isNull _unitUnderCursor) then
{
private ["_playerInGroup"];
_playerInGroup = false;
{
if (isPlayer _x) exitWith { _playerInGroup = true; };
} forEach (units (group _unitUnderCursor));
if (not _playerInGroup) then
{
[group _unitUnderCursor] call Ares_fnc_TransferGroupsToServer;
["Group will be transfered to the server."] call Ares_fnc_ShowZeusMessage;
}
else
{
["Cannot transfer a group with player units."] call Ares_fnc_ShowZeusMessage;
};
}
else
{
[] call Ares_fnc_TransferGroupsToServer;
["All groups will be transfered to the server"] call Ares_fnc_ShowZeusMessage;
};
}
] call Ares_fnc_RegisterCustomModule;
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ _scripts = [
"Util_ExecuteCodeServer",
"Util_MakeZeusInvisible",
"Util_MakeZeusVisible",
"Util_RemoveAllActions"
"Util_RemoveAllActions",
"Util_TransferGroupToServer"
];
{
call compile preprocessFileLineNumbers ("\ares_zeusExtensions\scripts\" + _x + ".sqf");
Expand All @@ -38,4 +39,3 @@ if (isNil "Ares_FireArtilleryFunction") then
};
publicVariable "Ares_FireArtilleryFunction";
};