Epoch/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf

446 lines
16 KiB
Plaintext
Raw Normal View History

2015-12-15 18:46:09 +00:00
/*
Author: Aaron Clark - EpochMod.com
Contributors:
Description:
Base building base building with ghost preview.
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_simulSwap.sqf
2015-12-15 18:46:09 +00:00
Example:
2016-04-25 20:41:14 +00:00
[_object,_item] spawn EPOCH_staticMove;
2015-12-15 18:46:09 +00:00
Parameter(s):
_this select 0: OBJECT - Base building object
_this select 1: STRING - Item to consume on build finalization
Returns:
NOTHING
*/
2016-09-01 00:40:18 +00:00
//[[[cog import generate_private_arrays ]]]
2017-10-12 12:04:29 +00:00
private ["_AnchorPos","_EPOCH_1","_EPOCH_2","_MoveObject","_Snapdirection","_allowedSnapObjects","_allowedSnapPoints","_arr_snapPoints","_baselineSnapPos","_cfgBaseBuilding","_class","_currentOffSet","_currentPos","_currentTarget","_currentTargetAttachedTo","_dir2","_direction","_distance","_energyCost","_helper","_ins","_isSnap","_lastCheckTime","_maxHeight","_maxSnapDistance","_nearestObject","_nearestObjects","_newDir","_newDirAndUp","_numberOfContacts","_objSlot","_objType","_offSet","_offsetZPos","_pOffset","_playerEnergy","_playerEnergyKeyFinal","_pos1_snap","_pos2","_pos2ATL","_pos2_snap","_pos_snapObj","_rejectMove","_simulClass","_snapChecks","_snapConfig","_snapDistance","_snapMemoryPoint","_snapPointsPara","_snapPointsPerp","_snapPos","_snapPos1","_snapPosition","_snapType","_snapped","_stabilityCheck","_staticClass","_tempClass","_tiltFB","_tiltLR","_vectorDir","_vectorUp","_worldspace"];
2016-09-01 00:40:18 +00:00
//[[[end]]]
2015-09-14 20:55:36 +00:00
if !(isNil "EPOCH_simulSwap_Lock") exitWith{};
2016-09-01 00:40:18 +00:00
Release 0.3.8 (#502) * first build for 0.3.8 * 0.3.8.0190 * 0.3.8.0202 * 0.3.8.0213 * 0.3.7.0214 * 0.3.8.0222 * 0.3.8.0246 * 0.3.8.0247 fixed typo * 0.3.8.0249 more fixes for server compiler * 0.3.8.0256 * add build number and simple batch file for packing * match build number with internal * add build numbers to server pbo's and mission files also reworked build script for more options * 0.3.8.0261 * 0.3.8.0261 * 0.3.8.0283 * 0.3.8.0284 * changelog * 0.3.8.0307 * 0.3.8.0311 * remove old BEC plugin * update redis-server.exe to latest build and full config * 0.3.8.0314 * 0.3.8.0315 * inverse logic This should correctly prevent spawning these units nearby jammer or protection zones * use pushbackUnique here * optimized loot function by using selectRandom instead of slower sqf logic * 0.3.8.0316 * make use of new getDir functionality instead of BIS fnc * add lower disconnect value to server.cfg * use new getpos functionality * 0.3.8.0317 * 0.3.8.0319 * 0.3.8.0327 * 0.3.8.0338 changelog update tba * changelog * 0.3.8.0341 * BE update * 0.3.8.0353 * changelog * removed duplicates * 0.3.8.0355 fixed error in getIDC * 0.3.8.0356 revert to BIS_fnc_param as params threw errors * 0.3.8.0357 fixes for #496 #497 * 0.3.8.0359 fixed #497 fixed #496 * 0.3.8.0365 * 0.3.8.0371 * 0.3.8.0373 * 0.3.8.0379 * 0.3.8.0381 * 0.3.8.0386 * 0.3.8.0393 * 0.3.8.0395 * 0.3.8.0396 * 0.3.8.0397 * 0.3.8.0406 * 0.3.8.0409 * 0.3.8.0410 loot balance suppress error in spawnloot make near object check based on building size * 0.3.8.0412 * 0.3.8.0414 removed classes with scope 0 test remove loot trash on gear for #498 fixed #501 * 0.3.8.0415 * same
2016-04-08 20:21:46 +00:00
params [
["_object",objNull],
["_item",""]
];
2015-12-15 18:46:09 +00:00
// exit if object is nulll
2015-09-14 20:55:36 +00:00
if (isNull _object) exitWith{ EPOCH_target = objNull; };
2015-12-15 18:46:09 +00:00
// exit if item is not given
if (_item == "") exitWith{ EPOCH_target = objNull; };
2015-09-14 20:55:36 +00:00
2017-10-03 14:04:30 +00:00
_playerEnergyKeyFinal = "EPOCH_playerEnergy";
if !(isNil "_playerEnergyKey") then {_playerEnergyKeyFinal = _playerEnergyKey};
_playerEnergy = missionNamespace getVariable [_playerEnergyKeyFinal,[]];
if (_playerEnergy <= 0) exitWith{
2016-06-18 01:22:29 +00:00
["Need Energy", 5] call Epoch_message;
2015-09-14 20:55:36 +00:00
};
2016-04-12 13:48:26 +00:00
// Remove object if not allowed
if !(_object call EPOCH_isBuildAllowed) exitWith{ deleteVehicle _object };
2015-09-14 20:55:36 +00:00
EPOCH_simulSwap_Lock = true;
2015-09-14 20:55:36 +00:00
_objType = typeOf _object;
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
_class = getText(_cfgBaseBuilding >> _objType >> "GhostPreview");
_EnablePhysicsOnBuild = ["CfgEpochClient", "EnablePhysicsOnBuild", true] call EPOCH_fnc_returnConfigEntryV2;
if (_class != "") then {
_energyCost = getNumber(_cfgBaseBuilding >> _objType >> "energyCost");
_maxHeight = getNumber(_cfgBaseBuilding >> _objType >> "maxHeight");
_simulClass = getText(_cfgBaseBuilding >> _objType >> "simulClass");
2017-10-12 12:04:29 +00:00
_staticClass = getText(_cfgBaseBuilding >> _objType >> "staticClass");
_maxSnapDistance = getNumber (_cfgBaseBuilding >> _objType >> "maxSnapDistance");
2017-10-12 12:04:29 +00:00
_snapChecks = getArray(("CfgSnapChecks" call EPOCH_returnConfig) >> _staticClass >> "nails");
_allowedSnapPoints = getArray(_cfgBaseBuilding >> _class >> "allowedSnapPoints");
_allowedSnapObjects = getArray(_cfgBaseBuilding >> _class >> "allowedSnapObjects");
2015-09-14 20:55:36 +00:00
if (_energyCost == 0) then {_energyCost = 0.1;};
if (_maxSnapDistance == 0) then {_maxSnapDistance = 1;};
_lastCheckTime = diag_tickTime;
_stabilityCheck = false;
// force sim check if object has sim class and default max height to 9m if not already specified
if (_simulClass != "") then {
_stabilityCheck = true;
if (_maxHeight == 0) then {
_maxHeight = 500;
};
2015-09-14 20:55:36 +00:00
};
if !(EPOCH_maxBuildingHeight == 0) then {
_maxHeight = _maxHeight min EPOCH_maxBuildingHeight;
};
2015-09-14 20:55:36 +00:00
_objSlot = _object getVariable["BUILD_SLOT", -1];
_pos2 = player modelToWorldVisual[EPOCH_X_OFFSET, EPOCH_Y_OFFSET, EPOCH_Z_OFFSET];
// object already ghost
if (_objType isEqualTo _class) then {
EPOCH_target = _object;
} else {
deleteVehicle _object;
EPOCH_target = createVehicle[_class, _pos2, [], 0, "CAN_COLLIDE"];
};
2015-12-28 16:31:54 +00:00
// send to server
[EPOCH_target] remoteExec ["EPOCH_localCleanup",2];
2015-09-14 20:55:36 +00:00
if (_pos2 select 2 > _maxHeight) then {
_pos2 set[2, _maxHeight];
};
_pos2ATL = _pos2;
if (surfaceIsWater _pos2ATL) then {
_pos2ATL = ASLtoATL _pos2ATL;
};
EPOCH_target setposATL _pos2ATL;
EPOCH_target attachTo[player];
_currentTarget = EPOCH_target;
if (_objSlot != -1) then {
_currentTarget setVariable["BUILD_SLOT", _objSlot, true];
};
EPOCH_X_OFFSET = 0;
EPOCH_Y_OFFSET = 5;
EPOCH_Z_OFFSET = 0;
EPOCH_buildDirection = 0;
EPOCH_buildDirectionPitch = 0;
EPOCH_buildDirectionRoll = 0;
EPOCH_target_attachedTo = player;
2015-09-14 20:55:36 +00:00
EP_snap = objNull;
2017-07-27 20:16:16 +00:00
EPOCH_tempTarget = objNull;
2015-09-14 20:55:36 +00:00
EP_snapPos = [0, 0, 0];
_isSnap = false;
_currentOffSet = [];
2015-09-14 20:55:36 +00:00
_EPOCH_1 = diag_tickTime;
2015-11-22 23:01:46 +00:00
_EPOCH_2 = diag_tickTime;
2015-09-14 20:55:36 +00:00
_nearestObjects = [];
_Snapdirection = EPOCH_snapDirection;
_snapped = false;
_currentTargetAttachedTo = player;
_AnchorPos = [];
_helper = objnull;
2018-11-14 18:41:26 +00:00
if (typeof EPOCH_target in ["CinderWallHalf_Ghost_EPOCH","WoodLargeWall_Ghost_EPOCH","JailWall_Ghost_EPOCH"]) then {
_helper = "Sign_Arrow_Direction_Yellow_F" createVehicleLocal (getpos EPOCH_target);
_helper attachto [EPOCH_target, [0, -0.5, 1]];
_helper setdir 180;
};
2015-09-14 20:55:36 +00:00
_MoveObject = {
if (!(_currentOffSet isEqualTo _offSet) || EPOCH_doRotate || !isnull EP_snap && _currentTargetAttachedTo isequalto EPOCH_target_attachedTo) then {
_currentOffSet = _offSet;
EPOCH_doRotate = false;
EPOCH_arr_snapPoints = [];
EPOCH_arr_snapObjects = [];
EP_snap = objnull;
_pos2ATL = _pos2;
if (surfaceIsWater _pos2ATL) then {
_pos2ATL = ASLtoATL _pos2ATL;
};
EPOCH_target setposATL _pos2ATL;
if (_currentTargetAttachedTo isequalto player) then {
EPOCH_target attachTo [player];
}
else {
{
detach _x;
} forEach attachedObjects player;
};
_newDirAndUp = [[sin EPOCH_buildDirection * cos EPOCH_buildDirectionPitch, cos EPOCH_buildDirection * cos EPOCH_buildDirectionPitch, sin EPOCH_buildDirectionPitch],[[ sin EPOCH_buildDirectionRoll,-sin EPOCH_buildDirectionPitch,cos EPOCH_buildDirectionRoll * cos EPOCH_buildDirectionPitch],-EPOCH_buildDirection] call BIS_fnc_rotateVector2D];
EPOCH_target setVectorDirAndUp _newDirAndUp;
};
};
2015-09-14 20:55:36 +00:00
while {EPOCH_target == _currentTarget} do {
2015-09-14 20:55:36 +00:00
_rejectMove = false;
if ((diag_tickTime - _lastCheckTime) > 10) then {
_lastCheckTime = diag_tickTime;
_rejectMove = !(EPOCH_target call EPOCH_isBuildAllowed);
2015-09-14 20:55:36 +00:00
};
if (_rejectMove) exitWith{
deleteVehicle EPOCH_target;
_currentTarget = objnull;
2015-09-14 20:55:36 +00:00
};
if (player distance _currentTarget > 15) exitWith{
deleteVehicle EPOCH_target;
_currentTarget = objnull;
["Building Abort: Distance to high", 5] call Epoch_message;
2015-09-14 20:55:36 +00:00
};
if ((diag_tickTime - _EPOCH_1) > 1) then {
_EPOCH_1 = diag_tickTime;
if !(isNull EPOCH_target) then {
_nearestObjects = nearestObjects[EPOCH_target, _allowedSnapObjects, 12];
2017-10-03 14:04:30 +00:00
[_playerEnergyKeyFinal, -_energyCost, 2500 , 0] call EPOCH_fnc_setVariableLimited;
2015-09-14 20:55:36 +00:00
};
};
if !(_currentTargetAttachedTo isequalto EPOCH_target_attachedTo) then {
_currentTargetAttachedTo = EPOCH_target_attachedTo;
EPOCH_X_OFFSET = 0;
EPOCH_Z_OFFSET = 0;
EPOCH_doRotate = true;
if !(_currentTargetAttachedTo isequalto player) then {
EPOCH_buildDirection = getdir EPOCH_target;
EPOCH_Y_OFFSET = 0;
_AnchorPos = getposasl EPOCH_target;
}
else {
EPOCH_buildDirection = 0;
EPOCH_Y_OFFSET = 5;
};
2015-11-12 18:01:19 +00:00
};
_offSet = [EPOCH_X_OFFSET, EPOCH_Y_OFFSET, EPOCH_Z_OFFSET];
if (_currentTargetAttachedTo isequalto player) then {
_pos2 = _currentTargetAttachedTo modelToWorldVisual _offSet;
if (surfaceIsWater _pos2) then {
_pos2 set[2, ((getPosASL _currentTargetAttachedTo) select 2) + EPOCH_Z_OFFSET];
2015-09-14 20:55:36 +00:00
};
}
else {
_pos2 = [(_AnchorPos select 0) + EPOCH_X_OFFSET,(_AnchorPos select 1) + EPOCH_Y_OFFSET,(_AnchorPos select 2) + EPOCH_Z_OFFSET];
if !(surfaceIsWater _pos2) then {
_pos2 = asltoatl _pos2;
};
};
if (_pos2 select 2 > _maxHeight) then {
_pos2 set[2, _maxHeight];
EPOCH_doRotate = true;
};
if (_currentTargetAttachedTo isequalto player) then {
if (!(_nearestobjects isequalto []) && EPOCH_buildMode == 1) then {
if ((_pos2 distance EP_snapPos) > _maxSnapDistance || EPOCH_snapDirection != _Snapdirection) then {
_Snapdirection = EPOCH_snapDirection;
EP_snapPos = [0,0,0];
_snapped = false;
_dirlock = false;
2015-09-14 20:55:36 +00:00
{
_nearestObject = _x;
_isSnap = false;
// Vector + Snapping
_snapMemoryPoint = "";
if( ((typeOf _nearestObject) isEqualTo _staticClass) || ((_nearestObject isKindOf "Const_floors_static_F") && (_staticClass isKindOf "Const_floors_static_F")) || ((_nearestObject isKindOf "Const_Cinder_static_F") && (_staticClass isKindOf "Const_Cinder_static_F")) || ((_nearestObject isKindOf "Const_WoodWalls_static_F") && (_staticClass isKindOf "Const_WoodWalls_static_F")) )then{
_dirLock = true;
};
_snapPosition = [0, 0, 0];
if (!isNull _nearestObject) then {
_snapConfig = _cfgBaseBuilding >> (typeOf _nearestObject);
_snapPointsPara = getArray(_snapConfig >> "snapPointsPara");
_snapPointsPerp = getArray(_snapConfig >> "snapPointsPerp");
// base line for z height offset
_baselineSnapPos = _nearestObject modelToWorldVisual [0,0,0];
{
_x params ["_snapPoints","_type"];
{
if (_x in _allowedSnapPoints) then {
2017-10-20 15:08:52 +00:00
_pOffset = getArray (_snapConfig >> _x);
_snapPos = _nearestObject modelToWorldVisual _pOffset;
if (surfaceIsWater _snapPos) then {
_snapPos set[2, ((getPosASL _nearestObject) select 2) + (_pOffset select 2)];
};
_snapDistance = _pos2 distance _snapPos;
if (_snapDistance < _maxSnapDistance) exitWith{
_isSnap = true;
_snapPosition = _snapPos;
_snapType = _type;
// Vector + Snapping
_snapMemoryPoint = _x;
};
};
} forEach _snapPoints;
} forEach [[_snapPointsPara,"para"],[_snapPointsPerp,"perp"]];
_distance = _pos2 distance _currentTarget;
if (_isSnap && _distance < 5) exitwith {
EP_snap = _nearestObject;
EP_snapPos = _snapPosition;
_direction = getDir _nearestObject;
if (_snapType == "perp") then {
_snapPos1 = [_snapPosition select 0, _snapPosition select 1, 0];
_pos_snapObj = getposATL _nearestObject;
_pos_snapObj set[2, 0];
_direction = _direction - (_snapPos1 getDir _pos_snapObj);
}
else {
_direction = 0;
Release 0.3.8 (#502) * first build for 0.3.8 * 0.3.8.0190 * 0.3.8.0202 * 0.3.8.0213 * 0.3.7.0214 * 0.3.8.0222 * 0.3.8.0246 * 0.3.8.0247 fixed typo * 0.3.8.0249 more fixes for server compiler * 0.3.8.0256 * add build number and simple batch file for packing * match build number with internal * add build numbers to server pbo's and mission files also reworked build script for more options * 0.3.8.0261 * 0.3.8.0261 * 0.3.8.0283 * 0.3.8.0284 * changelog * 0.3.8.0307 * 0.3.8.0311 * remove old BEC plugin * update redis-server.exe to latest build and full config * 0.3.8.0314 * 0.3.8.0315 * inverse logic This should correctly prevent spawning these units nearby jammer or protection zones * use pushbackUnique here * optimized loot function by using selectRandom instead of slower sqf logic * 0.3.8.0316 * make use of new getDir functionality instead of BIS fnc * add lower disconnect value to server.cfg * use new getpos functionality * 0.3.8.0317 * 0.3.8.0319 * 0.3.8.0327 * 0.3.8.0338 changelog update tba * changelog * 0.3.8.0341 * BE update * 0.3.8.0353 * changelog * removed duplicates * 0.3.8.0355 fixed error in getIDC * 0.3.8.0356 revert to BIS_fnc_param as params threw errors * 0.3.8.0357 fixes for #496 #497 * 0.3.8.0359 fixed #497 fixed #496 * 0.3.8.0365 * 0.3.8.0371 * 0.3.8.0373 * 0.3.8.0379 * 0.3.8.0381 * 0.3.8.0386 * 0.3.8.0393 * 0.3.8.0395 * 0.3.8.0396 * 0.3.8.0397 * 0.3.8.0406 * 0.3.8.0409 * 0.3.8.0410 loot balance suppress error in spawnloot make near object check based on building size * 0.3.8.0412 * 0.3.8.0414 removed classes with scope 0 test remove loot trash on gear for #498 fixed #501 * 0.3.8.0415 * same
2016-04-08 20:21:46 +00:00
};
2017-10-20 21:15:17 +00:00
/*
if(_dirLock)then{
["Snap Direction LOCKED to 0 and 180", 5] call Epoch_message;
if(EPOCH_snapDirection isEqualTo 3)then{EPOCH_snapDirection = 0;};
if(EPOCH_snapDirection isEqualTo 1)then{EPOCH_snapDirection = 2;};
};
2017-10-20 21:15:17 +00:00
*/
if (EPOCH_snapDirection > 0) then {
_direction = _direction + (EPOCH_snapDirection * 90);
Release 0.3.8 (#502) * first build for 0.3.8 * 0.3.8.0190 * 0.3.8.0202 * 0.3.8.0213 * 0.3.7.0214 * 0.3.8.0222 * 0.3.8.0246 * 0.3.8.0247 fixed typo * 0.3.8.0249 more fixes for server compiler * 0.3.8.0256 * add build number and simple batch file for packing * match build number with internal * add build numbers to server pbo's and mission files also reworked build script for more options * 0.3.8.0261 * 0.3.8.0261 * 0.3.8.0283 * 0.3.8.0284 * changelog * 0.3.8.0307 * 0.3.8.0311 * remove old BEC plugin * update redis-server.exe to latest build and full config * 0.3.8.0314 * 0.3.8.0315 * inverse logic This should correctly prevent spawning these units nearby jammer or protection zones * use pushbackUnique here * optimized loot function by using selectRandom instead of slower sqf logic * 0.3.8.0316 * make use of new getDir functionality instead of BIS fnc * add lower disconnect value to server.cfg * use new getpos functionality * 0.3.8.0317 * 0.3.8.0319 * 0.3.8.0327 * 0.3.8.0338 changelog update tba * changelog * 0.3.8.0341 * BE update * 0.3.8.0353 * changelog * removed duplicates * 0.3.8.0355 fixed error in getIDC * 0.3.8.0356 revert to BIS_fnc_param as params threw errors * 0.3.8.0357 fixes for #496 #497 * 0.3.8.0359 fixed #497 fixed #496 * 0.3.8.0365 * 0.3.8.0371 * 0.3.8.0373 * 0.3.8.0379 * 0.3.8.0381 * 0.3.8.0386 * 0.3.8.0393 * 0.3.8.0395 * 0.3.8.0396 * 0.3.8.0397 * 0.3.8.0406 * 0.3.8.0409 * 0.3.8.0410 loot balance suppress error in spawnloot make near object check based on building size * 0.3.8.0412 * 0.3.8.0414 removed classes with scope 0 test remove loot trash on gear for #498 fixed #501 * 0.3.8.0415 * same
2016-04-08 20:21:46 +00:00
};
if (_direction > 360) then {
_direction = _direction - ((floor (_direction/360))*360);
};
if (_direction < 0) then {
_direction = _direction + ((floor (-_direction/360))*360);
};
{
detach _x;
} forEach attachedObjects player;
// Vector + Snapping
_vectorDir = vectorDir _nearestObject;
_vectorUp = vectorup _nearestObject;
_dir2 = [_vectorDir, _direction] call BIS_fnc_returnVector;
if (_pos2 select 2 > _maxHeight) then {
_pos2 set[2, _maxHeight];
};
if (surfaceIsWater _snapPosition) then {
_snapPosition = ASLtoATL _snapPosition;
};
_currentTarget setVectorDirAndUp[_dir2, (vectorUp _nearestObject)];
_currentTarget setposATL _snapPosition;
// Vector + Snapping
if(!(_vectorUp select 0 == 0) || !(_vectorUp select 1 == 0) || !(_vectorUp select 2 == 1)) then{
_tempClass = getText(_cfgBaseBuilding >> (typeOf _nearestObject) >> "GhostPreview");
if!(_tempClass isEqualTo "")then{
EPOCH_tempTarget = _tempClass createVehicleLocal [0,0,0];
EPOCH_tempTarget setPosATL (getPosATL _nearestObject);
EPOCH_tempTarget setVectorDirAndUp [_vectorDir, _vectorUp];
EPOCH_tempTarget setDir ((getDir _nearestObject) + (EPOCH_snapDirection * 90));
// hideObject EPOCH_tempTarget;
if(_snapType in ["para","perp"])then{
EPOCH_tempTarget setVectorUp _vectorUp;
};
_newDir = vectorDir EPOCH_tempTarget;
_vectorDir = _newDir;
deleteVehicle EPOCH_tempTarget;
EPOCH_tempTarget = objNull;
_currentTarget setposATL _snapPosition;
_currentTarget setDir ((getDir _currentTarget) + (EPOCH_snapDirection * 90));
_currentTarget setVectorDirAndUp [_vectorDir,_vectorUP];
};
};
2017-10-20 15:08:52 +00:00
if(_dirLock)then{
_currentTarget setVectorDirAndUp [_dir2,_vectorUP];
_currentTarget setposATL _snapPosition;
};
2017-10-20 15:08:52 +00:00
_snapped = true;
_arr_snapPoints = [];
EPOCH_arr_snapPoints = [];
{
_pos1_snap = _currentTarget modelToWorldVisual (_x select 0);
_pos2_snap = _currentTarget modelToWorldVisual (_x select 1);
_ins = lineIntersectsSurfaces [AGLToASL _pos1_snap, AGLToASL _pos2_snap,player,_currentTarget,true,1,"VIEW","FIRE"];
if (count _ins > 0) then {
if (surfaceIsWater _snapPosition) then {
_arr_snapPoints pushBackUnique (_ins select 0 select 0);
} else {
_arr_snapPoints pushBackUnique ASLToATL(_ins select 0 select 0);
};
2015-11-22 23:01:46 +00:00
};
if (count _arr_snapPoints >= 2) exitWith { EPOCH_arr_snapPoints = _arr_snapPoints; }
} forEach _snapChecks;
EPOCH_arr_snapObjects = [_nearestObject, _currentTarget];
};
2015-09-14 20:55:36 +00:00
};
if (_snapped) exitwith {};
} forEach _nearestObjects;
2015-09-14 20:55:36 +00:00
};
if (!_snapped) then {
[] call _MoveObject;
};
}
else {
[] call _MoveObject;
2015-09-14 20:55:36 +00:00
};
}
else {
[] call _MoveObject;
2015-09-14 20:55:36 +00:00
};
};
2015-11-22 23:01:46 +00:00
EPOCH_arr_snapPoints = [];
EPOCH_arr_snapObjects = [];
2015-11-22 23:01:46 +00:00
2015-09-14 20:55:36 +00:00
{
detach _x;
} forEach attachedObjects _currentTargetAttachedTo;
if (!isnull _helper) then {
deletevehicle _helper;
};
2015-09-14 20:55:36 +00:00
if !(isNull _currentTarget) then {
// check if touching ground
_currentPos = getPosATL _currentTarget;
if (_currentPos select 2 > _maxHeight) then {
_currentPos set[2, _maxHeight];
_currentTarget setPosATL _currentPos;
};
_currentPos set[2, (_currentPos select 2) + 0.1];
// remove item here
if (([player, _item] call BIS_fnc_invRemove) == 1) then {
if (_stabilityCheck && !isTouchingGround _currentTarget && _EnablePhysicsOnBuild) then {
2015-09-14 20:55:36 +00:00
_offsetZPos = [_currentPos select 0, _currentPos select 1, (_currentPos select 2) - 0.5];
if !(terrainIntersect[_currentPos, _offsetZPos]) then {
2015-11-12 18:01:19 +00:00
_numberOfContacts = 0;
{
2015-11-20 14:39:59 +00:00
_pos1_snap = _currentTarget modelToWorldVisual (_x select 0);
_pos2_snap = _currentTarget modelToWorldVisual (_x select 1);
_ins = lineIntersectsSurfaces [AGLToASL _pos1_snap, AGLToASL _pos2_snap,player,_currentTarget,true,1,"VIEW","FIRE"];
2015-11-12 18:01:19 +00:00
if (count _ins > 0) then {
2015-11-20 14:39:59 +00:00
_numberOfContacts = _numberOfContacts + 1;
2015-11-12 18:01:19 +00:00
};
2015-11-22 23:52:24 +00:00
if (_numberOfContacts >= 2) exitWith {}
2015-11-12 18:01:19 +00:00
} forEach _snapChecks;
if (_numberOfContacts < 2) then {
// TODO: foundations need to be handled
// change to sim
_worldspace = [getposATL _currentTarget, vectordir _currentTarget, vectorup _currentTarget];
deleteVehicle _currentTarget;
_currentTarget = createVehicle[_simulClass, (_worldspace select 0), [], 0, "CAN_COLLIDE"];
Release 0.3.8 (#502) * first build for 0.3.8 * 0.3.8.0190 * 0.3.8.0202 * 0.3.8.0213 * 0.3.7.0214 * 0.3.8.0222 * 0.3.8.0246 * 0.3.8.0247 fixed typo * 0.3.8.0249 more fixes for server compiler * 0.3.8.0256 * add build number and simple batch file for packing * match build number with internal * add build numbers to server pbo's and mission files also reworked build script for more options * 0.3.8.0261 * 0.3.8.0261 * 0.3.8.0283 * 0.3.8.0284 * changelog * 0.3.8.0307 * 0.3.8.0311 * remove old BEC plugin * update redis-server.exe to latest build and full config * 0.3.8.0314 * 0.3.8.0315 * inverse logic This should correctly prevent spawning these units nearby jammer or protection zones * use pushbackUnique here * optimized loot function by using selectRandom instead of slower sqf logic * 0.3.8.0316 * make use of new getDir functionality instead of BIS fnc * add lower disconnect value to server.cfg * use new getpos functionality * 0.3.8.0317 * 0.3.8.0319 * 0.3.8.0327 * 0.3.8.0338 changelog update tba * changelog * 0.3.8.0341 * BE update * 0.3.8.0353 * changelog * removed duplicates * 0.3.8.0355 fixed error in getIDC * 0.3.8.0356 revert to BIS_fnc_param as params threw errors * 0.3.8.0357 fixes for #496 #497 * 0.3.8.0359 fixed #497 fixed #496 * 0.3.8.0365 * 0.3.8.0371 * 0.3.8.0373 * 0.3.8.0379 * 0.3.8.0381 * 0.3.8.0386 * 0.3.8.0393 * 0.3.8.0395 * 0.3.8.0396 * 0.3.8.0397 * 0.3.8.0406 * 0.3.8.0409 * 0.3.8.0410 loot balance suppress error in spawnloot make near object check based on building size * 0.3.8.0412 * 0.3.8.0414 removed classes with scope 0 test remove loot trash on gear for #498 fixed #501 * 0.3.8.0415 * same
2016-04-08 20:21:46 +00:00
_currentTarget setposATL(_worldspace select 0);
_currentTarget setVectorDirAndUp[_worldspace select 1, _worldspace select 2];
2015-09-14 20:55:36 +00:00
};
};
};
_currentTarget spawn EPOCH_countdown;
};
};
};
[] spawn{
uiSleep 2;
EPOCH_simulSwap_Lock = nil;
};