96 lines
1.9 KiB
Plaintext
96 lines
1.9 KiB
Plaintext
/*
|
|||
|
|
* 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)
|
||
|
|
{
|
||
|
|
case west:
|
||
|
|
{
|
||
|
|
_name = GVAR(baseNames) select GVAR(bluforBaseIndex);
|
||
|
|
_hq setVariable ["baseName", _name, true];
|
||
|
|
INC(GVAR(bluforBaseIndex));
|
||
|
|
}
|
||
|
|
case east:
|
||
|
|
{
|
||
|
|
_name = GVAR(baseNames) select GVAR(opforBaseIndex);
|
||
|
|
_hq setVariable ["baseName", _name, true];
|
||
|
|
INC(GVAR(opforBaseIndex));
|
||
|
|
}
|
||
|
|
case independent:
|
||
|
|
{
|
||
|
|
_name = GVAR(baseNames) select GVAR(independentBaseIndex);
|
||
|
|
_hq setVariable ["baseName", _name, true];
|
||
|
|
INC(GVAR(independentBaseIndex));
|
||
|
|
}
|
||
|
|
case civilian:
|
||
|
|
{
|
||
|
|
_name = GVAR(baseNames) select GVAR(civilianBaseIndex);
|
||
|
|
_hq setVariable ["baseName", _name, true];
|
||
|
|
INC(GVAR(civilianBaseIndex));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private _baseMarker = createMarker [format ["%1 [HQ]", _name], _hq];
|
||
|
|
_baseMarker setMarkerShape "ICON";
|
||
|
|
_baseMarker setMarkerType "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
|
||
|
|
];
|