Files
Clarksons_Logi_Framework/Addons/main/functions/init/fnc_initHQ.sqf
T

97 lines
2.0 KiB
Plaintext
Raw Normal View History

#include "..\..\script_component.hpp"
/*
* Author: Clarky
* Description:
* Initialises a Headquarters type base. Intended to be called as a function by internal processes, or exposed as a module in Eden and Zeus
*
* Arguments:
* 0: HQ <OBJECT>
* 1: Side <STR>
*
* Usage:
* [this, side] call CLRK_fnc_initHQ
*
*/
params ["_hq", "_side"];
if (!isServer) exitWith {};
waitUntil { !isNull _hq; };
_hq setVariable ["isHQ", true, true];
// Set object to invulnerable -- May be removed once base building is fully implemented.
[_hq, false] remoteExec ["allowDamage", 0, true];
/*
// Set BaseID
private _baseID = format [
"BASE_%1_%2",
diag_tickTime,
random[0,50,100]
];
_hq setVariable [
"baseID",
_baseID,
true
];*/
private _name = "";
switch (_side) do
{
case 1:
{
_name = GVAR(baseNames) select GVAR(bluforBaseIndex);
_hq setVariable ["baseName", _name, true];
INC(GVAR(bluforBaseIndex));
};
case 2:
{
_name = GVAR(baseNames) select GVAR(opforBaseIndex);
_hq setVariable ["baseName", _name, true];
INC(GVAR(opforBaseIndex));
};
case 3:
{
_name = GVAR(baseNames) select GVAR(independentBaseIndex);
_hq setVariable ["baseName", _name, true];
INC(GVAR(independentBaseIndex));
};
case 4:
{
_name = GVAR(baseNames) select GVAR(civilianBaseIndex);
_hq setVariable ["baseName", _name, true];
INC(GVAR(civilianBaseIndex));
};
};
private _baseMarker = createMarker [format ["%1 [HQ]", _name], _hq];
_baseMarker setMarkerShapeLocal "ICON";
_baseMarker setMarkerTypeLocal "mil_dot";
_baseMarker setMarkerText format ["%1 [HQ]", _name];
// TODO - Set colour based on side. Also figure out better icon.
_hq setVariable ["baseMarker", _baseMarker, true];
_hq setVariable [
"baseDetails",
createHashMapFromArray [
//["id", _baseID],
["hq", _hq],
["buildings", []],
["supplyDepots", []],
["oreDepots", []],
["side", _side]
],
true
];
// Initialise base HQ interactions for all clients
[_hq] remoteExecCall [
QFUNC(initHQInteractions),
0,
true
];