Epoch/Sources/epoch_code/compile/building/EPOCH_fnc_SelectTarget.sqf
2015-10-02 09:27:56 -05:00

33 lines
965 B
Plaintext

private ["_dt","_object","_objType","_dialog","_handled","_config","_upgrade","_remove"];
if !(isNil "EPOCH_simulSwap_Lock") exitWith{ false };
if !(isNull EPOCH_Target) exitWith{ false };
if (EPOCH_playerEnergy <= 0) exitWith{ _dt = ["<t size='0.8' shadow='0' color='#99ffffff'>Need energy</t>", 0, 1, 5, 2, 0, 1] spawn bis_fnc_dynamictext; false };
_object = _this;
if (isNull _object) exitWith{ false };
if ((player distance _object) > 9) exitWith { false };
_objType = typeOf _object;
_dialog = "InteractBaseBuilding";
_handled = createdialog _dialog;
_config = 'CfgBaseBuilding' call EPOCH_returnConfig;
_upgrade = getArray(_config >> _objType >> "upgradeBuilding");
if (_upgrade isEqualTo[]) then{
ctrlEnable[2400, false];
};
_remove = getArray(_config >> _objType >> "removeParts");
if (_remove isEqualTo[]) then{
ctrlEnable[2401, false];
};
// disable Move option if not SIM
if !(_object isKindOf "ThingX") then{
ctrlEnable[2402, false];
};
true