From 628e72dd4b21970b97fd0bd3cf3245ef577bc0c6 Mon Sep 17 00:00:00 2001 From: A Man Date: Fri, 29 Apr 2022 15:12:44 +0200 Subject: [PATCH] Update statics again Made by @Victor-the-Cleaner --- .../CfgVehicles/Buildables/StaticWeapons.hpp | 25 ------------------ SQF/dayz_code/actions/modular_build.sqf | 26 ++++++++++++------- 2 files changed, 16 insertions(+), 35 deletions(-) diff --git a/SQF/dayz_code/Configs/CfgVehicles/Buildables/StaticWeapons.hpp b/SQF/dayz_code/Configs/CfgVehicles/Buildables/StaticWeapons.hpp index 67161ef21..bbb2b50ee 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/Buildables/StaticWeapons.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/Buildables/StaticWeapons.hpp @@ -5,7 +5,6 @@ class M240Nest_DZ: USMC_WarfareBMGNest_M240 // M240 Nest armor = 450; scope = 2; offset[] = {0,4,-0.1}; - staticOffset = 0.255829; nounderground = 0; displayName = $STR_EPOCH_M240NEST; transportMaxMagazines = 25; @@ -22,7 +21,6 @@ class M2_MG_Static_DZ: M2StaticMG { // M2 Machine Gun side = 1; faction = "USMC"; offset[] = {0,3,0}; - staticOffset = 0.00726318; nounderground = 0; GhostPreview = "M2_MG_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -34,7 +32,6 @@ class M2_TriPod_MG_Static_DZ: M2HD_mini_TriPod { // M2 Minitripod side = 1; faction = "USMC"; offset[] = {0,3,0}; - staticOffset = 0.00726318; nounderground = 0; GhostPreview = "M2_TriPod_MG_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -46,7 +43,6 @@ class DSHKM_MG_Static_DZ: DSHKM_Ins { // DShKM side = 1; faction = "USMC"; offset[] = {0,3,0}; - staticOffset = 0.0482254; nounderground = 0; GhostPreview = "DSHKM_MG_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -58,7 +54,6 @@ class DSHKM_TriPod_MG_Static_DZ: DSHkM_Mini_TriPod { // DSHkM Minitripod side = 1; faction = "USMC"; offset[] = {0,3,0.2}; - staticOffset = -0.2189362; nounderground = 0; GhostPreview = "DSHKM_TriPod_MG_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -70,7 +65,6 @@ class KORD_Tripod_MG_Static_DZ: KORD { // KORD Minitripod side = 1; faction = "USMC"; offset[] = {0,3,0.5}; - staticOffset = -0.5164566; nounderground = 0; GhostPreview = "KORD_Tripod_MG_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -82,7 +76,6 @@ class KORD_MG_Static_DZ: KORD_high { // KORD side = 1; faction = "USMC"; offset[] = {0,3,0}; - staticOffset = 0.00204468; nounderground = 0; GhostPreview = "KORD_MG_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -101,7 +94,6 @@ class L2A1_MG_Static_DZ: BAF_L2A1_Tripod_D { // L111A1 Tripod dissasembleTo[] = {}; }; offset[] = {0,3,0}; - staticOffset = 0.00726318; nounderground = 0; GhostPreview = "L2A1_MG_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -119,7 +111,6 @@ class L2A1_Tripod_MG_Static_DZ: BAF_L2A1_Minitripod_D { // L111A1 Minitripod dissasembleTo[] = {}; }; offset[] = {0,3,0}; - staticOffset = 0.00726318; nounderground = 0; GhostPreview = "L2A1_Tripod_MG_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -138,7 +129,6 @@ class GMG_Tripod_MG_Static_DZ: BAF_GMG_Tripod_D { // GMG Minitripod dissasembleTo[] = {}; }; offset[] = {0,3,0}; - staticOffset = -0.0716057; nounderground = 0; GhostPreview = "GMG_Tripod_MG_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -150,7 +140,6 @@ class AGS30_GrenadeLauncher_Static_DZ: AGS_Ins { // AGS-30 side = 1; faction = "USMC"; offset[] = {0,3,0.2}; - staticOffset = -0.218933; nounderground = 0; GhostPreview = "AGS30_GrenadeLauncher_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -162,7 +151,6 @@ class MK19_TriPod_GrenadeLauncher_Static_DZ: MK19_TriPod { // MK19 Minitripod side = 1; faction = "USMC"; offset[] = {0,3,0}; - staticOffset = 0.00726318; nounderground = 0; GhostPreview = "MK19_TriPod_GrenadeLauncher_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -180,7 +168,6 @@ class GPMG_TriPod_GrenadeLauncher_Static_DZ: BAF_GPMG_Minitripod_D { // GPMG Min dissasembleTo[] = {}; }; offset[] = {0,3,0}; - staticOffset = 0.00726318; nounderground = 0; GhostPreview = "GPMG_TriPod_GrenadeLauncher_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -192,7 +179,6 @@ class M119_Artillery_Static_DZ: M119 { // M119 side = 1; faction = "USMC"; offset[] = {0,5,0}; - staticOffset = -0.0161057; nounderground = 0; GhostPreview = "M119_Artillery_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -204,7 +190,6 @@ class D30_Artillery_Static_DZ: D30_Ins { // D-30 side = 1; faction = "USMC"; offset[] = {0,5,0}; - staticOffset = 0.00608826; nounderground = 0; GhostPreview = "D30_Artillery_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -216,7 +201,6 @@ class SearchLight_Static_DZ: SearchLight_INS { // Searchlight side = 1; faction = "USMC"; offset[] = {0,3,0}; - staticOffset = 0.00726318; nounderground = 0; GhostPreview = "SearchLight_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -228,7 +212,6 @@ class M252_Mortar_Static_DZ: M252 { // M252 81mm Mortar side = 1; faction = "USMC"; offset[] = {0,3,0}; - staticOffset = -0.00256348; nounderground = 0; GhostPreview = "M252_Mortar_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -240,7 +223,6 @@ class 2b14_82mm_Mortar_Static_DZ: 2b14_82mm { // Podnos 2B14 side = 1; faction = "USMC"; offset[] = {0,3,0}; - staticOffset = -0.00256348; nounderground = 0; GhostPreview = "2b14_82mm_Mortar_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -252,7 +234,6 @@ class Metis_Launcher_Static_DZ: Metis { // Metis AT-13 side = 1; faction = "USMC"; offset[] = {0,3,0}; - staticOffset = 0.0016861; nounderground = 0; GhostPreview = "Metis_Launcher_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -264,7 +245,6 @@ class SPG9_Launcher_Static_DZ: SPG9_Gue { // SPG-9 side = 1; faction = "USMC"; offset[] = {0,3,-0.02}; - staticOffset = 0.00415802; nounderground = 0; GhostPreview = "SPG9_Launcher_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -276,7 +256,6 @@ class Stinger_Tripod_Launcher_Static_DZ: Stinger_Pod { // AA Pod side = 1; faction = "USMC"; offset[] = {0,3,0.17}; - staticOffset = -0.189877; nounderground = 0; GhostPreview = "Stinger_Tripod_Launcher_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -288,7 +267,6 @@ class TOW_Tripod_Launcher_Static_DZ: TOW_TriPod { // TOW Tripod side = 1; faction = "USMC"; offset[] = {0,3,0}; - staticOffset = -0.00392151; nounderground = 0; GhostPreview = "TOW_Tripod_Launcher_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -307,7 +285,6 @@ class Rbs70_Launcher_Static_DZ: Rbs70_ACR { // RBS-70 dissasembleTo[] = {}; }; offset[] = {0,3,0}; - staticOffset = 0.00267029; nounderground = 0; GhostPreview = "Rbs70_Launcher_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -319,7 +296,6 @@ class Igla_AntiAir_Launcher_Static_DZ: Igla_AA_pod_East { // AA IGLA Pod side = 1; faction = "USMC"; offset[] = {0,3,0}; - staticOffset = 0.0; nounderground = 0; GhostPreview = "Igla_AntiAir_Launcher_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; @@ -331,7 +307,6 @@ class ZU23_AntiAir_Static_DZ: ZU23_Ins { // ZU-23 side = 1; faction = "USMC"; offset[] = {0,3,0}; - staticOffset = 0.0286407; nounderground = 0; GhostPreview = "ZU23_AntiAir_Static_DZ"; vehicleClass = "DayZ Epoch Static Weapons"; diff --git a/SQF/dayz_code/actions/modular_build.sqf b/SQF/dayz_code/actions/modular_build.sqf index eea71d03a..7655384e1 100644 --- a/SQF/dayz_code/actions/modular_build.sqf +++ b/SQF/dayz_code/actions/modular_build.sqf @@ -114,12 +114,13 @@ if (_canBuild) then { local _tooLow = false; // warn player object cannot go below ground local _isOnWater = false; // object placed in or above water local _heightASL = 0; // test if object is below max sea level - local _minHeight = 0; // used for nounderground local _startPos = []; local _playerASL = 0; local _startHeight = 0; // raise object up on creation if necessary - + local _staticOffset = 0; + local _staticOffsetSet = false; + local _isStaticWeapon = false; local _vectoringEnabled = false; local _snappingEnabled = false; local _snapList = []; // helper panel array of valid snapping points @@ -141,7 +142,6 @@ if (_canBuild) then { DZE_SnapSelIdx = -2; // array of object snapping points DZE_nowBuilding = false; // notify snap build so it can clean up helpers snapGizmosNearby = []; - local _isStaticWeapon = false; local _walk = "amovpercmwlk"; // animation state substrings local _run = "amovpercmrun"; @@ -238,6 +238,12 @@ if (_canBuild) then { local _setup_object = { + if (!_staticOffsetSet) then { + _object setVectorUp [0,0,1]; + _staticOffset = ((getPosASL _object) select 2) - ((getPosASL _modelBase) select 2); + _staticOffsetSet = true; + }; + DZE_updateVec = false; // trigger update on true DZE_memDir = 0; // object rotation (Q/E keys) DZE_memForBack = 0; // pitch forward/back @@ -705,7 +711,8 @@ if (_canBuild) then { _objectHelperPos = ATLToASL _pos; }; - if (_vectoringEnabled || {_classname in DZE_StaticWeapons}) then { + //if (_vectoringEnabled || {_classname in DZE_StaticWeapons}) then { + if (_vectoringEnabled || _isStaticWeapon) then { _objectHelper setVectorUp _vector; // align }; @@ -887,9 +894,6 @@ if (_canBuild) then { local _text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName"); // e.g. "Cinder Wall Full" local _ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview"); // e.g. "CinderWall_Preview_DZ" local _lockable = getNumber (configFile >> "CfgVehicles" >> _classname >> "lockable"); // defaults to 0 - local _staticOffset = getNumber (configFile >> "CfgVehicles" >> _classname >> "staticOffset"); - - _isStaticWeapon = ((_classname isKindof "StaticWeapon") || {_classname in DZE_StaticWeapons}); local _offset = getArray (configFile >> "CfgVehicles" >> _classname >> "offset"); if (count _offset == 0) then { @@ -985,6 +989,8 @@ if (_canBuild) then { _refreshDist = DZE_snapRadius * 0.5; // distance object moves before the snap auto-refresh triggers }; + _isStaticWeapon = ((_object isKindof "StaticWeapon") || {_classname in DZE_StaticWeapons}); + if (!(DZE_buildItem in DZE_noRotate) && !_isStaticWeapon) then { _vectoringEnabled = true; ["","","",["Init", "Init", 0]] spawn build_vectors; @@ -1601,10 +1607,10 @@ if (_canBuild) then { }; publicVariableServer "PVDZ_obj_Publish"; }; - - if (_builtObject isKindOf "StaticWeapon" || {_classname in DZE_StaticWeapons}) then { + if (_isStaticWeapon) then { [_builtObject,DZE_clearStaticAmmo,false] call fn_vehicleAddons; - }; }; + }; + }; if (DZE_GodModeBase && {!(_classname in DZE_GodModeBaseExclude)}) then { _builtObject addEventHandler ["HandleDamage", {0}]; };