2015-12-07 16:24:52 +00:00
|
|
|
/*
|
|
|
|
Author: Aaron Clark - EpochMod.com
|
2015-09-14 20:55:36 +00:00
|
|
|
|
2015-12-07 16:24:52 +00:00
|
|
|
Contributors: Raimonds Virtoss
|
|
|
|
|
|
|
|
Description:
|
|
|
|
Epoch build select target
|
|
|
|
|
|
|
|
Licence:
|
|
|
|
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
|
|
|
|
|
|
|
Github:
|
2016-06-13 16:54:19 +00:00
|
|
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/building/EPOCH_fnc_SelectTargetBuild.sqf
|
2015-12-07 16:24:52 +00:00
|
|
|
|
|
|
|
Example:
|
|
|
|
cursorTarget call EPOCH_fnc_SelectTargetBuild;
|
2015-09-14 20:55:36 +00:00
|
|
|
|
2015-12-07 16:24:52 +00:00
|
|
|
Parameter(s):
|
|
|
|
_this select 0: OBJECT - Base building object
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
BOOL
|
|
|
|
*/
|
2016-09-01 00:29:08 +00:00
|
|
|
//[[[cog import generate_private_arrays ]]]
|
|
|
|
private ["_stability","_targeter"];
|
|
|
|
//[[[end]]]
|
2015-12-07 16:24:52 +00:00
|
|
|
|
|
|
|
if !(isNil "EPOCH_simulSwap_Lock") exitWith{ false };
|
|
|
|
if !(isNull EPOCH_Target) exitWith{ false };
|
2016-06-18 01:22:29 +00:00
|
|
|
if (EPOCH_playerEnergy <= 0) exitWith{ ["Need energy", 5] call Epoch_message; false };
|
2015-09-14 20:55:36 +00:00
|
|
|
|
2016-04-08 20:21:46 +00:00
|
|
|
params [["_object",objNull]];
|
2015-09-14 20:55:36 +00:00
|
|
|
|
|
|
|
EPOCH_buildOption = 2;
|
|
|
|
|
|
|
|
if (isNull _object) exitWith{ false };
|
|
|
|
if ((player distance _object) > 9) exitWith { false };
|
|
|
|
if (!(_object isKindOf "ThingX") && !(_object isKindOf "Constructions_static_F") && !(_object isKindOf "Constructions_foundation_F")) exitWith{ false };
|
|
|
|
|
|
|
|
// check if another player has target
|
|
|
|
_targeter = _object getVariable["last_targeter", objNull];
|
|
|
|
|
|
|
|
if (!isNull _targeter && _targeter != player && (player distance _object > _targeter distance _object)) exitWith{ EPOCH_stabilityTarget = objNull; false };
|
|
|
|
|
|
|
|
_stability = _object getVariable["stability", 100];
|
|
|
|
if (_stability > 0) exitWith{
|
|
|
|
if (isNull EPOCH_stabilityTarget) then {
|
|
|
|
_object setVariable["last_targeter", player, true];
|
|
|
|
EPOCH_stabilityTarget = _object;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
if (_object isKindOf "Infostand_base_F") then {
|
2016-04-08 20:21:46 +00:00
|
|
|
EPOCH_SURVEY pushBackUnique _object;
|
2015-09-14 20:55:36 +00:00
|
|
|
};
|
|
|
|
*/
|
|
|
|
|
|
|
|
[_object] spawn EPOCH_simulSwap;
|
|
|
|
|
|
|
|
true
|