From fe1d7fb48d9eb1c1eea72927fdef2320f1b09fc7 Mon Sep 17 00:00:00 2001 From: A Man Date: Sun, 8 Mar 2020 14:08:45 +0100 Subject: [PATCH] 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 --- SQF/dayz_code/Configs/CfgExtra/snappoints.hpp | 286 ++++++++------- .../CfgVehicles/DZE/ModularBuilding.hpp | 4 +- SQF/dayz_code/actions/modular_build.sqf | 170 ++++----- SQF/dayz_code/actions/player_build.sqf | 86 +++-- SQF/dayz_code/actions/snap_build.sqf | 326 ++++-------------- .../compile/BuildVectors/build_vectors.sqf | 139 +++----- .../BuildVectors/fnc_SetPitchBankYaw.sqf | 46 --- .../compile/BuildVectors/vector_functions.sqf | 113 ++++++ SQF/dayz_code/compile/snap_functions.sqf | 255 ++++++++++++++ SQF/dayz_code/init/compiles.sqf | 7 +- SQF/dayz_code/stringtable.xml | 148 ++++++++ 11 files changed, 880 insertions(+), 700 deletions(-) delete mode 100644 SQF/dayz_code/compile/BuildVectors/fnc_SetPitchBankYaw.sqf create mode 100644 SQF/dayz_code/compile/BuildVectors/vector_functions.sqf create mode 100644 SQF/dayz_code/compile/snap_functions.sqf diff --git a/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp b/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp index 75af544fe..78c04f64a 100644 --- a/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp +++ b/SQF/dayz_code/Configs/CfgExtra/snappoints.hpp @@ -21,76 +21,76 @@ class SnapBuilding { }; class Land_HBarrier5Preview: Barrier{ //fix for broken offsets in ghost points[] = { - {0,0,0,"Pivot"}, - {0,-0.75,0.1,"Back"}, - {0,0.75,0.1,"Front"}, - {-2.85,0,0.1,"Left"}, - {2.85,0,0.1,"Right"}, - {0,0,0.9,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {0,-0.75,0.1,$STR_EPOCH_ACTION_SNAP_BACK}, + {0,0.75,0.1,$STR_EPOCH_ACTION_SNAP_FRONT}, + {-2.85,0,0.1,$STR_EPOCH_ACTION_SNAP_LEFT}, + {2.85,0,0.1,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0,0,0.9,$STR_EPOCH_ACTION_SNAP_TOP} }; }; class Land_HBarrier5_DZ: Land_HBarrier5Preview { points[] = { - {0,0,0,"Pivot"}, - {0,-0.75,0,"Back"}, - {0,0.75,0,"Front"}, - {-2.85,0,0,"Left"}, - {2.85,0,0,"Right"}, - {0,0,0.9,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {0,-0.75,0,$STR_EPOCH_ACTION_SNAP_BACK}, + {0,0.75,0,$STR_EPOCH_ACTION_SNAP_FRONT}, + {-2.85,0,0,$STR_EPOCH_ACTION_SNAP_LEFT}, + {2.85,0,0,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0,0,0.9,$STR_EPOCH_ACTION_SNAP_TOP} }; }; class Land_HBarrier3ePreview: Barrier { //whitelist inheritance points[] = { - {0,0,0,"Pivot"}, - {0,-0.75,0,"Back"}, - {0,0.75,0,"Front"}, - {-1.7,0,0,"Left"}, - {1.7,0,0,"Right"}, - {0,0,0.9,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {0,-0.75,0,$STR_EPOCH_ACTION_SNAP_BACK}, + {0,0.75,0,$STR_EPOCH_ACTION_SNAP_FRONT}, + {-1.7,0,0,$STR_EPOCH_ACTION_SNAP_LEFT}, + {1.7,0,0,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0,0,0.9,$STR_EPOCH_ACTION_SNAP_TOP} }; }; class Land_HBarrier3_DZ: Land_HBarrier3ePreview{}; //point inheritance class Land_HBarrier1Preview: Barrier { points[] = { - {0,0,0,"Pivot"}, - {0,-0.75,0,"Back"}, - {0,0.75,0,"Front"}, - {-0.6,0,0,"Left"}, - {0.6,0,0,"Right"}, - {0,0,0.9,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {0,-0.75,0,$STR_EPOCH_ACTION_SNAP_BACK}, + {0,0.75,0,$STR_EPOCH_ACTION_SNAP_FRONT}, + {-0.6,0,0,$STR_EPOCH_ACTION_SNAP_LEFT}, + {0.6,0,0,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0,0,0.9,$STR_EPOCH_ACTION_SNAP_TOP} }; }; class Land_HBarrier1_DZ: Land_HBarrier1Preview{}; class Fort_RazorWirePreview: Barrier { points[] = { - {0,0,0,"Pivot"}, - {0,-0.95,-0.3,"Back"}, - {0,0.95,-0.3,"Front"}, - {-4.1,0,-0.3,"Left"}, - {4.1,0,-0.3,"Right"}, - {0,0,1,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {0,-0.95,-0.3,$STR_EPOCH_ACTION_SNAP_BACK}, + {0,0.95,-0.3,$STR_EPOCH_ACTION_SNAP_FRONT}, + {-4.1,0,-0.3,$STR_EPOCH_ACTION_SNAP_LEFT}, + {4.1,0,-0.3,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0,0,1,$STR_EPOCH_ACTION_SNAP_TOP} }; }; class Fort_RazorWire: Fort_RazorWirePreview {}; class Sandbag1_DZ: Barrier { points[] = { - {0,0,0,"Pivot"}, - {-1.5,0,0,"Left"}, - {1.5,0,0,"Right"}, - {0,0,0.4,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {-1.5,0,0,$STR_EPOCH_ACTION_SNAP_LEFT}, + {1.5,0,0,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0,0,0.4,$STR_EPOCH_ACTION_SNAP_TOP} }; }; class BagFenceRound_DZ: Barrier { points[] = { - {0,0,0,"Pivot"}, - {-1.295,0.38,0,"Left"}, - {1.295,0.38,0,"Right"}, - {0,0,0.4,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {-1.295,0.38,0,$STR_EPOCH_ACTION_SNAP_LEFT}, + {1.295,0.38,0,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0,0,0.4,$STR_EPOCH_ACTION_SNAP_TOP} }; }; @@ -130,50 +130,50 @@ class SnapBuilding { class WoodFloorQuarter_Preview_DZ: FloorsWallsStairs { //fix for broken offsets in ghost points[] = { - {0,0,0,"Pivot"}, - {0,-1.23,0,"Back"}, - {0,1.23,0,"Front"}, - {-1.24,0,0,"Left"}, - {1.24,0,0,"Right"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {0,-1.23,0,$STR_EPOCH_ACTION_SNAP_BACK}, + {0,1.23,0,$STR_EPOCH_ACTION_SNAP_FRONT}, + {-1.24,0,0,$STR_EPOCH_ACTION_SNAP_LEFT}, + {1.24,0,0,$STR_EPOCH_ACTION_SNAP_RIGHT} }; }; class WoodFloorQuarter_DZ: FloorsWallsStairs { points[] = { - {0,0,0,"Pivot"}, - {0,-1.23,0.137726,"Back"}, - {0,1.23,0.137726,"Front"}, - {-1.24,0,0.137726,"Left"}, - {1.24,0,0.137726,"Right"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {0,-1.23,0.137726,$STR_EPOCH_ACTION_SNAP_BACK}, + {0,1.23,0.137726,$STR_EPOCH_ACTION_SNAP_FRONT}, + {-1.24,0,0.137726,$STR_EPOCH_ACTION_SNAP_LEFT}, + {1.24,0,0.137726,$STR_EPOCH_ACTION_SNAP_RIGHT} }; }; class WoodFloorHalf_Preview_DZ: FloorsWallsStairs { //fix for broken offsets in ghost points[] = { - {0,0,0,"Pivot"}, - {0,-2.34,0,"Back"}, - {0,2.34,0,"Front"}, - {-1.25,0,0,"Left"}, - {1.25,0,0,"Right"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {0,-2.34,0,$STR_EPOCH_ACTION_SNAP_BACK}, + {0,2.34,0,$STR_EPOCH_ACTION_SNAP_FRONT}, + {-1.25,0,0,$STR_EPOCH_ACTION_SNAP_LEFT}, + {1.25,0,0,$STR_EPOCH_ACTION_SNAP_RIGHT} }; }; class WoodFloorHalf_DZ: FloorsWallsStairs{ points[] = { - {0,0,0,"Pivot"}, - {0,-2.34,0.1407,"Back"}, - {0,2.34,0.1407,"Front"}, - {-1.25,0,0.1407,"Left"}, - {1.25,0,0.1407,"Right"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {0,-2.34,0.1407,$STR_EPOCH_ACTION_SNAP_BACK}, + {0,2.34,0.1407,$STR_EPOCH_ACTION_SNAP_FRONT}, + {-1.25,0,0.1407,$STR_EPOCH_ACTION_SNAP_LEFT}, + {1.25,0,0.1407,$STR_EPOCH_ACTION_SNAP_RIGHT} }; }; class WoodFloor_Preview_DZ: FloorsWallsStairs { points[] = { - {0,0,0,"Pivot"}, - {0,-2.33,0.130,"Back"}, - {0,2.33,0.130,"Front"}, - {-2.495,0,0.130,"Left"}, - {2.495,0,0.130,"Right"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {0,-2.33,0.130,$STR_EPOCH_ACTION_SNAP_BACK}, + {0,2.33,0.130,$STR_EPOCH_ACTION_SNAP_FRONT}, + {-2.495,0,0.130,$STR_EPOCH_ACTION_SNAP_LEFT}, + {2.495,0,0.130,$STR_EPOCH_ACTION_SNAP_RIGHT} }; radius = 10; }; @@ -181,11 +181,11 @@ class SnapBuilding { class Stairs_DZE: FloorsWallsStairs { points[] = { - {0,0,0,"Pivot"}, - {1.56055,-0.78,1.5,"Back"}, - {1.56055,0.78,1.5,"Front"}, - {1.73926,0.05,2.9,"Top"}, - {-1.73926,0.05,0,"Bottom"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {1.56055,-0.78,1.5,$STR_EPOCH_ACTION_SNAP_BACK}, + {1.56055,0.78,1.5,$STR_EPOCH_ACTION_SNAP_FRONT}, + {1.73926,0.05,2.9,$STR_EPOCH_ACTION_SNAP_TOP}, + {-1.73926,0.05,0,$STR_EPOCH_ACTION_SNAP_BOTTOM} }; }; class WoodStairs_DZ: Stairs_DZE {}; @@ -195,10 +195,10 @@ class SnapBuilding { class WoodSmall_DZE: FloorsWallsStairs { // Small wood walls points[] = { - {0,0,0,"Pivot"}, - {-2.285, 0, 1.5,"Left"}, - {2.285, 0, 1.5,"Right"}, - {0, 0, 3,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {-2.285, 0, 1.5,$STR_EPOCH_ACTION_SNAP_LEFT}, + {2.285, 0, 1.5,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0, 0, 3,$STR_EPOCH_ACTION_SNAP_TOP} }; }; class WoodSmallWallDoor_Preview_DZ: WoodSmall_DZE {}; @@ -213,10 +213,10 @@ class SnapBuilding { class WoodLarge_DZE: FloorsWallsStairs { //Large wood walls points[] = { - {0,0,0,"Pivot"}, - {-2.45, 0, 1.5,"Left"}, - {2.45, 0, 1.5,"Right"}, - {0, 0, 3,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {-2.45, 0, 1.5,$STR_EPOCH_ACTION_SNAP_LEFT}, + {2.45, 0, 1.5,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0, 0, 3,$STR_EPOCH_ACTION_SNAP_TOP} }; }; class WoodLargeWall_Preview_DZ: WoodLarge_DZE {}; @@ -224,10 +224,10 @@ class SnapBuilding { class WoodLargeWallDoor_Preview_DZ: WoodLarge_DZE {}; class WoodSmallWallThird_Preview_DZ: WoodLarge_DZE { points[] = { - {0,0,0,"Pivot"}, - {-2.445, 0, 1.5,"Left"}, - {2.445, 0, 1.5,"Right"}, - {0, 0, 1.17,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {-2.445, 0, 1.5,$STR_EPOCH_ACTION_SNAP_LEFT}, + {2.445, 0, 1.5,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0, 0, 1.17,$STR_EPOCH_ACTION_SNAP_TOP} }; }; class WoodSmallWallThird_DZ: WoodSmallWallThird_Preview_DZ{}; @@ -243,41 +243,33 @@ class SnapBuilding { class Cinder_DZE: FloorsWallsStairs { //All cinder walls and doors points[] = { - {0,0,0,"Pivot"}, - {-2.64, 0, 1.685,"Left"}, - {2.64, 0, 1.685,"Right"}, - {0, 0, 3.37042,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_BOTTOM}, + {-2.64, 0, 1.685,$STR_EPOCH_ACTION_SNAP_LEFT}, + {2.64, 0, 1.685,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0, 0, 3.37042,$STR_EPOCH_ACTION_SNAP_TOP} }; radius = 10; }; - class CinderWall_Preview_DZ: Cinder_DZE { - points[] = { - {0,0,0,"Pivot"}, - {-2.64, 0, -0.009,"Left"}, - {2.64, 0, -0.009,"Right"}, - {0, 0, 1.685,"Top"}, - {0,0,-1.685,"Bottom"} - }; - }; class CinderWallDoorway_Preview_DZ: Cinder_DZE {}; class CinderWallSmallDoorway_Preview_DZ: Cinder_DZE {}; class CinderWallHalf_Preview_DZ: Cinder_DZE { points[] = { - {0,0,0,"Pivot"}, - {-2.64, 0, 1.685,"Left"}, - {2.64, 0, 1.685,"Right"}, - {0, 0, 1.5,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_BOTTOM}, + {-2.64, 0, 1.685,$STR_EPOCH_ACTION_SNAP_LEFT}, + {2.64, 0, 1.685,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0, 0, 1.5,$STR_EPOCH_ACTION_SNAP_TOP} }; }; class CinderWall_DZ: Cinder_DZE { points[] = { - {0,0,0,"Pivot"}, - {-2.64, 0, 1.685,"Left"}, - {2.64, 0, 1.685,"Right"}, - {0, 0, 3.37042,"Top"}, - {0,0,-1.685,"Bottom"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_BOTTOM}, + {-2.64, 0, 1.685,$STR_EPOCH_ACTION_SNAP_LEFT}, + {2.64, 0, 1.685,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0, 0, 3.37042,$STR_EPOCH_ACTION_SNAP_TOP} }; }; + class CinderWall_Preview_DZ: CinderWall_DZ {}; + class CinderWallDoorway_DZ: Cinder_DZE {}; class CinderWallDoorLocked_DZ: Cinder_DZE {}; class CinderWallDoor_DZ: Cinder_DZE {}; @@ -285,35 +277,27 @@ class SnapBuilding { class CinderWallDoorSmallLocked_DZ: Cinder_DZE {}; class CinderWallHalf_DZ: Cinder_DZE { points[] = { - {0,0,0,"Pivot"}, - {-2.64, 0, 1.685,"Left"}, - {2.64, 0, 1.685,"Right"}, - {0, 0, 1.5,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {-2.64, 0, 1.685,$STR_EPOCH_ACTION_SNAP_LEFT}, + {2.64, 0, 1.685,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0, 0, 1.5,$STR_EPOCH_ACTION_SNAP_TOP} }; }; class CinderWallDoorSmall_DZ: Cinder_DZE {}; - - class MetalFloor_Preview_DZ: FloorsWallsStairs { - points[] = { - {0,0,0.011,"Pivot"}, - {0, -2.64, 0.025,"Back"}, - {0, 2.64, 0.025,"Front"}, - {-2.64, 0, 0.025,"Left"}, - {2.64, 0, 0.025,"Right"} - }; - radius = 12; - }; + class MetalFloor_DZ: FloorsWallsStairs{ points[] = { - {0,0,0,"Pivot"}, - {0, -2.64, 0.166,"Back"}, - {0, 2.64, 0.166,"Front"}, - {-2.64, 0, 0.166,"Left"}, - {2.64, 0, 0.166,"Right"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {0, -2.64, 0.025,$STR_EPOCH_ACTION_SNAP_BACK}, + {0, 2.64, 0.025,$STR_EPOCH_ACTION_SNAP_FRONT}, + {-2.64, 0, 0.025,$STR_EPOCH_ACTION_SNAP_LEFT}, + {2.64, 0, 0.025,$STR_EPOCH_ACTION_SNAP_RIGHT} }; radius = 12; }; + class MetalFloor_Preview_DZ: MetalFloor_DZ {}; + //Non essential Items that only snap to themselves, do whitelist inheritance if you want these to snap class WoodCrate_DZ { snapTo[] = { @@ -321,12 +305,12 @@ class SnapBuilding { }; radius = 5; points[] = { - {0,0,0,"Pivot"}, - {0,-0.47,0,"Back"}, - {0,0.47,0,"Front"}, - {-0.47,0,0,"Left"}, - {0.47,0,0,"Right"}, - {0,0,0.47,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {0,-0.47,0,$STR_EPOCH_ACTION_SNAP_BACK}, + {0,0.47,0,$STR_EPOCH_ACTION_SNAP_FRONT}, + {-0.47,0,0,$STR_EPOCH_ACTION_SNAP_LEFT}, + {0.47,0,0,$STR_EPOCH_ACTION_SNAP_RIGHT}, + {0,0,0.47,$STR_EPOCH_ACTION_SNAP_TOP} }; }; @@ -336,9 +320,9 @@ class SnapBuilding { }; radius = 5; points[] = { - {0,0,0,"Pivot"}, - {-1.5,0,0,"Left"}, - {1.5,0,0,"Right"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {-1.5,0,0,$STR_EPOCH_ACTION_SNAP_LEFT}, + {1.5,0,0,$STR_EPOCH_ACTION_SNAP_RIGHT} }; }; @@ -348,8 +332,8 @@ class SnapBuilding { }; radius = 5; points[] = { - {0,0,0,"Pivot"}, - {-4.1,0,0,"Left"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {-4.1,0,0,$STR_EPOCH_ACTION_SNAP_LEFT} }; }; @@ -359,9 +343,9 @@ class SnapBuilding { }; radius = 10; points[] = { - {0,0,0,"Pivot"}, - {-2.95,0,0.3,"Left"}, - {2.95,0,0.3,"Right"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {-2.95,0,0.3,$STR_EPOCH_ACTION_SNAP_LEFT}, + {2.95,0,0.3,$STR_EPOCH_ACTION_SNAP_RIGHT} }; }; @@ -371,9 +355,9 @@ class SnapBuilding { }; radius = 10; points[] = { - {0,0,0,"Pivot"}, - {-1.95,0,0.88,"Left"}, - {1.95,0,0.88,"Right"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {-1.95,0,0.88,$STR_EPOCH_ACTION_SNAP_LEFT}, + {1.95,0,0.88,$STR_EPOCH_ACTION_SNAP_RIGHT} }; }; @@ -383,10 +367,10 @@ class SnapBuilding { }; radius = 7; points[] = { - {0,0,0,"Pivot"}, - {0.65,-1.7,1.2,"Back"}, - {0.65,1.5,1.2,"Front"}, - {3.34,-0.115,2.82,"Top"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {0.65,-1.7,1.2,$STR_EPOCH_ACTION_SNAP_BACK}, + {0.65,1.5,1.2,$STR_EPOCH_ACTION_SNAP_FRONT}, + {3.34,-0.115,2.82,$STR_EPOCH_ACTION_SNAP_TOP} }; }; class WoodRamp_DZ: WoodRamp_Preview_DZ{}; @@ -397,9 +381,9 @@ class SnapBuilding { }; radius = 5; points[] = { - {0,0,0,"Pivot"}, - {-0.4,0,1.725,"Left"}, - {0.4,0,1.725,"Right"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {-0.4,0,1.725,$STR_EPOCH_ACTION_SNAP_LEFT}, + {0.4,0,1.725,$STR_EPOCH_ACTION_SNAP_RIGHT} }; }; class WoodLadder_DZ: WoodLadder_Preview_DZ{}; @@ -411,11 +395,11 @@ class SnapBuilding { }; radius = 5; points[] = { - {0,0,0,"Pivot"}, - {0,0.284,0.615,"Back"}, - {0,0,1.23,"Top"}, - {-0.362,0,0.615,"Left"}, - {0.362,0,0.615,"Right"} + {0,0,0,$STR_EPOCH_ACTION_SNAP_PIVOT}, + {0,0.284,0.615,$STR_EPOCH_ACTION_SNAP_BACK}, + {0,0,1.23,$STR_EPOCH_ACTION_SNAP_TOP}, + {-0.362,0,0.615,$STR_EPOCH_ACTION_SNAP_LEFT}, + {0.362,0,0.615,$STR_EPOCH_ACTION_SNAP_RIGHT} }; }; diff --git a/SQF/dayz_code/Configs/CfgVehicles/DZE/ModularBuilding.hpp b/SQF/dayz_code/Configs/CfgVehicles/DZE/ModularBuilding.hpp index 1fee3bd45..a201121fc 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/DZE/ModularBuilding.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/DZE/ModularBuilding.hpp @@ -67,7 +67,7 @@ class CinderWallHalf_DZ: ModularItems { scope = public; destrType = "DestructBuilding"; cost = 100; - offset[] = {0,1.5,0}; + offset[] = {0,2,0}; model="\z\addons\dayz_epoch\models\cinder_wall_half.p3d"; icon = "\ca\data\data\Unknown_object.paa"; mapSize = 2; @@ -93,7 +93,7 @@ class CinderWall_DZ: ModularItems { scope = public; destrType = "DestructBuilding"; cost = 100; - offset[] = {0,1.5,1.65}; + offset[] = {0,2,0}; model="\z\addons\dayz_epoch\models\cinder_wall_full.p3d"; icon = "\ca\data\data\Unknown_object.paa"; mapSize = 2; diff --git a/SQF/dayz_code/actions/modular_build.sqf b/SQF/dayz_code/actions/modular_build.sqf index 0bd288098..9dbaa7a3f 100644 --- a/SQF/dayz_code/actions/modular_build.sqf +++ b/SQF/dayz_code/actions/modular_build.sqf @@ -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; diff --git a/SQF/dayz_code/actions/player_build.sqf b/SQF/dayz_code/actions/player_build.sqf index 353cd9069..392bd7645 100644 --- a/SQF/dayz_code/actions/player_build.sqf +++ b/SQF/dayz_code/actions/player_build.sqf @@ -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; diff --git a/SQF/dayz_code/actions/snap_build.sqf b/SQF/dayz_code/actions/snap_build.sqf index e592bd391..8d27b2d35 100644 --- a/SQF/dayz_code/actions/snap_build.sqf +++ b/SQF/dayz_code/actions/snap_build.sqf @@ -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[("" + ("Snap: %1") +""),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[("" + ("Snap Point: %1") +""),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[("" + ("%1)Select: %2") +""),_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 ["Epoch Snap Building
",_bldTxtClrW,_bldTxtSz,_bldTxtShdw,_bldTxtAlgnL,_bldTxtClrO,_bldTxtUndrln,_bldTxtBold]; - _bldTxtStringSD = format["[Snap] Disabled: use action menu to enable.

",_bldTxtClrO,_bldTxtClrR,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL]; - _bldTxtStringSE = format["[Snap] Enabled: use action menu to disable.

",_bldTxtClrO,_bldTxtClrG,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL]; - _bldTxtStringSA = format["[Auto]: Automatic snap point detection.

",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL]; - _bldTxtStringSM = format["[Manual]: Select your preferred snap point.

",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL]; - _bldTxtStringPG = format["[PgUP / PgDOWN]: Adjust height of object by 10cm
",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL]; - _bldTxtStringAPG = format["[Alt]+[PgUP / PgDOWN]: Adjust height of object by 1m
",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL]; - _bldTxtStringCPG = format["[Ctrl]+[PgUP / PgDOWN]: Adjust height of object by 1cm
",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL]; - _bldTxtStringQE = format["[Q / E]: Rotate object 180 degrees while holding.
",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL]; - _bldTxtStringQEF = format["[Q / E]: Rotate object 45 degrees while dropped or snapped.

",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL]; - _bldTxtStringFD = format["[F]: Drop / Pick up object.
",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL]; - _bldTxtStringFS = format["[F]: Snap / Pick up object.
",_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; }; }; diff --git a/SQF/dayz_code/compile/BuildVectors/build_vectors.sqf b/SQF/dayz_code/compile/BuildVectors/build_vectors.sqf index a2a0874da..251611534 100644 --- a/SQF/dayz_code/compile/BuildVectors/build_vectors.sqf +++ b/SQF/dayz_code/compile/BuildVectors/build_vectors.sqf @@ -1,111 +1,76 @@ /*-----------------------------------*/ -// by Raymix // -// July 10 2014 // +// by strikerforce // /*--------------------------------*/ -private ["_object","_objectSnapGizmo","_objColorActive","_objColorInactive","_classname","_whitelist","_radius","_cfg","_cnt","_pos","_findWhitelisted","_nearbyObject","_posNearby","_selectedAction","_newPos","_pointsNearby","_onWater","_waterBase"]; -//Args +private ["_todo", "_selected"]; + _todo = _this select 3 select 2; -if(_todo == 0) then{ + +if (_todo == 0) then { vectorActionState = _this select 3 select 0; degreeActionState = _this select 3 select 1; -}else{ - if(_todo == 1) then{ +} else { + if (_todo == 1) then { vectorActionState = _this select 3 select 0; - }else{ + } else { degreeActionState = _this select 3 select 1; }; }; + _selected = _this select 3 select 3; -_staticRotate = ["Pitch Forward","Pitch Back","Bank Left","Bank Right","Reset"]; -fnc_vectorActionCleanup = { - private ["_s1","_s2"]; - _s1 = _this select 0; - _s2 = _this select 1; - player removeAction s_player_toggleVector; s_player_toggleVector = -1; - if (count s_player_toggleVectors != 0) then {{player removeAction _x;} count s_player_toggleVectors; s_player_toggleVectors=[]; vectorActions = -1;}; - if (_s1 > 0) then { - s_player_toggleVector = player addaction [format[("" + ("Vectors: %1") +""),vectorActionState],DZE_build_vector_file,[vectorActionState,degreeActionState,1],7,false,false]; - }; - if (_s2 > 0) then { - s_player_toggleVectors=[]; - { - vectorActions = player addaction [format[("" + (" %1") +""),_x],DZE_build_vector_file,[_x,degreeActionState,1],6,false,false]; - s_player_toggleVectors set [count s_player_toggleVectors,vectorActions]; - }count _staticRotate; - }; -}; -fnc_degreeActionCleanup = { - private ["_s1","_s2"]; - _s1 = _this select 0; - _s2 = _this select 1; - player removeAction s_player_toggleDegree; s_player_toggleDegree = -1; - if (count s_player_toggleDegrees != 0) then {{player removeAction _x;} count s_player_toggleDegrees; s_player_toggleDegrees=[]; degreeActions = -1;}; - if (_s1 > 0) then { - s_player_toggleDegree = player addaction [format[("" + ("Degrees: %1") +""),degreeActionState],DZE_build_vector_file,[vectorActionState,degreeActionState,2],5,false,false]; - }; - if (_s2 > 0) then { - s_player_toggleDegrees=[]; - { - if(DZE_curDegree == _x) then{ - degreeActions = player addaction [format[("" + (" Select: %1") +""),_x],DZE_build_vector_file,[vectorActionState,"SELECT",2,_x],4,false,false]; - }else{ - degreeActions = player addaction [format[("" + (" Select: %1") +""),_x],DZE_build_vector_file,[vectorActionState,"SELECT",2,_x],4,false,false]; - }; - - s_player_toggleDegrees set [count s_player_toggleDegrees,degreeActions]; - }count DZE_vectorDegrees; - }; -}; - -if(_todo == 1 || _todo == 0) then{ - switch (vectorActionState) do { - case "Init": { - vectorActionState = "OPEN"; +if (_todo == 1 || {_todo == 0}) then { + call { + if (vectorActionState == "Init") exitwith { + vectorActionState = localize "STR_EPOCH_VECTORS_OPEN"; [1,0] call fnc_vectorActionCleanup; + [] spawn { - while {true} do { - if(!dayz_actionInProgress || DZE_cancelBuilding) exitWith {[0,0] call fnc_vectorActionCleanup; vectorActionState = "CLOSE";}; - sleep 2; + while {1==1} do { + if (DZE_cancelBuilding || {!dayz_actionInProgress}) exitWith { + [0,0] call fnc_vectorActionCleanup; + vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE"; + }; + + uisleep 2; }; }; }; - case "OPEN": { - vectorActionState = "CLOSE"; + if (vectorActionState == localize "STR_EPOCH_VECTORS_OPEN") exitwith { + vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE"; [1,1] call fnc_vectorActionCleanup; }; - - case "CLOSE":{ - vectorActionState = "OPEN"; + + if (vectorActionState == localize "STR_EPOCH_VECTORS_CLOSE") exitwith { + vectorActionState = localize "STR_EPOCH_VECTORS_OPEN"; [1,0] call fnc_vectorActionCleanup; }; - case "Pitch Forward":{ - vectorActionState = "CLOSE"; + if (vectorActionState == localize "STR_EPOCH_VECTORS_PITCH_FORWARD") exitwith { + vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE"; [1,1] call fnc_vectorActionCleanup; DZE_updateVec = true; DZE_memForBack = DZE_memForBack + (DZE_curDegree * -1); }; - case "Pitch Back":{ - vectorActionState = "CLOSE"; + if (vectorActionState == localize "STR_EPOCH_VECTORS_PITCH_BACK") exitwith { + vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE"; [1,1] call fnc_vectorActionCleanup; DZE_updateVec = true; DZE_memForBack = DZE_memForBack + DZE_curDegree; }; - case "Bank Left":{ - vectorActionState = "CLOSE"; + if (vectorActionState == localize "STR_EPOCH_VECTORS_BANK_LEFT") exitwith { + vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE"; [1,1] call fnc_vectorActionCleanup; DZE_updateVec = true; DZE_memLeftRight = DZE_memLeftRight + (DZE_curDegree * -1); }; - case "Bank Right":{ - vectorActionState = "CLOSE"; + if (vectorActionState == localize "STR_EPOCH_VECTORS_BANK_RIGHT") exitwith { + vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE"; [1,1] call fnc_vectorActionCleanup; DZE_updateVec = true; DZE_memLeftRight = DZE_memLeftRight + DZE_curDegree; }; - case "Reset":{ - vectorActionState = "CLOSE"; + if (vectorActionState == localize "STR_EPOCH_VECTORS_RESET") exitwith { + vectorActionState = localize "STR_EPOCH_VECTORS_CLOSE"; [1,1] call fnc_vectorActionCleanup; DZE_memForBack = 0; DZE_memLeftRight = 0; @@ -115,29 +80,33 @@ if(_todo == 1 || _todo == 0) then{ }; }; -if(_todo == 2 || _todo == 0) then{ - switch (degreeActionState) do { - case "Init": { - degreeActionState = "OPEN"; +if (_todo == 2 || {_todo == 0}) then{ + call { + if (degreeActionState == "Init") exitwith { + degreeActionState = localize "STR_EPOCH_VECTORS_OPEN"; [1,0] call fnc_degreeActionCleanup; [] spawn { - while {true} do { - if(!dayz_actionInProgress || DZE_cancelBuilding) exitWith {[0,0] call fnc_degreeActionCleanup; degreeActionState = "CLOSE";}; - sleep 2; + while {1==1} do { + if (DZE_cancelBuilding || {!dayz_actionInProgress}) exitWith { + [0,0] call fnc_degreeActionCleanup; + degreeActionState = localize "STR_EPOCH_VECTORS_CLOSE"; + }; + + uisleep 2; }; }; }; - case "OPEN": { - degreeActionState = "CLOSE"; + if (degreeActionState == localize "STR_EPOCH_VECTORS_OPEN") exitwith { + degreeActionState = localize "STR_EPOCH_VECTORS_CLOSE"; [1,1] call fnc_degreeActionCleanup; }; - - case "CLOSE":{ - degreeActionState = "OPEN"; + + if (degreeActionState == localize "STR_EPOCH_VECTORS_CLOSE") exitwith { + degreeActionState = localize "STR_EPOCH_VECTORS_OPEN"; [1,0] call fnc_degreeActionCleanup; }; - case "SELECT":{ - degreeActionState = "CLOSE"; + if (degreeActionState == "SELECT") exitwith { + degreeActionState = localize "STR_EPOCH_VECTORS_CLOSE"; DZE_curDegree = _selected; [1,1] call fnc_degreeActionCleanup; }; diff --git a/SQF/dayz_code/compile/BuildVectors/fnc_SetPitchBankYaw.sqf b/SQF/dayz_code/compile/BuildVectors/fnc_SetPitchBankYaw.sqf deleted file mode 100644 index 7abbf0ca9..000000000 --- a/SQF/dayz_code/compile/BuildVectors/fnc_SetPitchBankYaw.sqf +++ /dev/null @@ -1,46 +0,0 @@ -private ["_sinaroundX","_cosaroundX","_dirY","_dirZ","_upY","_upZ","_sinaroundY","_cosaroundY","_dirX","_upX","_sinaroundZ","_cosaroundZ","_dirXTemp","_upXTemp","_object","_rotations","_aroundX","_aroundY","_aroundZ","_dir","_up"]; -_object = _this select 0; -_rotations = _this select 1; -_aroundX = _rotations select 0; -_aroundY = _rotations select 1; -_aroundZ = (360 - (_rotations select 2)) - 360; - -_dirX = 0; -_dirY = 1; -_dirZ = 0; -_upX = 0; -_upY = 0; -_upZ = 1; - -if (_aroundX != 0) then { - _sinaroundX = sin _aroundX; - _cosaroundX = cos _aroundX; - _dirY = _cosaroundX; - _dirZ = _sinaroundX; - _upY = -(_sinaroundX); - _upZ = _cosaroundX; -}; - -if (_aroundY != 0) then { - _sinaroundY = sin _aroundY; - _cosaroundY = cos _aroundY; - _dirX = _dirZ * _sinaroundY; - _dirZ = _dirZ * _cosaroundY; - _upX = _upZ * _sinaroundY; - _upZ = _upZ * _cosaroundY; -}; - -if (_aroundZ != 0) then { - _sinaroundZ = sin _aroundZ; - _cosaroundZ = cos _aroundZ; - _dirXTemp = _dirX; - _dirX = (_dirXTemp * _cosaroundZ) - (_dirY * _sinaroundZ); - _dirY = (_dirY * _cosaroundZ) + (_dirXTemp * _sinaroundZ); - _upXTemp = _upX; - _upX = (_upXTemp * _cosaroundZ) - (_upY * _sinaroundZ); - _upY = (_upY * _cosaroundZ) + (_upXTemp * _sinaroundZ); -}; - -_dir = [_dirX, _dirY, _dirZ]; -_up = [_upX, _upY, _upZ]; -_object setVectorDirAndUp [_dir, _up]; \ No newline at end of file diff --git a/SQF/dayz_code/compile/BuildVectors/vector_functions.sqf b/SQF/dayz_code/compile/BuildVectors/vector_functions.sqf new file mode 100644 index 000000000..9a081b7dd --- /dev/null +++ b/SQF/dayz_code/compile/BuildVectors/vector_functions.sqf @@ -0,0 +1,113 @@ +/*-----------------------------------*/ +// by strikerforce // +/*--------------------------------*/ + +fnc_vectorActionCleanup = { + private ["_s1","_s2","_staticRotate","_vector"]; + + _s1 = _this select 0; + _s2 = _this select 1; + _staticRotate = ["STR_EPOCH_VECTORS_PITCH_FORWARD","STR_EPOCH_VECTORS_PITCH_BACK","STR_EPOCH_VECTORS_BANK_LEFT","STR_EPOCH_VECTORS_BANK_RIGHT","STR_EPOCH_VECTORS_RESET"]; + + player removeAction s_player_toggleVector; + s_player_toggleVector = -1; + + if (count s_player_toggleVectors != 0) then { + {player removeAction _x;} count s_player_toggleVectors; + s_player_toggleVectors = []; + vectorActions = -1; + }; + + if (_s1 > 0) then { + s_player_toggleVector = player addaction [format["" + localize "STR_EPOCH_ACTION_VECTORS" + " %1" +"",vectorActionState],"\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf",[vectorActionState,degreeActionState,1],7,false,false]; + }; + if (_s2 > 0) then { + s_player_toggleVectors = []; + { + _vector = localize _x; + vectorActions = player addaction [format["" + " %1" +"",_vector],"\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf",[_vector,degreeActionState,1],6,false,false]; + s_player_toggleVectors set [count s_player_toggleVectors,vectorActions]; + } count _staticRotate; + }; +}; + +fnc_degreeActionCleanup = { + private ["_s1","_s2"]; + + _s1 = _this select 0; + _s2 = _this select 1; + player removeAction s_player_toggleDegree; + s_player_toggleDegree = -1; + + if (count s_player_toggleDegrees != 0) then { + {player removeAction _x;} count s_player_toggleDegrees; + s_player_toggleDegrees = []; + degreeActions = -1; + }; + + if (_s1 > 0) then { + s_player_toggleDegree = player addaction [format["" + localize "STR_EPOCH_VECTORS_DEGREES" + " %1" +"",degreeActionState],"\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf",[vectorActionState,degreeActionState,2],5,false,false]; + }; + if (_s2 > 0) then { + s_player_toggleDegrees = []; + { + if (DZE_curDegree == _x) then { + degreeActions = player addaction [format["" + " " + localize "STR_EPOCH_ACTION_SNAP_SELECT" + " %1" +"",_x],"\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf",[vectorActionState,"SELECT",2,_x],4,false,false]; + } else { + degreeActions = player addaction [format["" + " " + localize "STR_EPOCH_ACTION_SNAP_SELECT" + " %1" +"",_x],"\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf",[vectorActionState,"SELECT",2,_x],4,false,false]; + }; + + s_player_toggleDegrees set [count s_player_toggleDegrees,degreeActions]; + } count DZE_vectorDegrees; + }; +}; + +fnc_SetPitchBankYaw = { + private ["_sinaroundX","_cosaroundX","_dirY","_dirZ","_upY","_upZ","_sinaroundY","_cosaroundY","_dirX","_upX","_sinaroundZ","_cosaroundZ","_dirXTemp","_upXTemp","_object","_rotations","_aroundX","_aroundY","_aroundZ","_dir","_up"]; + + _object = _this select 0; + _rotations = _this select 1; + _aroundX = _rotations select 0; + _aroundY = _rotations select 1; + _aroundZ = (360 - (_rotations select 2)) - 360; + + _dirX = 0; + _dirY = 1; + _dirZ = 0; + _upX = 0; + _upY = 0; + _upZ = 1; + + if (_aroundX != 0) then { + _sinaroundX = sin _aroundX; + _cosaroundX = cos _aroundX; + _dirY = _cosaroundX; + _dirZ = _sinaroundX; + _upY = -(_sinaroundX); + _upZ = _cosaroundX; + }; + + if (_aroundY != 0) then { + _sinaroundY = sin _aroundY; + _cosaroundY = cos _aroundY; + _dirX = _dirZ * _sinaroundY; + _dirZ = _dirZ * _cosaroundY; + _upX = _upZ * _sinaroundY; + _upZ = _upZ * _cosaroundY; + }; + + if (_aroundZ != 0) then { + _sinaroundZ = sin _aroundZ; + _cosaroundZ = cos _aroundZ; + _dirXTemp = _dirX; + _dirX = (_dirXTemp * _cosaroundZ) - (_dirY * _sinaroundZ); + _dirY = (_dirY * _cosaroundZ) + (_dirXTemp * _sinaroundZ); + _upXTemp = _upX; + _upX = (_upXTemp * _cosaroundZ) - (_upY * _sinaroundZ); + _upY = (_upY * _cosaroundZ) + (_upXTemp * _sinaroundZ); + }; + + _dir = [_dirX, _dirY, _dirZ]; + _up = [_upX, _upY, _upZ]; + _object setVectorDirAndUp [_dir, _up]; +}; diff --git a/SQF/dayz_code/compile/snap_functions.sqf b/SQF/dayz_code/compile/snap_functions.sqf new file mode 100644 index 000000000..f9af51f2b --- /dev/null +++ b/SQF/dayz_code/compile/snap_functions.sqf @@ -0,0 +1,255 @@ +/*-----------------------------------*/ +// by Raymix // +// July 10 2014 // +/*--------------------------------*/ + +fnc_snapActionCleanup = { + private ["_s1","_s2","_s3","_cnt","_object","_classname","_objectHelper","_points"]; + + _s1 = _this select 0; + _s2 = _this select 1; + _s3 = _this select 2; + _object = _this select 3; + _classname = _this select 4; + _objectHelper = _this select 5; + _points = _this select 6; + + 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["" + "Snap: %1" +"",snapActionState],"\z\addons\dayz_code\actions\snap_build.sqf",[snapActionState,_object,_classname,_objectHelper,0],10,false,true]; + }; + if (_s2 > 0) then { + s_player_toggleSnapSelect = player addaction [format["" + localize "STR_EPOCH_ACTION_SNAP_POINT" + " %1" +"",snapActionStateSelect],"\z\addons\dayz_code\actions\snap_build.sqf",[snapActionStateSelect,_object,_classname,_objectHelper,0],9,false,true]; + }; + if (_s3 > 0) then { + s_player_toggleSnapSelectPoint = []; + _cnt = 0; + { + snapActions = player addaction [format["" + " %1. " + localize "STR_EPOCH_ACTION_SNAP_SELECT" + " %2" + "",_cnt+1,_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 = { + private ["_objectSnapGizmo","_object","_points"]; + + _object = _this select 0; + _points = _this select 1; + + snapGizmos = []; + { + _objectSnapGizmo = "Sign_sphere10cm_EP1" createVehicleLocal [0,0,0]; + _objectSnapGizmo setobjecttexture [0,"#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)"]; + _objectSnapGizmo attachTo [_object,[_x select 0,_x select 1,_x select 2]]; + snapGizmos set [count snapGizmos,_objectSnapGizmo]; + } count _points; +}; + +fnc_initSnapPointsNearby = { + private ["_pos","_findWhitelisted","_pointsNearby","_nearbyObject","_objectSnapGizmo","_posNearby","_object","_whitelist","_radius"]; + + _object = _this select 0; + _whitelist = _this select 1; + _radius = _this select 2; + + _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,"#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)"]; + _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 = localize "STR_EPOCH_ACTION_SNAP_OFF"; +}; + +fnc_snapDistanceCheck = { + private ["_distClosestPointFound","_distCheck","_distClosest","_testXPos","_distClosestPointFoundPos","_distClosestPointFoundDir","_distClosestAttached","_distCheckAttached","_distClosestAttachedFoundPos","_onWater","_objectHelper","_object"]; + + _object = _this select 0; + _objectHelper = _this select 1; + + while {snapActionState != localize "STR_EPOCH_ACTION_SNAP_OFF"} do { + _distClosestPointFound = objNull; + _distCheck = 0; + _distClosest = 10; + _testXPos = []; + _distClosestPointFoundPos =[]; + _distClosestPointFoundDir = 0; + + { + if (_x !=_distClosestPointFound) then {_x setobjecttexture [0,"#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)"];}; + _testXPos = [_x] call FNC_GetPos; + _distCheck = _objectHelper distance _testXPos; + if (_distCheck < _distClosest) then { + _distClosest = _distCheck; + _distClosestPointFound setobjecttexture [0,"#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)"]; + _distClosestPointFound = _x; + _distClosestPointFound setobjecttexture [0,"#(argb,8,8,3)color(0,0.92,0.06,1,ca)"]; + }; + } count snapGizmosNearby; + + if (!isNull _distClosestPointFound) then { + if (snapActionStateSelect == localize "STR_EPOCH_ACTION_SNAP_POINT_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,"#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)"];}; + _testXPos = [_x] call FNC_GetPos; + _distCheckAttached = _distClosestPointFound distance _testXPos; + if (_distCheckAttached < _distClosest) then { + _distClosest = _distCheckAttached; + _distClosestAttached setobjecttexture [0,"#(argb,8,8,3)color(0.04,0.84,0.92,0.3,ca)"]; + _distClosestAttached = _x; + _distClosestAttached setobjecttexture [0,"#(argb,8,8,3)color(0,0.92,0.06,1,ca)"]; + }; + } 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 ["Epoch Snap Building
",_bldTxtClrW,_bldTxtSz,_bldTxtShdw,_bldTxtAlgnL,_bldTxtClrO,_bldTxtUndrln,_bldTxtBold]; + _bldTxtStringSD = format["[Snap] %7 %8

",_bldTxtClrO,_bldTxtClrR,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_DISABLE",localize "STR_EPOCH_SNAP_TUTORIAL_DISABLE_MSG"]; + _bldTxtStringSE = format["[Snap] %7 %8

",_bldTxtClrO,_bldTxtClrG,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_ENABLE",localize "STR_EPOCH_SNAP_TUTORIAL_ENABLE_MSG"]; + _bldTxtStringSA = format["[Auto]: %6

",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_AUTO_DETECT"]; + _bldTxtStringSM = format["[%6]: %7

",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_ACTION_SNAP_POINT_MANUAL",localize "STR_EPOCH_SNAP_TUTORIAL_MANUAL_DETECT"]; + _bldTxtStringPG = format["%6: %7
",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_PGUPPGDOWN",localize "STR_EPOCH_SNAP_TUTORIAL_PGUPPGDOWN_MSG"]; + _bldTxtStringAPG = format["%6: %7
",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_ALT_PGUPPGDOWN",localize "STR_EPOCH_SNAP_TUTORIAL_ALT_PGUPPGDOWN_MSG"]; + _bldTxtStringCPG = format["%6: %7
",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_CTRL_PGUPPGDOWN",localize "STR_EPOCH_SNAP_TUTORIAL_CTRL_PGUPPGDOWN_MSG"]; + _bldTxtStringQE = format["[Q / E]: %6
",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_ROTATE180_MSG"]; + _bldTxtStringQEF = format["[Q / E]: %6

",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_ROTATE45_MSG"]; + _bldTxtStringFD = format["[F]: %6
",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_F_DROP_MSG"]; + _bldTxtStringFS = format["[F]: %6
",_bldTxtClrO,_bldTxtClrW,_bldTxtSzT,_bldTxtShdw,_bldTxtAlgnL,localize "STR_EPOCH_SNAP_TUTORIAL_F_SNAP_MSG"]; + 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; + }; + }; +}; diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index a46aa571e..e963c5943 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -96,13 +96,14 @@ if (!isDedicated) then { player_mineStone = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_mineStone.sqf"; if (DZE_modularBuild) then { player_build = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\modular_build.sqf"; + call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\snap_functions.sqf"; snap_build = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\snap_build.sqf"; + call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BuildVectors\vector_functions.sqf"; + build_vectors = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf"; } else { player_build = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_build.sqf"; }; - DZE_build_vector_file = "\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf"; - build_vectors = compile preprocessFileLineNumbers DZE_build_vector_file; - fnc_SetPitchBankYaw = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BuildVectors\fnc_SetPitchBankYaw.sqf"; + FNC_find_plots = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_find_plots.sqf"; //player_buildVanilla = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_buildVanilla.sqf"; diff --git a/SQF/dayz_code/stringtable.xml b/SQF/dayz_code/stringtable.xml index bca9c4cbc..1859ad06b 100644 --- a/SQF/dayz_code/stringtable.xml +++ b/SQF/dayz_code/stringtable.xml @@ -22331,6 +22331,154 @@ APSI (Anti PSI) device, which full purpose is yet unknown. APSI (Anti PSI) Emitter, dessen vollständige Funktion noch unbekannt ist. + + + Disabled: + Deaktiviert: + + + Use action menu to enable. + Benutzte das Scrollmenü zum Aktivieren. + + + Enabled: + Aktiviert: + + + Use action menu to disable. + Benutzte das Scrollmenü zum Deaktivieren. + + + Automatic snap point detection. + Das Snapping findet automatisch den nächsten Snap-Punkt. + + + Select your preferred snap point. + Wähle selbstständig den nächsten Snap-Punkt. + + + [PgUP / PgDOWN] + [Bild Auf / Bild Ab]. + + + Adjust height of object by 10cm. + Passt die Höhe des Objektes um 10cm an. + + + [Alt] + [PgUP / PgDOWN] + [Alt] + [Bild Auf / Bild Ab]. + + + Adjust height of object by 1m. + Passt die Höhe des Objektes um 1m an. + + + [Ctrl] + [PgUP / PgDOWN] + [Strg] + [Bild Auf / Bild Ab]. + + + Adjust height of object by 1cm. + Passt die Höhe des Objektes um 1cm an. + + + Rotate object 180 degrees while holding. + Dreht das Objekt um 180 Grad. + + + Rotate object 45 degrees while holding. + Dreht das Objekt um 45 Grad. + + + Drop / Pick up object. + Objekt feststellen / aufnehmen. + + + Drop / Pick up object. + Objekt snappen / aufnehmen. + + + ON + AN + + + OFF + AUS + + + Manual + Manuell + + + Snap Points: + Snap-Punkte: + + + Select: + Auswahl: + + + Right + Rechts + + + Left + Links + + + Pivot + Mittelpunkt + + + Back + Hinten + + + Front + Vorne + + + Bottom + Boden + + + Top + Spitze + + + Vectors: + Vektoren: + + + Pitch Forward + Nach vorne neigen + + + Pitch Back + Nach hinten neigen + + + Bank Left + Nach links neigen + + + Bank Right + Nach rechts neigen + + + Reset + Zurücksetzen + + + CLOSE + Schließen + + + OPEN + Öffnen + + + DEGREES: + Grad: