mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-21 23:50:48 +03:00
Update Snap and Vector build
- pre compile all snap and vector functions, it was only pre compiled if got started from modular_build before but not if it got called from the action menu - localize snap and vector building - clean up the code - remove old Cinderwall vector fix, it looks like it is not needed anymore - Update modular_build and player_build
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
private ["_abort","_reason","_distance","_isNear","_lockable","_isAllowedUnderGround","_offset","_classname","_zheightdirection","_zheightchanged","_rotate","_objectHelperPos","_objectHelperDir","_objHDiff","_position","_isOk","_dir","_vector","_cancel","_location2","_buildOffset","_location","_limit","_finished","_proceed","_counter","_dis","_sfx","_combination_1_Display","_combination_1","_combination_2","_combination_3","_combination","_combinationDisplay","_combination_4","_num_removed","_tmpbuilt","_vUp","_classnametmp","_text","_ghost","_ghost2","_VectorWorkAround","_objectHelper","_location1","_object","_object2","_helperColor","_canDo","_pos","_onLadder","_vehicle","_inVehicle","_needNear","_canBuild"];
|
||||
|
||||
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
private ["_abort","_reason","_distance","_isNear","_lockable","_isAllowedUnderGround","_offset","_classname","_zheightdirection","_zheightchanged","_rotate","_objectHelperPos","_objHDiff","_position","_isOk","_dir","_vector","_cancel","_location2","_buildOffset","_location","_limit","_finished","_proceed","_counter","_dis","_sfx","_combination_1_Display","_combination_1","_combination_2","_combination_3","_combination","_combinationDisplay","_combination_4","_num_removed","_tmpbuilt","_vUp","_classnametmp","_text","_ghost","_objectHelper","_location1","_object","_helperColor","_canDo","_pos","_onLadder","_vehicle","_inVehicle","_needNear","_canBuild","_friendsArr"];
|
||||
|
||||
_pos = [player] call FNC_GetPos;
|
||||
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
@@ -48,36 +48,33 @@ _reason = "";
|
||||
_needNear = getArray (configFile >> "CfgMagazines" >> DZE_buildItem >> "ItemActions" >> "Build" >> "neednearby");
|
||||
|
||||
{
|
||||
switch(_x) do{
|
||||
case "fire":
|
||||
{
|
||||
call {
|
||||
if (_x == "fire") exitwith {
|
||||
_distance = 3;
|
||||
_isNear = {inflamed _x} count (_pos nearObjects _distance);
|
||||
if(_isNear == 0) then {
|
||||
if (_isNear == 0) then {
|
||||
_abort = true;
|
||||
_reason = localize "STR_EPOCH_FIRE";
|
||||
};
|
||||
};
|
||||
case "workshop":
|
||||
{
|
||||
if (_x == "workshop") exitwith {
|
||||
_distance = 3;
|
||||
_isNear = count (nearestObjects [_pos, ["Wooden_shed_DZ","WoodShack_DZ","WorkBench_DZ"], _distance]);
|
||||
if(_isNear == 0) then {
|
||||
if (_isNear == 0) then {
|
||||
_abort = true;
|
||||
_reason = localize "STR_EPOCH_WORKBENCH_NEARBY";
|
||||
};
|
||||
};
|
||||
case "fueltank":
|
||||
{
|
||||
if (_x == "fueltank") exitwith {
|
||||
_distance = 30;
|
||||
_isNear = count (nearestObjects [_pos, dayz_fuelsources, _distance]);
|
||||
if(_isNear == 0) then {
|
||||
if (_isNear == 0) then {
|
||||
_abort = true;
|
||||
_reason = localize "STR_EPOCH_VEHUP_TNK";
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach _needNear;
|
||||
} count _needNear;
|
||||
|
||||
if (_abort) exitWith {
|
||||
format[localize "str_epoch_player_135",_reason,_distance] call dayz_rollingMessages;
|
||||
@@ -96,41 +93,28 @@ if (_canBuild select 0) then {
|
||||
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
|
||||
|
||||
_lockable = 0;
|
||||
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "lockable")) then {
|
||||
if (isNumber (configFile >> "CfgVehicles" >> _classname >> "lockable")) then {
|
||||
_lockable = getNumber(configFile >> "CfgVehicles" >> _classname >> "lockable");
|
||||
};
|
||||
|
||||
_isAllowedUnderGround = 1;
|
||||
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "nounderground")) then {
|
||||
if (isNumber (configFile >> "CfgVehicles" >> _classname >> "nounderground")) then {
|
||||
_isAllowedUnderGround = getNumber(configFile >> "CfgVehicles" >> _classname >> "nounderground");
|
||||
};
|
||||
|
||||
_offset = getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
|
||||
_offset = getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
|
||||
_objectHelper = objNull;
|
||||
_isOk = true;
|
||||
_location1 = [player] call FNC_GetPos;
|
||||
_dir = getDir player;
|
||||
_ghost2 = "";
|
||||
_VectorWorkAround = false;
|
||||
|
||||
if (_classname == "CinderWall_DZ") then {
|
||||
_ghost2 = _ghost;
|
||||
_ghost = "CinderWallHalf_Preview_DZ";
|
||||
_VectorWorkAround = true;
|
||||
};
|
||||
|
||||
if (_ghost != "") then {
|
||||
_classname = _ghost;
|
||||
};
|
||||
|
||||
_object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"];
|
||||
_object2 = ObjNull;
|
||||
if (_VectorWorkAround) then {
|
||||
_object2 = _ghost2 createVehicleLocal [0,0,0];
|
||||
hideObject _object;
|
||||
};
|
||||
|
||||
if((count _offset) <= 0) then {
|
||||
if ((count _offset) <= 0) then {
|
||||
_offset = [0,(abs(((boundingBox _object)select 0) select 1)),0];
|
||||
};
|
||||
|
||||
@@ -138,14 +122,9 @@ if (_canBuild select 0) then {
|
||||
_helperColor = "#(argb,8,8,3)color(0,0,0,0,ca)";
|
||||
_objectHelper setobjecttexture [0,_helperColor];
|
||||
_objectHelper attachTo [player,_offset];
|
||||
if (_VectorWorkAround) then {
|
||||
_object attachTo [_objectHelper,[0,0,-1.65]];
|
||||
_object2 attachTo [_object,[0,0,1.65]];
|
||||
} else {
|
||||
_object attachTo [_objectHelper,[0,0,0]];
|
||||
};
|
||||
_object attachTo [_objectHelper,[0,0,0]];
|
||||
|
||||
if (isClass (configFile >> "SnapBuilding" >> _classname)) then {
|
||||
if (isClass (configFile >> "SnapBuilding" >> _classname)) then {
|
||||
["","","",["Init",_object,_classname,_objectHelper]] spawn snap_build;
|
||||
};
|
||||
|
||||
@@ -153,12 +132,12 @@ if (_canBuild select 0) then {
|
||||
["","","",["Init","Init",0]] spawn build_vectors;
|
||||
};
|
||||
|
||||
_objHDiff = 0;
|
||||
_objHDiff = 0;
|
||||
_cancel = false;
|
||||
_reason = "";
|
||||
|
||||
|
||||
helperDetach = false;
|
||||
_canDo = (!r_drag_sqf and !r_player_unconscious);
|
||||
_canDo = (!r_drag_sqf && {!r_player_unconscious});
|
||||
_position = [_objectHelper] call FNC_GetPos;
|
||||
|
||||
while {_isOk} do {
|
||||
@@ -200,7 +179,7 @@ if (_canBuild select 0) then {
|
||||
if (DZE_4) then {
|
||||
_rotate = true;
|
||||
DZE_4 = false;
|
||||
if(DZE_dirWithDegrees) then{
|
||||
if (DZE_dirWithDegrees) then{
|
||||
DZE_memDir = DZE_memDir - DZE_curDegree;
|
||||
}else{
|
||||
DZE_memDir = DZE_memDir - 45;
|
||||
@@ -209,27 +188,27 @@ if (_canBuild select 0) then {
|
||||
if (DZE_6) then {
|
||||
_rotate = true;
|
||||
DZE_6 = false;
|
||||
if(DZE_dirWithDegrees) then{
|
||||
if (DZE_dirWithDegrees) then{
|
||||
DZE_memDir = DZE_memDir + DZE_curDegree;
|
||||
}else{
|
||||
DZE_memDir = DZE_memDir + 45;
|
||||
};
|
||||
};
|
||||
|
||||
if(DZE_updateVec) then{
|
||||
|
||||
if (DZE_updateVec) then{
|
||||
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
|
||||
DZE_updateVec = false;
|
||||
};
|
||||
|
||||
|
||||
if (DZE_F and _canDo) then {
|
||||
if (helperDetach) then {
|
||||
_objectHelper attachTo [player];
|
||||
DZE_memDir = DZE_memDir-(getDir player);
|
||||
helperDetach = false;
|
||||
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
|
||||
} else {
|
||||
} else {
|
||||
_objectHelperPos = getPosATL _objectHelper;
|
||||
detach _objectHelper;
|
||||
detach _objectHelper;
|
||||
DZE_memDir = getDir _objectHelper;
|
||||
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
|
||||
_objectHelper setPosATL _objectHelperPos;
|
||||
@@ -239,46 +218,45 @@ if (_canBuild select 0) then {
|
||||
DZE_F = false;
|
||||
};
|
||||
|
||||
if(_rotate) then {
|
||||
if (_rotate) then {
|
||||
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
|
||||
};
|
||||
|
||||
if(_zheightchanged) then {
|
||||
if (_zheightchanged) then {
|
||||
if (!helperDetach) then {
|
||||
detach _objectHelper;
|
||||
_objectHelperDir = getDir _objectHelper;
|
||||
detach _objectHelper;
|
||||
};
|
||||
|
||||
_position = [_objectHelper] call FNC_GetPos;
|
||||
|
||||
if(_zheightdirection == "up") then {
|
||||
if (_zheightdirection == "up") then {
|
||||
_position set [2,((_position select 2)+0.1)];
|
||||
_objHDiff = _objHDiff + 0.1;
|
||||
};
|
||||
if(_zheightdirection == "down") then {
|
||||
if (_zheightdirection == "down") then {
|
||||
_position set [2,((_position select 2)-0.1)];
|
||||
_objHDiff = _objHDiff - 0.1;
|
||||
};
|
||||
|
||||
if(_zheightdirection == "up_alt") then {
|
||||
if (_zheightdirection == "up_alt") then {
|
||||
_position set [2,((_position select 2)+1)];
|
||||
_objHDiff = _objHDiff + 1;
|
||||
};
|
||||
if(_zheightdirection == "down_alt") then {
|
||||
if (_zheightdirection == "down_alt") then {
|
||||
_position set [2,((_position select 2)-1)];
|
||||
_objHDiff = _objHDiff - 1;
|
||||
};
|
||||
|
||||
if(_zheightdirection == "up_ctrl") then {
|
||||
if (_zheightdirection == "up_ctrl") then {
|
||||
_position set [2,((_position select 2)+0.01)];
|
||||
_objHDiff = _objHDiff + 0.01;
|
||||
};
|
||||
if(_zheightdirection == "down_ctrl") then {
|
||||
if (_zheightdirection == "down_ctrl") then {
|
||||
_position set [2,((_position select 2)-0.01)];
|
||||
_objHDiff = _objHDiff - 0.01;
|
||||
};
|
||||
|
||||
if((_isAllowedUnderGround == 0) && ((_position select 2) < 0)) then {
|
||||
if ((_isAllowedUnderGround == 0) && {(_position select 2) < 0}) then {
|
||||
_position set [2,0];
|
||||
};
|
||||
|
||||
@@ -289,7 +267,7 @@ if (_canBuild select 0) then {
|
||||
};
|
||||
|
||||
if (!helperDetach) then {
|
||||
_objectHelper attachTo [player];
|
||||
_objectHelper attachTo [player];
|
||||
};
|
||||
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
|
||||
};
|
||||
@@ -298,74 +276,54 @@ if (_canBuild select 0) then {
|
||||
|
||||
_location2 = [player] call FNC_GetPos;
|
||||
_objectHelperPos = [_objectHelper] call FNC_GetPos;
|
||||
|
||||
if(DZE_5) exitWith {
|
||||
|
||||
if (DZE_5) exitWith {
|
||||
_isOk = false;
|
||||
_position = [_object] call FNC_GetPos;
|
||||
detach _object;
|
||||
_dir = getDir _object;
|
||||
_vector = [(vectorDir _object),(vectorUp _object)];
|
||||
_vector = [(vectorDir _object),(vectorUp _object)];
|
||||
deleteVehicle _object;
|
||||
if (_VectorWorkAround) then {
|
||||
detach _object2;
|
||||
deleteVehicle _object2;
|
||||
};
|
||||
detach _objectHelper;
|
||||
deleteVehicle _objectHelper;
|
||||
};
|
||||
|
||||
if(_location1 distance _location2 > DZE_buildMaxMoveDistance) exitWith {
|
||||
if (_location1 distance _location2 > DZE_buildMaxMoveDistance) exitWith {
|
||||
_isOk = false;
|
||||
_cancel = true;
|
||||
_reason = format[localize "STR_EPOCH_BUILD_FAIL_MOVED",DZE_buildMaxMoveDistance];
|
||||
detach _object;
|
||||
deleteVehicle _object;
|
||||
if (_VectorWorkAround) then {
|
||||
detach _object2;
|
||||
deleteVehicle _object2;
|
||||
};
|
||||
detach _objectHelper;
|
||||
deleteVehicle _objectHelper;
|
||||
};
|
||||
|
||||
if(_location1 distance _objectHelperPos > DZE_buildMaxMoveDistance) exitWith {
|
||||
|
||||
if (_location1 distance _objectHelperPos > DZE_buildMaxMoveDistance) exitWith {
|
||||
_isOk = false;
|
||||
_cancel = true;
|
||||
_reason = format[localize "STR_EPOCH_BUILD_FAIL_TOO_FAR",DZE_buildMaxMoveDistance];
|
||||
detach _object;
|
||||
deleteVehicle _object;
|
||||
if (_VectorWorkAround) then {
|
||||
detach _object2;
|
||||
deleteVehicle _object2;
|
||||
};
|
||||
detach _objectHelper;
|
||||
deleteVehicle _objectHelper;
|
||||
};
|
||||
|
||||
if(abs(_objHDiff) > DZE_buildMaxHeightDistance) exitWith {
|
||||
if (abs(_objHDiff) > DZE_buildMaxHeightDistance) exitWith {
|
||||
_isOk = false;
|
||||
_cancel = true;
|
||||
_reason = format[localize "STR_EPOCH_BUILD_FAIL_HEIGHT",DZE_buildMaxHeightDistance];
|
||||
detach _object;
|
||||
deleteVehicle _object;
|
||||
if (_VectorWorkAround) then {
|
||||
detach _object2;
|
||||
deleteVehicle _object2;
|
||||
};
|
||||
detach _objectHelper;
|
||||
deleteVehicle _objectHelper;
|
||||
};
|
||||
|
||||
|
||||
if (DZE_BuildHeightLimit > 0 && {_position select 2 > DZE_BuildHeightLimit}) exitWith {
|
||||
_isOk = false;
|
||||
_cancel = true;
|
||||
_reason = format[localize "STR_EPOCH_PLAYER_168",DZE_BuildHeightLimit];
|
||||
detach _object;
|
||||
deleteVehicle _object;
|
||||
if (_VectorWorkAround) then {
|
||||
detach _object2;
|
||||
deleteVehicle _object2;
|
||||
};
|
||||
detach _objectHelper;
|
||||
deleteVehicle _objectHelper;
|
||||
};
|
||||
@@ -376,10 +334,6 @@ if (_canBuild select 0) then {
|
||||
_reason = localize "str_epoch_player_43";
|
||||
detach _object;
|
||||
deleteVehicle _object;
|
||||
if (_VectorWorkAround) then {
|
||||
detach _object2;
|
||||
deleteVehicle _object2;
|
||||
};
|
||||
detach _objectHelper;
|
||||
deleteVehicle _objectHelper;
|
||||
};
|
||||
@@ -390,15 +344,11 @@ if (_canBuild select 0) then {
|
||||
_reason = localize "STR_EPOCH_PLAYER_46";
|
||||
detach _object;
|
||||
deleteVehicle _object;
|
||||
if (_VectorWorkAround) then {
|
||||
detach _object2;
|
||||
deleteVehicle _object2;
|
||||
};
|
||||
detach _objectHelper;
|
||||
deleteVehicle _objectHelper;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
_isOk = true;
|
||||
_proceed = false;
|
||||
_counter = 0;
|
||||
@@ -407,33 +357,33 @@ if (_canBuild select 0) then {
|
||||
if (!DZE_BuildOnRoads) then {
|
||||
if (isOnRoad _position) then { _cancel = true; _reason = localize "STR_EPOCH_BUILD_FAIL_ROAD"; };
|
||||
};
|
||||
if(!canbuild) then { _cancel = true; _reason = format[localize "STR_EPOCH_PLAYER_136",localize "STR_EPOCH_TRADER"]; };
|
||||
if (!canbuild) then { _cancel = true; _reason = format[localize "STR_EPOCH_PLAYER_136",localize "STR_EPOCH_TRADER"]; };
|
||||
|
||||
if(!_cancel) then {
|
||||
if (!_cancel) then {
|
||||
_classname = _classnametmp;
|
||||
_tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
|
||||
_tmpbuilt setdir _dir;
|
||||
_tmpbuilt setVariable["memDir",_dir,true];
|
||||
_location = _position;
|
||||
|
||||
if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then {
|
||||
if ((_isAllowedUnderGround == 0) && {(_location select 2) < 0}) then {
|
||||
_location set [2,0];
|
||||
};
|
||||
|
||||
|
||||
_tmpbuilt setVectorDirAndUp _vector;
|
||||
|
||||
|
||||
_buildOffset = [0,0,0];
|
||||
_vUp = _vector select 1;
|
||||
switch (_classname) do {
|
||||
case "MetalFloor_DZ": { _buildOffset = [(_vUp select 0) * .148, (_vUp select 1) * .148,0]; };
|
||||
};
|
||||
|
||||
|
||||
_location = [
|
||||
(_location select 0) - (_buildOffset select 0),
|
||||
(_location select 1) - (_buildOffset select 1),
|
||||
(_location select 2) - (_buildOffset select 2)
|
||||
];
|
||||
|
||||
|
||||
if (surfaceIsWater _location) then {
|
||||
_tmpbuilt setPosASL _location;
|
||||
_location = ASLtoATL _location;
|
||||
@@ -461,19 +411,19 @@ if (_canBuild select 0) then {
|
||||
_sfx = "repair";
|
||||
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
|
||||
|
||||
|
||||
_finished = ["Medic",1,{player getVariable["combattimeout",0] >= diag_tickTime or DZE_cancelBuilding}] call fn_loopAction;
|
||||
|
||||
if(!_finished) exitWith {
|
||||
if (!_finished) exitWith {
|
||||
_isOk = false;
|
||||
_proceed = false;
|
||||
};
|
||||
|
||||
if(_finished) then {
|
||||
if (_finished) then {
|
||||
_counter = _counter + 1;
|
||||
};
|
||||
|
||||
if(_counter == _limit) exitWith {
|
||||
if (_counter == _limit) exitWith {
|
||||
_isOk = false;
|
||||
_proceed = true;
|
||||
};
|
||||
@@ -482,14 +432,14 @@ if (_canBuild select 0) then {
|
||||
if (_proceed) then {
|
||||
|
||||
_num_removed = ([player,DZE_buildItem] call BIS_fnc_invRemove); //remove item's magazine from inventory
|
||||
if(_num_removed == 1) then {
|
||||
if (_num_removed == 1) then {
|
||||
["Working",0,[20,10,5,0]] call dayz_NutritionSystem;
|
||||
call player_forceSave;
|
||||
[format[localize "str_build_01",_text],1] call dayz_rollingMessages;
|
||||
|
||||
_tmpbuilt setVariable ["OEMPos",_location,true]; //store original location as a variable
|
||||
|
||||
if(_lockable > 1) then { //if item has code lock on it
|
||||
if (_lockable > 1) then { //if item has code lock on it
|
||||
|
||||
_combinationDisplay = ""; //define new display
|
||||
|
||||
@@ -576,7 +526,7 @@ if (_canBuild select 0) then {
|
||||
};
|
||||
if (DZE_GodModeBase && {!(_classname in DZE_GodModeBaseExclude)}) then {
|
||||
_tmpbuilt addEventHandler ["HandleDamage",{false}];
|
||||
};
|
||||
};
|
||||
} else { //if magazine was not removed, cancel publish
|
||||
deleteVehicle _tmpbuilt;
|
||||
localize "str_epoch_player_46" call dayz_rollingMessages;
|
||||
|
||||
@@ -2,17 +2,14 @@
|
||||
DayZ Base Building
|
||||
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
|
||||
*/
|
||||
private ["_location","_pos","_dir","_classname","_item","_cancel","_reason","_finished","_dis","_sfx","_tmpbuilt","_onLadder","_require","_text","_offset","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_canBuildOnPlot","_distance","_classnametmp","_ghost","_lockable","_zheightchanged","_rotate","_combination_1","_combination_2","_combination_3","_combination_4","_combination","_combination_1_Display","_combinationDisplay","_zheightdirection","_abort","_isNear","_needNear","_vehicle","_inVehicle","_objHDiff","_isAllowedUnderGround","_canBuild"];
|
||||
|
||||
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
private ["_location","_pos","_dir","_classname","_item","_cancel","_reason","_finished","_dis","_sfx","_tmpbuilt","_onLadder","_text","_offset","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_distance","_classnametmp","_ghost","_lockable","_zheightchanged","_rotate","_combination_1","_combination_2","_combination_3","_combination_4","_combination","_combination_1_Display","_combinationDisplay","_zheightdirection","_abort","_isNear","_needNear","_vehicle","_inVehicle","_objHDiff","_isAllowedUnderGround","_canBuild","_friendsArr","_vector"];
|
||||
|
||||
_pos = [player] call FNC_GetPos;
|
||||
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
|
||||
_cancel = false;
|
||||
_canBuildOnPlot = false;
|
||||
|
||||
_vehicle = vehicle player;
|
||||
_inVehicle = (_vehicle != player);
|
||||
|
||||
@@ -48,39 +45,35 @@ _reason = "";
|
||||
_needNear = getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "neednearby");
|
||||
|
||||
{
|
||||
switch(_x) do{
|
||||
case "fire":
|
||||
{
|
||||
call {
|
||||
if (_x == "fire") exitwith {
|
||||
_distance = 3;
|
||||
_isNear = {inflamed _x} count (_pos nearObjects _distance);
|
||||
if(_isNear == 0) then {
|
||||
if (_isNear == 0) then {
|
||||
_abort = true;
|
||||
_reason = localize "STR_EPOCH_FIRE";
|
||||
};
|
||||
};
|
||||
case "workshop":
|
||||
{
|
||||
if (_x == "workshop") exitwith {
|
||||
_distance = 3;
|
||||
_isNear = count (nearestObjects [_pos, ["Wooden_shed_DZ","WoodShack_DZ","WorkBench_DZ"], _distance]);
|
||||
if(_isNear == 0) then {
|
||||
if (_isNear == 0) then {
|
||||
_abort = true;
|
||||
_reason = localize "STR_EPOCH_WORKBENCH_NEARBY";
|
||||
};
|
||||
};
|
||||
case "fueltank":
|
||||
{
|
||||
if (_x == "fueltank") exitwith {
|
||||
_distance = 30;
|
||||
_isNear = count (nearestObjects [_pos, dayz_fuelsources, _distance]);
|
||||
if(_isNear == 0) then {
|
||||
if (_isNear == 0) then {
|
||||
_abort = true;
|
||||
_reason = localize "STR_EPOCH_VEHUP_TNK";
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach _needNear;
|
||||
} count _needNear;
|
||||
|
||||
|
||||
if(_abort) exitWith {
|
||||
if (_abort) exitWith {
|
||||
format[localize "str_epoch_player_135",_reason,_distance] call dayz_rollingMessages;
|
||||
dayz_actionInProgress = false;
|
||||
};
|
||||
@@ -89,7 +82,7 @@ _canBuild = [_pos, _item, true] call dze_buildChecks;
|
||||
if (_canBuild select 0) then {
|
||||
_classname = getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "create");
|
||||
_classnametmp = _classname;
|
||||
_require = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> "Build" >> "require");
|
||||
|
||||
if (isText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "buildText")) then {
|
||||
_text = getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "buildText");
|
||||
} else {
|
||||
@@ -98,16 +91,16 @@ if (_canBuild select 0) then {
|
||||
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
|
||||
|
||||
_lockable = 0;
|
||||
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "lockable")) then {
|
||||
if (isNumber (configFile >> "CfgVehicles" >> _classname >> "lockable")) then {
|
||||
_lockable = getNumber(configFile >> "CfgVehicles" >> _classname >> "lockable");
|
||||
};
|
||||
|
||||
_isAllowedUnderGround = 1;
|
||||
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "nounderground")) then {
|
||||
if (isNumber (configFile >> "CfgVehicles" >> _classname >> "nounderground")) then {
|
||||
_isAllowedUnderGround = getNumber(configFile >> "CfgVehicles" >> _classname >> "nounderground");
|
||||
};
|
||||
|
||||
_offset = getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
|
||||
_offset = getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
|
||||
|
||||
_location = [0,0,0];
|
||||
_isOk = true;
|
||||
@@ -121,7 +114,7 @@ if (_canBuild select 0) then {
|
||||
|
||||
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
if((count _offset) <= 0) then {
|
||||
if ((count _offset) <= 0) then {
|
||||
_offset = [0,(abs(((boundingBox _object)select 0) select 1)),0];
|
||||
};
|
||||
|
||||
@@ -180,47 +173,47 @@ if (_canBuild select 0) then {
|
||||
_dir = 0;
|
||||
};
|
||||
|
||||
if(_rotate) then {
|
||||
if (_rotate) then {
|
||||
_object setDir _dir;
|
||||
_object setPosATL _position;
|
||||
//diag_log format["DEBUG Rotate BUILDING POS: %1", _position];
|
||||
};
|
||||
|
||||
if(_zheightchanged) then {
|
||||
if (_zheightchanged) then {
|
||||
detach _object;
|
||||
|
||||
_position = getPosATL _object;
|
||||
|
||||
if(_zheightdirection == "up") then {
|
||||
if (_zheightdirection == "up") then {
|
||||
_position set [2,((_position select 2)+0.1)];
|
||||
_objHDiff = _objHDiff + 0.1;
|
||||
};
|
||||
if(_zheightdirection == "down") then {
|
||||
if (_zheightdirection == "down") then {
|
||||
_position set [2,((_position select 2)-0.1)];
|
||||
_objHDiff = _objHDiff - 0.1;
|
||||
};
|
||||
|
||||
if(_zheightdirection == "up_alt") then {
|
||||
if (_zheightdirection == "up_alt") then {
|
||||
_position set [2,((_position select 2)+1)];
|
||||
_objHDiff = _objHDiff + 1;
|
||||
};
|
||||
if(_zheightdirection == "down_alt") then {
|
||||
if (_zheightdirection == "down_alt") then {
|
||||
_position set [2,((_position select 2)-1)];
|
||||
_objHDiff = _objHDiff - 1;
|
||||
};
|
||||
|
||||
if(_zheightdirection == "up_ctrl") then {
|
||||
if (_zheightdirection == "up_ctrl") then {
|
||||
_position set [2,((_position select 2)+0.01)];
|
||||
_objHDiff = _objHDiff + 0.01;
|
||||
};
|
||||
if(_zheightdirection == "down_ctrl") then {
|
||||
if (_zheightdirection == "down_ctrl") then {
|
||||
_position set [2,((_position select 2)-0.01)];
|
||||
_objHDiff = _objHDiff - 0.01;
|
||||
};
|
||||
|
||||
_object setDir (getDir _object);
|
||||
|
||||
if((_isAllowedUnderGround == 0) && ((_position select 2) < 0)) then {
|
||||
if ((_isAllowedUnderGround == 0) && {(_position select 2) < 0}) then {
|
||||
_position set [2,0];
|
||||
};
|
||||
|
||||
@@ -236,16 +229,17 @@ if (_canBuild select 0) then {
|
||||
|
||||
_location2 = getPosATL player;
|
||||
|
||||
if(DZE_5) exitWith {
|
||||
if (DZE_5) exitWith {
|
||||
_isOk = false;
|
||||
detach _object;
|
||||
_dir = getDir _object;
|
||||
_position = getPosATL _object;
|
||||
_vector = [(vectorDir _object),(vectorUp _object)];
|
||||
//diag_log format["DEBUG BUILDING POS: %1", _position];
|
||||
deleteVehicle _object;
|
||||
};
|
||||
|
||||
if(_location1 distance _location2 > DZE_buildMaxMoveDistance) exitWith {
|
||||
if (_location1 distance _location2 > DZE_buildMaxMoveDistance) exitWith {
|
||||
_isOk = false;
|
||||
_cancel = true;
|
||||
_reason = format[localize "STR_EPOCH_BUILD_FAIL_MOVED",DZE_buildMaxMoveDistance];
|
||||
@@ -253,14 +247,14 @@ if (_canBuild select 0) then {
|
||||
deleteVehicle _object;
|
||||
};
|
||||
|
||||
if(abs(_objHDiff) > DZE_buildMaxHeightDistance) exitWith {
|
||||
if (abs(_objHDiff) > DZE_buildMaxHeightDistance) exitWith {
|
||||
_isOk = false;
|
||||
_cancel = true;
|
||||
_reason = format[localize "STR_EPOCH_BUILD_FAIL_HEIGHT",DZE_buildMaxHeightDistance];
|
||||
detach _object;
|
||||
deleteVehicle _object;
|
||||
};
|
||||
|
||||
|
||||
if (DZE_BuildHeightLimit > 0 && {_position select 2 > DZE_BuildHeightLimit}) exitWith {
|
||||
_isOk = false;
|
||||
_cancel = true;
|
||||
@@ -292,9 +286,9 @@ if (_canBuild select 0) then {
|
||||
};
|
||||
|
||||
// No building in trader zones
|
||||
if(!canbuild) then { _cancel = true; _reason = format[localize "STR_EPOCH_PLAYER_136",localize "STR_EPOCH_TRADER"]; };
|
||||
if (!canbuild) then { _cancel = true; _reason = format[localize "STR_EPOCH_PLAYER_136",localize "STR_EPOCH_TRADER"]; };
|
||||
|
||||
if(!_cancel) then {
|
||||
if (!_cancel) then {
|
||||
|
||||
_classname = _classnametmp;
|
||||
|
||||
@@ -306,7 +300,7 @@ if (_canBuild select 0) then {
|
||||
// Get position based on object
|
||||
_location = _position;
|
||||
|
||||
if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then {
|
||||
if ((_isAllowedUnderGround == 0) && {(_location select 2) < 0}) then {
|
||||
_location set [2,0];
|
||||
};
|
||||
|
||||
@@ -339,16 +333,16 @@ if (_canBuild select 0) then {
|
||||
|
||||
_finished = ["Medic",1,{player getVariable["combattimeout",0] >= diag_tickTime or DZE_cancelBuilding}] call fn_loopAction;
|
||||
|
||||
if(!_finished) exitWith {
|
||||
if (!_finished) exitWith {
|
||||
_isOk = false;
|
||||
_proceed = false;
|
||||
};
|
||||
|
||||
if(_finished) then {
|
||||
if (_finished) then {
|
||||
_counter = _counter + 1;
|
||||
};
|
||||
|
||||
if(_counter == _limit) exitWith {
|
||||
if (_counter == _limit) exitWith {
|
||||
_isOk = false;
|
||||
_proceed = true;
|
||||
};
|
||||
@@ -357,14 +351,14 @@ if (_canBuild select 0) then {
|
||||
if (_proceed) then {
|
||||
|
||||
_num_removed = ([player,_item] call BIS_fnc_invRemove);
|
||||
if(_num_removed == 1) then {
|
||||
if (_num_removed == 1) then {
|
||||
["Working",0,[20,10,5,0]] call dayz_NutritionSystem;
|
||||
call player_forceSave;
|
||||
format[localize "str_build_01",_text] call dayz_rollingMessages;
|
||||
|
||||
_tmpbuilt setVariable ["OEMPos",_location,true];
|
||||
|
||||
if(_lockable > 1) then {
|
||||
if (_lockable > 1) then {
|
||||
|
||||
_combinationDisplay = "";
|
||||
|
||||
@@ -449,7 +443,7 @@ if (_canBuild select 0) then {
|
||||
};
|
||||
if (DZE_GodModeBase && {!(_classname in DZE_GodModeBaseExclude)}) then {
|
||||
_tmpbuilt addEventHandler ["HandleDamage",{false}];
|
||||
};
|
||||
};
|
||||
} else {
|
||||
deleteVehicle _tmpbuilt;
|
||||
localize "str_epoch_player_46" call dayz_rollingMessages;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// July 10 2014 //
|
||||
/*--------------------------------*/
|
||||
|
||||
private ["_object","_objectSnapGizmo","_objColorActive","_objColorInactive","_classname","_whitelist","_points","_radius","_cfg","_cnt","_pos","_findWhitelisted","_nearbyObject","_posNearby","_selectedAction","_newPos","_pointsNearby","_onWater","_waterBase"];
|
||||
//Args
|
||||
private ["_object", "_classname", "_objectHelper", "_selectedAction", "_cfg", "_whitelist", "_points", "_radius"];
|
||||
|
||||
snapActionState = _this select 3 select 0;
|
||||
_object = _this select 3 select 1;
|
||||
_classname = _this select 3 select 2;
|
||||
@@ -17,274 +17,86 @@ _whitelist = getArray (_cfg >> "snapTo");
|
||||
_points = getArray (_cfg >> "points");
|
||||
_radius = getNumber (_cfg >> "radius");
|
||||
|
||||
//colors
|
||||
_objColorActive = "#(argb,8,8,3)color(0,0.92,0.06,1,ca)";
|
||||
_objColorInactive = "#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)";
|
||||
|
||||
|
||||
fnc_snapActionCleanup = {
|
||||
private ["_s1","_s2","_s3","_cnt"];
|
||||
_s1 = _this select 0;
|
||||
_s2 = _this select 1;
|
||||
_s3 = _this select 2;
|
||||
player removeAction s_player_toggleSnap; s_player_toggleSnap = -1;
|
||||
player removeAction s_player_toggleSnapSelect; s_player_toggleSnapSelect = -1;
|
||||
if (count s_player_toggleSnapSelectPoint != 0) then {{player removeAction _x;} count s_player_toggleSnapSelectPoint; s_player_toggleSnapSelectPoint=[]; snapActions = -1;};
|
||||
if (_s1 > 0) then {
|
||||
s_player_toggleSnap = player addaction [format[("<t color=""#ffffff"">" + ("Snap: %1") +"</t>"),snapActionState], "\z\addons\dayz_code\actions\snap_build.sqf",[snapActionState,_object,_classname,_objectHelper],10,false,true];
|
||||
};
|
||||
if (_s2 > 0) then {
|
||||
s_player_toggleSnapSelect = player addaction [format[("<t color=""#ffffff"">" + ("Snap Point: %1") +"</t>"),snapActionStateSelect], "\z\addons\dayz_code\actions\snap_build.sqf",[snapActionStateSelect,_object,_classname,_objectHelper],9,false,true];
|
||||
};
|
||||
if (_s3 > 0) then {
|
||||
s_player_toggleSnapSelectPoint=[];
|
||||
_cnt = 0;
|
||||
{snapActions = player addaction [format[("<t color=""#ffffff"">" + ("%1)Select: %2") +"</t>"),_cnt,_x select 3], "\z\addons\dayz_code\actions\snap_build.sqf",["Selected",_object,_classname,_objectHelper,_cnt],8,false,false];
|
||||
s_player_toggleSnapSelectPoint set [count s_player_toggleSnapSelectPoint,snapActions];
|
||||
_cnt = _cnt+1;
|
||||
}count _points;
|
||||
};
|
||||
};
|
||||
|
||||
fnc_initSnapPoints = {
|
||||
snapGizmos = [];
|
||||
{
|
||||
_objectSnapGizmo = "Sign_sphere10cm_EP1" createVehicleLocal [0,0,0];
|
||||
_objectSnapGizmo setobjecttexture [0,_objColorInactive];
|
||||
_objectSnapGizmo attachTo [_object,[_x select 0,_x select 1,_x select 2]];
|
||||
snapGizmos set [count snapGizmos,_objectSnapGizmo];
|
||||
} count _points;
|
||||
};
|
||||
|
||||
fnc_initSnapPointsNearby = {
|
||||
_pos = [_object] call FNC_GetPos;
|
||||
_findWhitelisted = []; _pointsNearby = [];
|
||||
_findWhitelisted = nearestObjects [_pos,_whitelist,(_radius + DZE_snapExtraRange)]-[_object];
|
||||
snapGizmosNearby = [];
|
||||
{
|
||||
_nearbyObject = _x;
|
||||
_pointsNearby = getArray (configFile >> "SnapBuilding" >> (typeOf _x) >> "points");
|
||||
{
|
||||
_objectSnapGizmo = "Sign_sphere10cm_EP1" createVehicleLocal [0,0,0];
|
||||
_objectSnapGizmo setobjecttexture [0,_objColorInactive];
|
||||
//_objectSnapGizmo setDir (getDir _nearbyObject);
|
||||
_objectSnapGizmo setDir (_nearbyObject getVariable["memDir",0]);
|
||||
_posNearby = _nearbyObject modelToWorld [_x select 0,_x select 1,_x select 2];
|
||||
if (surfaceIsWater _posNearby) then {
|
||||
_objectSnapGizmo setPosASL [(_posNearby) select 0,(_posNearby) select 1,(getPosASL _nearbyObject select 2) + (_x select 2)];
|
||||
} else {
|
||||
_objectSnapGizmo setPosATL _posNearby;
|
||||
};
|
||||
snapGizmosNearby set [count snapGizmosNearby,_objectSnapGizmo];
|
||||
} count _pointsNearby;
|
||||
} forEach _findWhitelisted;
|
||||
};
|
||||
|
||||
fnc_initSnapPointsCleanup = {
|
||||
{detach _x;deleteVehicle _x;}count snapGizmos;snapGizmos=[];
|
||||
{detach _x;deleteVehicle _x;}count snapGizmosNearby;snapGizmosNearby=[];
|
||||
snapActionState = "OFF";
|
||||
};
|
||||
|
||||
fnc_snapDistanceCheck = {
|
||||
while {snapActionState != "OFF"} do {
|
||||
private ["_distClosestPointFound","_distCheck","_distClosest","_distClosestPoint","_testXPos","_testXDir","_distClosestPointFoundPos","_distClosestPointFoundDir","_distClosestAttached","_distCheckAttached","_distClosestAttachedFoundPos"];
|
||||
_distClosestPointFound = objNull; _distCheck = 0; _distClosest = 10; _distClosestPoint = objNull; _testXPos = []; _distClosestPointFoundPos =[]; _distClosestPointFoundDir = 0;
|
||||
{
|
||||
if (_x !=_distClosestPointFound) then {_x setobjecttexture [0,_objColorInactive];};
|
||||
_testXPos = [_x] call FNC_GetPos;
|
||||
_distCheck = _objectHelper distance _testXPos;
|
||||
_distClosestPoint = _x;
|
||||
if (_distCheck < _distClosest) then {
|
||||
_distClosest = _distCheck;
|
||||
_distClosestPointFound setobjecttexture [0,_objColorInactive];
|
||||
_distClosestPointFound = _x;
|
||||
_distClosestPointFound setobjecttexture [0,_objColorActive];
|
||||
};
|
||||
} count snapGizmosNearby;
|
||||
|
||||
if (!isNull _distClosestPointFound) then {
|
||||
if (snapActionStateSelect == "Manual") then {
|
||||
if (helperDetach) then {
|
||||
_onWater = surfaceIsWater position _distClosestPointFound;
|
||||
_distClosestPointFoundDir = getDir _distClosestPointFound;
|
||||
if (_onWater) then {
|
||||
_distClosestPointFoundPos = getPosASL _distClosestPointFound;
|
||||
_objectHelper setPosASL _distClosestPointFoundPos;
|
||||
} else {
|
||||
_distClosestPointFoundPos = getPosATL _distClosestPointFound;
|
||||
_objectHelper setPosATL _distClosestPointFoundPos;
|
||||
};
|
||||
//_objectHelper setDir _distClosestPointFoundDir;
|
||||
DZE_memDir = _distClosestPointFoundDir;
|
||||
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
|
||||
waitUntil {uiSleep 0.1; !helperDetach};
|
||||
};
|
||||
} else {
|
||||
_distClosestAttached = objNull; _distCheckAttached = 0; _distClosest = 10; _distClosestAttachedFoundPos = [];
|
||||
{
|
||||
if (_x !=_distClosestAttached) then {_x setobjecttexture [0,_objColorInactive];};
|
||||
_testXPos = [_x] call FNC_GetPos;
|
||||
_distCheckAttached = _distClosestPointFound distance _testXPos;
|
||||
_distClosestPoint = _x;
|
||||
if (_distCheckAttached < _distClosest) then {
|
||||
_distClosest = _distCheckAttached;
|
||||
_distClosestAttached setobjecttexture [0,_objColorInactive];
|
||||
_distClosestAttached = _x;
|
||||
_distClosestAttached setobjecttexture [0,_objColorActive];
|
||||
};
|
||||
} count snapGizmos;
|
||||
|
||||
if (helperDetach) then {
|
||||
_distClosestPointFoundDir = getDir _distClosestPointFound;
|
||||
_onWater = surfaceIsWater position _distClosestPointFound;
|
||||
if (_onWater) then {
|
||||
_distClosestPointFoundPos = getPosASL _distClosestPointFound;
|
||||
_distClosestAttachedFoundPos = getPosASL _distClosestAttached;
|
||||
detach _object;
|
||||
_objectHelper setPosASL _distClosestAttachedFoundPos;
|
||||
_object attachTo [_objectHelper];
|
||||
_objectHelper setPosASL _distClosestPointFoundPos;
|
||||
} else {
|
||||
_distClosestPointFoundPos = getPosATL _distClosestPointFound;
|
||||
_distClosestAttachedFoundPos = getPosATL _distClosestAttached;
|
||||
detach _object;
|
||||
_objectHelper setPosATL _distClosestAttachedFoundPos;
|
||||
_object attachTo [_objectHelper];
|
||||
_objectHelper setPosATL _distClosestPointFoundPos;
|
||||
};
|
||||
//_objectHelper setDir _distClosestPointFoundDir;
|
||||
DZE_memDir = _distClosestPointFoundDir;
|
||||
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
|
||||
waitUntil {uiSleep 0.1; !helperDetach};
|
||||
};
|
||||
};
|
||||
};
|
||||
uiSleep 0.1;
|
||||
};
|
||||
};
|
||||
|
||||
fnc_initSnapTutorial = {
|
||||
/*
|
||||
Shows help dialog for player ONCE per log in, explaining controls.
|
||||
Add snapTutorial = false; to your init.sqf to disable this tutorial completely.
|
||||
You can also add this bool to the end of this function to only show tutorial once per player login (not recommended)
|
||||
*/
|
||||
private ["_bldTxtSwitch","_bldTxtEnable","_bldTxtClrO","_bldTxtClrW","_bldTxtClrR","_bldTxtClrG","_bldTxtSz","_bldTxtSzT","_bldTxtShdw","_bldTxtAlgnL","_bldTxtUndrln","_bldTxtBold","_bldTxtFinal","_bldTxtStringTitle","_bldTxtStringSD","_bldTxtStringSE","_bldTxtStringSA","_bldTxtStringSM","_bldTxtStringPG","_bldTxtStringAPG","_bldTxtStringCPG","_bldTxtStringQE","_bldTxtStringQEF","_bldTxtStringFD","_bldTxtStringFS"];
|
||||
if (isNil "snapTutorial") then {
|
||||
_bldTxtSwitch = _this select 0;
|
||||
_bldTxtEnable = _this select 1;
|
||||
_bldTxtClrO = "color='#ff8800'"; //orange
|
||||
_bldTxtClrW = "color='#ffffff'"; //white
|
||||
_bldTxtClrR = "color='#fd0a05'"; //red
|
||||
_bldTxtClrG = "color='#11ef00'"; //green
|
||||
_bldTxtSz = "size='0.76'"; //Title font size
|
||||
_bldTxtSzT = "size='0.4'"; //Text font size
|
||||
_bldTxtShdw = "shadow='1'"; //Font shadow
|
||||
_bldTxtAlgnL = "align='left'"; //Text align left
|
||||
_bldTxtUndrln = "underline='true'";
|
||||
_bldTxtBold = "font='Zeppelin33'"; //Bold text
|
||||
_bldTxtFinal = "";
|
||||
|
||||
//Delete on init
|
||||
800 cutRsc ["Default", "PLAIN"];
|
||||
uiSleep 0.1;
|
||||
|
||||
//Init Tutorial text
|
||||
if (_bldTxtEnable) then {
|
||||
_bldTxtStringTitle = format ["<t %1%2%3%4%6>Epoch<t %5%7> Snap Building</t></t><br />",_bldTxtClrW,_bldTxtSz,_bldTxtShdw,_bldTxtAlgnL,_bldTxtClrO,_bldTxtUndrln,_bldTxtBold];
|
||||
_bldTxtStringSD = format["<t %1%4%5%6>[Snap]<t %2> Disabled:</t> <t %3>use action menu to enable.</t></t><br /><br />",_bldTxtClrO,_bldTxtClrR,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL];
|
||||
_bldTxtStringSE = format["<t %1%4%5%6>[Snap]<t %2> Enabled:</t> <t %3>use action menu to disable.</t></t><br /><br />",_bldTxtClrO,_bldTxtClrG,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL];
|
||||
_bldTxtStringSA = format["<t %1%3%4%5>[Auto]<t %2>: Automatic snap point detection.</t></t><br /><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL];
|
||||
_bldTxtStringSM = format["<t %1%3%4%5>[Manual]<t %2>: Select your preferred snap point.</t></t><br /><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL];
|
||||
_bldTxtStringPG = format["<t %1%3%4%5>[PgUP / PgDOWN]<t %2>: Adjust height of object by 10cm</t></t><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL];
|
||||
_bldTxtStringAPG = format["<t %1%3%4%5>[Alt]+[PgUP / PgDOWN]<t %2>: Adjust height of object by 1m</t></t><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL];
|
||||
_bldTxtStringCPG = format["<t %1%3%4%5>[Ctrl]+[PgUP / PgDOWN]<t %2>: Adjust height of object by 1cm</t></t><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL];
|
||||
_bldTxtStringQE = format["<t %1%3%4%5>[Q / E]<t %2>: Rotate object 180 degrees while holding.</t></t><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL];
|
||||
_bldTxtStringQEF = format["<t %1%3%4%5>[Q / E]<t %2>: Rotate object 45 degrees while dropped or snapped.</t></t><br /><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL];
|
||||
_bldTxtStringFD = format["<t %1%3%4%5>[F]<t %2>: Drop / Pick up object.</t></t><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL];
|
||||
_bldTxtStringFS = format["<t %1%3%4%5>[F]<t %2>: Snap / Pick up object.</t></t><br />",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL];
|
||||
switch (_bldTxtSwitch) do {
|
||||
case "init": {
|
||||
_bldTxtFinal = _bldTxtStringTitle + _bldTxtStringSD + _bldTxtStringPG + _bldTxtStringAPG + _bldTxtStringCPG + _bldTxtStringQE + _bldTxtStringQEF + _bldTxtStringFD;
|
||||
};
|
||||
case "OnAuto": {
|
||||
_bldTxtFinal = _bldTxtStringTitle + _bldTxtStringSE + _bldTxtStringSA + _bldTxtStringPG + _bldTxtStringAPG + _bldTxtStringCPG + _bldTxtStringQE + _bldTxtStringQEF + _bldTxtStringFS;
|
||||
};
|
||||
case "manual": {
|
||||
_bldTxtFinal = _bldTxtStringTitle + _bldTxtStringSE + _bldTxtStringSM + _bldTxtStringPG + _bldTxtStringAPG + _bldTxtStringCPG + _bldTxtStringQE + _bldTxtStringQEF + _bldTxtStringFS;
|
||||
};
|
||||
};
|
||||
|
||||
[
|
||||
_bldTxtFinal, //structured text
|
||||
0.73 * safezoneW + safezoneX, //number - x
|
||||
0.65 * safezoneH + safezoneY, //number - y
|
||||
30, //number - duration
|
||||
1, // number - fade in time
|
||||
0, // number - delta y
|
||||
800 //number - layer ID
|
||||
] spawn bis_fnc_dynamicText;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
switch (snapActionState) do {
|
||||
case "Init": {
|
||||
call {
|
||||
if (snapActionState == "Init") exitwith {
|
||||
["init",true] call fnc_initSnapTutorial;
|
||||
snapActionState = "OFF";
|
||||
[1,0,0] call fnc_snapActionCleanup;
|
||||
[] spawn {
|
||||
while {true} do {
|
||||
if(!dayz_actionInProgress || DZE_cancelBuilding) exitWith {call fnc_initSnapPointsCleanup;[0,0,0] call fnc_snapActionCleanup; ["",false] call fnc_initSnapTutorial; snapActionState = "OFF";};
|
||||
uiSleep 2;
|
||||
snapActionState = localize "STR_EPOCH_ACTION_SNAP_OFF";
|
||||
[1,0,0,_object,_classname,_objectHelper,_points] call fnc_snapActionCleanup;
|
||||
|
||||
[_object,_classname,_objectHelper,_points] spawn {
|
||||
private ["_object", "_classname", "_objectHelper", "_points"];
|
||||
|
||||
_object = _this select 0;
|
||||
_classname = _this select 1;
|
||||
_objectHelper = _this select 2;
|
||||
_points = _this select 3;
|
||||
|
||||
while {1==1} do {
|
||||
if (DZE_cancelBuilding || {!dayz_actionInProgress}) exitWith {
|
||||
call fnc_initSnapPointsCleanup;
|
||||
[0,0,0,_object,_classname,_objectHelper,_points] call fnc_snapActionCleanup;
|
||||
["",false] call fnc_initSnapTutorial;
|
||||
snapActionState = localize "STR_EPOCH_ACTION_SNAP_OFF";
|
||||
};
|
||||
|
||||
uiSleep 2;
|
||||
};
|
||||
};
|
||||
};
|
||||
case "OFF": {
|
||||
if (snapActionState == localize "STR_EPOCH_ACTION_SNAP_OFF") exitwith {
|
||||
["OnAuto",true] call fnc_initSnapTutorial;
|
||||
snapActionState = "ON"; snapActionStateSelect = "Auto";
|
||||
[1,1,0] call fnc_snapActionCleanup;
|
||||
call fnc_initSnapPoints;
|
||||
call fnc_initSnapPointsNearby;
|
||||
snapActionState = localize "STR_EPOCH_ACTION_SNAP_ON";
|
||||
snapActionStateSelect = "Auto";
|
||||
[1,1,0,_object,_classname,_objectHelper,_points] call fnc_snapActionCleanup;
|
||||
[_object,_points] call fnc_initSnapPoints;
|
||||
[_object,_whitelist,_radius] call fnc_initSnapPointsNearby;
|
||||
uiSleep 0.25;
|
||||
call fnc_snapDistanceCheck;
|
||||
[_object,_objectHelper] call fnc_snapDistanceCheck;
|
||||
};
|
||||
|
||||
case "ON": {
|
||||
|
||||
if (snapActionState == localize "STR_EPOCH_ACTION_SNAP_ON") exitwith {
|
||||
["init",true] call fnc_initSnapTutorial;
|
||||
snapActionState = "OFF";
|
||||
[1,0,0] call fnc_snapActionCleanup;
|
||||
snapActionState = localize "STR_EPOCH_ACTION_SNAP_OFF";
|
||||
[1,0,0,_object,_classname,_objectHelper,_points] call fnc_snapActionCleanup;
|
||||
call fnc_initSnapPointsCleanup;
|
||||
};
|
||||
|
||||
case "Auto": {
|
||||
|
||||
if (snapActionState == "Auto") exitwith {
|
||||
["manual",true] call fnc_initSnapTutorial;
|
||||
snapActionState = "ON";snapActionStateSelect = "Manual";
|
||||
[1,1,1] call fnc_snapActionCleanup;
|
||||
snapActionState = localize "STR_EPOCH_ACTION_SNAP_ON";
|
||||
snapActionStateSelect = localize "STR_EPOCH_ACTION_SNAP_POINT_MANUAL";
|
||||
[1,1,1,_object,_classname,_objectHelper,_points] call fnc_snapActionCleanup;
|
||||
};
|
||||
|
||||
case "Manual": {
|
||||
|
||||
if (snapActionState == localize "STR_EPOCH_ACTION_SNAP_POINT_MANUAL") exitwith {
|
||||
["OnAuto",true] call fnc_initSnapTutorial;
|
||||
snapActionState = "ON";snapActionStateSelect = "Auto";
|
||||
[1,1,0] call fnc_snapActionCleanup;
|
||||
snapActionState = localize "STR_EPOCH_ACTION_SNAP_ON";
|
||||
snapActionStateSelect = "Auto";
|
||||
[1,1,0,_object,_classname,_objectHelper,_points] call fnc_snapActionCleanup;
|
||||
};
|
||||
|
||||
case "Selected": { _cnt = 0; _newPos = [];
|
||||
{
|
||||
_x setobjecttexture [0,_objColorInactive];
|
||||
if (_cnt == _selectedAction) then {
|
||||
_newPos = [(getPosATL _x select 0),(getPosATL _x select 1),(getPosATL _x select 2)];
|
||||
detach _object;
|
||||
detach _objectHelper;
|
||||
_objectHelper setDir (getDir _object);
|
||||
_objectHelper setPosATL _newPos;
|
||||
_object attachTo [_objectHelper];
|
||||
_x setobjecttexture [0,_objColorActive];
|
||||
if (!helperDetach) then {_objectHelper attachTo [player]; _objectHelper setDir ((getDir _objectHelper)-(getDir player));};
|
||||
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
|
||||
};
|
||||
_cnt = _cnt+1;
|
||||
}count snapGizmos;
|
||||
|
||||
if (snapActionState == "Selected") exitwith {
|
||||
private ["_cnt", "_newPos"];
|
||||
|
||||
_cnt = 0;
|
||||
_newPos = [];
|
||||
{
|
||||
_x setobjecttexture [0,"#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)"];
|
||||
if (_cnt == _selectedAction) then {
|
||||
_newPos = [(getPosATL _x select 0),(getPosATL _x select 1),(getPosATL _x select 2)];
|
||||
detach _object;
|
||||
detach _objectHelper;
|
||||
_objectHelper setDir (getDir _object);
|
||||
_objectHelper setPosATL _newPos;
|
||||
_object attachTo [_objectHelper];
|
||||
_x setobjecttexture [0,"#(argb,8,8,3)color(0,0.92,0.06,1,ca)"];
|
||||
if (!helperDetach) then {
|
||||
_objectHelper attachTo [player];
|
||||
_objectHelper setDir ((getDir _objectHelper)-(getDir player));
|
||||
};
|
||||
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
|
||||
};
|
||||
_cnt = _cnt + 1;
|
||||
} count snapGizmos;
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user