Fix static weapon placement

Made by @Victor-the-Cleaner
This commit is contained in:
A Man
2022-04-27 20:49:21 +02:00
parent 455178fcee
commit 311b23cd94
3 changed files with 176 additions and 101 deletions

View File

@@ -1,13 +1,16 @@
class USMC_WarfareBMGNest_M240;
class M240Nest_DZ: USMC_WarfareBMGNest_M240
class M240Nest_DZ: USMC_WarfareBMGNest_M240 // M240 Nest
{
side = 1;
faction = "USMC";
destrType = "DestructBuilding";
armor = 450;
scope = 2;
offset[] = {0,4,0};
offset[] = {0,4,-0.1};
staticOffset = 0.255829;
nounderground = 0;
displayName = $STR_EPOCH_M240NEST;
transportMaxMagazines = 25;
transportMaxWeapons = 4;
transportMaxBackpacks = 1;
constructioncount = 10;
vehicleClass = "DayZ Epoch Static Weapons";
GhostPreview = "M240Nest_DZ";
@@ -15,60 +18,72 @@ class M240Nest_DZ: USMC_WarfareBMGNest_M240
};
class M2StaticMG;
class M2_MG_Static_DZ: M2StaticMG {
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";
removeoutput[] = {{"M2_MG_Static_kit",1}};
};
class M2HD_mini_TriPod;
class M2_TriPod_MG_Static_DZ: M2HD_mini_TriPod {
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";
removeoutput[] = {{"M2_TriPod_MG_Static_kit",1}};
};
class DSHKM_Ins;
class DSHKM_MG_Static_DZ: DSHKM_Ins {
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";
removeoutput[] = {{"DSHKM_MG_Static_kit",1}};
};
class DSHkM_Mini_TriPod;
class DSHKM_TriPod_MG_Static_DZ: DSHkM_Mini_TriPod {
class DSHKM_TriPod_MG_Static_DZ: DSHkM_Mini_TriPod { // DSHkM Minitripod
side = 1;
faction = "USMC";
offset[] = {0,3,0};
offset[] = {0,3,0.2};
staticOffset = -0.2189362;
nounderground = 0;
GhostPreview = "DSHKM_TriPod_MG_Static_DZ";
vehicleClass = "DayZ Epoch Static Weapons";
removeoutput[] = {{"DSHKM_TriPod_MG_Static_kit",1}};
};
class KORD;
class KORD_Tripod_MG_Static_DZ: KORD {
class KORD_Tripod_MG_Static_DZ: KORD { // KORD Minitripod
side = 1;
faction = "USMC";
offset[] = {0,3,0};
offset[] = {0,3,0.5};
staticOffset = -0.5164566;
nounderground = 0;
GhostPreview = "KORD_Tripod_MG_Static_DZ";
vehicleClass = "DayZ Epoch Static Weapons";
removeoutput[] = {{"KORD_TriPod_MG_Static_kit",1}};
};
class KORD_high;
class KORD_MG_Static_DZ: KORD_high {
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";
removeoutput[] = {{"KORD_MG_Static_kit",1}};
@@ -79,13 +94,15 @@ class BAF_L2A1_Tripod_D: BAF_L2A1_ACOG_base {
class assembleInfo;
};
class L2A1_MG_Static_DZ: BAF_L2A1_Tripod_D {
class L2A1_MG_Static_DZ: BAF_L2A1_Tripod_D { // L111A1 Tripod
side = 1;
faction = "USMC";
class assembleInfo: assembleInfo {
dissasembleTo[] = {};
};
offset[] = {0,3,0};
staticOffset = 0.00726318;
nounderground = 0;
GhostPreview = "L2A1_MG_Static_DZ";
vehicleClass = "DayZ Epoch Static Weapons";
removeoutput[] = {{"L2A1_MG_Static_kit",1}};
@@ -95,13 +112,15 @@ class BAF_L2A1_Minitripod_D: BAF_L2A1_ACOG_base {
class assembleInfo;
};
class L2A1_Tripod_MG_Static_DZ: BAF_L2A1_Minitripod_D {
class L2A1_Tripod_MG_Static_DZ: BAF_L2A1_Minitripod_D { // L111A1 Minitripod
side = 1;
faction = "USMC";
class assembleInfo: assembleInfo {
dissasembleTo[] = {};
};
offset[] = {0,3,0};
staticOffset = 0.00726318;
nounderground = 0;
GhostPreview = "L2A1_Tripod_MG_Static_DZ";
vehicleClass = "DayZ Epoch Static Weapons";
removeoutput[] = {{"L2A1_Tripod_MG_Static_kit",1}};
@@ -112,33 +131,39 @@ class BAF_GMG_Tripod_D: GMG_TriPod {
class assembleInfo;
};
class GMG_Tripod_MG_Static_DZ: BAF_GMG_Tripod_D {
class GMG_Tripod_MG_Static_DZ: BAF_GMG_Tripod_D { // GMG Minitripod
side = 1;
faction = "USMC";
class assembleInfo: assembleInfo {
dissasembleTo[] = {};
};
offset[] = {0,3,0};
staticOffset = -0.0716057;
nounderground = 0;
GhostPreview = "GMG_Tripod_MG_Static_DZ";
vehicleClass = "DayZ Epoch Static Weapons";
removeoutput[] = {{"GMG_Tripod_MG_Static_kit",1}};
};
class AGS_Ins;
class AGS30_GrenadeLauncher_Static_DZ: AGS_Ins {
class AGS30_GrenadeLauncher_Static_DZ: AGS_Ins { // AGS-30
side = 1;
faction = "USMC";
offset[] = {0,3,0};
offset[] = {0,3,0.2};
staticOffset = -0.218933;
nounderground = 0;
GhostPreview = "AGS30_GrenadeLauncher_Static_DZ";
vehicleClass = "DayZ Epoch Static Weapons";
removeoutput[] = {{"AGS30_GrenadeLauncher_Static_kit",1}};
};
class MK19_TriPod;
class MK19_TriPod_GrenadeLauncher_Static_DZ: MK19_TriPod {
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";
removeoutput[] = {{"MK19_TriPod_GrenadeLauncher_Static_kit",1}};
@@ -148,103 +173,123 @@ class BAF_GPMG_Minitripod_D: BAF_L2A1_ACOG_base {
class assembleInfo;
};
class GPMG_TriPod_GrenadeLauncher_Static_DZ: BAF_GPMG_Minitripod_D {
class GPMG_TriPod_GrenadeLauncher_Static_DZ: BAF_GPMG_Minitripod_D { // GPMG Minitripod
side = 1;
faction = "USMC";
class assembleInfo: assembleInfo {
dissasembleTo[] = {};
};
offset[] = {0,3,0};
staticOffset = 0.00726318;
nounderground = 0;
GhostPreview = "GPMG_TriPod_GrenadeLauncher_Static_DZ";
vehicleClass = "DayZ Epoch Static Weapons";
removeoutput[] = {{"GPMG_TriPod_GrenadeLauncher_Static_kit",1}};
};
class M119;
class M119_Artillery_Static_DZ: M119 {
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";
removeoutput[] = {{"M119_Artillery_Static_kit",1}};
};
class D30_Ins;
class D30_Artillery_Static_DZ: D30_Ins {
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";
removeoutput[] = {{"D30_Artillery_Static_kit",1}};
};
class SearchLight_INS;
class SearchLight_Static_DZ: SearchLight_INS {
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";
removeoutput[] = {{"SearchLight_Static_kit",1}};
};
class M252;
class M252_Mortar_Static_DZ: M252 {
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";
removeoutput[] = {{"M252_Mortar_Static_kit",1}};
};
class 2b14_82mm;
class 2b14_82mm_Mortar_Static_DZ: 2b14_82mm {
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";
removeoutput[] = {{"2b14_82mm_Mortar_Static_kit",1}};
};
class Metis;
class Metis_Launcher_Static_DZ: Metis {
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";
removeoutput[] = {{"Metis_Launcher_Static_kit",1}};
};
class SPG9_Gue;
class SPG9_Launcher_Static_DZ: SPG9_Gue {
class SPG9_Launcher_Static_DZ: SPG9_Gue { // SPG-9
side = 1;
faction = "USMC";
offset[] = {0,3,0};
offset[] = {0,3,-0.02};
staticOffset = 0.00415802;
nounderground = 0;
GhostPreview = "SPG9_Launcher_Static_DZ";
vehicleClass = "DayZ Epoch Static Weapons";
removeoutput[] = {{"SPG9_Launcher_Static_kit",1}};
};
class Stinger_Pod;
class Stinger_Tripod_Launcher_Static_DZ: Stinger_Pod {
class Stinger_Tripod_Launcher_Static_DZ: Stinger_Pod { // AA Pod
side = 1;
faction = "USMC";
offset[] = {0,3,0};
offset[] = {0,3,0.17};
staticOffset = -0.189877;
nounderground = 0;
GhostPreview = "Stinger_Tripod_Launcher_Static_DZ";
vehicleClass = "DayZ Epoch Static Weapons";
removeoutput[] = {{"Stinger_Tripod_Launcher_Static_kit",1}};
};
class TOW_TriPod;
class TOW_Tripod_Launcher_Static_DZ: TOW_TriPod {
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";
removeoutput[] = {{"TOW_Tripod_Launcher_Static_kit",1}};
@@ -255,33 +300,39 @@ class Rbs70_ACR: Stinger_Pod_base {
class AssembleInfo;
};
class Rbs70_Launcher_Static_DZ: Rbs70_ACR {
class Rbs70_Launcher_Static_DZ: Rbs70_ACR { // RBS-70
side = 1;
faction = "USMC";
class AssembleInfo : AssembleInfo {
dissasembleTo[] = {};
};
offset[] = {0,3,0};
staticOffset = 0.00267029;
nounderground = 0;
GhostPreview = "Rbs70_Launcher_Static_DZ";
vehicleClass = "DayZ Epoch Static Weapons";
removeoutput[] = {{"Rbs70_Launcher_Static_kit",1}};
};
class Igla_AA_pod_East;
class Igla_AntiAir_Launcher_Static_DZ: Igla_AA_pod_East {
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";
removeoutput[] = {{"Igla_AntiAir_Launcher_Static_kit",1}};
};
class ZU23_Ins;
class ZU23_AntiAir_Static_DZ: ZU23_Ins {
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";
removeoutput[] = {{"ZU23_AntiAir_Static_kit",1}};

View File

@@ -141,6 +141,7 @@ 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";
@@ -704,7 +705,7 @@ if (_canBuild) then {
_objectHelperPos = ATLToASL _pos;
};
if (_vectoringEnabled) then {
if (_vectoringEnabled || {_classname in DZE_StaticWeapons}) then {
_objectHelper setVectorUp _vector; // align
};
@@ -886,6 +887,9 @@ 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 {
@@ -981,7 +985,7 @@ if (_canBuild) then {
_refreshDist = DZE_snapRadius * 0.5; // distance object moves before the snap auto-refresh triggers
};
if !(DZE_buildItem in DZE_noRotate) then {
if (!(DZE_buildItem in DZE_noRotate) && !_isStaticWeapon) then {
_vectoringEnabled = true;
["","","",["Init", "Init", 0]] spawn build_vectors;
};
@@ -994,7 +998,7 @@ if (_canBuild) then {
call _axial_helper;
call _setup_object;
[_distFromPlot, _radius, _snappingEnabled, _vectoringEnabled, _snapList, _object] spawn dze_snap_building;
[_distFromPlot, _radius, _snappingEnabled, _vectoringEnabled, _isStaticWeapon, _snapList, _object] spawn dze_snap_building;
while {_isOk} do {
@@ -1352,20 +1356,39 @@ if (_canBuild) then {
_builtObject setVectorDirAndUp _vector;
local _position = _modelBasePos; // ATL/ASL
local _vectorUp = _vector select 1;
local _isWater = surfaceIsWater _position;
if (surfaceIsWater _position) then {
if (_isStaticWeapon) then { // handle static weapons
local _positionASL = _position;
if (!_isWater) then {_positionASL = ATLToASL _position;}; // must be ASL
for "_i" from 0 to 2 do {
_positionASL set [_i, (_positionASL select _i) + ((_vectorUp select _i) * _staticOffset)]; // add static weapon vectorUp offset to ASL position (world coordinates)
};
if (!_isWater) then { // convert back to
_position = ASLToATL _positionASL; // ATL
} else {
_position = _positionASL; // or ASL
};
};
if (_isWater) then {
_position = ASLToATL _position; // position must be ATL
};
_builtObject setPosATL _position;
///////////////////////////////////////////////////////////////////////////////////
if (!_isStaticWeapon) then {
_position = _modelCenterPos; // ATL/ASL. Update db position in case model center is non-zero
_position set [2, (_position select 2) - _modelOffset]; // adjust world Z-height
if (surfaceIsWater _position) then {
_position = ASLToATL _position; // ensure position passed to db is ATL
};
};
///////////////////////////////////////////////////////////////////////////////////
@@ -1581,8 +1604,7 @@ if (_canBuild) then {
if (_builtObject isKindOf "StaticWeapon" || {_classname in DZE_StaticWeapons}) then {
[_builtObject,DZE_clearStaticAmmo,false] call fn_vehicleAddons;
};
};
}; };
if (DZE_GodModeBase && {!(_classname in DZE_GodModeBaseExclude)}) then {
_builtObject addEventHandler ["HandleDamage", {0}];
};

View File

@@ -11,8 +11,9 @@ local _distFromPlot = _this select 0;
local _radius = _this select 1;
local _snappingEnabled = _this select 2;
local _vectoringEnabled = _this select 3;
local _snapList = _this select 4;
local _object = _this select 5;
local _isStaticWeapon = _this select 4;
local _snapList = _this select 5;
local _object = _this select 6;
local _header = "<img align='left' size='1' image='\z\addons\dayz_code\gui\EpochSnapBuilding.paa'></img><br/>";
local _format = "<t align='left' size='0.4' font='Zeppelin33'>";
@@ -24,6 +25,7 @@ local _ORA = _COL + "'#FF8800'>"; // orange
local _GRY = _COL + "'#808080'>"; // greyed out
local _TRN = _format + "<t shadow='0' color='#00000000'>"; // transparent
local _VEC = [_GRY, _WHT] select _vectoringEnabled; // initial text color
local _TER = [_VEC, _WHT] select _isStaticWeapon; // initial text color
local _END = "</t>"; // end of segment
local _NL = _END + "<br/>"; // new line
local _spacing = _TRN + "." + _NL; // blank line
@@ -58,7 +60,7 @@ _HK = _HK + _ORA + "[Q] [E] " + _WHT + _strRotate + _NL;
_HK = _HK + _OBR + _decrease + _DBR + _increase + _BRW + localize "STR_EPOCH_TUT_ADJ_DEGREES" + _NL;
_HK = _HK + _spacing;
_HK = _HK + _ORA + "[L] " + _WHT + localize "STR_EPOCH_TUT_LOCAL" + " [%1"+ _NL;
_HK = _HK + _ORA + "[T] " + _VEC + localize "STR_EPOCH_TUT_TERRAIN" + _NL;
_HK = _HK + _ORA + "[T] " + _TER + localize "STR_EPOCH_TUT_TERRAIN" + _NL;
_HK = _HK + _ORA + "[P] " + _WHT + localize "STR_EPOCH_TUT_BOUNDARY" + _NL;
_HK = _HK + _ORA + "[F] " + _WHT + localize "STR_EPOCH_TUT_RELEASE_HOLD" + _NL;
_HK = _HK + _ORA + "[H] " + _WHT + localize "STR_EPOCH_TUT_HIDE_PANEL" + _NL;