diff --git a/Audio/ARC/WEP/ArcWepShipGatlingShot3d01.wav b/Audio/ARC/WEP/ArcWepShipGatlingShot3d01.wav new file mode 100644 index 00000000..9e4cada5 Binary files /dev/null and b/Audio/ARC/WEP/ArcWepShipGatlingShot3d01.wav differ diff --git a/Audio/ARC/WEP/ArcWepShipGatlingShot3d02.wav b/Audio/ARC/WEP/ArcWepShipGatlingShot3d02.wav new file mode 100644 index 00000000..f4fc9e0a Binary files /dev/null and b/Audio/ARC/WEP/ArcWepShipGatlingShot3d02.wav differ diff --git a/Audio/ARC/WEP/ArcWepShipGatlingShot3d03.wav b/Audio/ARC/WEP/ArcWepShipGatlingShot3d03.wav new file mode 100644 index 00000000..01486b29 Binary files /dev/null and b/Audio/ARC/WEP/ArcWepShipGatlingShot3d03.wav differ diff --git a/Audio/ARC/WEP/ArcWepShipGatlingShot3d04.wav b/Audio/ARC/WEP/ArcWepShipGatlingShot3d04.wav new file mode 100644 index 00000000..2a261ba0 Binary files /dev/null and b/Audio/ARC/WEP/ArcWepShipGatlingShot3d04.wav differ diff --git a/Audio/ARC/WEP/ArcWepShipGatlingShot3d05.wav b/Audio/ARC/WEP/ArcWepShipGatlingShot3d05.wav new file mode 100644 index 00000000..f7c33ed2 Binary files /dev/null and b/Audio/ARC/WEP/ArcWepShipGatlingShot3d05.wav differ diff --git a/Audio/ARC/WEP/ArcWepShipGatlingShot3d06.wav b/Audio/ARC/WEP/ArcWepShipGatlingShot3d06.wav new file mode 100644 index 00000000..c54ee9f4 Binary files /dev/null and b/Audio/ARC/WEP/ArcWepShipGatlingShot3d06.wav differ diff --git a/Audio/ARC/WEP/ArcWepShipGatlingShot3d07.wav b/Audio/ARC/WEP/ArcWepShipGatlingShot3d07.wav new file mode 100644 index 00000000..7accbbd4 Binary files /dev/null and b/Audio/ARC/WEP/ArcWepShipGatlingShot3d07.wav differ diff --git a/CoreSystems.csproj b/CoreSystems.csproj index 4c21e724..32408fad 100644 --- a/CoreSystems.csproj +++ b/CoreSystems.csproj @@ -21,7 +21,7 @@ 4 false 6 - WeaponCore.ruleset + AllRules.ruleset pdbonly @@ -32,7 +32,8 @@ 4 false 7 - WeaponCore.ruleset + + WeaponCore @@ -40,6 +41,24 @@ false + + true + bin\x64\Debug\ + full + x64 + 6 + prompt + AllRules.ruleset + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + 7 + prompt + @@ -118,7 +137,6 @@ PreserveNewest - @@ -430,9 +448,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest @@ -532,9 +547,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest @@ -687,9 +699,6 @@ False - - - PreserveNewest diff --git a/CoreSystems.ruleset b/CoreSystems.ruleset deleted file mode 100644 index 3e717fad..00000000 --- a/CoreSystems.ruleset +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CoreSystems.sln b/CoreSystems.sln index 8b421450..b636bcb5 100644 --- a/CoreSystems.sln +++ b/CoreSystems.sln @@ -1,20 +1,26 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31112.23 +# Visual Studio Version 17 +VisualStudioVersion = 17.13.35806.99 d17.13 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreSystems", "CoreSystems.csproj", "{A02FF223-D75F-45ED-84F4-63ED89AFCCE9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {A02FF223-D75F-45ED-84F4-63ED89AFCCE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A02FF223-D75F-45ED-84F4-63ED89AFCCE9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A02FF223-D75F-45ED-84F4-63ED89AFCCE9}.Debug|x64.ActiveCfg = Debug|x64 + {A02FF223-D75F-45ED-84F4-63ED89AFCCE9}.Debug|x64.Build.0 = Debug|x64 {A02FF223-D75F-45ED-84F4-63ED89AFCCE9}.Release|Any CPU.ActiveCfg = Release|Any CPU {A02FF223-D75F-45ED-84F4-63ED89AFCCE9}.Release|Any CPU.Build.0 = Release|Any CPU + {A02FF223-D75F-45ED-84F4-63ED89AFCCE9}.Release|x64.ActiveCfg = Release|x64 + {A02FF223-D75F-45ED-84F4-63ED89AFCCE9}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Data/Audio.sbc b/Data/Audio.sbc new file mode 100644 index 00000000..c2a316d8 --- /dev/null +++ b/Data/Audio.sbc @@ -0,0 +1,43 @@ + + + + + + MyObjectBuilder_AudioDefinition + ArcWepShipGatlingShot + + SHOT + 200 + 0 + HeavyFight + 3 + + + + 0.7 + + + Audio\ARC\WEP\ArcWepShipGatlingShot3d01.wav + + + Audio\ARC\WEP\ArcWepShipGatlingShot3d02.wav + + + Audio\ARC\WEP\ArcWepShipGatlingShot3d03.wav + + + Audio\ARC\WEP\ArcWepShipGatlingShot3d04.wav + + + Audio\ARC\WEP\ArcWepShipGatlingShot3d05.wav + + + Audio\ARC\WEP\ArcWepShipGatlingShot3d06.wav + + + Audio\ARC\WEP\ArcWepShipGatlingShot3d07.wav + + + + + diff --git a/Data/BlockVariantGroups.sbc b/Data/BlockVariantGroups.sbc index 304d4813..824a4998 100644 --- a/Data/BlockVariantGroups.sbc +++ b/Data/BlockVariantGroups.sbc @@ -19,6 +19,8 @@ + + @@ -30,8 +32,12 @@ + + + + diff --git a/Data/Scripts/CoreSystems/Ai/AiComp/AiCompRun.cs b/Data/Scripts/CoreSystems/Ai/AiComp/AiCompRun.cs index 0e6bcea3..99fead1d 100644 --- a/Data/Scripts/CoreSystems/Ai/AiComp/AiCompRun.cs +++ b/Data/Scripts/CoreSystems/Ai/AiComp/AiCompRun.cs @@ -1,5 +1,4 @@ -using System; -using VRage.Game.Components; +using VRage.Game.Components; namespace CoreSystems.Support { diff --git a/Data/Scripts/CoreSystems/Ai/AiConstruct.cs b/Data/Scripts/CoreSystems/Ai/AiConstruct.cs index a7489ce4..ef5edeab 100644 --- a/Data/Scripts/CoreSystems/Ai/AiConstruct.cs +++ b/Data/Scripts/CoreSystems/Ai/AiConstruct.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using CoreSystems.Platform; using CoreSystems.Projectiles; using Sandbox.Game.Entities; @@ -441,6 +440,19 @@ internal static void CombatBlockUpdates(Ai cAi)//Obligatory comment to annoy com double rangeToTarg = double.MaxValue; var currentAim = aFB.LookAtPosition == null ? Vector3D.Zero : (Vector3D)aFB.LookAtPosition; var hasTarg = aCB.SearchEnemyComponent.FoundEnemy != null; + + if (aCB.IsWorking && aFB.IsWorking && Session.I.IsServer) + { + if (hasTarg) + { + var targTopmost = aCB.SearchEnemyComponent.FoundEnemy.GetTopMostParent(); + if (checkAi.Construct.Data.Repo.FocusData.Target != targTopmost.EntityId) + checkAi.Construct.Focus.ServerChangeFocus((MyEntity)targTopmost, checkAi, 0, Focus.ChangeMode.Add, true); + } + else if (checkAi.Construct.Data.Repo.FocusData.Target != 0) + checkAi.Construct.Focus.ServerChangeFocus(null, checkAi, 0, Focus.ChangeMode.Release, true); + } + var targSphere = new BoundingSphereD(hasTarg ? aCB.SearchEnemyComponent.FoundEnemy.PositionComp.WorldAABB.Center : Vector3D.Zero, 1); //Does the radius really matter here? use actual enemy or lead position? if (currentAim != Vector3D.Zero && !stopFiring) @@ -453,9 +465,17 @@ internal static void CombatBlockUpdates(Ai cAi)//Obligatory comment to annoy com { foreach (var comp in ais[x].WeaponComps) { - if (comp.HasTurret || comp.HasScanTrackOnly) continue; + if (comp.HasTurret || comp.HasScanTrackOnly || comp.PrimaryWeapon.System.RadioType != WeaponCore.Data.Scripts.CoreSystems.Comms.Radio.RadioTypes.Slave) continue; - if (comp.HasGuidance) + if (comp.PrimaryWeapon.System.RadioType == WeaponCore.Data.Scripts.CoreSystems.Comms.Radio.RadioTypes.Slave) + { + var shoot = comp.PrimaryWeapon.Target.HasTarget; + if (shoot && comp.Data.Repo.Values.State.Trigger == CoreComponent.Trigger.Off) + comp.ShootManager.RequestShootSync(0, ShootManager.RequestType.On); + else if ((stopFiring || !shoot) && comp.Data.Repo.Values.State.Trigger == CoreComponent.Trigger.On) + comp.ShootManager.RequestShootSync(0, ShootManager.RequestType.Off); + } + else if (comp.HasGuidance) { bool shoot = hasTarg ? rangeToTarg <= comp.PrimaryWeapon.MaxTargetDistance && MathFuncs.TargetSphereInCone(ref targSphere, ref comp.PrimaryWeapon.AimCone) : false; if (shoot && comp.Data.Repo.Values.State.Trigger == CoreComponent.Trigger.Off) @@ -477,8 +497,8 @@ internal static void CombatBlockUpdates(Ai cAi)//Obligatory comment to annoy com } } } - if (aCB.MarkedForClose) checkAi.Construct.ActiveCombatBlock = null; - if (aFB.MarkedForClose) checkAi.Construct.ActiveFlightBlock = null; //Placed these removals here so we can flip triggers "off" the last time the method runs + if (aCB.MarkedForClose || !aCB.IsWorking) checkAi.Construct.ActiveCombatBlock = null; + if (aFB.MarkedForClose || !aFB.IsWorking) checkAi.Construct.ActiveFlightBlock = null; //Placed these removals here so we can flip triggers "off" the last time the method runs } } @@ -855,13 +875,9 @@ internal void Clean() { if (TotalEffect > 0) { - try - { - PlayerMap player; - var playerName = Session.I.Players.TryGetValue(Ai.AiOwner, out player) ? player.Player.DisplayName ?? string.Empty : string.Empty; - Log.Stats($"{Ai.TopEntity?.DisplayName}, {playerName}, {(long)TotalEffect}, {TotalPrimaryEffect}, {TotalAoeEffect}, {TotalShieldEffect}, {TotalProjectileEffect}", "griddmgstats"); - } - catch (Exception ex) { Log.Line($"Exception in ConstructClean: {ex}", null, true); } + PlayerMap player; + var playerName = Session.I.Players.TryGetValue(Ai.AiOwner, out player) ? player.Player.DisplayName ?? string.Empty : string.Empty; + Log.Stats($"{Ai.TopEntity?.DisplayName}, {playerName}, {(long)TotalEffect}, {TotalPrimaryEffect}, {TotalAoeEffect}, {TotalShieldEffect}, {TotalProjectileEffect}", "griddmgstats"); } if (WeaponGroups.Count > 0) diff --git a/Data/Scripts/CoreSystems/Ai/AiData.cs b/Data/Scripts/CoreSystems/Ai/AiData.cs index 19d2625b..4d305235 100644 --- a/Data/Scripts/CoreSystems/Ai/AiData.cs +++ b/Data/Scripts/CoreSystems/Ai/AiData.cs @@ -5,8 +5,6 @@ namespace CoreSystems { - using static Session; - public class AiData { public Ai Ai; diff --git a/Data/Scripts/CoreSystems/Ai/AiDatabase.cs b/Data/Scripts/CoreSystems/Ai/AiDatabase.cs index 722ea21f..a7db422a 100644 --- a/Data/Scripts/CoreSystems/Ai/AiDatabase.cs +++ b/Data/Scripts/CoreSystems/Ai/AiDatabase.cs @@ -1,6 +1,4 @@ -using System; -using CoreSystems.Platform; -using Sandbox.Common.ObjectBuilders; +using Sandbox.Common.ObjectBuilders; using Sandbox.Game.Entities; using Sandbox.ModAPI; using VRage.Game; @@ -42,7 +40,10 @@ internal void RequestDbUpdate() internal void Scan() { - MyGamePruningStructure.GetAllTopMostEntitiesInSphere(ref ScanVolume, _possibleTargets); + if (Session.I.ScanTargetsAction == null) + MyGamePruningStructure.GetAllTopMostEntitiesInSphere(ref ScanVolume, _possibleTargets); + else + Session.I.ScanTargetsAction.Invoke(GridEntity, ScanVolume, _possibleTargets); NearByEntitiesTmp = _possibleTargets.Count; for (int i = 0; i < NearByEntitiesTmp; i++) @@ -362,80 +363,75 @@ private bool TouchingSafeZone(MySafeZone safeZone) internal bool CreateEntInfo(MyEntity entity, long gridOwner, out Sandbox.ModAPI.Ingame.MyDetectedEntityInfo entInfo) { - - try + MyRelationsBetweenPlayerAndBlock relationship = MyRelationsBetweenPlayerAndBlock.Neutral; + if (entity == null) + { + entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(); + return false; + } + var grid = entity.GetTopMostParent() as MyCubeGrid; + if (grid != null) { - MyRelationsBetweenPlayerAndBlock relationship = MyRelationsBetweenPlayerAndBlock.Neutral; - if (entity == null) + if (!grid.DestructibleBlocks || grid.Immune || grid.GridGeneralDamageModifier <= 0) { entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(); return false; } - var grid = entity.GetTopMostParent() as MyCubeGrid; - if (grid != null) - { - if (!grid.DestructibleBlocks || grid.Immune || grid.GridGeneralDamageModifier <= 0) - { - entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(); - return false; - } - var bigOwners = grid.BigOwners; - var topOwner = bigOwners.Count > 0 ? bigOwners[0] : long.MaxValue; + var bigOwners = grid.BigOwners; + var topOwner = bigOwners.Count > 0 ? bigOwners[0] : long.MaxValue; - relationship = topOwner != long.MaxValue ? MyIDModule.GetRelationPlayerBlock(gridOwner, topOwner, MyOwnershipShareModeEnum.Faction) : MyRelationsBetweenPlayerAndBlock.NoOwnership; - var type = grid.GridSizeEnum != MyCubeSize.Small ? Sandbox.ModAPI.Ingame.MyDetectedEntityType.LargeGrid : Sandbox.ModAPI.Ingame.MyDetectedEntityType.SmallGrid; - entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(grid.EntityId, string.Empty, type, null, MatrixD.Zero, Vector3.Zero, relationship, new BoundingBoxD(), Session.I.Tick); - return true; - } + relationship = topOwner != long.MaxValue ? MyIDModule.GetRelationPlayerBlock(gridOwner, topOwner, MyOwnershipShareModeEnum.Faction) : MyRelationsBetweenPlayerAndBlock.NoOwnership; + var type = grid.GridSizeEnum != MyCubeSize.Small ? Sandbox.ModAPI.Ingame.MyDetectedEntityType.LargeGrid : Sandbox.ModAPI.Ingame.MyDetectedEntityType.SmallGrid; + entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(grid.EntityId, string.Empty, type, null, MatrixD.Zero, Vector3.Zero, relationship, new BoundingBoxD(), Session.I.Tick); + return true; + } - var myCharacter = entity as IMyCharacter; - if (myCharacter != null) - { - var type = !myCharacter.IsPlayer ? Sandbox.ModAPI.Ingame.MyDetectedEntityType.CharacterOther : Sandbox.ModAPI.Ingame.MyDetectedEntityType.CharacterHuman; + var myCharacter = entity as IMyCharacter; + if (myCharacter != null) + { + var type = !myCharacter.IsPlayer ? Sandbox.ModAPI.Ingame.MyDetectedEntityType.CharacterOther : Sandbox.ModAPI.Ingame.MyDetectedEntityType.CharacterHuman; - var getComponentOwner = entity as IMyComponentOwner; + var getComponentOwner = entity as IMyComponentOwner; - long playerId; - MyIDModule targetIdModule; - if (getComponentOwner != null && getComponentOwner.GetComponent(out targetIdModule)) - playerId = targetIdModule.Owner; - else { - var controllingId = myCharacter.ControllerInfo?.ControllingIdentityId; - playerId = controllingId ?? 0; - } + long playerId; + MyIDModule targetIdModule; + if (getComponentOwner != null && getComponentOwner.GetComponent(out targetIdModule)) + playerId = targetIdModule.Owner; + else { + var controllingId = myCharacter.ControllerInfo?.ControllingIdentityId; + playerId = controllingId ?? 0; + } - relationship = MyIDModule.GetRelationPlayerBlock(gridOwner, playerId, MyOwnershipShareModeEnum.Faction); - entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(entity.EntityId, string.Empty, type, null, MatrixD.Zero, Vector3.Zero, relationship, new BoundingBoxD(), Session.I.Tick); + relationship = MyIDModule.GetRelationPlayerBlock(gridOwner, playerId, MyOwnershipShareModeEnum.Faction); + entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(entity.EntityId, string.Empty, type, null, MatrixD.Zero, Vector3.Zero, relationship, new BoundingBoxD(), Session.I.Tick); - return !myCharacter.IsDead && myCharacter.Integrity > 0; - } + return !myCharacter.IsDead && myCharacter.Integrity > 0; + } - var myPlanet = entity as MyPlanet; + var myPlanet = entity as MyPlanet; - if (myPlanet != null) - { - const Sandbox.ModAPI.Ingame.MyDetectedEntityType type = Sandbox.ModAPI.Ingame.MyDetectedEntityType.Planet; - entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(entity.EntityId, string.Empty, type, null, MatrixD.Zero, Vector3.Zero, relationship, new BoundingBoxD(), Session.I.Tick); - return true; - } - if (entity is MyVoxelMap) - { - const Sandbox.ModAPI.Ingame.MyDetectedEntityType type = Sandbox.ModAPI.Ingame.MyDetectedEntityType.Asteroid; - entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(entity.EntityId, string.Empty, type, null, MatrixD.Zero, Vector3.Zero, relationship, new BoundingBoxD(), Session.I.Tick); - return true; - } - if (entity is MyMeteor) - { - const Sandbox.ModAPI.Ingame.MyDetectedEntityType type = Sandbox.ModAPI.Ingame.MyDetectedEntityType.Meteor; - entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(entity.EntityId, string.Empty, type, null, MatrixD.Zero, Vector3.Zero, MyRelationsBetweenPlayerAndBlock.Enemies, new BoundingBoxD(), Session.I.Tick); - return true; - } + if (myPlanet != null) + { + const Sandbox.ModAPI.Ingame.MyDetectedEntityType type = Sandbox.ModAPI.Ingame.MyDetectedEntityType.Planet; + entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(entity.EntityId, string.Empty, type, null, MatrixD.Zero, Vector3.Zero, relationship, new BoundingBoxD(), Session.I.Tick); + return true; + } + if (entity is MyVoxelMap) + { + const Sandbox.ModAPI.Ingame.MyDetectedEntityType type = Sandbox.ModAPI.Ingame.MyDetectedEntityType.Asteroid; + entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(entity.EntityId, string.Empty, type, null, MatrixD.Zero, Vector3.Zero, relationship, new BoundingBoxD(), Session.I.Tick); + return true; + } + if (entity is MyMeteor) + { + const Sandbox.ModAPI.Ingame.MyDetectedEntityType type = Sandbox.ModAPI.Ingame.MyDetectedEntityType.Meteor; + entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(entity.EntityId, string.Empty, type, null, MatrixD.Zero, Vector3.Zero, MyRelationsBetweenPlayerAndBlock.Enemies, new BoundingBoxD(), Session.I.Tick); + return true; } - catch (Exception ex) { Log.Line($"Exception in CreateEntInfo: {ex}", null, true); } - entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(); - return false; + entInfo = new Sandbox.ModAPI.Ingame.MyDetectedEntityInfo(); + return false; } } } diff --git a/Data/Scripts/CoreSystems/Ai/AiEvents.cs b/Data/Scripts/CoreSystems/Ai/AiEvents.cs index 4b6d57b9..a808a82f 100644 --- a/Data/Scripts/CoreSystems/Ai/AiEvents.cs +++ b/Data/Scripts/CoreSystems/Ai/AiEvents.cs @@ -2,13 +2,11 @@ using System.Collections.Generic; using Sandbox.Game; using Sandbox.Game.Entities; -using Sandbox.Game.Entities.Interfaces; using Sandbox.ModAPI; using VRage; using VRage.Collections; using VRage.Game.Entity; using VRage.Game.ModAPI; -using VRage.Utils; using VRageMath; namespace CoreSystems.Support @@ -185,10 +183,7 @@ internal void FatBlockAdded(MyCubeBlock cube) if (!ModOverride && Session.I.IsPartAreaRestricted(cube.BlockDefinition.Id.SubtypeId, blockBox, cube.CubeGrid, cube.EntityId, null, out b, out s)) { if (Session.I.IsServer) - { Session.I.FutureEvents.Schedule(QueuedBlockRemoval, cube, 10); - //cube.CubeGrid.RemoveBlock(cube.SlimBlock, true); - } } //Projected block ammo removal diff --git a/Data/Scripts/CoreSystems/Ai/AiFields.cs b/Data/Scripts/CoreSystems/Ai/AiFields.cs index 230bf5a9..6c1fe363 100644 --- a/Data/Scripts/CoreSystems/Ai/AiFields.cs +++ b/Data/Scripts/CoreSystems/Ai/AiFields.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Collections.Generic; using CoreSystems.Platform; using CoreSystems.Projectiles; diff --git a/Data/Scripts/CoreSystems/Ai/AiSupport.cs b/Data/Scripts/CoreSystems/Ai/AiSupport.cs index 6fa1ae08..a49b6e5f 100644 --- a/Data/Scripts/CoreSystems/Ai/AiSupport.cs +++ b/Data/Scripts/CoreSystems/Ai/AiSupport.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using CoreSystems.Platform; using CoreSystems.Projectiles; using Sandbox.Game.EntityComponents; @@ -68,7 +67,7 @@ internal void CompChange(bool add, CoreComponent comp) WeaponIdx[WeaponComps[weaponIdx]] = weaponIdx; WeaponIdx.Remove(wComp); - if (wCompMaxWepRange >= (MaxTargetingRange - TopEntity.PositionComp.LocalVolume.Radius) * 0.95) //Filter so that only the longest ranged weps force a recalc + if (wCompMaxWepRange >= (MaxTargetingRange - TopEntity.PositionComp.LocalVolume.Radius) * 0.95) UpdateMaxTargetingRange(); if (wComp.Data.Repo.Values.Set.Overrides.WeaponGroupId > 0) diff --git a/Data/Scripts/CoreSystems/Ai/AiTargeting.cs b/Data/Scripts/CoreSystems/Ai/AiTargeting.cs index 7a7a52ae..d9ade1aa 100644 --- a/Data/Scripts/CoreSystems/Ai/AiTargeting.cs +++ b/Data/Scripts/CoreSystems/Ai/AiTargeting.cs @@ -1,6 +1,5 @@ using System.Collections.Concurrent; using System.Collections.Generic; -using System.Xml; using CoreSystems.Platform; using CoreSystems.Projectiles; using Sandbox.Game.Entities; @@ -133,9 +132,10 @@ private static bool AcquireTopMostEntity(Weapon w, ProtoWeaponOverrides overRide var movingMode = moveMode == ProtoWeaponOverrides.MoveModes.Moving; var fireOnStation = moveMode == ProtoWeaponOverrides.MoveModes.Any || moveMode == ProtoWeaponOverrides.MoveModes.Moored; var stationOnly = moveMode == ProtoWeaponOverrides.MoveModes.Moored; + var shipOnly = moveMode == ProtoWeaponOverrides.MoveModes.ShipAny; BoundingSphereD waterSphere = new BoundingSphereD(Vector3D.Zero, 1f); WaterData water = null; - if (session.WaterApiLoaded && !ammoDef.IgnoreWater && ai.InPlanetGravity && ai.MyPlanet != null && session.WaterMap.TryGetValue(ai.MyPlanet.EntityId, out water)) + if (session.WaterApiLoaded && !(ammoDef.IgnoreWater || comp.TargetSubmerged) && ai.InPlanetGravity && ai.MyPlanet != null && session.WaterMap.TryGetValue(ai.MyPlanet.EntityId, out water)) waterSphere = new BoundingSphereD(ai.MyPlanet.PositionComp.WorldAABB.Center, water.MinRadius); var rootConstruct = ai.Construct.RootAi.Construct; @@ -223,7 +223,7 @@ private static bool AcquireTopMostEntity(Weapon w, ProtoWeaponOverrides overRide if (w.System.ScanTrackOnly && !ValidScanEntity(w, info.EntInfo, info.Target, true)) continue; - if (movingMode && info.VelLenSqr < 1 || !fireOnStation && info.IsStatic || stationOnly && !info.IsStatic) + if (movingMode && info.VelLenSqr < 1 || !fireOnStation && info.IsStatic || stationOnly && !info.IsStatic || shipOnly && info.IsStatic) continue; var character = info.Target as IMyCharacter; @@ -246,9 +246,15 @@ private static bool AcquireTopMostEntity(Weapon w, ProtoWeaponOverrides overRide Vector3D targetAccel = accelPrediction ? info.Target.Physics?.LinearAcceleration ?? Vector3D.Zero : Vector3.Zero; Vector3D predictedPos; + // WcApi turret target validation + if (Session.I.ValidateWeaponTargetFunc != null && + !Session.I.ValidateWeaponTargetFunc.Invoke(w.Comp.TerminalBlock, w.PartId, info.Target)) + continue; + if (info.IsGrid) { - if (!s.TrackGrids || !overRides.Grids || (!overRides.LargeGrid && info.LargeGrid) || (!overRides.SmallGrid && !info.LargeGrid) || !focusTarget && info.FatCount < 2) continue; + if (!s.TrackGrids || !overRides.Grids || ((s.TrackProhibitLG || !overRides.LargeGrid) && info.LargeGrid) || ((s.TrackProhibitSG || !overRides.SmallGrid) && !info.LargeGrid) || !focusTarget && info.FatCount < 2) continue; + if (w.System.TargetGridCenter) { if (!Weapon.CanShootTarget(w, ref targetCenter, targetLinVel, targetAccel, out predictedPos, false, null, MathFuncs.DebugCaller.CanShootTarget2)) continue; @@ -451,7 +457,7 @@ private static bool AcquireObstruction(Weapon w, ProtoWeaponOverrides overRides) if (grid != null) { - if (!overRides.Grids || (!overRides.LargeGrid && info.LargeGrid) || (!overRides.SmallGrid && !info.LargeGrid) || grid.CubeBlocks.Count == 0) continue; + if (!overRides.Grids || ((s.TrackProhibitLG || !overRides.LargeGrid) && info.LargeGrid) || ((s.TrackProhibitSG || !overRides.SmallGrid) && !info.LargeGrid) || grid.CubeBlocks.Count == 0) continue; session.CanShoot++; Vector3D newCenter; @@ -518,7 +524,7 @@ internal static bool AcquireProjectile(Weapon w, ulong id = ulong.MaxValue) var aConst = w.ActiveAmmoDef.AmmoDef.Const; BoundingSphereD waterSphere = new BoundingSphereD(Vector3D.Zero, 1f); WaterData water = null; - if (Session.I.WaterApiLoaded && !w.ActiveAmmoDef.AmmoDef.IgnoreWater && ai.InPlanetGravity && ai.MyPlanet != null && Session.I.WaterMap.TryGetValue(ai.MyPlanet.EntityId, out water)) + if (Session.I.WaterApiLoaded && !(w.ActiveAmmoDef.AmmoDef.IgnoreWater || w.Comp.TargetSubmerged) && ai.InPlanetGravity && ai.MyPlanet != null && Session.I.WaterMap.TryGetValue(ai.MyPlanet.EntityId, out water)) waterSphere = new BoundingSphereD(ai.MyPlanet.PositionComp.WorldAABB.Center, water.MinRadius); var wepAiOwnerFactionId = w.Comp.MasterAi.AiOwnerFactionId; @@ -735,7 +741,7 @@ internal static bool ReacquireTarget(Projectile p) var previousEntity = info.AcquiredEntity; BoundingSphereD waterSphere = new BoundingSphereD(Vector3D.Zero, 1f); WaterData water = null; - if (Session.I.WaterApiLoaded && !info.AmmoDef.IgnoreWater && ai.InPlanetGravity && ai.MyPlanet != null && Session.I.WaterMap.TryGetValue(ai.MyPlanet.EntityId, out water)) + if (Session.I.WaterApiLoaded && !(info.AmmoDef.IgnoreWater || w.Comp.TargetSubmerged) && ai.InPlanetGravity && ai.MyPlanet != null && Session.I.WaterMap.TryGetValue(ai.MyPlanet.EntityId, out water)) waterSphere = new BoundingSphereD(ai.MyPlanet.PositionComp.WorldAABB.Center, water.MinRadius); TargetInfo alphaInfo = null; int offset = 0; @@ -821,7 +827,7 @@ internal static bool ReacquireTarget(Projectile p) if (tInfo.IsGrid) { - if (!s.TrackGrids || !overRides.Grids || !focusTarget && tInfo.FatCount < 2 || !aConst.CheckFutureIntersection && Obstruction(ref tInfo, ref targetPos, p) || (!overRides.LargeGrid && tInfo.LargeGrid) || (!overRides.SmallGrid && !tInfo.LargeGrid)) continue; + if (!s.TrackGrids || !overRides.Grids || !focusTarget && tInfo.FatCount < 2 || !aConst.CheckFutureIntersection && Obstruction(ref tInfo, ref targetPos, p) || ((s.TrackProhibitLG || !overRides.LargeGrid) && tInfo.LargeGrid) || ((s.TrackProhibitSG || !overRides.SmallGrid) && !tInfo.LargeGrid)) continue; if (!AcquireBlock(w, target, tInfo, ref waterSphere, ref info.Random, p, focusTarget)) continue; acquired = true; @@ -1129,7 +1135,8 @@ private static bool FindRandomBlock(Weapon w, Target target, TargetInfo info, Co w.AcquiredBlock = true; var targetDirNorm = Vector3D.Normalize(blockPos - w.BarrelOrigin); - var testPos = w.BarrelOrigin + (targetDirNorm * w.MuzzleDistToBarrelCenter); + var ctcCam = w.RotorTurretTracking && w.Comp.Ai.ControlComp?.Controller.Camera != null; + var testPos = ctcCam ? w.Comp.Ai.ControlComp.Controller.Camera.GetPosition() : w.BarrelOrigin + (targetDirNorm * w.MuzzleDistToBarrelCenter); var targetDist = Vector3D.Distance(testPos, blockPos); var fakeCheck = w.System.NoVoxelLosCheck; @@ -1145,50 +1152,53 @@ private static bool FindRandomBlock(Weapon w, Target target, TargetInfo info, Co var lowFiVoxels = distSqr > oneHalfKmSqr && (ai.PlanetSurfaceInRange || ai.ClosestVoxelSqr <= oneHalfKmSqr); var filter = lowFiVoxels ? CollisionLayers.DefaultCollisionLayer : CollisionLayers.VoxelLod1CollisionLayer; - physics.CastRay(testPos, blockPos, hitTmpList, filter); - for (int j = 0; j < hitTmpList.Count; j++) + IHitInfo iHitInfo; + MyCubeGrid rayGrid = null; + if (ai.AiType == AiTypes.Grid && physics.CastRay(testPos, blockPos, out iHitInfo, CollisionLayers.NoVoxelCollisionLayer)) + { + rayGrid = iHitInfo.HitEntity?.GetTopMostParent() as MyCubeGrid; + if (rayGrid != null && rayGrid.IsSameConstructAs(ai.GridEntity)) + continue; + } + if (rayGrid != null && block.CubeGrid == rayGrid) { - var hitInfo = hitTmpList[j]; + acquire = true; + } + else + { + physics.CastRay(testPos, blockPos, hitTmpList, filter); + for (int j = 0; j < hitTmpList.Count; j++) + { + var hitInfo = hitTmpList[j]; - var entity = hitInfo.HitEntity as MyEntity; - var hitGrid = entity as MyCubeGrid; - var voxel = entity as MyVoxelBase; - var character = entity as IMyCharacter; - var dist = hitInfo.Fraction * targetDist; + var entity = hitInfo.HitEntity as MyEntity; + var hitGrid = entity as MyCubeGrid; + var voxel = entity as MyVoxelBase; + var character = entity as IMyCharacter; + var dist = hitInfo.Fraction * targetDist; - if (character == null && hitGrid == null && voxel == null || dist >= closest || hitGrid != null && (hitGrid.MarkedForClose || hitGrid.Physics == null || hitGrid.IsPreview)) - continue; + if (character == null && hitGrid == null && voxel == null || dist >= closest || hitGrid != null && (hitGrid.MarkedForClose || hitGrid.Physics == null || hitGrid.IsPreview)) + continue; - TargetInfo otherInfo; - var knownTarget = ai.Targets.TryGetValue(entity, out otherInfo) && (otherInfo.EntInfo.Relationship == MyRelationsBetweenPlayerAndBlock.Enemies || otherInfo.EntInfo.Relationship == MyRelationsBetweenPlayerAndBlock.Neutral || otherInfo.EntInfo.Relationship == MyRelationsBetweenPlayerAndBlock.NoOwnership); + TargetInfo otherInfo; + var knownTarget = ai.Targets.TryGetValue(entity, out otherInfo) && (otherInfo.EntInfo.Relationship == MyRelationsBetweenPlayerAndBlock.Enemies || otherInfo.EntInfo.Relationship == MyRelationsBetweenPlayerAndBlock.Neutral || otherInfo.EntInfo.Relationship == MyRelationsBetweenPlayerAndBlock.NoOwnership); - var enemyCharacter = character != null && knownTarget; + var enemyCharacter = character != null && knownTarget; - if (character != null && !enemyCharacter) - { - if (dist < closest) + if (character != null && !enemyCharacter && dist < closest) { closest = dist; acquire = false; } - } - if (voxel != null) - { - if (dist < closest) + else if (voxel != null && dist < closest) { closest = dist; acquire = false; } - } - else if (hitGrid != null) - { - var bigOwners = hitGrid.BigOwners; - var noOwner = bigOwners.Count == 0; - var validTarget = noOwner || knownTarget; - - if (dist < closest) + else if (hitGrid != null && dist < closest) { + var validTarget = hitGrid.BigOwners.Count == 0 || knownTarget; closest = dist; acquire = validTarget; } @@ -1198,17 +1208,29 @@ private static bool FindRandomBlock(Weapon w, Target target, TargetInfo info, Co else { IHitInfo iHitInfo; + MyCubeGrid rayGrid = null; if (ai.AiType == AiTypes.Grid && physics.CastRay(testPos, testPos + (targetDirNorm * (ai.TopEntityVolume.Radius * 2)), out iHitInfo, CollisionLayers.NoVoxelCollisionLayer)) { - var rayGrid = iHitInfo.HitEntity?.GetTopMostParent() as MyCubeGrid; + rayGrid = iHitInfo.HitEntity?.GetTopMostParent() as MyCubeGrid; if (rayGrid != null && rayGrid.IsSameConstructAs(ai.GridEntity)) continue; } - var checkLine = new LineD(testPos, testPos + (targetDirNorm * w.MaxTargetDistance), w.MaxTargetDistance); + s.OverlapResultTmp.Clear(); - var queryType = ai.StaticEntityInRange ? MyEntityQueryType.Both : MyEntityQueryType.Dynamic; - MyGamePruningStructure.GetTopmostEntitiesOverlappingRay(ref checkLine, s.OverlapResultTmp, queryType); + var checkLine = new LineD(testPos, testPos + (targetDirNorm * targetDist), targetDist); + + if (rayGrid != null && block.CubeGrid == rayGrid) + { + var hit = new MyLineSegmentOverlapResult() {Element = rayGrid}; + s.OverlapResultTmp.Add(hit); + } + else + { + var queryType = ai.StaticEntityInRange ? MyEntityQueryType.Both : MyEntityQueryType.Dynamic; + MyGamePruningStructure.GetTopmostEntitiesOverlappingRay(ref checkLine, s.OverlapResultTmp, queryType); + } + for (int j = 0; j < s.OverlapResultTmp.Count; j++) { var entity = s.OverlapResultTmp[j].Element; @@ -1751,7 +1773,7 @@ internal static bool SwitchToDrone(Weapon w) var stationOnly = moveMode == ProtoWeaponOverrides.MoveModes.Moored; BoundingSphereD waterSphere = new BoundingSphereD(Vector3D.Zero, 1f); WaterData water = null; - if (session.WaterApiLoaded && !ammoDef.IgnoreWater && ai.InPlanetGravity && ai.MyPlanet != null && session.WaterMap.TryGetValue(ai.MyPlanet.EntityId, out water)) + if (session.WaterApiLoaded && !(ammoDef.IgnoreWater || w.Comp.TargetSubmerged) && ai.InPlanetGravity && ai.MyPlanet != null && session.WaterMap.TryGetValue(ai.MyPlanet.EntityId, out water)) waterSphere = new BoundingSphereD(ai.MyPlanet.PositionComp.WorldAABB.Center, water.MinRadius); var numOfTargets = ai.SortedTargets.Count; @@ -1801,7 +1823,7 @@ internal static bool SwitchToDrone(Weapon w) if (info.IsGrid) { - if (!s.TrackGrids || !overRides.Grids || info.FatCount < 2 || (!overRides.LargeGrid && info.LargeGrid) || (!overRides.SmallGrid && !info.LargeGrid)) continue; + if (!s.TrackGrids || !overRides.Grids || info.FatCount < 2 || ((s.TrackProhibitLG || !overRides.LargeGrid) && info.LargeGrid) || ((s.TrackProhibitSG || !overRides.SmallGrid) && !info.LargeGrid)) continue; session.CanShoot++; Vector3D newCenter; if (!w.TurretController) diff --git a/Data/Scripts/CoreSystems/Ai/AiTypes.cs b/Data/Scripts/CoreSystems/Ai/AiTypes.cs index 874af0d1..e05287fa 100644 --- a/Data/Scripts/CoreSystems/Ai/AiTypes.cs +++ b/Data/Scripts/CoreSystems/Ai/AiTypes.cs @@ -1,10 +1,7 @@ -using System; -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Collections.Generic; using CoreSystems.Platform; using Sandbox.Game.Entities; -using Sandbox.Game.World; -using Sandbox.ModAPI; using Sandbox.ModAPI.Ingame; using VRage.Collections; using VRage.Game; @@ -12,7 +9,6 @@ using VRage.Game.ModAPI; using VRage.Utils; using VRageMath; -using CollisionLayers = Sandbox.Engine.Physics.MyPhysics.CollisionLayers; namespace CoreSystems.Support { public partial class Ai @@ -366,7 +362,7 @@ internal void Clean(Ai ai) DroneCount = 0; var rootConstruct = ai.Construct.RootAi.Construct; - if (rootConstruct.DroneCount != 0 && Session.I.Tick - rootConstruct.LastDroneTick > 30) //Was 200, dropped for faster updates on current threats + if (rootConstruct.DroneCount != 0 && Session.I.Tick - rootConstruct.LastDroneTick > 30) rootConstruct.DroneCleanup(); } } diff --git a/Data/Scripts/CoreSystems/Api/ApiBackend.cs b/Data/Scripts/CoreSystems/Api/ApiBackend.cs index 97457462..9b0a8a00 100644 --- a/Data/Scripts/CoreSystems/Api/ApiBackend.cs +++ b/Data/Scripts/CoreSystems/Api/ApiBackend.cs @@ -141,6 +141,9 @@ internal ApiBackend() ["IsInRange"] = new Func>(IsInRangeLegacy), ["GetConstructEffectiveDpsBase"] = new Func(GetConstructEffectiveDps), ["GetConstructEffectiveDps"] = new Func(GetConstructEffectiveDpsLegacy), + ["AddScanTargetsAction"] = new Action>>(AddScanTargetsAction), + ["RemoveScanTargetsAction"] = new Action>>(RemoveScanTargetsAction), + ["SetValidateWeaponTargetFunc"] = new Action>(SetValidateWeaponTargetFunc), // Phantoms ["GetTargetAssessment"] = new Func>(GetPhantomTargetAssessment), @@ -190,6 +193,7 @@ internal ApiBackend() ["HasGridAi"] = new Func(PbHasGridAi), ["HasCoreWeapon"] = new Func(PbHasCoreWeapon), ["GetOptimalDps"] = new Func(PbGetOptimalDps), + ["GetAmmoCount"] = new Func(PbGetAmmoCount), ["GetActiveAmmo"] = new Func(PbGetActiveAmmo), ["SetActiveAmmo"] = new Action(PbSetActiveAmmo), ["RegisterProjectileAdded"] = new Action>(RegisterProjectileAddedCallback), @@ -264,6 +268,15 @@ private void PbSetActiveAmmo(object arg1, int arg2, string arg3) SetActiveAmmo((MyEntity) arg1, arg2, arg3); } + private int PbGetAmmoCount(object arg1, int arg2) + { + var weaponBlock = (MyEntity)arg1; + var comp = weaponBlock.Components.Get() as Weapon.WeaponComponent; + if (comp?.Platform != null && comp.Platform.State == Ready && comp.Platform.Weapons.Count > arg2) + return comp.Platform.Weapons[arg2].ProtoWeaponAmmo.CurrentAmmo; + return -1; + } + private string PbGetActiveAmmo(object arg1, int arg2) { return GetActiveAmmo((MyEntity) arg1, arg2); @@ -1509,6 +1522,23 @@ private MyTuple IsInRange(MyEntity entity) } return new MyTuple(); } + + private void AddScanTargetsAction(Action> action) + { + Session.I.ScanTargetsAction += action; + } + + private void RemoveScanTargetsAction(Action> action) + { + Session.I.ScanTargetsAction -= action; + } + + private void SetValidateWeaponTargetFunc(Func func) + { + Session.I.ValidateWeaponTargetFunc = func; + } + + /// /// Phantoms /// diff --git a/Data/Scripts/CoreSystems/Api/CoreSystemsApiBase.cs b/Data/Scripts/CoreSystems/Api/CoreSystemsApiBase.cs index 94222dbe..69c0f195 100644 --- a/Data/Scripts/CoreSystems/Api/CoreSystemsApiBase.cs +++ b/Data/Scripts/CoreSystems/Api/CoreSystemsApiBase.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using CoreSystems.Platform; +using Sandbox.Game.Entities; using Sandbox.ModAPI; using VRage; using VRage.Collections; @@ -12,7 +12,7 @@ namespace CoreSystems.Api { /// - /// https://github.com/sstixrud/CoreSystems/blob/master/BaseData/Scripts/CoreSystems/Api/CoreSystemsApiBase.cs + /// https://github.com/Ash-LikeSnow/WeaponCore/blob/master/Data/Scripts/CoreSystems/Api/CoreSystemsApiBase.cs /// public partial class WcApi { @@ -92,6 +92,9 @@ public partial class WcApi private Func> _getMagazineMap; private Func _setMagazine; private Func _forceReload; + private Action>> _addScanTargetsAction; + private Action>> _removeScanTargetsAction; + private Action> _setValidateWeaponTargetFunc; public void SetWeaponTarget(MyEntity weapon, MyEntity target, int weaponId = 0) => _setWeaponTarget?.Invoke(weapon, target, weaponId); @@ -468,6 +471,25 @@ public bool ForceReload(MyEntity weapon, int weaponId) } + /// + /// Registers an action that tells a given grid's AI available target entities in a given sphere. NOT NETWORKED - make sure this is synced in your mod. + /// + /// + public void AddScanTargetsAction(Action> action) => _addScanTargetsAction?.Invoke(action); + + /// + /// Unregisters an action that tells a given grid's AI available target entities in a given sphere. NOT NETWORKED - make sure this is synced in your mod. + /// + /// + public void RemoveScanTargetsAction(Action> action) => _removeScanTargetsAction?.Invoke(action); + + /// + /// Assigns a function that determines if a given weapon can target a given entity. NOT NETWORKED - make sure this is synced in your mod. + /// + /// Block, PartId, target + public void SetValidateWeaponTargetFunc(Func func) => + _setValidateWeaponTargetFunc?.Invoke(func); + private const long Channel = 67549756549; private bool _getWeaponDefinitions; private bool _isRegistered; @@ -618,6 +640,10 @@ public void ApiAssign(IReadOnlyDictionary delegates, bool getW AssignMethod(delegates, "SetMagazine", ref _setMagazine); AssignMethod(delegates, "ForceReload", ref _forceReload); + AssignMethod(delegates, "AddScanTargetsAction", ref _addScanTargetsAction); + AssignMethod(delegates, "RemoveScanTargetsAction", ref _removeScanTargetsAction); + AssignMethod(delegates, "SetValidateWeaponTargetFunc", ref _setValidateWeaponTargetFunc); + // Damage handler AssignMethod(delegates, "DamageHandler", ref _registerDamageEvent); diff --git a/Data/Scripts/CoreSystems/Api/CoreSystemsApiBlocks.cs b/Data/Scripts/CoreSystems/Api/CoreSystemsApiBlocks.cs index ac20ccce..ba582a31 100644 --- a/Data/Scripts/CoreSystems/Api/CoreSystemsApiBlocks.cs +++ b/Data/Scripts/CoreSystems/Api/CoreSystemsApiBlocks.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; using Sandbox.ModAPI; -using VRage; -using VRage.Game.Entity; -using VRage.ModAPI; -using VRageMath; namespace CoreSystems.Api { diff --git a/Data/Scripts/CoreSystems/Api/CoreSystemsApiDefs.cs b/Data/Scripts/CoreSystems/Api/CoreSystemsApiDefs.cs index c8328ac2..e0a169bf 100644 --- a/Data/Scripts/CoreSystems/Api/CoreSystemsApiDefs.cs +++ b/Data/Scripts/CoreSystems/Api/CoreSystemsApiDefs.cs @@ -1,9 +1,6 @@ using System.Collections.Generic; using ProtoBuf; using VRageMath; -using static CoreSystems.Support.WeaponDefinition.AmmoDef.GraphicDef.LineDef; -using static CoreSystems.Support.WeaponDefinition.AmmoDef.TrajectoryDef.ApproachDef; -using static CoreSystems.Support.WeaponDefinition.AnimationDef.PartAnimationSetDef; namespace CoreSystems.Api { diff --git a/Data/Scripts/CoreSystems/Api/CoreSystemsPbApi.cs b/Data/Scripts/CoreSystems/Api/CoreSystemsPbApi.cs index 7cf8ee10..8a414678 100644 --- a/Data/Scripts/CoreSystems/Api/CoreSystemsPbApi.cs +++ b/Data/Scripts/CoreSystems/Api/CoreSystemsPbApi.cs @@ -8,6 +8,8 @@ namespace CoreSystems.Api { + // WC PB API USERS: Copy the class below into your script + /// /// https://github.com/Ash-LikeSnow/WeaponCore/blob/master/Data/Scripts/CoreSystems/Api/CoreSystemsPbApi.cs /// @@ -44,6 +46,7 @@ public class WcPbApi private Func _hasCoreWeapon; private Func _getOptimalDps; private Func _getActiveAmmo; + private Func _getAmmoCount; private Action _setActiveAmmo; private Action> _monitorProjectile; private Action> _unMonitorProjectile; @@ -120,6 +123,7 @@ public bool ApiAssign(IReadOnlyDictionary delegates) AssignMethod(delegates, "HasGridAi", ref _hasGridAi); AssignMethod(delegates, "HasCoreWeapon", ref _hasCoreWeapon); AssignMethod(delegates, "GetOptimalDps", ref _getOptimalDps); + AssignMethod(delegates, "GetAmmoCount", ref _getAmmoCount); AssignMethod(delegates, "GetActiveAmmo", ref _getActiveAmmo); AssignMethod(delegates, "SetActiveAmmo", ref _setActiveAmmo); AssignMethod(delegates, "MonitorProjectile", ref _monitorProjectile); @@ -502,6 +506,15 @@ public bool CanShootTarget(Sandbox.ModAPI.Ingame.IMyTerminalBlock weapon, long t public string GetActiveAmmo(Sandbox.ModAPI.Ingame.IMyTerminalBlock weapon, int weaponId) => _getActiveAmmo?.Invoke(weapon, weaponId) ?? null; + /// + /// Returns the current amount of ammo the weapon has internally (loaded, not inventory) on . + /// + /// + /// + /// Current ammo + public string GetAmmoCount(Sandbox.ModAPI.Ingame.IMyTerminalBlock weapon, int weaponId) => + _getActiveAmmo?.Invoke(weapon, weaponId) ?? null; + /// /// Sets the active ammo name of on to . /// diff --git a/Data/Scripts/CoreSystems/AudioVisual/AvShot.cs b/Data/Scripts/CoreSystems/AudioVisual/AvShot.cs index 1085c15d..19765163 100644 --- a/Data/Scripts/CoreSystems/AudioVisual/AvShot.cs +++ b/Data/Scripts/CoreSystems/AudioVisual/AvShot.cs @@ -58,6 +58,9 @@ public AvShot(Session session) internal bool LastHitShield; internal bool ForceHitParticle; internal bool HitParticleActive; + internal bool ShieldHitParticleActive; + internal bool VoxelHitParticleActive; + internal bool WaterHitParticleActive; internal bool MarkForClose; internal bool ProEnded; internal bool AccelClearance; @@ -104,6 +107,7 @@ public AvShot(Session session) internal Vector3D ShootVelStep; internal Vector3D TracerFront; internal Vector3D TracerBack; + internal Vector3D ShieldHitAngle; internal Vector4 Color; internal Vector4 SegmentColor; internal Vector4 FgFactionColor; @@ -127,6 +131,9 @@ internal enum ParticleState { None, Custom, + Shield, + Water, + Voxel, Dirty, } @@ -385,7 +392,10 @@ internal static void DeferedAvStateUpdates() var lineOnScreen = a.OnScreen > (Screen)2; - if (!a.Active && (a.OnScreen != Screen.None || a.HitSoundInitted || a.TravelSound || aConst.AmmoParticleNoCull || saveHit && aConst.HitParticleNoCull || aConst.FieldParticle && aConst.FieldParticleNoCull)) { + var anyHitParticleNoCull = saveHit && (aConst.HitParticleNoCull || aConst.ShieldHitParticleNoCull || aConst.VoxelHitParticleNoCull || aConst.WaterHitParticleNoCull); + + if (!a.Active && (a.OnScreen != Screen.None || a.HitSoundInitted || a.TravelSound || aConst.AmmoParticleNoCull || anyHitParticleNoCull || aConst.FieldParticle && aConst.FieldParticleNoCull)) + { a.Active = true; s.Av.AvShots.Add(a); } @@ -397,19 +407,23 @@ internal static void DeferedAvStateUpdates() { if (a.Tracer == TracerState.Shrink && !a.ShrinkInited) a.Shrink(); - else if (aConst.IsBeamWeapon && aConst.HitParticle && !(a.MuzzleId != 0 && (aConst.ConvergeBeams || aConst.OneHitParticle))) + else if (aConst.IsBeamWeapon && !(a.MuzzleId != 0 && (aConst.ConvergeBeams || aConst.OneHitParticle))) { - MyParticleEffect effect; - if (a.Hitting) - { - ContainmentType containment; - s.CameraFrustrum.Contains(ref a.Hit.SurfaceHit, out containment); - if (containment != ContainmentType.Disjoint) a.RunBeam(); - } - else if (s.Av.BeamEffects.TryGetValue(a.UniqueMuzzleId, out effect)) + var shieldHit = a.Hit.EventType == HitEntity.Type.Shield && aConst.ShieldHitParticle; + if (shieldHit && a.ShieldHitParticleActive || (!shieldHit && aConst.HitParticle && a.HitParticleActive)) { - effect.Stop(); - s.Av.BeamEffects.Remove(a.UniqueMuzzleId); + MyParticleEffect effect; + if (a.Hitting) + { + ContainmentType containment; + s.CameraFrustrum.Contains(ref a.Hit.SurfaceHit, out containment); + if (containment != ContainmentType.Disjoint) a.RunBeam(shieldHit && a.ShieldHitParticleActive); + } + else if (s.Av.BeamEffects.TryGetValue(a.UniqueMuzzleId, out effect)) + { + effect.Stop(); + s.Av.BeamEffects.Remove(a.UniqueMuzzleId); + } } } @@ -957,53 +971,47 @@ internal void HitEffects(bool force = false) double distToCameraSqr; Vector3D.DistanceSquared(ref Hit.SurfaceHit, ref Session.CameraPos, out distToCameraSqr); - if (Hit.EventType == HitEntity.Type.Water) - { - HitParticleActive = true;//FML... didn't know there was rand for impacts. - } + if (Hit.EventType == HitEntity.Type.Water && !AmmoDef.Const.WaterHitParticle) + HitParticleActive = true; - if (OnScreen == Screen.Tracer || AmmoDef.Const.HitParticleNoCull || distToCameraSqr < 360000) { - if (HitParticleActive && AmmoDef.Const.HitParticle && !(LastHitShield && !AmmoDef.AmmoGraphics.Particles.Hit.ApplyToShield)) - HitParticle = ParticleState.Custom; + if (OnScreen != Screen.None) + { + if (LastHitShield && ShieldHitParticleActive && AmmoDef.Const.ShieldHitParticle && (AmmoDef.Const.ShieldHitParticleNoCull || distToCameraSqr < 360000)) + HitParticle = ParticleState.Shield; + else if (WaterHitParticleActive && Hit.EventType == HitEntity.Type.Water && (AmmoDef.Const.WaterHitParticleNoCull || distToCameraSqr < 360000)) + HitParticle = ParticleState.Water; + else if (VoxelHitParticleActive && Hit.EventType == HitEntity.Type.Voxel && (AmmoDef.Const.VoxelHitParticleNoCull || distToCameraSqr < 360000)) + HitParticle = ParticleState.Voxel; + else if (HitParticleActive && AmmoDef.Const.HitParticle && !(LastHitShield && !AmmoDef.AmmoGraphics.Particles.Hit.ApplyToShield) && (AmmoDef.Const.HitParticleNoCull || distToCameraSqr < 360000)) + HitParticle = ParticleState.Custom; } - var hitSound = AmmoDef.Const.HitSound && HitSoundActive && distToCameraSqr < AmmoDef.Const.HitSoundDistSqr && (!LastHitShield || AmmoDef.AmmoAudio.HitPlayShield); - if (hitSound) { - + if (hitSound) + { MySoundPair pair = null; - var shield = Hit.Entity as IMyUpgradeModule; - var voxel = Hit.Entity as MyVoxelBase; - var player = Hit.Entity as IMyCharacter; - var floating = Hit.Entity as MyFloatingObject; - if (voxel != null && AmmoDef.Const.VoxelSound) { + if (AmmoDef.Const.VoxelSound && Hit.EventType == HitEntity.Type.Voxel) pair = AmmoDef.Const.VoxelSoundPair; - } - else if (player != null && AmmoDef.Const.PlayerSound) { + else if (AmmoDef.Const.PlayerSound && Hit.Entity is IMyCharacter) pair = AmmoDef.Const.PlayerSoundPair; - } - else if (floating != null && AmmoDef.Const.FloatingSound) { + else if (AmmoDef.Const.FloatingSound && Hit.Entity is MyFloatingObject) pair = AmmoDef.Const.FloatingSoundPair; - } - else if (shield != null && AmmoDef.Const.ShieldSound) { + else if (AmmoDef.Const.ShieldSound && LastHitShield) pair = AmmoDef.Const.ShieldSoundPair; - } - else if (AmmoDef.Const.HitSound) { + else if (AmmoDef.Const.WaterSound && Hit.EventType == HitEntity.Type.Water) + pair = AmmoDef.Const.WaterSoundPair; + else if (AmmoDef.Const.HitSound) pair = AmmoDef.Const.HitSoundPair; - } - - if (pair != null) { + if (pair != null) + { var hitEmitter = Session.Av.PersistentEmitters.Count > 0 ? Session.Av.PersistentEmitters.Pop() : new MyEntity3DSoundEmitter(null); - var pos = Session.Tick - Hit.HitTick <= 1 && !MyUtils.IsZero(Hit.SurfaceHit) ? Hit.SurfaceHit : TracerFront; hitEmitter.Entity = Hit.Entity; hitEmitter.SetPosition(pos); hitEmitter.PlaySound(pair); - Session.SoundsToClean.Add(new Session.CleanSound { DelayedReturn = true, Emitter = hitEmitter, Pair = pair, EmitterPool = Session.I.Av.PersistentEmitters, SpawnTick = Session.I.Tick }); - HitSoundInitted = true; } } @@ -1051,8 +1059,8 @@ internal void SetupSounds(double distanceFromCameraSqr) } catch (Exception e) { - MyLog.Default.Error($"Sound error with ammo: {AmmoDef.AmmoRound} from {Weapon.Comp.TerminalBlock.DisplayName} soundID {AmmoDef.Const.ShotSoundPair.SoundId} cuename {AmmoDef.Const.ShotSoundPair.GetCueName()}" + - $"FireEmitter.Entity null? {FireEmitter?.Entity == null} \n Origin: {Origin}"); + MyLog.Default.Error($"Sound error with ammo: {AmmoDef.AmmoRound} from {Weapon.Comp.TerminalBlock.CustomName} soundID {AmmoDef.Const.ShotSoundPair.SoundId} cuename {AmmoDef.Const.ShotSoundPair.GetCueName()}" + + $"\n FireEmitter.Entity null? {FireEmitter?.Entity == null} \n Origin: {Origin} \n Marked for Close? {Weapon.Comp.FunctionalBlock.MarkedForClose}"); throw e; } } @@ -1187,22 +1195,24 @@ private void StageChange(int newStageIdx, bool createdPrimeEntity) } - internal void RunBeam() - { + internal void RunBeam(bool shieldHit) + { + var p = AmmoDef.AmmoGraphics.Particles; MyParticleEffect effect; MatrixD matrix; var vel = HitVelocity; if (!Session.Av.BeamEffects.TryGetValue(UniqueMuzzleId, out effect)) { - - MatrixD.CreateTranslation(ref TracerFront, out matrix); - if (!MyParticlesManager.TryCreateParticleEffect(AmmoDef.AmmoGraphics.Particles.Hit.Name, ref matrix, ref TracerFront, uint.MaxValue, out effect)) { + if (shieldHit) + matrix = MatrixD.CreateWorld(TracerFront, ShieldHitAngle, Vector3D.CalculatePerpendicularVector(ShieldHitAngle)); + else + MatrixD.CreateTranslation(ref TracerFront, out matrix); + if (!MyParticlesManager.TryCreateParticleEffect(shieldHit ? p.ShieldHit.Name : p.Hit.Name, ref matrix, ref TracerFront, uint.MaxValue, out effect)) return; - } if (effect.Loop || effect.DurationMax <= 0) Session.Av.BeamEffects[UniqueMuzzleId] = effect; - effect.UserScale = AmmoDef.AmmoGraphics.Particles.Hit.Extras.Scale; + effect.UserScale = shieldHit ? p.ShieldHit.Extras.Scale : p.Hit.Extras.Scale; Vector3D.ClampToSphere(ref vel, (float)MaxSpeed); } @@ -1221,6 +1231,8 @@ internal static void UpdateVirtualBeams(Projectile p, ProInfo info, HitEntity hi for (int v = 0; v < p.VrPros.Count; v++) { + if (p.State == ProjectileState.Dead) + break; var vp = p.VrPros[v]; var vs = vp.AvShot; @@ -1308,11 +1320,10 @@ internal void AvClose() { var particle = AmmoDef.AmmoGraphics.Particles.Hit; - var keenStrikesAgain = particle.Offset == Vector3D.MaxValue; MatrixD matrix = MatrixD.CreateTranslation(pos); - if(keenStrikesAgain) + if (particle.Offset == Vector3D.MaxValue) { - matrix = MatrixD.CreateWorld(pos, VisualDir, OriginUp); + matrix = MatrixD.CreateWorld(pos, VisualDir, Vector3D.CalculatePerpendicularVector(VisualDir)); } else if (particle.Offset == Vector3D.MinValue) { @@ -1410,7 +1421,6 @@ internal void UpdateCache(AvInfoCache avInfoCache) internal void Close() { - // Reset only vars that are not always set Hit = new Hit(); EndState = new AvClose(); @@ -1482,6 +1492,7 @@ internal void Close() Session.Av.OffSetLists.Push(Offsets); } + ShieldHitAngle = Vector3D.Zero; HitVelocity = Vector3D.Zero; TracerBack = Vector3D.Zero; TracerFront = Vector3D.Zero; diff --git a/Data/Scripts/CoreSystems/AudioVisual/RunAv.cs b/Data/Scripts/CoreSystems/AudioVisual/RunAv.cs index 85aa356a..81691626 100644 --- a/Data/Scripts/CoreSystems/AudioVisual/RunAv.cs +++ b/Data/Scripts/CoreSystems/AudioVisual/RunAv.cs @@ -11,6 +11,7 @@ using VRageRender; using static VRageRender.MyBillboard; using static CoreSystems.Support.WeaponDefinition.AmmoDef.GraphicDef.LineDef; +using static CoreSystems.Support.WeaponDefinition; namespace CoreSystems.Support { class RunAv @@ -138,42 +139,78 @@ internal void End() else av.TravelEmitter.SetPosition(av.TracerFront); } - if (av.HitParticle == AvShot.ParticleState.Custom) + if (!(av.HitParticle == AvShot.ParticleState.Dirty || av.HitParticle == AvShot.ParticleState.None)) { - av.HitParticle = AvShot.ParticleState.Dirty; if (av.OnScreen != AvShot.Screen.None) { var pos = Session.I.Tick - av.Hit.HitTick <= 1 && !MyUtils.IsZero(av.Hit.SurfaceHit) ? av.Hit.SurfaceHit : av.TracerFront; - var particle = av.AmmoDef.AmmoGraphics.Particles.Hit; - var keenStrikesAgain = particle.Offset == Vector3D.MaxValue; + ParticleDef particle; + bool gravPerp = false; MatrixD matrix = MatrixD.CreateTranslation(pos); - if (keenStrikesAgain) + switch (av.HitParticle) { - matrix = MatrixD.CreateWorld(pos, av.VisualDir, av.OriginUp); + case AvShot.ParticleState.Shield: + particle = av.AmmoDef.AmmoGraphics.Particles.ShieldHit; + if (av.ShieldHitAngle == Vector3D.Zero) + { + var grid = av.Hit.Entity.GetTopMostParent() as IMyCubeGrid; + var lineToShield = pos - grid.PositionComp.WorldAABB.Center; + lineToShield.Normalize(); + matrix = MatrixD.CreateWorld(pos, lineToShield, Vector3D.CalculatePerpendicularVector(lineToShield)); + } + else + matrix = MatrixD.CreateWorld(pos, av.ShieldHitAngle, Vector3D.CalculatePerpendicularVector(av.ShieldHitAngle)); + break; + case AvShot.ParticleState.Water: + particle = av.AmmoDef.AmmoGraphics.Particles.WaterHit; + gravPerp = true; + break; + case AvShot.ParticleState.Voxel: + particle = av.AmmoDef.AmmoGraphics.Particles.VoxelHit; + gravPerp = true; + break; + case AvShot.ParticleState.Custom: + default: + particle = av.AmmoDef.AmmoGraphics.Particles.Hit; + if (particle.Offset == Vector3D.MaxValue) + matrix = MatrixD.CreateWorld(pos, av.VisualDir, Vector3D.CalculatePerpendicularVector(av.VisualDir)); + else if (particle.Offset == Vector3D.MinValue) + gravPerp = true; + break; } - else if (particle.Offset == Vector3D.MinValue) + + if (gravPerp) { - float interference; - Vector3D localGrav = Session.I.Physics.CalculateNaturalGravityAt(pos, out interference); - localGrav.Normalize(); - if (localGrav != Vector3D.Zero) - matrix = MatrixD.CreateWorld(pos, Vector3D.CalculatePerpendicularVector(localGrav), -localGrav); + if (av.Weapon?.Comp?.Ai?.MyPlanet != null) + { + var planetDir = pos - av.Weapon.Comp.Ai.MyPlanet.PositionComp.WorldAABB.Center; + planetDir.Normalize(); + matrix = MatrixD.CreateWorld(pos, Vector3D.CalculatePerpendicularVector(planetDir), -planetDir); + } + else + { + float interference; + Vector3D localGrav = Session.I.Physics.CalculateNaturalGravityAt(pos, out interference); + localGrav.Normalize(); + if (localGrav != Vector3D.Zero) + matrix = MatrixD.CreateWorld(pos, Vector3D.CalculatePerpendicularVector(localGrav), -localGrav); + } } MyParticleEffect hitEffect; - if (MyParticlesManager.TryCreateParticleEffect(av.AmmoDef.Const.HitParticleStr, ref matrix, ref pos, uint.MaxValue, out hitEffect)) + if (MyParticlesManager.TryCreateParticleEffect(particle.Name, ref matrix, ref pos, uint.MaxValue, out hitEffect)) { - hitEffect.UserScale = av.AmmoDef.AmmoGraphics.Particles.Hit.Extras.Scale; + hitEffect.UserScale = particle.Extras.Scale; var tickVelo = av.Hit.HitVelocity / 60; HitParticles.Add(new HitParticleEvent(hitEffect, tickVelo)); if (hitEffect.Loop) hitEffect.Stop(); } } + av.HitParticle = AvShot.ParticleState.Dirty; } if (av.Hit.Entity != null && av.AmmoDef.AmmoGraphics.Decals.MaxAge > 0 && !Vector3D.IsZero(av.Hit.SurfaceHit) && av.AmmoDef.Const.TextureHitMap.Count > 0 && !av.Hit.Entity.MarkedForClose && av.Hit.Entity.InScene) { - //Starcore bug report on decals, parent "not found" and world position goes to NaN var shield = av.Hit.Entity as IMyUpgradeModule; var floating = av.Hit.Entity as MyFloatingObject; if (shield == null && floating == null) @@ -201,26 +238,11 @@ internal void End() Position = av.Hit.SurfaceHit + (av.Direction * 0.01), Normal = av.Direction, }; - - - //Log.Line($"Decal: {av.Hit.Entity.DebugName} mat{materialType} closed?{av.Hit.Entity.Closed} posCompNull?{av.Hit.Entity.PositionComp != null}"); - MyDecals.HandleAddDecal(av.Hit.Entity, hitInfo, Vector3.Zero, materialType, projectileMaterial, null, -1, voxelMaterial, false, MyDecalFlags.IgnoreOffScreenDeletion, MyAPIGateway.Session.GameplayFrameCounter + av.AmmoDef.AmmoGraphics.Decals.MaxAge); } } } - if (av.Hit.EventType == HitEntity.Type.Water) - { - var splashHit = av.Hit.SurfaceHit;//Hopefully we can get a more precise surface intercept or correction? - var ammoInfo = av.AmmoDef; - var radius = ammoInfo.Const.CollisionSize > ammoInfo.Const.LargestHitSize ? (float)ammoInfo.Const.CollisionSize : (float)ammoInfo.Const.LargestHitSize; - if (radius < 3) - radius = 3; - - WaterModAPI.CreateSplash(splashHit, radius, true); - } - if (av.Model != AvShot.ModelState.None) { if (av.AmmoEffect != null && av.AmmoDef.Const.AmmoParticle && av.AmmoDef.Const.PrimeModel) diff --git a/Data/Scripts/CoreSystems/Comms/Spectrum.cs b/Data/Scripts/CoreSystems/Comms/Spectrum.cs index 8b8c8e0c..c01d3dfc 100644 --- a/Data/Scripts/CoreSystems/Comms/Spectrum.cs +++ b/Data/Scripts/CoreSystems/Comms/Spectrum.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using CoreSystems; using VRage.Utils; using WeaponCore.Data.Scripts.CoreSystems.Support; diff --git a/Data/Scripts/CoreSystems/Coreparts/Definitions/AmmoTypes.cs b/Data/Scripts/CoreSystems/Coreparts/Definitions/AmmoTypes.cs index 6591afe3..3fafc203 100644 --- a/Data/Scripts/CoreSystems/Coreparts/Definitions/AmmoTypes.cs +++ b/Data/Scripts/CoreSystems/Coreparts/Definitions/AmmoTypes.cs @@ -1,16 +1,9 @@ using static CoreSystems.Support.WeaponDefinition; using static CoreSystems.Support.WeaponDefinition.AmmoDef; -using static CoreSystems.Support.WeaponDefinition.AmmoDef.EjectionDef; -using static CoreSystems.Support.WeaponDefinition.AmmoDef.EjectionDef.SpawnType; using static CoreSystems.Support.WeaponDefinition.AmmoDef.ShapeDef.Shapes; using static CoreSystems.Support.WeaponDefinition.AmmoDef.DamageScaleDef.CustomScalesDef.SkipMode; using static CoreSystems.Support.WeaponDefinition.AmmoDef.GraphicDef; using static CoreSystems.Support.WeaponDefinition.AmmoDef.GraphicDef.DecalDef; - -using static CoreSystems.Support.WeaponDefinition.AmmoDef.FragmentDef; -using static CoreSystems.Support.WeaponDefinition.AmmoDef.PatternDef.PatternModes; -using static CoreSystems.Support.WeaponDefinition.AmmoDef.FragmentDef.TimedSpawnDef.PointTypes; -using static CoreSystems.Support.WeaponDefinition.AmmoDef.TrajectoryDef; using static CoreSystems.Support.WeaponDefinition.AmmoDef.TrajectoryDef.GuidanceType; using static CoreSystems.Support.WeaponDefinition.AmmoDef.DamageScaleDef; using static CoreSystems.Support.WeaponDefinition.AmmoDef.DamageScaleDef.ShieldDef.ShieldType; @@ -18,12 +11,7 @@ using static CoreSystems.Support.WeaponDefinition.AmmoDef.AreaOfDamageDef; using static CoreSystems.Support.WeaponDefinition.AmmoDef.AreaOfDamageDef.Falloff; using static CoreSystems.Support.WeaponDefinition.AmmoDef.AreaOfDamageDef.AoeShape; -using static CoreSystems.Support.WeaponDefinition.AmmoDef.EwarDef; -using static CoreSystems.Support.WeaponDefinition.AmmoDef.EwarDef.EwarMode; -using static CoreSystems.Support.WeaponDefinition.AmmoDef.EwarDef.EwarType; -using static CoreSystems.Support.WeaponDefinition.AmmoDef.EwarDef.PushPullDef.Force; using static CoreSystems.Support.WeaponDefinition.AmmoDef.GraphicDef.LineDef; -using static CoreSystems.Support.WeaponDefinition.AmmoDef.GraphicDef.LineDef.TracerBaseDef; using static CoreSystems.Support.WeaponDefinition.AmmoDef.GraphicDef.LineDef.Texture; using static CoreSystems.Support.WeaponDefinition.AmmoDef.DamageScaleDef.DamageTypes.Damage; namespace Scripts @@ -36,6 +24,7 @@ partial class Parts AmmoRound = "SpotLight", BaseDamage = 0, NoGridOrArmorScaling = true, + EnergyMagazineSize = 1, Trajectory = new TrajectoryDef { MaxLifeTime = 3600, @@ -47,82 +36,15 @@ partial class Parts { AmmoMagazine = "NATO_25x184mm", // SubtypeId of physical ammo magazine. Use "Energy" for weapons without physical ammo. AmmoRound = "25mm NATO", // Name of ammo in terminal, should be different for each ammo type used by the same weapon. Is used by Shrapnel. - HybridRound = false, // Use both a physical ammo magazine and energy per shot. - EnergyCost = 0.1f, // Scaler for energy per shot (EnergyCost * BaseDamage * (RateOfFire / 3600) * BarrelsPerShot * TrajectilesPerBarrel). Uses EffectStrength instead of BaseDamage if EWAR. BaseDamage = 90f, // Direct damage; one steel plate is worth 100. Mass = 1f, // In kilograms; how much force the impact will apply to the target. - Health = 0, // How much damage the projectile can take from other projectiles (base of 1 per hit) before dying; 0 disables this and makes the projectile untargetable. BackKickForce = 200f, // Recoil. This is applied to the Parent Grid. - DecayPerShot = 0f, // Damage to the firing weapon itself. - HardPointUsable = true, // Whether this is a primary ammo type fired directly by the turret. Set to false if this is a shrapnel ammoType and you don't want the turret to be able to select it directly. - EnergyMagazineSize = 0, // For energy weapons, how many shots to fire before reloading. - IgnoreWater = false, // Whether the projectile should be able to penetrate water when using WaterMod. - IgnoreVoxels = false, // Whether the projectile should be able to penetrate voxels. - Synchronize = false, // For future use - HeatModifier = -1f, // Allows this ammo to modify the amount of heat the weapon produces per shot. - Shape = new ShapeDef // Defines the collision shape of the projectile, defaults to LineShape and uses the visual Line Length if set to 0. - { - Shape = LineShape, // LineShape or SphereShape. Do not use SphereShape for fast moving projectiles if you care about precision. - Diameter = 0, // Diameter is minimum length of LineShape or minimum diameter of SphereShape. - }, - ObjectsHit = new ObjectsHitDef - { - MaxObjectsHit = 0, // Limits the number of entities (grids, players, projectiles) the projectile can penetrate; 0 = unlimited. - CountBlocks = false, // Counts individual blocks, not just entities hit. - }, - Fragment = new FragmentDef // Formerly known as Shrapnel. Spawns specified ammo fragments on projectile death (via hit or detonation). - { - AmmoRound = "", // AmmoRound field of the ammo to spawn. - Fragments = 0, // Number of projectiles to spawn. - Degrees = 0, // Cone in which to randomize direction of spawned projectiles. - Reverse = false, // Spawn projectiles backward instead of forward. - DropVelocity = false, // fragments will not inherit velocity from parent. - Offset = 0f, // Offsets the fragment spawn by this amount, in meters (positive forward, negative for backwards), value is read from parent ammo type. - Radial = 0f, // Determines starting angle for Degrees of spread above. IE, 0 degrees and 90 radial goes perpendicular to travel path - MaxChildren = 0, // number of maximum branches for fragments from the roots point of view, 0 is unlimited - IgnoreArming = true, // If true, ignore ArmOnHit or MinArmingTime in EndOfLife definitions - AdvOffset = Vector(x: 0, y: 0, z: 0), // advanced offsets the fragment by xyz coordinates relative to parent, value is read from fragment ammo type. - TimedSpawns = new TimedSpawnDef // disables FragOnEnd in favor of info specified below - { - Enable = false, // Enables TimedSpawns mechanism - Interval = 0, // Time between spawning fragments, in ticks, 0 means every tick, 1 means every other - StartTime = 0, // Time delay to start spawning fragments, in ticks, of total projectile life - MaxSpawns = 1, // Max number of fragment children to spawn - Proximity = 1000, // Starting distance from target bounding sphere to start spawning fragments, 0 disables this feature. No spawning outside this distance - ParentDies = true, // Parent dies once after it spawns its last child. - PointAtTarget = true, // Start fragment direction pointing at Target - PointType = Predict, // Point accuracy, Direct, Lead (always fire), Predict (only fire if it can hit) - GroupSize = 5, // Number of spawns in each group - GroupDelay = 120, // Delay between each group. - }, - }, - Pattern = new PatternDef - { - Patterns = new[] { // If enabled, set of multiple ammos to fire in order instead of the main ammo. - "", - }, - Mode = Fragment, // Select when to activate this pattern, options: Never, Weapon, Fragment, Both - TriggerChance = 1f, // This is % - Random = false, // This randomizes the number spawned at once, NOT the list order. - RandomMin = 1, - RandomMax = 1, - SkipParent = false, // Skip the Ammo itself, in the list - PatternSteps = 1, // Number of Ammos activated per round, will progress in order and loop. Ignored if Random = true. - }, + HardPointUsable = true, // Whether this is a primary ammo type fired directly by the turret. Set to false if this is a shrapnel ammoType and you don't want the turret to be able to select it directly. DamageScales = new DamageScaleDef { - MaxIntegrity = 0f, // Blocks with integrity higher than this value will be immune to damage from this projectile; 0 = disabled. - DamageVoxels = false, // Whether to damage voxels. - SelfDamage = false, // Whether to damage the weapon's own grid. HealthHitModifier = 1, // How much Health to subtract from another projectile on hit; defaults to 1 if zero or less. VoxelHitModifier = 1, // Voxel damage multiplier; defaults to 1 if zero or less. Characters = 0.33f, // Character damage multiplier; defaults to 1 if zero or less. - // For the following modifier values: -1 = disabled (higher performance), 0 = no damage, 0.01f = 1% damage, 2 = 200% damage. - FallOff = new FallOffDef - { - Distance = 1000f, // Distance at which damage begins falling off. - MinMultipler = -1f, // Value from 0.0001f to 1f where 0.1f would be a min damage of 10% of base damage. - }, Grids = new GridSizeDef { Large = -1f, // Multiplier for damage against large grids. @@ -153,164 +75,15 @@ partial class Parts DeformType = HitBlock, DeformDelay = 30, }, - Custom = new CustomScalesDef - { - SkipOthers = NoSkip, // Controls how projectile interacts with other blocks in relation to those defined here, NoSkip, Exclusive, Inclusive. - Types = new[] // List of blocks to apply custom damage multipliers to. - { - new CustomBlocksDef - { - SubTypeId = "Test1", - Modifier = -1f, - }, - new CustomBlocksDef - { - SubTypeId = "Test2", - Modifier = -1f, - }, - }, - }, - }, - AreaOfDamage = new AreaOfDamageDef - { - ByBlockHit = new ByBlockHitDef - { - Enable = false, - Radius = 5f, // Meters - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Pooled, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - EndOfLife = new EndOfLifeDef - { - Enable = false, - Radius = 5f, // Radius of AOE effect, in meters. - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Squeeze, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - ArmOnlyOnHit = false, // Detonation only is available, After it hits something, when this is true. IE, if shot down, it won't explode. - MinArmingTime = 100, // In ticks, before the Ammo is allowed to explode, detonate or similar; This affects shrapnel spawning. - NoVisuals = false, - NoSound = false, - ParticleScale = 1, - CustomParticle = "", // Particle SubtypeID, from your Particle SBC - CustomSound = "", // SubtypeID from your Audio SBC, not a filename - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - }, - Ewar = new EwarDef - { - Enable = false, // Enables EWAR effects AND DISABLES BASE DAMAGE AND AOE DAMAGE!! - Type = EnergySink, // EnergySink, Emp, Offense, Nav, Dot, AntiSmart, JumpNull, Anchor, Tractor, Pull, Push, - Mode = Effect, // Effect , Field - Strength = 100f, - Radius = 5f, // Meters - Duration = 100, // In Ticks - StackDuration = true, // Combined Durations - Depletable = true, - MaxStacks = 10, // Max Debuffs at once - NoHitParticle = false, - /* - EnergySink : Targets & Shutdowns Power Supplies, such as Batteries & Reactor - Emp : Targets & Shutdown any Block capable of being powered - Offense : Targets & Shutdowns Weaponry - Nav : Targets & Shutdown Gyros or Locks them down - Dot : Deals Damage to Blocks in radius - AntiSmart : Effects & Scrambles the Targeting List of Affected Missiles - JumpNull : Shutdown & Stops any Active Jumps, or JumpDrive Units in radius - Tractor : Affects target with Physics - Pull : Affects target with Physics - Push : Affects target with Physics - Anchor : Targets & Shutdowns Thrusters - - */ - Force = new PushPullDef - { - ForceFrom = ProjectileLastPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - ForceTo = HitPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - Position = TargetCenterOfMass, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - DisableRelativeMass = false, - TractorRange = 0, - ShooterFeelsForce = false, - }, - Field = new FieldDef - { - Interval = 0, // Time between each pulse, in game ticks (60 == 1 second), starts at 0 (59 == tick 60). - PulseChance = 0, // Chance from 0 - 100 that an entity in the field will be hit by any given pulse. - GrowTime = 0, // How many ticks it should take the field to grow to full size. - HideModel = false, // Hide the default bubble, or other model if specified. - ShowParticle = true, // Show Block damage effect. - TriggerRange = 250f, //range at which fields are triggered - Particle = new ParticleDef // Particle effect to generate at the field's position. - { - Name = "", // SubtypeId of field particle effect. - Extras = new ParticleOptionDef - { - Scale = 1, // Scale of effect. - }, - }, - }, - }, - Beams = new BeamDef - { - Enable = false, // Enable beam behaviour. Please have 3600 RPM, when this Setting is enabled. Please do not fire Beams into Voxels. - VirtualBeams = false, // Only one damaging beam, but with the effectiveness of the visual beams combined (better performance). - ConvergeBeams = false, // When using virtual beams, converge the visual beams to the location of the real beam. - RotateRealBeam = false, // The real beam is rotated between all visual beams, instead of centered between them. - OneParticle = false, // Only spawn one particle hit per beam weapon. }, Trajectory = new TrajectoryDef { Guidance = None, // None, Remote, TravelTo, Smart, DetectTravelTo, DetectSmart, DetectFixed TargetLossDegree = 180f, // Degrees, Is pointed forward - TargetLossTime = 0, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MaxLifeTime = 300, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). time begins at 0 and time must EXCEED this value to trigger "time > maxValue". Please have a value for this, It stops Bad things. - AccelPerSec = 0f, // Meters Per Second. This is the spawning Speed of the Projectile, and used by turning. DesiredSpeed = 400, // voxel phasing if you go above 5100 MaxTrajectory = 800f, // Max Distance the projectile or beam can Travel. - DeaccelTime = 0, // 0 is disabled, a value causes the projectile to come to rest overtime, (Measured in game ticks, 60 = 1 second) - GravityMultiplier = 0f, // Gravity multiplier, influences the trajectory of the projectile, value greater than 0 to enable. Natural Gravity Only. SpeedVariance = Random(start: -5, end: 5), // subtracts value from DesiredSpeed. Be warned, you can make your projectile go backwards. - RangeVariance = Random(start: 0, end: 0), // subtracts value from MaxTrajectory - MaxTrajectoryTime = 0, // How long the weapon must fire before it reaches MaxTrajectory. - Smarts = new SmartsDef - { - Inaccuracy = 0f, // 0 is perfect, hit accuracy will be a random num of meters between 0 and this value. - Aggressiveness = 1f, // controls how responsive tracking is. - MaxLateralThrust = 0.5, // controls how sharp the trajectile may turn - TrackingDelay = 0, // Measured in Shape diameter units traveled. - MaxChaseTime = 0, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - OverideTarget = true, // when set to true ammo picks its own target, does not use hardpoint's. - MaxTargets = 0, // Number of targets allowed before ending, 0 = unlimited - NoTargetExpire = false, // Expire without ever having a target at TargetLossTime - Roam = false, // Roam current area after target loss - KeepAliveAfterTargetLoss = false, // Whether to stop early death of projectile on target loss - OffsetRatio = 0.05f, // The ratio to offset the random direction (0 to 1) - OffsetTime = 60, // how often to offset degree, measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..) - }, - Mines = new MinesDef // Note: This is being investigated. Please report to Github, any issues. - { - DetectRadius = 0, - DeCloakRadius = 0, - FieldTime = 0, - Cloak = false, - Persist = false, - }, }, AmmoGraphics = new GraphicDef { @@ -336,15 +109,6 @@ partial class Parts }, Particles = new AmmoParticleDef { - Ammo = new ParticleDef - { - Name = "", //ShipWelderArc - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - }, - }, Hit = new ParticleDef { Name = "MaterialHit_Metal_GatlingGun", @@ -356,17 +120,6 @@ partial class Parts HitPlayChance = 0.5f, }, }, - Eject = new ParticleDef - { - Name = "", - ApplyToShield = true, - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - HitPlayChance = 1f, - }, - }, }, Lines = new LineDef { @@ -384,36 +137,6 @@ partial class Parts "ProjectileTrailLine", // Please always have this Line set, if this Section is enabled. }, TextureMode = Normal, // Normal, Cycle, Chaos, Wave - Segmentation = new SegmentDef - { - Enable = false, // If true Tracer TextureMode is ignored - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - SegmentLength = 0f, // Uses the values below. - SegmentGap = 0f, // Uses Tracer textures and values - Speed = 1f, // meters per second - Color = Color(red: 1, green: 2, blue: 2.5f, alpha: 1), - WidthMultiplier = 1f, - Reverse = false, - UseLineVariance = true, - WidthVariance = Random(start: 0f, end: 0f), - ColorVariance = Random(start: 0f, end: 0f) - } - }, - Trail = new TrailDef - { - Enable = false, - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - TextureMode = Normal, - DecayTime = 3, // In Ticks. 1 = 1 Additional Tracer generated per motion, 33 is 33 lines drawn per projectile. Keep this number low. - Color = Color(red: 0, green: 0, blue: 1, alpha: 1), - Back = false, - CustomWidth = 0, - UseWidthVariance = false, - UseColorFade = true, }, OffsetEffect = new OffsetEffectDef { @@ -425,110 +148,27 @@ partial class Parts }, AmmoAudio = new AmmoAudioDef { - TravelSound = "", // SubtypeID for your Sound File. Travel, is sound generated around your Projectile in flight HitSound = "ImpMetalMetalCat0", - ShotSound = "", - ShieldHitSound = "", - PlayerHitSound = "", VoxelHitSound = "ImpMetalRockCat0", - FloatingHitSound = "", HitPlayChance = 0.5f, HitPlayShield = true, }, - Ejection = new EjectionDef // Optional Component, allows generation of Particle or Item (Typically magazine), on firing, to simulate Tank shell ejection - { - Type = Particle, // Particle or Item (Inventory Component) - Speed = 100f, // Speed inventory is ejected from in dummy direction - SpawnChance = 0.5f, // chance of triggering effect (0 - 1) - CompDef = new ComponentDef - { - ItemName = "", //InventoryComponent name - ItemLifeTime = 0, // how long item should exist in world - Delay = 0, // delay in ticks after shot before ejected - } - }, // Don't edit below this line }; private AmmoDef InteriorAmmo => new AmmoDef // Your ID, for slotting into the Weapon CS { AmmoMagazine = "RapidFireAutomaticRifleGun_Mag_50rd", // SubtypeId of physical ammo magazine. Use "Energy" for weapons without physical ammo. AmmoRound = "MR-50A", // Name of ammo in terminal, should be different for each ammo type used by the same weapon. Is used by Shrapnel. - HybridRound = false, // Use both a physical ammo magazine and energy per shot. EnergyCost = 0.1f, // Scaler for energy per shot (EnergyCost * BaseDamage * (RateOfFire / 3600) * BarrelsPerShot * TrajectilesPerBarrel). Uses EffectStrength instead of BaseDamage if EWAR. BaseDamage = 30f, // Direct damage; one steel plate is worth 100. Mass = 0.1f, // In kilograms; how much force the impact will apply to the target. - Health = 0, // How much damage the projectile can take from other projectiles (base of 1 per hit) before dying; 0 disables this and makes the projectile untargetable. BackKickForce = 1f, // Recoil. This is applied to the Parent Grid. - DecayPerShot = 0f, // Damage to the firing weapon itself. HardPointUsable = true, // Whether this is a primary ammo type fired directly by the turret. Set to false if this is a shrapnel ammoType and you don't want the turret to be able to select it directly. - EnergyMagazineSize = 0, // For energy weapons, how many shots to fire before reloading. - IgnoreWater = false, // Whether the projectile should be able to penetrate water when using WaterMod. - IgnoreVoxels = false, // Whether the projectile should be able to penetrate voxels. - Synchronize = false, // For future use - HeatModifier = -1f, // Allows this ammo to modify the amount of heat the weapon produces per shot. - Shape = new ShapeDef // Defines the collision shape of the projectile, defaults to LineShape and uses the visual Line Length if set to 0. - { - Shape = LineShape, // LineShape or SphereShape. Do not use SphereShape for fast moving projectiles if you care about precision. - Diameter = 0, // Diameter is minimum length of LineShape or minimum diameter of SphereShape. - }, - ObjectsHit = new ObjectsHitDef - { - MaxObjectsHit = 0, // Limits the number of entities (grids, players, projectiles) the projectile can penetrate; 0 = unlimited. - CountBlocks = false, // Counts individual blocks, not just entities hit. - }, - Fragment = new FragmentDef // Formerly known as Shrapnel. Spawns specified ammo fragments on projectile death (via hit or detonation). - { - AmmoRound = "", // AmmoRound field of the ammo to spawn. - Fragments = 0, // Number of projectiles to spawn. - Degrees = 0, // Cone in which to randomize direction of spawned projectiles. - Reverse = false, // Spawn projectiles backward instead of forward. - DropVelocity = false, // fragments will not inherit velocity from parent. - Offset = 0f, // Offsets the fragment spawn by this amount, in meters (positive forward, negative for backwards), value is read from parent ammo type. - Radial = 0f, // Determines starting angle for Degrees of spread above. IE, 0 degrees and 90 radial goes perpendicular to travel path - MaxChildren = 0, // number of maximum branches for fragments from the roots point of view, 0 is unlimited - IgnoreArming = true, // If true, ignore ArmOnHit or MinArmingTime in EndOfLife definitions - AdvOffset = Vector(x: 0, y: 0, z: 0), // advanced offsets the fragment by xyz coordinates relative to parent, value is read from fragment ammo type. - TimedSpawns = new TimedSpawnDef // disables FragOnEnd in favor of info specified below - { - Enable = false, // Enables TimedSpawns mechanism - Interval = 0, // Time between spawning fragments, in ticks, 0 means every tick, 1 means every other - StartTime = 0, // Time delay to start spawning fragments, in ticks, of total projectile life - MaxSpawns = 1, // Max number of fragment children to spawn - Proximity = 1000, // Starting distance from target bounding sphere to start spawning fragments, 0 disables this feature. No spawning outside this distance - ParentDies = true, // Parent dies once after it spawns its last child. - PointAtTarget = true, // Start fragment direction pointing at Target - PointType = Predict, // Point accuracy, Direct, Lead (always fire), Predict (only fire if it can hit) - GroupSize = 5, // Number of spawns in each group - GroupDelay = 120, // Delay between each group. - }, - }, - Pattern = new PatternDef - { - Patterns = new[] { // If enabled, set of multiple ammos to fire in order instead of the main ammo. - "", - }, - Mode = Fragment, // Select when to activate this pattern, options: Never, Weapon, Fragment, Both - TriggerChance = 1f, // This is % - Random = false, // This randomizes the number spawned at once, NOT the list order. - RandomMin = 1, - RandomMax = 1, - SkipParent = false, // Skip the Ammo itself, in the list - PatternSteps = 1, // Number of Ammos activated per round, will progress in order and loop. Ignored if Random = true. - }, DamageScales = new DamageScaleDef { - MaxIntegrity = 0f, // Blocks with integrity higher than this value will be immune to damage from this projectile; 0 = disabled. - DamageVoxels = false, // Whether to damage voxels. - SelfDamage = false, // Whether to damage the weapon's own grid. HealthHitModifier = 0.5, // How much Health to subtract from another projectile on hit; defaults to 1 if zero or less. VoxelHitModifier = 1, // Voxel damage multiplier; defaults to 1 if zero or less. Characters = -1f, // Character damage multiplier; defaults to 1 if zero or less. - // For the following modifier values: -1 = disabled (higher performance), 0 = no damage, 0.01f = 1% damage, 2 = 200% damage. - FallOff = new FallOffDef - { - Distance = 0f, // Distance at which damage begins falling off. - MinMultipler = 1f, // Value from 0.0001f to 1f where 0.1f would be a min damage of 10% of base damage. - }, Grids = new GridSizeDef { Large = -1f, // Multiplier for damage against large grids. @@ -559,168 +199,15 @@ partial class Parts DeformType = HitBlock, DeformDelay = 30, }, - Custom = new CustomScalesDef - { - SkipOthers = NoSkip, // Controls how projectile interacts with other blocks in relation to those defined here, NoSkip, Exclusive, Inclusive. - Types = new[] // List of blocks to apply custom damage multipliers to. - { - new CustomBlocksDef - { - SubTypeId = "Test1", - Modifier = -1f, - }, - new CustomBlocksDef - { - SubTypeId = "Test2", - Modifier = -1f, - }, - }, - }, - }, - AreaOfDamage = new AreaOfDamageDef - { - ByBlockHit = new ByBlockHitDef - { - Enable = false, - Radius = 5f, // Meters - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Pooled, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - EndOfLife = new EndOfLifeDef - { - Enable = false, - Radius = 5f, // Radius of AOE effect, in meters. - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Squeeze, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - ArmOnlyOnHit = false, // Detonation only is available, After it hits something, when this is true. IE, if shot down, it won't explode. - MinArmingTime = 100, // In ticks, before the Ammo is allowed to explode, detonate or similar; This affects shrapnel spawning. - NoVisuals = false, - NoSound = false, - ParticleScale = 1, - CustomParticle = "", // Particle SubtypeID, from your Particle SBC - CustomSound = "", // SubtypeID from your Audio SBC, not a filename - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - }, - Ewar = new EwarDef - { - Enable = false, // Enables EWAR effects AND DISABLES BASE DAMAGE AND AOE DAMAGE!! - Type = EnergySink, // EnergySink, Emp, Offense, Nav, Dot, AntiSmart, JumpNull, Anchor, Tractor, Pull, Push, - Mode = Effect, // Effect , Field - Strength = 100f, - Radius = 5f, // Meters - Duration = 100, // In Ticks - StackDuration = true, // Combined Durations - Depletable = true, - MaxStacks = 10, // Max Debuffs at once - NoHitParticle = false, - /* - EnergySink : Targets & Shutdowns Power Supplies, such as Batteries & Reactor - Emp : Targets & Shutdown any Block capable of being powered - Offense : Targets & Shutdowns Weaponry - Nav : Targets & Shutdown Gyros or Locks them down - Dot : Deals Damage to Blocks in radius - AntiSmart : Effects & Scrambles the Targeting List of Affected Missiles - JumpNull : Shutdown & Stops any Active Jumps, or JumpDrive Units in radius - Tractor : Affects target with Physics - Pull : Affects target with Physics - Push : Affects target with Physics - Anchor : Targets & Shutdowns Thrusters - - */ - Force = new PushPullDef - { - ForceFrom = ProjectileLastPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - ForceTo = HitPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - Position = TargetCenterOfMass, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - DisableRelativeMass = false, - TractorRange = 0, - ShooterFeelsForce = false, - }, - Field = new FieldDef - { - Interval = 0, // Time between each pulse, in game ticks (60 == 1 second), starts at 0 (59 == tick 60). - PulseChance = 0, // Chance from 0 - 100 that an entity in the field will be hit by any given pulse. - GrowTime = 0, // How many ticks it should take the field to grow to full size. - HideModel = false, // Hide the default bubble, or other model if specified. - ShowParticle = true, // Show Block damage effect. - TriggerRange = 250f, //range at which fields are triggered - Particle = new ParticleDef // Particle effect to generate at the field's position. - { - Name = "", // SubtypeId of field particle effect. - Extras = new ParticleOptionDef - { - Scale = 1, // Scale of effect. - }, - }, - }, - }, - Beams = new BeamDef - { - Enable = false, // Enable beam behaviour. Please have 3600 RPM, when this Setting is enabled. Please do not fire Beams into Voxels. - VirtualBeams = false, // Only one damaging beam, but with the effectiveness of the visual beams combined (better performance). - ConvergeBeams = false, // When using virtual beams, converge the visual beams to the location of the real beam. - RotateRealBeam = false, // The real beam is rotated between all visual beams, instead of centered between them. - OneParticle = false, // Only spawn one particle hit per beam weapon. }, Trajectory = new TrajectoryDef { - Guidance = None, // None, Remote, TravelTo, Smart, DetectTravelTo, DetectSmart, DetectFixed - TargetLossDegree = 180f, // Degrees, Is pointed forward - TargetLossTime = 0, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MaxLifeTime = 100, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). time begins at 0 and time must EXCEED this value to trigger "time > maxValue". Please have a value for this, It stops Bad things. - AccelPerSec = 0f, // Meters Per Second. This is the spawning Speed of the Projectile, and used by turning. DesiredSpeed = 600, // voxel phasing if you go above 5100 MaxTrajectory = 400f, // Max Distance the projectile or beam can Travel. - DeaccelTime = 0, // 0 is disabled, a value causes the projectile to come to rest overtime, (Measured in game ticks, 60 = 1 second) - GravityMultiplier = 0f, // Gravity multiplier, influences the trajectory of the projectile, value greater than 0 to enable. Natural Gravity Only. - SpeedVariance = Random(start: 0, end: 0), // subtracts value from DesiredSpeed. Be warned, you can make your projectile go backwards. - RangeVariance = Random(start: 0, end: 0), // subtracts value from MaxTrajectory - MaxTrajectoryTime = 0, // How long the weapon must fire before it reaches MaxTrajectory. - Smarts = new SmartsDef - { - Inaccuracy = 0f, // 0 is perfect, hit accuracy will be a random num of meters between 0 and this value. - Aggressiveness = 1f, // controls how responsive tracking is. - MaxLateralThrust = 0.5, // controls how sharp the trajectile may turn - TrackingDelay = 0, // Measured in Shape diameter units traveled. - MaxChaseTime = 0, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - OverideTarget = true, // when set to true ammo picks its own target, does not use hardpoint's. - MaxTargets = 0, // Number of targets allowed before ending, 0 = unlimited - NoTargetExpire = false, // Expire without ever having a target at TargetLossTime - Roam = false, // Roam current area after target loss - KeepAliveAfterTargetLoss = false, // Whether to stop early death of projectile on target loss - OffsetRatio = 0.05f, // The ratio to offset the random direction (0 to 1) - OffsetTime = 60, // how often to offset degree, measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..) - }, - Mines = new MinesDef // Note: This is being investigated. Please report to Github, any issues. - { - DetectRadius = 0, - DeCloakRadius = 0, - FieldTime = 0, - Cloak = false, - Persist = false, - }, }, AmmoGraphics = new GraphicDef { - ModelName = "", // Model Path goes here. "\\Models\\Ammo\\Starcore_Arrow_Missile_Large" VisualProbability = 1f, // % ShieldHitDraw = false, Decals = new DecalDef @@ -742,15 +229,6 @@ partial class Parts }, Particles = new AmmoParticleDef { - Ammo = new ParticleDef - { - Name = "", //ShipWelderArc - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - }, - }, Hit = new ParticleDef { Name = "MaterialHit_Metal", @@ -762,17 +240,6 @@ partial class Parts HitPlayChance = 0.5f, }, }, - Eject = new ParticleDef - { - Name = "", - ApplyToShield = true, - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - HitPlayChance = 1f, - }, - }, }, Lines = new LineDef { @@ -790,36 +257,6 @@ partial class Parts "ProjectileTrailLine", // Please always have this Line set, if this Section is enabled. }, TextureMode = Normal, // Normal, Cycle, Chaos, Wave - Segmentation = new SegmentDef - { - Enable = false, // If true Tracer TextureMode is ignored - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - SegmentLength = 0f, // Uses the values below. - SegmentGap = 0f, // Uses Tracer textures and values - Speed = 1f, // meters per second - Color = Color(red: 1, green: 2, blue: 2.5f, alpha: 1), - WidthMultiplier = 1f, - Reverse = false, - UseLineVariance = true, - WidthVariance = Random(start: 0f, end: 0f), - ColorVariance = Random(start: 0f, end: 0f) - } - }, - Trail = new TrailDef - { - Enable = false, - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - TextureMode = Normal, - DecayTime = 3, // In Ticks. 1 = 1 Additional Tracer generated per motion, 33 is 33 lines drawn per projectile. Keep this number low. - Color = Color(red: 0, green: 0, blue: 1, alpha: 1), - Back = false, - CustomWidth = 0, - UseWidthVariance = false, - UseColorFade = true, }, OffsetEffect = new OffsetEffectDef { @@ -831,96 +268,21 @@ partial class Parts }, AmmoAudio = new AmmoAudioDef { - TravelSound = "", // SubtypeID for your Sound File. Travel, is sound generated around your Projectile in flight HitSound = "ImpMetalMetalCat0", - ShotSound = "", - ShieldHitSound = "", - PlayerHitSound = "", VoxelHitSound = "ImpMetalRockCat0", - FloatingHitSound = "", HitPlayChance = 0.5f, HitPlayShield = true, }, - Ejection = new EjectionDef // Optional Component, allows generation of Particle or Item (Typically magazine), on firing, to simulate Tank shell ejection - { - Type = Particle, // Particle or Item (Inventory Component) - Speed = 100f, // Speed inventory is ejected from in dummy direction - SpawnChance = 0.5f, // chance of triggering effect (0 - 1) - CompDef = new ComponentDef - { - ItemName = "", //InventoryComponent name - ItemLifeTime = 0, // how long item should exist in world - Delay = 0, // delay in ticks after shot before ejected - } - }, // Don't edit below this line }; private AmmoDef InteriorAmmoOld => new AmmoDef // Your ID, for slotting into the Weapon CS { AmmoMagazine = "NATO_5p56x45mm", // SubtypeId of physical ammo magazine. Use "Energy" for weapons without physical ammo. AmmoRound = "5.56x45mm", // Name of ammo in terminal, should be different for each ammo type used by the same weapon. Is used by Shrapnel. - HybridRound = false, // Use both a physical ammo magazine and energy per shot. - EnergyCost = 0.1f, // Scaler for energy per shot (EnergyCost * BaseDamage * (RateOfFire / 3600) * BarrelsPerShot * TrajectilesPerBarrel). Uses EffectStrength instead of BaseDamage if EWAR. BaseDamage = 30f, // Direct damage; one steel plate is worth 100. Mass = 0.1f, // In kilograms; how much force the impact will apply to the target. - Health = 0, // How much damage the projectile can take from other projectiles (base of 1 per hit) before dying; 0 disables this and makes the projectile untargetable. BackKickForce = 1f, // Recoil. This is applied to the Parent Grid. - DecayPerShot = 0f, // Damage to the firing weapon itself. HardPointUsable = true, // Whether this is a primary ammo type fired directly by the turret. Set to false if this is a shrapnel ammoType and you don't want the turret to be able to select it directly. - EnergyMagazineSize = 0, // For energy weapons, how many shots to fire before reloading. - IgnoreWater = false, // Whether the projectile should be able to penetrate water when using WaterMod. - IgnoreVoxels = false, // Whether the projectile should be able to penetrate voxels. - Synchronize = false, // For future use - HeatModifier = -1f, // Allows this ammo to modify the amount of heat the weapon produces per shot. - Shape = new ShapeDef // Defines the collision shape of the projectile, defaults to LineShape and uses the visual Line Length if set to 0. - { - Shape = LineShape, // LineShape or SphereShape. Do not use SphereShape for fast moving projectiles if you care about precision. - Diameter = 0, // Diameter is minimum length of LineShape or minimum diameter of SphereShape. - }, - ObjectsHit = new ObjectsHitDef - { - MaxObjectsHit = 0, // Limits the number of entities (grids, players, projectiles) the projectile can penetrate; 0 = unlimited. - CountBlocks = false, // Counts individual blocks, not just entities hit. - }, - Fragment = new FragmentDef // Formerly known as Shrapnel. Spawns specified ammo fragments on projectile death (via hit or detonation). - { - AmmoRound = "", // AmmoRound field of the ammo to spawn. - Fragments = 0, // Number of projectiles to spawn. - Degrees = 0, // Cone in which to randomize direction of spawned projectiles. - Reverse = false, // Spawn projectiles backward instead of forward. - DropVelocity = false, // fragments will not inherit velocity from parent. - Offset = 0f, // Offsets the fragment spawn by this amount, in meters (positive forward, negative for backwards), value is read from parent ammo type. - Radial = 0f, // Determines starting angle for Degrees of spread above. IE, 0 degrees and 90 radial goes perpendicular to travel path - MaxChildren = 0, // number of maximum branches for fragments from the roots point of view, 0 is unlimited - IgnoreArming = true, // If true, ignore ArmOnHit or MinArmingTime in EndOfLife definitions - AdvOffset = Vector(x: 0, y: 0, z: 0), // advanced offsets the fragment by xyz coordinates relative to parent, value is read from fragment ammo type. - TimedSpawns = new TimedSpawnDef // disables FragOnEnd in favor of info specified below - { - Enable = false, // Enables TimedSpawns mechanism - Interval = 0, // Time between spawning fragments, in ticks, 0 means every tick, 1 means every other - StartTime = 0, // Time delay to start spawning fragments, in ticks, of total projectile life - MaxSpawns = 1, // Max number of fragment children to spawn - Proximity = 1000, // Starting distance from target bounding sphere to start spawning fragments, 0 disables this feature. No spawning outside this distance - ParentDies = true, // Parent dies once after it spawns its last child. - PointAtTarget = true, // Start fragment direction pointing at Target - PointType = Predict, // Point accuracy, Direct, Lead (always fire), Predict (only fire if it can hit) - GroupSize = 5, // Number of spawns in each group - GroupDelay = 120, // Delay between each group. - }, - }, - Pattern = new PatternDef - { - Patterns = new[] { // If enabled, set of multiple ammos to fire in order instead of the main ammo. - "", - }, - Mode = Fragment, // Select when to activate this pattern, options: Never, Weapon, Fragment, Both - TriggerChance = 1f, // This is % - Random = false, // This randomizes the number spawned at once, NOT the list order. - RandomMin = 1, - RandomMax = 1, - SkipParent = false, // Skip the Ammo itself, in the list - PatternSteps = 1, // Number of Ammos activated per round, will progress in order and loop. Ignored if Random = true. - }, DamageScales = new DamageScaleDef { MaxIntegrity = 0f, // Blocks with integrity higher than this value will be immune to damage from this projectile; 0 = disabled. @@ -929,12 +291,6 @@ partial class Parts HealthHitModifier = 0.5, // How much Health to subtract from another projectile on hit; defaults to 1 if zero or less. VoxelHitModifier = 1, // Voxel damage multiplier; defaults to 1 if zero or less. Characters = -1f, // Character damage multiplier; defaults to 1 if zero or less. - // For the following modifier values: -1 = disabled (higher performance), 0 = no damage, 0.01f = 1% damage, 2 = 200% damage. - FallOff = new FallOffDef - { - Distance = 0f, // Distance at which damage begins falling off. - MinMultipler = 1f, // Value from 0.0001f to 1f where 0.1f would be a min damage of 10% of base damage. - }, Grids = new GridSizeDef { Large = -1f, // Multiplier for damage against large grids. @@ -965,181 +321,27 @@ partial class Parts DeformType = HitBlock, DeformDelay = 30, }, - Custom = new CustomScalesDef + }, + Trajectory = new TrajectoryDef + { + MaxLifeTime = 100, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). time begins at 0 and time must EXCEED this value to trigger "time > maxValue". Please have a value for this, It stops Bad things. + DesiredSpeed = 600, // voxel phasing if you go above 5100 + MaxTrajectory = 400f, // Max Distance the projectile or beam can Travel. + }, + AmmoGraphics = new GraphicDef + { + VisualProbability = 1f, // % + Decals = new DecalDef { - SkipOthers = NoSkip, // Controls how projectile interacts with other blocks in relation to those defined here, NoSkip, Exclusive, Inclusive. - Types = new[] // List of blocks to apply custom damage multipliers to. + MaxAge = 3600, + Map = new[] { - new CustomBlocksDef + new TextureMapDef { - SubTypeId = "Test1", - Modifier = -1f, + HitMaterial = "Metal", + DecalMaterial = "GunBullet", }, - new CustomBlocksDef - { - SubTypeId = "Test2", - Modifier = -1f, - }, - }, - }, - }, - AreaOfDamage = new AreaOfDamageDef - { - ByBlockHit = new ByBlockHitDef - { - Enable = false, - Radius = 5f, // Meters - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Pooled, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - EndOfLife = new EndOfLifeDef - { - Enable = false, - Radius = 5f, // Radius of AOE effect, in meters. - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Squeeze, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - ArmOnlyOnHit = false, // Detonation only is available, After it hits something, when this is true. IE, if shot down, it won't explode. - MinArmingTime = 100, // In ticks, before the Ammo is allowed to explode, detonate or similar; This affects shrapnel spawning. - NoVisuals = false, - NoSound = false, - ParticleScale = 1, - CustomParticle = "", // Particle SubtypeID, from your Particle SBC - CustomSound = "", // SubtypeID from your Audio SBC, not a filename - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - }, - Ewar = new EwarDef - { - Enable = false, // Enables EWAR effects AND DISABLES BASE DAMAGE AND AOE DAMAGE!! - Type = EnergySink, // EnergySink, Emp, Offense, Nav, Dot, AntiSmart, JumpNull, Anchor, Tractor, Pull, Push, - Mode = Effect, // Effect , Field - Strength = 100f, - Radius = 5f, // Meters - Duration = 100, // In Ticks - StackDuration = true, // Combined Durations - Depletable = true, - MaxStacks = 10, // Max Debuffs at once - NoHitParticle = false, - /* - EnergySink : Targets & Shutdowns Power Supplies, such as Batteries & Reactor - Emp : Targets & Shutdown any Block capable of being powered - Offense : Targets & Shutdowns Weaponry - Nav : Targets & Shutdown Gyros or Locks them down - Dot : Deals Damage to Blocks in radius - AntiSmart : Effects & Scrambles the Targeting List of Affected Missiles - JumpNull : Shutdown & Stops any Active Jumps, or JumpDrive Units in radius - Tractor : Affects target with Physics - Pull : Affects target with Physics - Push : Affects target with Physics - Anchor : Targets & Shutdowns Thrusters - - */ - Force = new PushPullDef - { - ForceFrom = ProjectileLastPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - ForceTo = HitPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - Position = TargetCenterOfMass, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - DisableRelativeMass = false, - TractorRange = 0, - ShooterFeelsForce = false, - }, - Field = new FieldDef - { - Interval = 0, // Time between each pulse, in game ticks (60 == 1 second), starts at 0 (59 == tick 60). - PulseChance = 0, // Chance from 0 - 100 that an entity in the field will be hit by any given pulse. - GrowTime = 0, // How many ticks it should take the field to grow to full size. - HideModel = false, // Hide the default bubble, or other model if specified. - ShowParticle = true, // Show Block damage effect. - TriggerRange = 250f, //range at which fields are triggered - Particle = new ParticleDef // Particle effect to generate at the field's position. - { - Name = "", // SubtypeId of field particle effect. - Extras = new ParticleOptionDef - { - Scale = 1, // Scale of effect. - }, - }, - }, - }, - Beams = new BeamDef - { - Enable = false, // Enable beam behaviour. Please have 3600 RPM, when this Setting is enabled. Please do not fire Beams into Voxels. - VirtualBeams = false, // Only one damaging beam, but with the effectiveness of the visual beams combined (better performance). - ConvergeBeams = false, // When using virtual beams, converge the visual beams to the location of the real beam. - RotateRealBeam = false, // The real beam is rotated between all visual beams, instead of centered between them. - OneParticle = false, // Only spawn one particle hit per beam weapon. - }, - Trajectory = new TrajectoryDef - { - Guidance = None, // None, Remote, TravelTo, Smart, DetectTravelTo, DetectSmart, DetectFixed - TargetLossDegree = 180f, // Degrees, Is pointed forward - TargetLossTime = 0, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - MaxLifeTime = 100, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). time begins at 0 and time must EXCEED this value to trigger "time > maxValue". Please have a value for this, It stops Bad things. - AccelPerSec = 0f, // Meters Per Second. This is the spawning Speed of the Projectile, and used by turning. - DesiredSpeed = 600, // voxel phasing if you go above 5100 - MaxTrajectory = 400f, // Max Distance the projectile or beam can Travel. - DeaccelTime = 0, // 0 is disabled, a value causes the projectile to come to rest overtime, (Measured in game ticks, 60 = 1 second) - GravityMultiplier = 0f, // Gravity multiplier, influences the trajectory of the projectile, value greater than 0 to enable. Natural Gravity Only. - SpeedVariance = Random(start: 0, end: 0), // subtracts value from DesiredSpeed. Be warned, you can make your projectile go backwards. - RangeVariance = Random(start: 0, end: 0), // subtracts value from MaxTrajectory - MaxTrajectoryTime = 0, // How long the weapon must fire before it reaches MaxTrajectory. - Smarts = new SmartsDef - { - Inaccuracy = 0.5f, // 0 is perfect, hit accuracy will be a random num of meters between 0 and this value. - Aggressiveness = 1f, // controls how responsive tracking is. - MaxLateralThrust = 0.5, // controls how sharp the trajectile may turn - TrackingDelay = 0, // Measured in Shape diameter units traveled. - MaxChaseTime = 0, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - OverideTarget = true, // when set to true ammo picks its own target, does not use hardpoint's. - MaxTargets = 0, // Number of targets allowed before ending, 0 = unlimited - NoTargetExpire = false, // Expire without ever having a target at TargetLossTime - Roam = false, // Roam current area after target loss - KeepAliveAfterTargetLoss = false, // Whether to stop early death of projectile on target loss - OffsetRatio = 0.05f, // The ratio to offset the random direction (0 to 1) - OffsetTime = 60, // how often to offset degree, measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..) - }, - Mines = new MinesDef // Note: This is being investigated. Please report to Github, any issues. - { - DetectRadius = 0, - DeCloakRadius = 0, - FieldTime = 0, - Cloak = false, - Persist = false, - }, - }, - AmmoGraphics = new GraphicDef - { - ModelName = "", // Model Path goes here. "\\Models\\Ammo\\Starcore_Arrow_Missile_Large" - VisualProbability = 1f, // % - ShieldHitDraw = false, - Decals = new DecalDef - { - MaxAge = 3600, - Map = new[] - { - new TextureMapDef - { - HitMaterial = "Metal", - DecalMaterial = "GunBullet", - }, - new TextureMapDef + new TextureMapDef { HitMaterial = "Glass", DecalMaterial = "GunBullet", @@ -1148,15 +350,6 @@ partial class Parts }, Particles = new AmmoParticleDef { - Ammo = new ParticleDef - { - Name = "", //ShipWelderArc - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - }, - }, Hit = new ParticleDef { Name = "MaterialHit_Metal", @@ -1168,17 +361,6 @@ partial class Parts HitPlayChance = 0.5f, }, }, - Eject = new ParticleDef - { - Name = "", - ApplyToShield = true, - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - HitPlayChance = 1f, - }, - }, }, Lines = new LineDef { @@ -1196,36 +378,6 @@ partial class Parts "ProjectileTrailLine", // Please always have this Line set, if this Section is enabled. }, TextureMode = Normal, // Normal, Cycle, Chaos, Wave - Segmentation = new SegmentDef - { - Enable = false, // If true Tracer TextureMode is ignored - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - SegmentLength = 0f, // Uses the values below. - SegmentGap = 0f, // Uses Tracer textures and values - Speed = 1f, // meters per second - Color = Color(red: 1, green: 2, blue: 2.5f, alpha: 1), - WidthMultiplier = 1f, - Reverse = false, - UseLineVariance = true, - WidthVariance = Random(start: 0f, end: 0f), - ColorVariance = Random(start: 0f, end: 0f) - } - }, - Trail = new TrailDef - { - Enable = false, - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - TextureMode = Normal, - DecayTime = 3, // In Ticks. 1 = 1 Additional Tracer generated per motion, 33 is 33 lines drawn per projectile. Keep this number low. - Color = Color(red: 0, green: 0, blue: 1, alpha: 1), - Back = false, - CustomWidth = 0, - UseWidthVariance = false, - UseColorFade = true, }, OffsetEffect = new OffsetEffectDef { @@ -1237,28 +389,11 @@ partial class Parts }, AmmoAudio = new AmmoAudioDef { - TravelSound = "", // SubtypeID for your Sound File. Travel, is sound generated around your Projectile in flight HitSound = "ImpMetalMetalCat0", - ShotSound = "", - ShieldHitSound = "", - PlayerHitSound = "", VoxelHitSound = "ImpMetalRockCat0", - FloatingHitSound = "", HitPlayChance = 0.5f, HitPlayShield = true, }, - Ejection = new EjectionDef // Optional Component, allows generation of Particle or Item (Typically magazine), on firing, to simulate Tank shell ejection - { - Type = Particle, // Particle or Item (Inventory Component) - Speed = 100f, // Speed inventory is ejected from in dummy direction - SpawnChance = 0.5f, // chance of triggering effect (0 - 1) - CompDef = new ComponentDef - { - ItemName = "", //InventoryComponent name - ItemLifeTime = 0, // how long item should exist in world - Delay = 0, // delay in ticks after shot before ejected - } - }, // Don't edit below this line }; private AmmoDef MissileAmmo => new AmmoDef // Your ID, for slotting into the Weapon CS @@ -1266,67 +401,15 @@ partial class Parts AmmoMagazine = "Missile200mm", // SubtypeId of physical ammo magazine. Use "Energy" for weapons without physical ammo. AmmoRound = "200mm Missile", // Name of ammo in terminal, should be different for each ammo type used by the same weapon. Is used by Shrapnel. HybridRound = false, // Use both a physical ammo magazine and energy per shot. - EnergyCost = 0.1f, // Scaler for energy per shot (EnergyCost * BaseDamage * (RateOfFire / 3600) * BarrelsPerShot * TrajectilesPerBarrel). Uses EffectStrength instead of BaseDamage if EWAR. BaseDamage = 1f, // Direct damage; one steel plate is worth 100. Mass = 45f, // In kilograms; how much force the impact will apply to the target. Health = 2, // How much damage the projectile can take from other projectiles (base of 1 per hit) before dying; 0 disables this and makes the projectile untargetable. - BackKickForce = 0f, // Recoil. This is applied to the Parent Grid. - DecayPerShot = 0f, // Damage to the firing weapon itself. HardPointUsable = true, // Whether this is a primary ammo type fired directly by the turret. Set to false if this is a shrapnel ammoType and you don't want the turret to be able to select it directly. - EnergyMagazineSize = 0, // For energy weapons, how many shots to fire before reloading. - IgnoreWater = false, // Whether the projectile should be able to penetrate water when using WaterMod. - IgnoreVoxels = false, // Whether the projectile should be able to penetrate voxels. - Synchronize = false, // For future use - HeatModifier = -1f, // Allows this ammo to modify the amount of heat the weapon produces per shot. Shape = new ShapeDef // Defines the collision shape of the projectile, defaults to LineShape and uses the visual Line Length if set to 0. { Shape = LineShape, // LineShape or SphereShape. Do not use SphereShape for fast moving projectiles if you care about precision. Diameter = 1, // Diameter is minimum length of LineShape or minimum diameter of SphereShape. }, - ObjectsHit = new ObjectsHitDef - { - MaxObjectsHit = 0, // Limits the number of entities (grids, players, projectiles) the projectile can penetrate; 0 = unlimited. - CountBlocks = false, // Counts individual blocks, not just entities hit. - }, - Fragment = new FragmentDef // Formerly known as Shrapnel. Spawns specified ammo fragments on projectile death (via hit or detonation). - { - AmmoRound = "", // AmmoRound field of the ammo to spawn. - Fragments = 0, // Number of projectiles to spawn. - Degrees = 0, // Cone in which to randomize direction of spawned projectiles. - Reverse = false, // Spawn projectiles backward instead of forward. - DropVelocity = false, // fragments will not inherit velocity from parent. - Offset = 0f, // Offsets the fragment spawn by this amount, in meters (positive forward, negative for backwards), value is read from parent ammo type. - Radial = 0f, // Determines starting angle for Degrees of spread above. IE, 0 degrees and 90 radial goes perpendicular to travel path - MaxChildren = 0, // number of maximum branches for fragments from the roots point of view, 0 is unlimited - IgnoreArming = true, // If true, ignore ArmOnHit or MinArmingTime in EndOfLife definitions - AdvOffset = Vector(x: 0, y: 0, z: 0), // advanced offsets the fragment by xyz coordinates relative to parent, value is read from fragment ammo type. - TimedSpawns = new TimedSpawnDef // disables FragOnEnd in favor of info specified below - { - Enable = false, // Enables TimedSpawns mechanism - Interval = 0, // Time between spawning fragments, in ticks, 0 means every tick, 1 means every other - StartTime = 0, // Time delay to start spawning fragments, in ticks, of total projectile life - MaxSpawns = 1, // Max number of fragment children to spawn - Proximity = 1000, // Starting distance from target bounding sphere to start spawning fragments, 0 disables this feature. No spawning outside this distance - ParentDies = true, // Parent dies once after it spawns its last child. - PointAtTarget = true, // Start fragment direction pointing at Target - PointType = Predict, // Point accuracy, Direct, Lead (always fire), Predict (only fire if it can hit) - GroupSize = 5, // Number of spawns in each group - GroupDelay = 120, // Delay between each group. - }, - }, - Pattern = new PatternDef - { - Patterns = new[] { // If enabled, set of multiple ammos to fire in order instead of the main ammo. - "", - }, - Mode = Fragment, // Select when to activate this pattern, options: Never, Weapon, Fragment, Both - TriggerChance = 1f, // This is % - Random = false, // This randomizes the number spawned at once, NOT the list order. - RandomMin = 1, - RandomMax = 1, - SkipParent = false, // Skip the Ammo itself, in the list - PatternSteps = 1, // Number of Ammos activated per round, will progress in order and loop. Ignored if Random = true. - }, DamageScales = new DamageScaleDef { MaxIntegrity = 0f, // Blocks with integrity higher than this value will be immune to damage from this projectile; 0 = disabled. @@ -1391,22 +474,6 @@ partial class Parts }, AreaOfDamage = new AreaOfDamageDef { - ByBlockHit = new ByBlockHitDef - { - Enable = false, - Radius = 5f, // Meters - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Pooled, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, EndOfLife = new EndOfLifeDef { Enable = true, @@ -1415,143 +482,25 @@ partial class Parts Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. Falloff = Linear, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - ArmOnlyOnHit = false, // Detonation only is available, After it hits something, when this is true. IE, if shot down, it won't explode. MinArmingTime = 1, // In ticks, before the Ammo is allowed to explode, detonate or similar; This affects shrapnel spawning. - NoVisuals = false, - NoSound = false, ParticleScale = 1, - CustomParticle = "", // Particle SubtypeID, from your Particle SBC - CustomSound = "", // SubtypeID from your Audio SBC, not a filename Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. }, }, - Ewar = new EwarDef - { - Enable = false, // Enables EWAR effects AND DISABLES BASE DAMAGE AND AOE DAMAGE!! - Type = EnergySink, // EnergySink, Emp, Offense, Nav, Dot, AntiSmart, JumpNull, Anchor, Tractor, Pull, Push, - Mode = Effect, // Effect , Field - Strength = 100f, - Radius = 5f, // Meters - Duration = 100, // In Ticks - StackDuration = true, // Combined Durations - Depletable = true, - MaxStacks = 10, // Max Debuffs at once - NoHitParticle = false, - /* - EnergySink : Targets & Shutdowns Power Supplies, such as Batteries & Reactor - Emp : Targets & Shutdown any Block capable of being powered - Offense : Targets & Shutdowns Weaponry - Nav : Targets & Shutdown Gyros or Locks them down - Dot : Deals Damage to Blocks in radius - AntiSmart : Effects & Scrambles the Targeting List of Affected Missiles - JumpNull : Shutdown & Stops any Active Jumps, or JumpDrive Units in radius - Tractor : Affects target with Physics - Pull : Affects target with Physics - Push : Affects target with Physics - Anchor : Targets & Shutdowns Thrusters - - */ - Force = new PushPullDef - { - ForceFrom = ProjectileLastPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - ForceTo = HitPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - Position = TargetCenterOfMass, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - DisableRelativeMass = false, - TractorRange = 0, - ShooterFeelsForce = false, - }, - Field = new FieldDef - { - Interval = 0, // Time between each pulse, in game ticks (60 == 1 second), starts at 0 (59 == tick 60). - PulseChance = 0, // Chance from 0 - 100 that an entity in the field will be hit by any given pulse. - GrowTime = 0, // How many ticks it should take the field to grow to full size. - HideModel = false, // Hide the default bubble, or other model if specified. - ShowParticle = true, // Show Block damage effect. - TriggerRange = 250f, //range at which fields are triggered - Particle = new ParticleDef // Particle effect to generate at the field's position. - { - Name = "", // SubtypeId of field particle effect. - Extras = new ParticleOptionDef - { - Scale = 1, // Scale of effect. - }, - }, - }, - }, - Beams = new BeamDef - { - Enable = false, // Enable beam behaviour. Please have 3600 RPM, when this Setting is enabled. Please do not fire Beams into Voxels. - VirtualBeams = false, // Only one damaging beam, but with the effectiveness of the visual beams combined (better performance). - ConvergeBeams = false, // When using virtual beams, converge the visual beams to the location of the real beam. - RotateRealBeam = false, // The real beam is rotated between all visual beams, instead of centered between them. - OneParticle = false, // Only spawn one particle hit per beam weapon. - }, Trajectory = new TrajectoryDef { Guidance = None, // None, Remote, TravelTo, Smart, DetectTravelTo, DetectSmart, DetectFixed TargetLossDegree = 15, // Degrees, Is pointed forward - TargetLossTime = 0, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MaxLifeTime = 1200, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). time begins at 0 and time must EXCEED this value to trigger "time > maxValue". Please have a value for this, It stops Bad things. AccelPerSec = 600, // Meters Per Second. This is the spawning Speed of the Projectile, and used by turning. DesiredSpeed = 200, // voxel phasing if you go above 5100 MaxTrajectory = 800f, // Max Distance the projectile or beam can Travel. - DeaccelTime = 0, // 0 is disabled, a value causes the projectile to come to rest overtime, (Measured in game ticks, 60 = 1 second) - GravityMultiplier = 0f, // Gravity multiplier, influences the trajectory of the projectile, value greater than 0 to enable. Natural Gravity Only. - SpeedVariance = Random(start: 0, end: 0), // subtracts value from DesiredSpeed. Be warned, you can make your projectile go backwards. - RangeVariance = Random(start: 0, end: 0), // subtracts value from MaxTrajectory - MaxTrajectoryTime = 0, // How long the weapon must fire before it reaches MaxTrajectory. - Smarts = new SmartsDef - { - Inaccuracy = 2.5f, // 0 is perfect, hit accuracy will be a random num of meters between 0 and this value. - Aggressiveness = 1, // controls how responsive tracking is. - MaxLateralThrust = 0.2f, // controls how sharp the trajectile may turn - TrackingDelay = 0, // Measured in Shape diameter units traveled. - MaxChaseTime = 0, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - OverideTarget = false, // when set to true ammo picks its own target, does not use hardpoint's. - MaxTargets = 1, // Number of targets allowed before ending, 0 = unlimited - NoTargetExpire = false, // Expire without ever having a target at TargetLossTime - Roam = false, // Roam current area after target loss - KeepAliveAfterTargetLoss = false, // Whether to stop early death of projectile on target loss - OffsetRatio = 0.0025f, // The ratio to offset the random direction (0 to 1) - OffsetTime = 120, // how often to offset degree, measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..) - }, - Mines = new MinesDef // Note: This is being investigated. Please report to Github, any issues. - { - DetectRadius = 0, - DeCloakRadius = 0, - FieldTime = 0, - Cloak = false, - Persist = false, - }, }, AmmoGraphics = new GraphicDef { - ModelName = "Models\\Weapons\\Projectile_Missile.mwm", // Model Path goes here. "\\Models\\Ammo\\Starcore_Arrow_Missile_Large" + ModelName = "Models\\Weapons\\Projectile_Missile.mwm", // Model Path goes here. VisualProbability = 1f, // % ShieldHitDraw = true, - Decals = new DecalDef - { - MaxAge = 3600, - Map = new[] - { - new TextureMapDef - { - HitMaterial = "Metal", - DecalMaterial = "Missile", - }, - new TextureMapDef - { - HitMaterial = "Glass", - DecalMaterial = "Missile", - }, - }, - }, Particles = new AmmoParticleDef { Ammo = new ParticleDef @@ -1563,176 +512,22 @@ partial class Parts Scale = 1, }, }, - Hit = new ParticleDef - { - Name = "", - ApplyToShield = true, - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - HitPlayChance = 1f, - }, - }, - Eject = new ParticleDef - { - Name = "", - ApplyToShield = true, - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - HitPlayChance = 1f, - }, - }, - }, - Lines = new LineDef - { - ColorVariance = Random(start: 0.8f, end: 1.2f), // multiply the color by random values within range. - WidthVariance = Random(start: 0f, end: 0f), // adds random value to default width (negatives shrinks width) - Tracer = new TracerBaseDef - { - Enable = false, - Length = 5f, // - Width = 0.1f, // - Color = Color(red: 3, green: 2, blue: 1f, alpha: 1), // RBG 255 is Neon Glowing, 100 is Quite Bright. - VisualFadeStart = 0, // Number of ticks the weapon has been firing before projectiles begin to fade their color - VisualFadeEnd = 0, // How many ticks after fade began before it will be invisible. - Textures = new[] {// WeaponLaser, ProjectileTrailLine, WarpBubble, etc.. - "WeaponLaser", // Please always have this Line set, if this Section is enabled. - }, - TextureMode = Normal, // Normal, Cycle, Chaos, Wave - Segmentation = new SegmentDef - { - Enable = false, // If true Tracer TextureMode is ignored - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - SegmentLength = 0f, // Uses the values below. - SegmentGap = 0f, // Uses Tracer textures and values - Speed = 1f, // meters per second - Color = Color(red: 1, green: 2, blue: 2.5f, alpha: 1), - WidthMultiplier = 1f, - Reverse = false, - UseLineVariance = true, - WidthVariance = Random(start: 0f, end: 0f), - ColorVariance = Random(start: 0f, end: 0f) - } - }, - Trail = new TrailDef - { - Enable = false, - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - TextureMode = Normal, - DecayTime = 3, // In Ticks. 1 = 1 Additional Tracer generated per motion, 33 is 33 lines drawn per projectile. Keep this number low. - Color = Color(red: 0, green: 0, blue: 1, alpha: 1), - Back = false, - CustomWidth = 0, - UseWidthVariance = false, - UseColorFade = true, - }, - OffsetEffect = new OffsetEffectDef - { - MaxOffset = 0,// 0 offset value disables this effect - MinLength = 0.2f, - MaxLength = 3, - }, }, }, AmmoAudio = new AmmoAudioDef { TravelSound = "MissileFlightSound", // SubtypeID for your Sound File. Travel, is sound generated around your Projectile in flight - HitSound = "", - ShotSound = "", - ShieldHitSound = "", - PlayerHitSound = "", - VoxelHitSound = "", - FloatingHitSound = "", - HitPlayChance = 0.5f, - HitPlayShield = true, }, - Ejection = new EjectionDef // Optional Component, allows generation of Particle or Item (Typically magazine), on firing, to simulate Tank shell ejection - { - Type = Particle, // Particle or Item (Inventory Component) - Speed = 100f, // Speed inventory is ejected from in dummy direction - SpawnChance = 0.5f, // chance of triggering effect (0 - 1) - CompDef = new ComponentDef - { - ItemName = "", //InventoryComponent name - ItemLifeTime = 0, // how long item should exist in world - Delay = 0, // delay in ticks after shot before ejected - } - }, // Don't edit below this line }; private AmmoDef AutocannonShell => new AmmoDef // Your ID, for slotting into the Weapon CS { AmmoMagazine = "AutocannonClip", // SubtypeId of physical ammo magazine. Use "Energy" for weapons without physical ammo. AmmoRound = "Autocannon Shell", // Name of ammo in terminal, should be different for each ammo type used by the same weapon. Is used by Shrapnel. - HybridRound = false, // Use both a physical ammo magazine and energy per shot. - EnergyCost = 0.1f, // Scaler for energy per shot (EnergyCost * BaseDamage * (RateOfFire / 3600) * BarrelsPerShot * TrajectilesPerBarrel). Uses EffectStrength instead of BaseDamage if EWAR. BaseDamage = 500f, // Direct damage; one steel plate is worth 100. Mass = 3f, // In kilograms; how much force the impact will apply to the target. - Health = 0, // How much damage the projectile can take from other projectiles (base of 1 per hit) before dying; 0 disables this and makes the projectile untargetable. BackKickForce = 250f, // Recoil. This is applied to the Parent Grid. - DecayPerShot = 0f, // Damage to the firing weapon itself. HardPointUsable = true, // Whether this is a primary ammo type fired directly by the turret. Set to false if this is a shrapnel ammoType and you don't want the turret to be able to select it directly. - EnergyMagazineSize = 0, // For energy weapons, how many shots to fire before reloading. - IgnoreWater = false, // Whether the projectile should be able to penetrate water when using WaterMod. - IgnoreVoxels = false, // Whether the projectile should be able to penetrate voxels. - Synchronize = false, // For future use - HeatModifier = -1f, // Allows this ammo to modify the amount of heat the weapon produces per shot. - Shape = new ShapeDef // Defines the collision shape of the projectile, defaults to LineShape and uses the visual Line Length if set to 0. - { - Shape = LineShape, // LineShape or SphereShape. Do not use SphereShape for fast moving projectiles if you care about precision. - Diameter = 0, // Diameter is minimum length of LineShape or minimum diameter of SphereShape. - }, - ObjectsHit = new ObjectsHitDef - { - MaxObjectsHit = 0, // Limits the number of entities (grids, players, projectiles) the projectile can penetrate; 0 = unlimited. - CountBlocks = false, // Counts individual blocks, not just entities hit. - }, - Fragment = new FragmentDef // Formerly known as Shrapnel. Spawns specified ammo fragments on projectile death (via hit or detonation). - { - AmmoRound = "", // AmmoRound field of the ammo to spawn. - Fragments = 0, // Number of projectiles to spawn. - Degrees = 0, // Cone in which to randomize direction of spawned projectiles. - Reverse = false, // Spawn projectiles backward instead of forward. - DropVelocity = false, // fragments will not inherit velocity from parent. - Offset = 0f, // Offsets the fragment spawn by this amount, in meters (positive forward, negative for backwards), value is read from parent ammo type. - Radial = 0f, // Determines starting angle for Degrees of spread above. IE, 0 degrees and 90 radial goes perpendicular to travel path - MaxChildren = 0, // number of maximum branches for fragments from the roots point of view, 0 is unlimited - IgnoreArming = true, // If true, ignore ArmOnHit or MinArmingTime in EndOfLife definitions - AdvOffset = Vector(x: 0, y: 0, z: 0), // advanced offsets the fragment by xyz coordinates relative to parent, value is read from fragment ammo type. - TimedSpawns = new TimedSpawnDef // disables FragOnEnd in favor of info specified below - { - Enable = false, // Enables TimedSpawns mechanism - Interval = 0, // Time between spawning fragments, in ticks, 0 means every tick, 1 means every other - StartTime = 0, // Time delay to start spawning fragments, in ticks, of total projectile life - MaxSpawns = 1, // Max number of fragment children to spawn - Proximity = 1000, // Starting distance from target bounding sphere to start spawning fragments, 0 disables this feature. No spawning outside this distance - ParentDies = true, // Parent dies once after it spawns its last child. - PointAtTarget = true, // Start fragment direction pointing at Target - PointType = Predict, // Point accuracy, Direct, Lead (always fire), Predict (only fire if it can hit) - GroupSize = 5, // Number of spawns in each group - GroupDelay = 120, // Delay between each group. - }, - }, - Pattern = new PatternDef - { - Patterns = new[] { // If enabled, set of multiple ammos to fire in order instead of the main ammo. - "", - }, - Mode = Fragment, // Select when to activate this pattern, options: Never, Weapon, Fragment, Both - TriggerChance = 1f, // This is % - Random = false, // This randomizes the number spawned at once, NOT the list order. - RandomMin = 1, - RandomMax = 1, - SkipParent = false, // Skip the Ammo itself, in the list - PatternSteps = 1, // Number of Ammos activated per round, will progress in order and loop. Ignored if Random = true. - }, DamageScales = new DamageScaleDef { MaxIntegrity = 0f, // Blocks with integrity higher than this value will be immune to damage from this projectile; 0 = disabled. @@ -1741,12 +536,6 @@ partial class Parts HealthHitModifier = 2, // How much Health to subtract from another projectile on hit; defaults to 1 if zero or less. VoxelHitModifier = 1, // Voxel damage multiplier; defaults to 1 if zero or less. Characters = 0.2f, // Character damage multiplier; defaults to 1 if zero or less. - // For the following modifier values: -1 = disabled (higher performance), 0 = no damage, 0.01f = 1% damage, 2 = 200% damage. - FallOff = new FallOffDef - { - Distance = 1500f, // Distance at which damage begins falling off. - MinMultipler = -1f, // Value from 0.0001f to 1f where 0.1f would be a min damage of 10% of base damage. - }, Grids = new GridSizeDef { Large = -1f, // Multiplier for damage against large grids. @@ -1795,152 +584,18 @@ partial class Parts }, }, }, - AreaOfDamage = new AreaOfDamageDef - { - ByBlockHit = new ByBlockHitDef - { - Enable = false, - Radius = 5f, // Meters - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Pooled, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - EndOfLife = new EndOfLifeDef - { - Enable = false, - Radius = 5f, // Radius of AOE effect, in meters. - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Squeeze, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - ArmOnlyOnHit = false, // Detonation only is available, After it hits something, when this is true. IE, if shot down, it won't explode. - MinArmingTime = 100, // In ticks, before the Ammo is allowed to explode, detonate or similar; This affects shrapnel spawning. - NoVisuals = false, - NoSound = false, - ParticleScale = 1, - CustomParticle = "", // Particle SubtypeID, from your Particle SBC - CustomSound = "", // SubtypeID from your Audio SBC, not a filename - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - }, - Ewar = new EwarDef - { - Enable = false, // Enables EWAR effects AND DISABLES BASE DAMAGE AND AOE DAMAGE!! - Type = EnergySink, // EnergySink, Emp, Offense, Nav, Dot, AntiSmart, JumpNull, Anchor, Tractor, Pull, Push, - Mode = Effect, // Effect , Field - Strength = 100f, - Radius = 5f, // Meters - Duration = 100, // In Ticks - StackDuration = true, // Combined Durations - Depletable = true, - MaxStacks = 10, // Max Debuffs at once - NoHitParticle = false, - /* - EnergySink : Targets & Shutdowns Power Supplies, such as Batteries & Reactor - Emp : Targets & Shutdown any Block capable of being powered - Offense : Targets & Shutdowns Weaponry - Nav : Targets & Shutdown Gyros or Locks them down - Dot : Deals Damage to Blocks in radius - AntiSmart : Effects & Scrambles the Targeting List of Affected Missiles - JumpNull : Shutdown & Stops any Active Jumps, or JumpDrive Units in radius - Tractor : Affects target with Physics - Pull : Affects target with Physics - Push : Affects target with Physics - Anchor : Targets & Shutdowns Thrusters - - */ - Force = new PushPullDef - { - ForceFrom = ProjectileLastPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - ForceTo = HitPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - Position = TargetCenterOfMass, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - DisableRelativeMass = false, - TractorRange = 0, - ShooterFeelsForce = false, - }, - Field = new FieldDef - { - Interval = 0, // Time between each pulse, in game ticks (60 == 1 second), starts at 0 (59 == tick 60). - PulseChance = 0, // Chance from 0 - 100 that an entity in the field will be hit by any given pulse. - GrowTime = 0, // How many ticks it should take the field to grow to full size. - HideModel = false, // Hide the default bubble, or other model if specified. - ShowParticle = true, // Show Block damage effect. - TriggerRange = 250f, //range at which fields are triggered - Particle = new ParticleDef // Particle effect to generate at the field's position. - { - Name = "", // SubtypeId of field particle effect. - Extras = new ParticleOptionDef - { - Scale = 1, // Scale of effect. - }, - }, - }, - }, - Beams = new BeamDef - { - Enable = false, // Enable beam behaviour. Please have 3600 RPM, when this Setting is enabled. Please do not fire Beams into Voxels. - VirtualBeams = false, // Only one damaging beam, but with the effectiveness of the visual beams combined (better performance). - ConvergeBeams = false, // When using virtual beams, converge the visual beams to the location of the real beam. - RotateRealBeam = false, // The real beam is rotated between all visual beams, instead of centered between them. - OneParticle = false, // Only spawn one particle hit per beam weapon. - }, Trajectory = new TrajectoryDef { Guidance = None, // None, Remote, TravelTo, Smart, DetectTravelTo, DetectSmart, DetectFixed - TargetLossDegree = 180f, // Degrees, Is pointed forward - TargetLossTime = 0, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MaxLifeTime = 420, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). time begins at 0 and time must EXCEED this value to trigger "time > maxValue". Please have a value for this, It stops Bad things. - AccelPerSec = 0f, // Meters Per Second. This is the spawning Speed of the Projectile, and used by turning. DesiredSpeed = 400, // voxel phasing if you go above 5100 MaxTrajectory = 800f, // Max Distance the projectile or beam can Travel. - DeaccelTime = 0, // 0 is disabled, a value causes the projectile to come to rest overtime, (Measured in game ticks, 60 = 1 second) - GravityMultiplier = 0f, // Gravity multiplier, influences the trajectory of the projectile, value greater than 0 to enable. Natural Gravity Only. SpeedVariance = Random(start: -5, end: 5), // subtracts value from DesiredSpeed. Be warned, you can make your projectile go backwards. RangeVariance = Random(start: 0, end: 0), // subtracts value from MaxTrajectory - MaxTrajectoryTime = 0, // How long the weapon must fire before it reaches MaxTrajectory. - Smarts = new SmartsDef - { - Inaccuracy = 0f, // 0 is perfect, hit accuracy will be a random num of meters between 0 and this value. - Aggressiveness = 1f, // controls how responsive tracking is. - MaxLateralThrust = 0.5, // controls how sharp the trajectile may turn - TrackingDelay = 0, // Measured in Shape diameter units traveled. - MaxChaseTime = 0, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - OverideTarget = true, // when set to true ammo picks its own target, does not use hardpoint's. - MaxTargets = 0, // Number of targets allowed before ending, 0 = unlimited - NoTargetExpire = false, // Expire without ever having a target at TargetLossTime - Roam = false, // Roam current area after target loss - KeepAliveAfterTargetLoss = false, // Whether to stop early death of projectile on target loss - OffsetRatio = 0.05f, // The ratio to offset the random direction (0 to 1) - OffsetTime = 60, // how often to offset degree, measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..) - }, - Mines = new MinesDef // Note: This is being investigated. Please report to Github, any issues. - { - DetectRadius = 0, - DeCloakRadius = 0, - FieldTime = 0, - Cloak = false, - Persist = false, - }, - }, + }, AmmoGraphics = new GraphicDef { - ModelName = "", // Model Path goes here. "\\Models\\Ammo\\Starcore_Arrow_Missile_Large" VisualProbability = 1f, // % - ShieldHitDraw = false, Decals = new DecalDef { MaxAge = 3600, @@ -1960,16 +615,7 @@ partial class Parts }, Particles = new AmmoParticleDef { - Ammo = new ParticleDef - { - Name = "", //ShipWelderArc - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - }, - }, - Hit = new ParticleDef + Hit = new ParticleDef { Name = "MaterialHit_Metal_GatlingGun", ApplyToShield = true, @@ -1980,17 +626,6 @@ partial class Parts HitPlayChance = 0.5f, }, }, - Eject = new ParticleDef - { - Name = "", - ApplyToShield = true, - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - HitPlayChance = 1f, - }, - }, }, Lines = new LineDef { @@ -2008,36 +643,6 @@ partial class Parts "ProjectileTrailLine", // Please always have this Line set, if this Section is enabled. }, TextureMode = Normal, // Normal, Cycle, Chaos, Wave - Segmentation = new SegmentDef - { - Enable = false, // If true Tracer TextureMode is ignored - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - SegmentLength = 0f, // Uses the values below. - SegmentGap = 0f, // Uses Tracer textures and values - Speed = 1f, // meters per second - Color = Color(red: 1, green: 2, blue: 2.5f, alpha: 1), - WidthMultiplier = 1f, - Reverse = false, - UseLineVariance = true, - WidthVariance = Random(start: 0f, end: 0f), - ColorVariance = Random(start: 0f, end: 0f) - } - }, - Trail = new TrailDef - { - Enable = false, - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - TextureMode = Normal, - DecayTime = 3, // In Ticks. 1 = 1 Additional Tracer generated per motion, 33 is 33 lines drawn per projectile. Keep this number low. - Color = Color(red: 0, green: 0, blue: 1, alpha: 1), - Back = false, - CustomWidth = 0, - UseWidthVariance = false, - UseColorFade = true, }, OffsetEffect = new OffsetEffectDef { @@ -2049,304 +654,35 @@ partial class Parts }, AmmoAudio = new AmmoAudioDef { - TravelSound = "", // SubtypeID for your Sound File. Travel, is sound generated around your Projectile in flight HitSound = "ImpMetalMetalCat0", - ShotSound = "", - ShieldHitSound = "", - PlayerHitSound = "", VoxelHitSound = "ImpMetalRockCat0", - FloatingHitSound = "", HitPlayChance = 1f, HitPlayShield = true, }, - Ejection = new EjectionDef // Optional Component, allows generation of Particle or Item (Typically magazine), on firing, to simulate Tank shell ejection - { - Type = Particle, // Particle or Item (Inventory Component) - Speed = 100f, // Speed inventory is ejected from in dummy direction - SpawnChance = 0.5f, // chance of triggering effect (0 - 1) - CompDef = new ComponentDef - { - ItemName = "", //InventoryComponent name - ItemLifeTime = 0, // how long item should exist in world - Delay = 0, // delay in ticks after shot before ejected - } - }, // Don't edit below this line }; private AmmoDef AssaultCannonShell => new AmmoDef // Your ID, for slotting into the Weapon CS { AmmoMagazine = "MediumCalibreAmmo", // SubtypeId of physical ammo magazine. Use "Energy" for weapons without physical ammo. AmmoRound = "Assault Cannon Shell", // Name of ammo in terminal, should be different for each ammo type used by the same weapon. Is used by Shrapnel. - HybridRound = false, // Use both a physical ammo magazine and energy per shot. - EnergyCost = 0.1f, // Scaler for energy per shot (EnergyCost * BaseDamage * (RateOfFire / 3600) * BarrelsPerShot * TrajectilesPerBarrel). Uses EffectStrength instead of BaseDamage if EWAR. BaseDamage = 4000f, // Direct damage; one steel plate is worth 100. Mass = 300f, // In kilograms; how much force the impact will apply to the target. - Health = 0, // How much damage the projectile can take from other projectiles (base of 1 per hit) before dying; 0 disables this and makes the projectile untargetable. BackKickForce = 10000f, // Recoil. This is applied to the Parent Grid. - DecayPerShot = 0f, // Damage to the firing weapon itself. HardPointUsable = true, // Whether this is a primary ammo type fired directly by the turret. Set to false if this is a shrapnel ammoType and you don't want the turret to be able to select it directly. - EnergyMagazineSize = 0, // For energy weapons, how many shots to fire before reloading. - IgnoreWater = false, // Whether the projectile should be able to penetrate water when using WaterMod. - IgnoreVoxels = false, // Whether the projectile should be able to penetrate voxels. - Synchronize = false, // For future use - HeatModifier = -1f, // Allows this ammo to modify the amount of heat the weapon produces per shot. - Shape = new ShapeDef // Defines the collision shape of the projectile, defaults to LineShape and uses the visual Line Length if set to 0. - { - Shape = LineShape, // LineShape or SphereShape. Do not use SphereShape for fast moving projectiles if you care about precision. - Diameter = 0, // Diameter is minimum length of LineShape or minimum diameter of SphereShape. - }, - ObjectsHit = new ObjectsHitDef - { - MaxObjectsHit = 0, // Limits the number of entities (grids, players, projectiles) the projectile can penetrate; 0 = unlimited. - CountBlocks = false, // Counts individual blocks, not just entities hit. - }, - Fragment = new FragmentDef // Formerly known as Shrapnel. Spawns specified ammo fragments on projectile death (via hit or detonation). - { - AmmoRound = "", // AmmoRound field of the ammo to spawn. - Fragments = 0, // Number of projectiles to spawn. - Degrees = 0, // Cone in which to randomize direction of spawned projectiles. - Reverse = false, // Spawn projectiles backward instead of forward. - DropVelocity = false, // fragments will not inherit velocity from parent. - Offset = 0f, // Offsets the fragment spawn by this amount, in meters (positive forward, negative for backwards), value is read from parent ammo type. - Radial = 0f, // Determines starting angle for Degrees of spread above. IE, 0 degrees and 90 radial goes perpendicular to travel path - MaxChildren = 0, // number of maximum branches for fragments from the roots point of view, 0 is unlimited - IgnoreArming = true, // If true, ignore ArmOnHit or MinArmingTime in EndOfLife definitions - AdvOffset = Vector(x: 0, y: 0, z: 0), // advanced offsets the fragment by xyz coordinates relative to parent, value is read from fragment ammo type. - TimedSpawns = new TimedSpawnDef // disables FragOnEnd in favor of info specified below - { - Enable = false, // Enables TimedSpawns mechanism - Interval = 0, // Time between spawning fragments, in ticks, 0 means every tick, 1 means every other - StartTime = 0, // Time delay to start spawning fragments, in ticks, of total projectile life - MaxSpawns = 1, // Max number of fragment children to spawn - Proximity = 1000, // Starting distance from target bounding sphere to start spawning fragments, 0 disables this feature. No spawning outside this distance - ParentDies = true, // Parent dies once after it spawns its last child. - PointAtTarget = true, // Start fragment direction pointing at Target - PointType = Predict, // Point accuracy, Direct, Lead (always fire), Predict (only fire if it can hit) - GroupSize = 5, // Number of spawns in each group - GroupDelay = 120, // Delay between each group. - }, - }, - Pattern = new PatternDef - { - Patterns = new[] { // If enabled, set of multiple ammos to fire in order instead of the main ammo. - "", - }, - Mode = Fragment, // Select when to activate this pattern, options: Never, Weapon, Fragment, Both - TriggerChance = 1f, // This is % - Random = false, // This randomizes the number spawned at once, NOT the list order. - RandomMin = 1, - RandomMax = 1, - SkipParent = false, // Skip the Ammo itself, in the list - PatternSteps = 1, // Number of Ammos activated per round, will progress in order and loop. Ignored if Random = true. - }, - DamageScales = new DamageScaleDef - { - MaxIntegrity = 0f, // Blocks with integrity higher than this value will be immune to damage from this projectile; 0 = disabled. - DamageVoxels = false, // Whether to damage voxels. - SelfDamage = false, // Whether to damage the weapon's own grid. - HealthHitModifier = 3, // How much Health to subtract from another projectile on hit; defaults to 1 if zero or less. - VoxelHitModifier = 1, // Voxel damage multiplier; defaults to 1 if zero or less. - Characters = 1f, // Character damage multiplier; defaults to 1 if zero or less. - // For the following modifier values: -1 = disabled (higher performance), 0 = no damage, 0.01f = 1% damage, 2 = 200% damage. - FallOff = new FallOffDef - { - Distance = 2000f, // Distance at which damage begins falling off. - MinMultipler = -1f, // Value from 0.0001f to 1f where 0.1f would be a min damage of 10% of base damage. - }, - Grids = new GridSizeDef - { - Large = -1f, // Multiplier for damage against large grids. - Small = -1f, // Multiplier for damage against small grids. - }, - Armor = new ArmorDef - { - Armor = -1f, // Multiplier for damage against all armor. This is multiplied with the specific armor type multiplier (light, heavy). - Light = -1f, // Multiplier for damage against light armor. - Heavy = -1f, // Multiplier for damage against heavy armor. - NonArmor = -1f, // Multiplier for damage against every else. - }, - Shields = new ShieldDef - { - Modifier = -1f, // Multiplier for damage against shields. - Type = Default, // Damage vs healing against shields; Default, Heal - BypassModifier = -1f, // If greater than zero, the percentage of damage that will penetrate the shield. - }, - DamageType = new DamageTypes // Damage type of each element of the projectile's damage; Kinetic, Energy - { - Base = Kinetic, // Base Damage uses this - AreaEffect = Kinetic, - Detonation = Kinetic, - Shield = Kinetic, // Damage against shields is currently all of one type per projectile. Shield Bypass Weapons, always Deal Energy regardless of this line - }, - Deform = new DeformDef - { - DeformType = HitBlock, - DeformDelay = 30, - }, - Custom = new CustomScalesDef - { - SkipOthers = NoSkip, // Controls how projectile interacts with other blocks in relation to those defined here, NoSkip, Exclusive, Inclusive. - Types = new[] // List of blocks to apply custom damage multipliers to. - { - new CustomBlocksDef - { - SubTypeId = "Test1", - Modifier = -1f, - }, - new CustomBlocksDef - { - SubTypeId = "Test2", - Modifier = -1f, - }, - }, - }, - }, - AreaOfDamage = new AreaOfDamageDef - { - ByBlockHit = new ByBlockHitDef - { - Enable = false, - Radius = 5f, // Meters - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Pooled, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - EndOfLife = new EndOfLifeDef - { - Enable = false, - Radius = 5f, // Radius of AOE effect, in meters. - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Squeeze, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - ArmOnlyOnHit = false, // Detonation only is available, After it hits something, when this is true. IE, if shot down, it won't explode. - MinArmingTime = 100, // In ticks, before the Ammo is allowed to explode, detonate or similar; This affects shrapnel spawning. - NoVisuals = false, - NoSound = false, - ParticleScale = 1, - CustomParticle = "", // Particle SubtypeID, from your Particle SBC - CustomSound = "", // SubtypeID from your Audio SBC, not a filename - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - }, - Ewar = new EwarDef - { - Enable = false, // Enables EWAR effects AND DISABLES BASE DAMAGE AND AOE DAMAGE!! - Type = EnergySink, // EnergySink, Emp, Offense, Nav, Dot, AntiSmart, JumpNull, Anchor, Tractor, Pull, Push, - Mode = Effect, // Effect , Field - Strength = 100f, - Radius = 5f, // Meters - Duration = 100, // In Ticks - StackDuration = true, // Combined Durations - Depletable = true, - MaxStacks = 10, // Max Debuffs at once - NoHitParticle = false, - /* - EnergySink : Targets & Shutdowns Power Supplies, such as Batteries & Reactor - Emp : Targets & Shutdown any Block capable of being powered - Offense : Targets & Shutdowns Weaponry - Nav : Targets & Shutdown Gyros or Locks them down - Dot : Deals Damage to Blocks in radius - AntiSmart : Effects & Scrambles the Targeting List of Affected Missiles - JumpNull : Shutdown & Stops any Active Jumps, or JumpDrive Units in radius - Tractor : Affects target with Physics - Pull : Affects target with Physics - Push : Affects target with Physics - Anchor : Targets & Shutdowns Thrusters - - */ - Force = new PushPullDef - { - ForceFrom = ProjectileLastPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - ForceTo = HitPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - Position = TargetCenterOfMass, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - DisableRelativeMass = false, - TractorRange = 0, - ShooterFeelsForce = false, - }, - Field = new FieldDef - { - Interval = 0, // Time between each pulse, in game ticks (60 == 1 second), starts at 0 (59 == tick 60). - PulseChance = 0, // Chance from 0 - 100 that an entity in the field will be hit by any given pulse. - GrowTime = 0, // How many ticks it should take the field to grow to full size. - HideModel = false, // Hide the default bubble, or other model if specified. - ShowParticle = true, // Show Block damage effect. - TriggerRange = 250f, //range at which fields are triggered - Particle = new ParticleDef // Particle effect to generate at the field's position. - { - Name = "", // SubtypeId of field particle effect. - Extras = new ParticleOptionDef - { - Scale = 1, // Scale of effect. - }, - }, - }, - }, - Beams = new BeamDef - { - Enable = false, // Enable beam behaviour. Please have 3600 RPM, when this Setting is enabled. Please do not fire Beams into Voxels. - VirtualBeams = false, // Only one damaging beam, but with the effectiveness of the visual beams combined (better performance). - ConvergeBeams = false, // When using virtual beams, converge the visual beams to the location of the real beam. - RotateRealBeam = false, // The real beam is rotated between all visual beams, instead of centered between them. - OneParticle = false, // Only spawn one particle hit per beam weapon. - }, + NoGridOrArmorScaling = true, Trajectory = new TrajectoryDef { Guidance = None, // None, Remote, TravelTo, Smart, DetectTravelTo, DetectSmart, DetectFixed TargetLossDegree = 180f, // Degrees, Is pointed forward - TargetLossTime = 0, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MaxLifeTime = 480, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). time begins at 0 and time must EXCEED this value to trigger "time > maxValue". Please have a value for this, It stops Bad things. - AccelPerSec = 0f, // Meters Per Second. This is the spawning Speed of the Projectile, and used by turning. DesiredSpeed = 500, // voxel phasing if you go above 5100 MaxTrajectory = 1400f, // Max Distance the projectile or beam can Travel. - DeaccelTime = 0, // 0 is disabled, a value causes the projectile to come to rest overtime, (Measured in game ticks, 60 = 1 second) GravityMultiplier = 1f, // Gravity multiplier, influences the trajectory of the projectile, value greater than 0 to enable. Natural Gravity Only. - SpeedVariance = Random(start: 0, end: 0), // subtracts value from DesiredSpeed. Be warned, you can make your projectile go backwards. - RangeVariance = Random(start: 0, end: 0), // subtracts value from MaxTrajectory - MaxTrajectoryTime = 0, // How long the weapon must fire before it reaches MaxTrajectory. - Smarts = new SmartsDef - { - Inaccuracy = 0f, // 0 is perfect, hit accuracy will be a random num of meters between 0 and this value. - Aggressiveness = 1f, // controls how responsive tracking is. - MaxLateralThrust = 0.5, // controls how sharp the trajectile may turn - TrackingDelay = 0, // Measured in Shape diameter units traveled. - MaxChaseTime = 0, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - OverideTarget = true, // when set to true ammo picks its own target, does not use hardpoint's. - MaxTargets = 0, // Number of targets allowed before ending, 0 = unlimited - NoTargetExpire = false, // Expire without ever having a target at TargetLossTime - Roam = false, // Roam current area after target loss - KeepAliveAfterTargetLoss = false, // Whether to stop early death of projectile on target loss - OffsetRatio = 0.05f, // The ratio to offset the random direction (0 to 1) - OffsetTime = 60, // how often to offset degree, measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..) - }, - Mines = new MinesDef // Note: This is being investigated. Please report to Github, any issues. - { - DetectRadius = 0, - DeCloakRadius = 0, - FieldTime = 0, - Cloak = false, - Persist = false, - }, }, AmmoGraphics = new GraphicDef { ModelName = "Models\\Weapons\\MediumCalibreShell.mwm", // Model Path goes here. "\\Models\\Ammo\\Starcore_Arrow_Missile_Large" VisualProbability = 1f, // % - ShieldHitDraw = false, Decals = new DecalDef { MaxAge = 3600, @@ -2354,809 +690,68 @@ partial class Parts { new TextureMapDef { - HitMaterial = "Metal", - DecalMaterial = "GunBullet", - }, - new TextureMapDef - { - HitMaterial = "Glass", - DecalMaterial = "GunBullet", - }, - }, - }, - Particles = new AmmoParticleDef - { - Ammo = new ParticleDef - { - Name = "MediumCalibreGun_Tracer", //ShipWelderArc - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - }, - }, - Hit = new ParticleDef - { - Name = "MaterialHit_Metal_GatlingGun", - ApplyToShield = true, - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - HitPlayChance = 1f, - }, - }, - Eject = new ParticleDef - { - Name = "", - ApplyToShield = true, - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - HitPlayChance = 1f, - }, - }, - }, - Lines = new LineDef - { - ColorVariance = Random(start: 0.5f, end: 2.5f), // multiply the color by random values within range. - WidthVariance = Random(start: 0f, end: 0.05f), // adds random value to default width (negatives shrinks width) - Tracer = new TracerBaseDef - { - Enable = false, - Length = 5f, // - Width = 0.2f, // - Color = Color(red: 2.5f, green: 2, blue: 1f, alpha: 1), // RBG 255 is Neon Glowing, 100 is Quite Bright. - VisualFadeStart = 0, // Number of ticks the weapon has been firing before projectiles begin to fade their color - VisualFadeEnd = 240, // How many ticks after fade began before it will be invisible. - Textures = new[] {// WeaponLaser, ProjectileTrailLine, WarpBubble, etc.. - "ProjectileTrailLine", // Please always have this Line set, if this Section is enabled. - }, - TextureMode = Normal, // Normal, Cycle, Chaos, Wave - Segmentation = new SegmentDef - { - Enable = false, // If true Tracer TextureMode is ignored - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - SegmentLength = 0f, // Uses the values below. - SegmentGap = 0f, // Uses Tracer textures and values - Speed = 1f, // meters per second - Color = Color(red: 1, green: 2, blue: 2.5f, alpha: 1), - WidthMultiplier = 1f, - Reverse = false, - UseLineVariance = true, - WidthVariance = Random(start: 0f, end: 0f), - ColorVariance = Random(start: 0f, end: 0f) - } - }, - Trail = new TrailDef - { - Enable = false, - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - TextureMode = Normal, - DecayTime = 3, // In Ticks. 1 = 1 Additional Tracer generated per motion, 33 is 33 lines drawn per projectile. Keep this number low. - Color = Color(red: 0, green: 0, blue: 1, alpha: 1), - Back = false, - CustomWidth = 0, - UseWidthVariance = false, - UseColorFade = true, - }, - OffsetEffect = new OffsetEffectDef - { - MaxOffset = 0,// 0 offset value disables this effect - MinLength = 0.2f, - MaxLength = 3, - }, - }, - }, - AmmoAudio = new AmmoAudioDef - { - TravelSound = "MediumShellFlightSound", // SubtypeID for your Sound File. Travel, is sound generated around your Projectile in flight - HitSound = "ImpMetalMetalCat0", - ShotSound = "", - ShieldHitSound = "", - PlayerHitSound = "", - VoxelHitSound = "ImpMetalRockCat0", - FloatingHitSound = "", - HitPlayChance = 1f, - HitPlayShield = true, - }, - Ejection = new EjectionDef // Optional Component, allows generation of Particle or Item (Typically magazine), on firing, to simulate Tank shell ejection - { - Type = Particle, // Particle or Item (Inventory Component) - Speed = 100f, // Speed inventory is ejected from in dummy direction - SpawnChance = 0.5f, // chance of triggering effect (0 - 1) - CompDef = new ComponentDef - { - ItemName = "", //InventoryComponent name - ItemLifeTime = 0, // how long item should exist in world - Delay = 0, // delay in ticks after shot before ejected - } - }, // Don't edit below this line - }; - - private AmmoDef ArtilleryShell => new AmmoDef // Your ID, for slotting into the Weapon CS - { - AmmoMagazine = "LargeCalibreAmmo", // SubtypeId of physical ammo magazine. Use "Energy" for weapons without physical ammo. - AmmoRound = "Artillery Shell", // Name of ammo in terminal, should be different for each ammo type used by the same weapon. Is used by Shrapnel. - HybridRound = false, // Use both a physical ammo magazine and energy per shot. - EnergyCost = 0.1f, // Scaler for energy per shot (EnergyCost * BaseDamage * (RateOfFire / 3600) * BarrelsPerShot * TrajectilesPerBarrel). Uses EffectStrength instead of BaseDamage if EWAR. - BaseDamage = 17000f, // Direct damage; one steel plate is worth 100. - Mass = 800f, // In kilograms; how much force the impact will apply to the target. - Health = 0, // How much damage the projectile can take from other projectiles (base of 1 per hit) before dying; 0 disables this and makes the projectile untargetable. - BackKickForce = 30000f, // Recoil. This is applied to the Parent Grid. - DecayPerShot = 0f, // Damage to the firing weapon itself. - HardPointUsable = true, // Whether this is a primary ammo type fired directly by the turret. Set to false if this is a shrapnel ammoType and you don't want the turret to be able to select it directly. - EnergyMagazineSize = 0, // For energy weapons, how many shots to fire before reloading. - IgnoreWater = false, // Whether the projectile should be able to penetrate water when using WaterMod. - IgnoreVoxels = false, // Whether the projectile should be able to penetrate voxels. - Synchronize = false, // For future use - HeatModifier = -1f, // Allows this ammo to modify the amount of heat the weapon produces per shot. - Shape = new ShapeDef // Defines the collision shape of the projectile, defaults to LineShape and uses the visual Line Length if set to 0. - { - Shape = LineShape, // LineShape or SphereShape. Do not use SphereShape for fast moving projectiles if you care about precision. - Diameter = 0, // Diameter is minimum length of LineShape or minimum diameter of SphereShape. - }, - ObjectsHit = new ObjectsHitDef - { - MaxObjectsHit = 0, // Limits the number of entities (grids, players, projectiles) the projectile can penetrate; 0 = unlimited. - CountBlocks = false, // Counts individual blocks, not just entities hit. - }, - Fragment = new FragmentDef // Formerly known as Shrapnel. Spawns specified ammo fragments on projectile death (via hit or detonation). - { - AmmoRound = "", // AmmoRound field of the ammo to spawn. - Fragments = 0, // Number of projectiles to spawn. - Degrees = 0, // Cone in which to randomize direction of spawned projectiles. - Reverse = false, // Spawn projectiles backward instead of forward. - DropVelocity = false, // fragments will not inherit velocity from parent. - Offset = 0f, // Offsets the fragment spawn by this amount, in meters (positive forward, negative for backwards), value is read from parent ammo type. - Radial = 0f, // Determines starting angle for Degrees of spread above. IE, 0 degrees and 90 radial goes perpendicular to travel path - MaxChildren = 0, // number of maximum branches for fragments from the roots point of view, 0 is unlimited - IgnoreArming = true, // If true, ignore ArmOnHit or MinArmingTime in EndOfLife definitions - AdvOffset = Vector(x: 0, y: 0, z: 0), // advanced offsets the fragment by xyz coordinates relative to parent, value is read from fragment ammo type. - TimedSpawns = new TimedSpawnDef // disables FragOnEnd in favor of info specified below - { - Enable = false, // Enables TimedSpawns mechanism - Interval = 0, // Time between spawning fragments, in ticks, 0 means every tick, 1 means every other - StartTime = 0, // Time delay to start spawning fragments, in ticks, of total projectile life - MaxSpawns = 1, // Max number of fragment children to spawn - Proximity = 1000, // Starting distance from target bounding sphere to start spawning fragments, 0 disables this feature. No spawning outside this distance - ParentDies = true, // Parent dies once after it spawns its last child. - PointAtTarget = true, // Start fragment direction pointing at Target - PointType = Predict, // Point accuracy, Direct, Lead (always fire), Predict (only fire if it can hit) - GroupSize = 5, // Number of spawns in each group - GroupDelay = 120, // Delay between each group. - }, - }, - Pattern = new PatternDef - { - Patterns = new[] { // If enabled, set of multiple ammos to fire in order instead of the main ammo. - "", - }, - Mode = Fragment, // Select when to activate this pattern, options: Never, Weapon, Fragment, Both - TriggerChance = 1f, // This is % - Random = false, // This randomizes the number spawned at once, NOT the list order. - RandomMin = 1, - RandomMax = 1, - SkipParent = false, // Skip the Ammo itself, in the list - PatternSteps = 1, // Number of Ammos activated per round, will progress in order and loop. Ignored if Random = true. - }, - DamageScales = new DamageScaleDef - { - MaxIntegrity = 0f, // Blocks with integrity higher than this value will be immune to damage from this projectile; 0 = disabled. - DamageVoxels = false, // Whether to damage voxels. - SelfDamage = false, // Whether to damage the weapon's own grid. - HealthHitModifier = 4, // How much Health to subtract from another projectile on hit; defaults to 1 if zero or less. - VoxelHitModifier = 1, // Voxel damage multiplier; defaults to 1 if zero or less. - Characters = 1f, // Character damage multiplier; defaults to 1 if zero or less. - // For the following modifier values: -1 = disabled (higher performance), 0 = no damage, 0.01f = 1% damage, 2 = 200% damage. - FallOff = new FallOffDef - { - Distance = 2500f, // Distance at which damage begins falling off. - MinMultipler = -1f, // Value from 0.0001f to 1f where 0.1f would be a min damage of 10% of base damage. - }, - Grids = new GridSizeDef - { - Large = -1f, // Multiplier for damage against large grids. - Small = -1f, // Multiplier for damage against small grids. - }, - Armor = new ArmorDef - { - Armor = -1f, // Multiplier for damage against all armor. This is multiplied with the specific armor type multiplier (light, heavy). - Light = -1f, // Multiplier for damage against light armor. - Heavy = -1f, // Multiplier for damage against heavy armor. - NonArmor = -1f, // Multiplier for damage against every else. - }, - Shields = new ShieldDef - { - Modifier = -1f, // Multiplier for damage against shields. - Type = Default, // Damage vs healing against shields; Default, Heal - BypassModifier = -1f, // If greater than zero, the percentage of damage that will penetrate the shield. - }, - DamageType = new DamageTypes // Damage type of each element of the projectile's damage; Kinetic, Energy - { - Base = Kinetic, // Base Damage uses this - AreaEffect = Kinetic, - Detonation = Kinetic, - Shield = Kinetic, // Damage against shields is currently all of one type per projectile. Shield Bypass Weapons, always Deal Energy regardless of this line - }, - Deform = new DeformDef - { - DeformType = HitBlock, - DeformDelay = 30, - }, - Custom = new CustomScalesDef - { - SkipOthers = NoSkip, // Controls how projectile interacts with other blocks in relation to those defined here, NoSkip, Exclusive, Inclusive. - Types = new[] // List of blocks to apply custom damage multipliers to. - { - new CustomBlocksDef - { - SubTypeId = "Test1", - Modifier = -1f, - }, - new CustomBlocksDef - { - SubTypeId = "Test2", - Modifier = -1f, - }, - }, - }, - }, - AreaOfDamage = new AreaOfDamageDef - { - ByBlockHit = new ByBlockHitDef - { - Enable = false, - Radius = 5f, // Meters - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Pooled, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - EndOfLife = new EndOfLifeDef - { - Enable = false, - Radius = 5f, // Radius of AOE effect, in meters. - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Squeeze, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - ArmOnlyOnHit = false, // Detonation only is available, After it hits something, when this is true. IE, if shot down, it won't explode. - MinArmingTime = 100, // In ticks, before the Ammo is allowed to explode, detonate or similar; This affects shrapnel spawning. - NoVisuals = false, - NoSound = false, - ParticleScale = 1, - CustomParticle = "", // Particle SubtypeID, from your Particle SBC - CustomSound = "", // SubtypeID from your Audio SBC, not a filename - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - }, - Ewar = new EwarDef - { - Enable = false, // Enables EWAR effects AND DISABLES BASE DAMAGE AND AOE DAMAGE!! - Type = EnergySink, // EnergySink, Emp, Offense, Nav, Dot, AntiSmart, JumpNull, Anchor, Tractor, Pull, Push, - Mode = Effect, // Effect , Field - Strength = 100f, - Radius = 5f, // Meters - Duration = 100, // In Ticks - StackDuration = true, // Combined Durations - Depletable = true, - MaxStacks = 10, // Max Debuffs at once - NoHitParticle = false, - /* - EnergySink : Targets & Shutdowns Power Supplies, such as Batteries & Reactor - Emp : Targets & Shutdown any Block capable of being powered - Offense : Targets & Shutdowns Weaponry - Nav : Targets & Shutdown Gyros or Locks them down - Dot : Deals Damage to Blocks in radius - AntiSmart : Effects & Scrambles the Targeting List of Affected Missiles - JumpNull : Shutdown & Stops any Active Jumps, or JumpDrive Units in radius - Tractor : Affects target with Physics - Pull : Affects target with Physics - Push : Affects target with Physics - Anchor : Targets & Shutdowns Thrusters - - */ - Force = new PushPullDef - { - ForceFrom = ProjectileLastPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - ForceTo = HitPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - Position = TargetCenterOfMass, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - DisableRelativeMass = false, - TractorRange = 0, - ShooterFeelsForce = false, - }, - Field = new FieldDef - { - Interval = 0, // Time between each pulse, in game ticks (60 == 1 second), starts at 0 (59 == tick 60). - PulseChance = 0, // Chance from 0 - 100 that an entity in the field will be hit by any given pulse. - GrowTime = 0, // How many ticks it should take the field to grow to full size. - HideModel = false, // Hide the default bubble, or other model if specified. - ShowParticle = true, // Show Block damage effect. - TriggerRange = 250f, //range at which fields are triggered - Particle = new ParticleDef // Particle effect to generate at the field's position. - { - Name = "", // SubtypeId of field particle effect. - Extras = new ParticleOptionDef - { - Scale = 1, // Scale of effect. - }, - }, - }, - }, - Beams = new BeamDef - { - Enable = false, // Enable beam behaviour. Please have 3600 RPM, when this Setting is enabled. Please do not fire Beams into Voxels. - VirtualBeams = false, // Only one damaging beam, but with the effectiveness of the visual beams combined (better performance). - ConvergeBeams = false, // When using virtual beams, converge the visual beams to the location of the real beam. - RotateRealBeam = false, // The real beam is rotated between all visual beams, instead of centered between them. - OneParticle = false, // Only spawn one particle hit per beam weapon. - }, - Trajectory = new TrajectoryDef - { - Guidance = None, // None, Remote, TravelTo, Smart, DetectTravelTo, DetectSmart, DetectFixed - TargetLossDegree = 180f, // Degrees, Is pointed forward - TargetLossTime = 0, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - MaxLifeTime = 600, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). time begins at 0 and time must EXCEED this value to trigger "time > maxValue". Please have a value for this, It stops Bad things. - AccelPerSec = 0f, // Meters Per Second. This is the spawning Speed of the Projectile, and used by turning. - DesiredSpeed = 500, // voxel phasing if you go above 5100 - MaxTrajectory = 2000f, // Max Distance the projectile or beam can Travel. - DeaccelTime = 0, // 0 is disabled, a value causes the projectile to come to rest overtime, (Measured in game ticks, 60 = 1 second) - GravityMultiplier = 0.5f, // Gravity multiplier, influences the trajectory of the projectile, value greater than 0 to enable. Natural Gravity Only. - SpeedVariance = Random(start: 0, end: 0), // subtracts value from DesiredSpeed. Be warned, you can make your projectile go backwards. - RangeVariance = Random(start: 0, end: 0), // subtracts value from MaxTrajectory - MaxTrajectoryTime = 0, // How long the weapon must fire before it reaches MaxTrajectory. - Smarts = new SmartsDef - { - Inaccuracy = 0f, // 0 is perfect, hit accuracy will be a random num of meters between 0 and this value. - Aggressiveness = 1f, // controls how responsive tracking is. - MaxLateralThrust = 0.5, // controls how sharp the trajectile may turn - TrackingDelay = 0, // Measured in Shape diameter units traveled. - MaxChaseTime = 0, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - OverideTarget = true, // when set to true ammo picks its own target, does not use hardpoint's. - MaxTargets = 0, // Number of targets allowed before ending, 0 = unlimited - NoTargetExpire = false, // Expire without ever having a target at TargetLossTime - Roam = false, // Roam current area after target loss - KeepAliveAfterTargetLoss = false, // Whether to stop early death of projectile on target loss - OffsetRatio = 0.05f, // The ratio to offset the random direction (0 to 1) - OffsetTime = 60, // how often to offset degree, measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..) - }, - Mines = new MinesDef // Note: This is being investigated. Please report to Github, any issues. - { - DetectRadius = 0, - DeCloakRadius = 0, - FieldTime = 0, - Cloak = false, - Persist = false, - }, - }, - AmmoGraphics = new GraphicDef - { - ModelName = "Models\\Weapons\\LargeCalibreShell.mwm", // Model Path goes here. "\\Models\\Ammo\\Starcore_Arrow_Missile_Large" - VisualProbability = 1f, // % - ShieldHitDraw = false, - Decals = new DecalDef - { - MaxAge = 3600, - Map = new[] - { - new TextureMapDef - { - HitMaterial = "Metal", - DecalMaterial = "LargeShell", - }, - new TextureMapDef - { - HitMaterial = "Glass", - DecalMaterial = "LargeShell", - }, - }, - }, - Particles = new AmmoParticleDef - { - Ammo = new ParticleDef - { - Name = "LargeCalibreGun_Tracer", //ShipWelderArc - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - }, - }, - Hit = new ParticleDef - { - Name = "MaterialHit_Metal_GatlingGun", - ApplyToShield = true, - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - HitPlayChance = 1f, - }, - }, - Eject = new ParticleDef - { - Name = "", - ApplyToShield = true, - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - HitPlayChance = 1f, - }, - }, - }, - Lines = new LineDef - { - ColorVariance = Random(start: 0.5f, end: 2.5f), // multiply the color by random values within range. - WidthVariance = Random(start: 0f, end: 0.05f), // adds random value to default width (negatives shrinks width) - Tracer = new TracerBaseDef - { - Enable = false, - Length = 5f, // - Width = 0.2f, // - Color = Color(red: 2.5f, green: 2, blue: 1f, alpha: 1), // RBG 255 is Neon Glowing, 100 is Quite Bright. - VisualFadeStart = 0, // Number of ticks the weapon has been firing before projectiles begin to fade their color - VisualFadeEnd = 240, // How many ticks after fade began before it will be invisible. - Textures = new[] {// WeaponLaser, ProjectileTrailLine, WarpBubble, etc.. - "ProjectileTrailLine", // Please always have this Line set, if this Section is enabled. - }, - TextureMode = Normal, // Normal, Cycle, Chaos, Wave - Segmentation = new SegmentDef - { - Enable = false, // If true Tracer TextureMode is ignored - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - SegmentLength = 0f, // Uses the values below. - SegmentGap = 0f, // Uses Tracer textures and values - Speed = 1f, // meters per second - Color = Color(red: 1, green: 2, blue: 2.5f, alpha: 1), - WidthMultiplier = 1f, - Reverse = false, - UseLineVariance = true, - WidthVariance = Random(start: 0f, end: 0f), - ColorVariance = Random(start: 0f, end: 0f) - } - }, - Trail = new TrailDef - { - Enable = false, - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - TextureMode = Normal, - DecayTime = 3, // In Ticks. 1 = 1 Additional Tracer generated per motion, 33 is 33 lines drawn per projectile. Keep this number low. - Color = Color(red: 0, green: 0, blue: 1, alpha: 1), - Back = false, - CustomWidth = 0, - UseWidthVariance = false, - UseColorFade = true, - }, - OffsetEffect = new OffsetEffectDef - { - MaxOffset = 0,// 0 offset value disables this effect - MinLength = 0.2f, - MaxLength = 3, - }, - }, - }, - AmmoAudio = new AmmoAudioDef - { - TravelSound = "HeavyShellFlightSound", // SubtypeID for your Sound File. Travel, is sound generated around your Projectile in flight - HitSound = "ImpMetalMetalCat0", - ShotSound = "", - ShieldHitSound = "", - PlayerHitSound = "", - VoxelHitSound = "ImpMetalRockCat0", - FloatingHitSound = "", - HitPlayChance = 1f, - HitPlayShield = true, - }, - Ejection = new EjectionDef // Optional Component, allows generation of Particle or Item (Typically magazine), on firing, to simulate Tank shell ejection - { - Type = Particle, // Particle or Item (Inventory Component) - Speed = 100f, // Speed inventory is ejected from in dummy direction - SpawnChance = 0.5f, // chance of triggering effect (0 - 1) - CompDef = new ComponentDef - { - ItemName = "", //InventoryComponent name - ItemLifeTime = 0, // how long item should exist in world - Delay = 0, // delay in ticks after shot before ejected - } - }, // Don't edit below this line - }; - - private AmmoDef LargeRailgunSabot => new AmmoDef // Your ID, for slotting into the Weapon CS - { - AmmoMagazine = "LargeRailgunAmmo", // SubtypeId of physical ammo magazine. Use "Energy" for weapons without physical ammo. - AmmoRound = "Large Railgun Slug", // Name of ammo in terminal, should be different for each ammo type used by the same weapon. Is used by Shrapnel. - HybridRound = true, // Use both a physical ammo magazine and energy per shot. - EnergyCost = 0.1368f, // Scaler for energy per shot (EnergyCost * BaseDamage * (RateOfFire / 3600) * BarrelsPerShot * TrajectilesPerBarrel). Uses EffectStrength instead of BaseDamage if EWAR. - BaseDamage = 50000f, // Direct damage; one steel plate is worth 100. - Mass = 100f, // In kilograms; how much force the impact will apply to the target. - Health = 0, // How much damage the projectile can take from other projectiles (base of 1 per hit) before dying; 0 disables this and makes the projectile untargetable. - BackKickForce = 120000f, // Recoil. This is applied to the Parent Grid. - DecayPerShot = 0f, // Damage to the firing weapon itself. - HardPointUsable = true, // Whether this is a primary ammo type fired directly by the turret. Set to false if this is a shrapnel ammoType and you don't want the turret to be able to select it directly. - EnergyMagazineSize = 0, // For energy weapons, how many shots to fire before reloading. - IgnoreWater = false, // Whether the projectile should be able to penetrate water when using WaterMod. - IgnoreVoxels = false, // Whether the projectile should be able to penetrate voxels. - Synchronize = false, // For future use - HeatModifier = -1f, // Allows this ammo to modify the amount of heat the weapon produces per shot. - Shape = new ShapeDef // Defines the collision shape of the projectile, defaults to LineShape and uses the visual Line Length if set to 0. - { - Shape = LineShape, // LineShape or SphereShape. Do not use SphereShape for fast moving projectiles if you care about precision. - Diameter = 0, // Diameter is minimum length of LineShape or minimum diameter of SphereShape. - }, - ObjectsHit = new ObjectsHitDef - { - MaxObjectsHit = 0, // Limits the number of entities (grids, players, projectiles) the projectile can penetrate; 0 = unlimited. - CountBlocks = false, // Counts individual blocks, not just entities hit. - }, - Fragment = new FragmentDef // Formerly known as Shrapnel. Spawns specified ammo fragments on projectile death (via hit or detonation). - { - AmmoRound = "", // AmmoRound field of the ammo to spawn. - Fragments = 0, // Number of projectiles to spawn. - Degrees = 0, // Cone in which to randomize direction of spawned projectiles. - Reverse = false, // Spawn projectiles backward instead of forward. - DropVelocity = false, // fragments will not inherit velocity from parent. - Offset = 0f, // Offsets the fragment spawn by this amount, in meters (positive forward, negative for backwards), value is read from parent ammo type. - Radial = 0f, // Determines starting angle for Degrees of spread above. IE, 0 degrees and 90 radial goes perpendicular to travel path - MaxChildren = 0, // number of maximum branches for fragments from the roots point of view, 0 is unlimited - IgnoreArming = true, // If true, ignore ArmOnHit or MinArmingTime in EndOfLife definitions - AdvOffset = Vector(x: 0, y: 0, z: 0), // advanced offsets the fragment by xyz coordinates relative to parent, value is read from fragment ammo type. - TimedSpawns = new TimedSpawnDef // disables FragOnEnd in favor of info specified below - { - Enable = false, // Enables TimedSpawns mechanism - Interval = 0, // Time between spawning fragments, in ticks, 0 means every tick, 1 means every other - StartTime = 0, // Time delay to start spawning fragments, in ticks, of total projectile life - MaxSpawns = 1, // Max number of fragment children to spawn - Proximity = 1000, // Starting distance from target bounding sphere to start spawning fragments, 0 disables this feature. No spawning outside this distance - ParentDies = true, // Parent dies once after it spawns its last child. - PointAtTarget = true, // Start fragment direction pointing at Target - PointType = Predict, // Point accuracy, Direct, Lead (always fire), Predict (only fire if it can hit) - GroupSize = 5, // Number of spawns in each group - GroupDelay = 120, // Delay between each group. - }, - }, - Pattern = new PatternDef - { - Patterns = new[] { // If enabled, set of multiple ammos to fire in order instead of the main ammo. - "", - }, - Mode = Fragment, // Select when to activate this pattern, options: Never, Weapon, Fragment, Both - TriggerChance = 1f, // This is % - Random = false, // This randomizes the number spawned at once, NOT the list order. - RandomMin = 1, - RandomMax = 1, - SkipParent = false, // Skip the Ammo itself, in the list - PatternSteps = 1, // Number of Ammos activated per round, will progress in order and loop. Ignored if Random = true. - }, - DamageScales = new DamageScaleDef - { - MaxIntegrity = 0f, // Blocks with integrity higher than this value will be immune to damage from this projectile; 0 = disabled. - DamageVoxels = false, // Whether to damage voxels. - SelfDamage = false, // Whether to damage the weapon's own grid. - HealthHitModifier = 10, // How much Health to subtract from another projectile on hit; defaults to 1 if zero or less. - VoxelHitModifier = 1, // Voxel damage multiplier; defaults to 1 if zero or less. - Characters = 1f, // Character damage multiplier; defaults to 1 if zero or less. - // For the following modifier values: -1 = disabled (higher performance), 0 = no damage, 0.01f = 1% damage, 2 = 200% damage. - FallOff = new FallOffDef - { - Distance = 3500f, // Distance at which damage begins falling off. - MinMultipler = -1f, // Value from 0.0001f to 1f where 0.1f would be a min damage of 10% of base damage. - }, - Grids = new GridSizeDef - { - Large = -1f, // Multiplier for damage against large grids. - Small = -1f, // Multiplier for damage against small grids. - }, - Armor = new ArmorDef - { - Armor = -1f, // Multiplier for damage against all armor. This is multiplied with the specific armor type multiplier (light, heavy). - Light = -1f, // Multiplier for damage against light armor. - Heavy = -1f, // Multiplier for damage against heavy armor. - NonArmor = -1f, // Multiplier for damage against every else. - }, - Shields = new ShieldDef - { - Modifier = -1f, // Multiplier for damage against shields. - Type = Default, // Damage vs healing against shields; Default, Heal - BypassModifier = -1f, // If greater than zero, the percentage of damage that will penetrate the shield. - }, - DamageType = new DamageTypes // Damage type of each element of the projectile's damage; Kinetic, Energy - { - Base = Kinetic, // Base Damage uses this - AreaEffect = Kinetic, - Detonation = Kinetic, - Shield = Kinetic, // Damage against shields is currently all of one type per projectile. Shield Bypass Weapons, always Deal Energy regardless of this line - }, - Deform = new DeformDef - { - DeformType = HitBlock, - DeformDelay = 30, - }, - Custom = new CustomScalesDef - { - SkipOthers = NoSkip, // Controls how projectile interacts with other blocks in relation to those defined here, NoSkip, Exclusive, Inclusive. - Types = new[] // List of blocks to apply custom damage multipliers to. - { - new CustomBlocksDef - { - SubTypeId = "Test1", - Modifier = -1f, - }, - new CustomBlocksDef - { - SubTypeId = "Test2", - Modifier = -1f, - }, - }, - }, - }, - AreaOfDamage = new AreaOfDamageDef - { - ByBlockHit = new ByBlockHitDef - { - Enable = false, - Radius = 5f, // Meters - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Pooled, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - EndOfLife = new EndOfLifeDef - { - Enable = false, - Radius = 5f, // Radius of AOE effect, in meters. - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Squeeze, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - ArmOnlyOnHit = false, // Detonation only is available, After it hits something, when this is true. IE, if shot down, it won't explode. - MinArmingTime = 100, // In ticks, before the Ammo is allowed to explode, detonate or similar; This affects shrapnel spawning. - NoVisuals = false, - NoSound = false, - ParticleScale = 1, - CustomParticle = "", // Particle SubtypeID, from your Particle SBC - CustomSound = "", // SubtypeID from your Audio SBC, not a filename - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - }, - Ewar = new EwarDef - { - Enable = false, // Enables EWAR effects AND DISABLES BASE DAMAGE AND AOE DAMAGE!! - Type = EnergySink, // EnergySink, Emp, Offense, Nav, Dot, AntiSmart, JumpNull, Anchor, Tractor, Pull, Push, - Mode = Effect, // Effect , Field - Strength = 100f, - Radius = 5f, // Meters - Duration = 100, // In Ticks - StackDuration = true, // Combined Durations - Depletable = true, - MaxStacks = 10, // Max Debuffs at once - NoHitParticle = false, - /* - EnergySink : Targets & Shutdowns Power Supplies, such as Batteries & Reactor - Emp : Targets & Shutdown any Block capable of being powered - Offense : Targets & Shutdowns Weaponry - Nav : Targets & Shutdown Gyros or Locks them down - Dot : Deals Damage to Blocks in radius - AntiSmart : Effects & Scrambles the Targeting List of Affected Missiles - JumpNull : Shutdown & Stops any Active Jumps, or JumpDrive Units in radius - Tractor : Affects target with Physics - Pull : Affects target with Physics - Push : Affects target with Physics - Anchor : Targets & Shutdowns Thrusters - - */ - Force = new PushPullDef - { - ForceFrom = ProjectileLastPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - ForceTo = HitPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - Position = TargetCenterOfMass, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - DisableRelativeMass = false, - TractorRange = 0, - ShooterFeelsForce = false, + HitMaterial = "Metal", + DecalMaterial = "GunBullet", + }, + new TextureMapDef + { + HitMaterial = "Glass", + DecalMaterial = "GunBullet", + }, + }, }, - Field = new FieldDef + Particles = new AmmoParticleDef { - Interval = 0, // Time between each pulse, in game ticks (60 == 1 second), starts at 0 (59 == tick 60). - PulseChance = 0, // Chance from 0 - 100 that an entity in the field will be hit by any given pulse. - GrowTime = 0, // How many ticks it should take the field to grow to full size. - HideModel = false, // Hide the default bubble, or other model if specified. - ShowParticle = true, // Show Block damage effect. - TriggerRange = 250f, //range at which fields are triggered - Particle = new ParticleDef // Particle effect to generate at the field's position. + Ammo = new ParticleDef + { + Name = "MediumCalibreGun_Tracer", //ShipWelderArc + Extras = new ParticleOptionDef + { + Scale = 1, + }, + }, + Hit = new ParticleDef { - Name = "", // SubtypeId of field particle effect. + Name = "MaterialHit_Metal_GatlingGun", + ApplyToShield = true, Extras = new ParticleOptionDef { - Scale = 1, // Scale of effect. + Scale = 1, + HitPlayChance = 1f, }, }, }, }, - Beams = new BeamDef + AmmoAudio = new AmmoAudioDef { - Enable = false, // Enable beam behaviour. Please have 3600 RPM, when this Setting is enabled. Please do not fire Beams into Voxels. - VirtualBeams = false, // Only one damaging beam, but with the effectiveness of the visual beams combined (better performance). - ConvergeBeams = false, // When using virtual beams, converge the visual beams to the location of the real beam. - RotateRealBeam = false, // The real beam is rotated between all visual beams, instead of centered between them. - OneParticle = false, // Only spawn one particle hit per beam weapon. + TravelSound = "MediumShellFlightSound", // SubtypeID for your Sound File. Travel, is sound generated around your Projectile in flight + HitSound = "ImpMetalMetalCat0", + VoxelHitSound = "ImpMetalRockCat0", + HitPlayChance = 1f, + HitPlayShield = true, }, + }; + + private AmmoDef ArtilleryShell => new AmmoDef // Your ID, for slotting into the Weapon CS + { + AmmoMagazine = "LargeCalibreAmmo", // SubtypeId of physical ammo magazine. Use "Energy" for weapons without physical ammo. + AmmoRound = "Artillery Shell", // Name of ammo in terminal, should be different for each ammo type used by the same weapon. Is used by Shrapnel. + BaseDamage = 17000f, // Direct damage; one steel plate is worth 100. + Mass = 800f, // In kilograms; how much force the impact will apply to the target. + BackKickForce = 30000f, // Recoil. This is applied to the Parent Grid. + HardPointUsable = true, // Whether this is a primary ammo type fired directly by the turret. Set to false if this is a shrapnel ammoType and you don't want the turret to be able to select it directly. + NoGridOrArmorScaling = true, Trajectory = new TrajectoryDef { Guidance = None, // None, Remote, TravelTo, Smart, DetectTravelTo, DetectSmart, DetectFixed - TargetLossDegree = 180f, // Degrees, Is pointed forward - TargetLossTime = 0, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - MaxLifeTime = 300, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). time begins at 0 and time must EXCEED this value to trigger "time > maxValue". Please have a value for this, It stops Bad things. - AccelPerSec = 0f, // Meters Per Second. This is the spawning Speed of the Projectile, and used by turning. - DesiredSpeed = 2000, // voxel phasing if you go above 5100 + MaxLifeTime = 600, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). time begins at 0 and time must EXCEED this value to trigger "time > maxValue". Please have a value for this, It stops Bad things. + DesiredSpeed = 500, // voxel phasing if you go above 5100 MaxTrajectory = 2000f, // Max Distance the projectile or beam can Travel. - DeaccelTime = 0, // 0 is disabled, a value causes the projectile to come to rest overtime, (Measured in game ticks, 60 = 1 second) - GravityMultiplier = 1f, // Gravity multiplier, influences the trajectory of the projectile, value greater than 0 to enable. Natural Gravity Only. - SpeedVariance = Random(start: 0, end: 0), // subtracts value from DesiredSpeed. Be warned, you can make your projectile go backwards. - RangeVariance = Random(start: 0, end: 0), // subtracts value from MaxTrajectory - MaxTrajectoryTime = 0, // How long the weapon must fire before it reaches MaxTrajectory. - Smarts = new SmartsDef - { - Inaccuracy = 0f, // 0 is perfect, hit accuracy will be a random num of meters between 0 and this value. - Aggressiveness = 1f, // controls how responsive tracking is. - MaxLateralThrust = 0.5, // controls how sharp the trajectile may turn - TrackingDelay = 0, // Measured in Shape diameter units traveled. - MaxChaseTime = 0, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - OverideTarget = true, // when set to true ammo picks its own target, does not use hardpoint's. - MaxTargets = 0, // Number of targets allowed before ending, 0 = unlimited - NoTargetExpire = false, // Expire without ever having a target at TargetLossTime - Roam = false, // Roam current area after target loss - KeepAliveAfterTargetLoss = false, // Whether to stop early death of projectile on target loss - OffsetRatio = 0.05f, // The ratio to offset the random direction (0 to 1) - OffsetTime = 60, // how often to offset degree, measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..) - }, - Mines = new MinesDef // Note: This is being investigated. Please report to Github, any issues. - { - DetectRadius = 0, - DeCloakRadius = 0, - FieldTime = 0, - Cloak = false, - Persist = false, - }, + GravityMultiplier = 0.5f, // Gravity multiplier, influences the trajectory of the projectile, value greater than 0 to enable. Natural Gravity Only. }, AmmoGraphics = new GraphicDef { - ModelName = "Models\\Weapons\\RailgunAmmoLarge.mwm", // Model Path goes here. "\\Models\\Ammo\\Starcore_Arrow_Missile_Large" + ModelName = "Models\\Weapons\\LargeCalibreShell.mwm", // Model Path goes here. "\\Models\\Ammo\\Starcore_Arrow_Missile_Large" VisualProbability = 1f, // % ShieldHitDraw = false, Decals = new DecalDef @@ -3166,12 +761,12 @@ partial class Parts { new TextureMapDef { - HitMaterial = "Glass", + HitMaterial = "Metal", DecalMaterial = "LargeShell", }, new TextureMapDef { - HitMaterial = "Metal", + HitMaterial = "Glass", DecalMaterial = "LargeShell", }, }, @@ -3180,7 +775,7 @@ partial class Parts { Ammo = new ParticleDef { - Name = "", //ShipWelderArc + Name = "LargeCalibreGun_Tracer", //ShipWelderArc Offset = Vector(x: 0, y: 0, z: 0), Extras = new ParticleOptionDef { @@ -3198,11 +793,65 @@ partial class Parts HitPlayChance = 1f, }, }, - Eject = new ParticleDef + }, + }, + AmmoAudio = new AmmoAudioDef + { + TravelSound = "HeavyShellFlightSound", // SubtypeID for your Sound File. Travel, is sound generated around your Projectile in flight + HitSound = "ImpMetalMetalCat0", + VoxelHitSound = "ImpMetalRockCat0", + HitPlayChance = 1f, + HitPlayShield = true, + }, + }; + + private AmmoDef LargeRailgunSabot => new AmmoDef // Your ID, for slotting into the Weapon CS + { + AmmoMagazine = "LargeRailgunAmmo", // SubtypeId of physical ammo magazine. Use "Energy" for weapons without physical ammo. + AmmoRound = "Large Railgun Slug", // Name of ammo in terminal, should be different for each ammo type used by the same weapon. Is used by Shrapnel. + HybridRound = true, // Use both a physical ammo magazine and energy per shot. + EnergyCost = 0.1368f, // Scaler for energy per shot (EnergyCost * BaseDamage * (RateOfFire / 3600) * BarrelsPerShot * TrajectilesPerBarrel). Uses EffectStrength instead of BaseDamage if EWAR. + BaseDamage = 50000f, // Direct damage; one steel plate is worth 100. + Mass = 100f, // In kilograms; how much force the impact will apply to the target. + BackKickForce = 120000f, // Recoil. This is applied to the Parent Grid. + HardPointUsable = true, // Whether this is a primary ammo type fired directly by the turret. Set to false if this is a shrapnel ammoType and you don't want the turret to be able to select it directly. + NoGridOrArmorScaling = true, + Trajectory = new TrajectoryDef + { + MaxLifeTime = 300, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). time begins at 0 and time must EXCEED this value to trigger "time > maxValue". Please have a value for this, It stops Bad things. + DesiredSpeed = 2000, // voxel phasing if you go above 5100 + MaxTrajectory = 2000f, // Max Distance the projectile or beam can Travel. + SpeedVariance = Random(start: 0, end: 0), // subtracts value from DesiredSpeed. Be warned, you can make your projectile go backwards. + RangeVariance = Random(start: 0, end: 0), // subtracts value from MaxTrajectory + MaxTrajectoryTime = 0, // How long the weapon must fire before it reaches MaxTrajectory. + }, + AmmoGraphics = new GraphicDef + { + ModelName = "Models\\Weapons\\RailgunAmmoLarge.mwm", // Model Path goes here. "\\Models\\Ammo\\Starcore_Arrow_Missile_Large" + VisualProbability = 1f, // % + Decals = new DecalDef + { + MaxAge = 3600, + Map = new[] + { + new TextureMapDef + { + HitMaterial = "Glass", + DecalMaterial = "LargeShell", + }, + new TextureMapDef + { + HitMaterial = "Metal", + DecalMaterial = "LargeShell", + }, + }, + }, + Particles = new AmmoParticleDef + { + Hit = new ParticleDef { - Name = "", + Name = "MaterialHit_Metal_GatlingGun", ApplyToShield = true, - Offset = Vector(x: 0, y: 0, z: 0), Extras = new ParticleOptionDef { Scale = 1, @@ -3220,28 +869,11 @@ partial class Parts Length = 80f, // Width = 0.3f, // Color = Color(red: 20f, green: 20f, blue: 40f, alpha: 1f), // RBG 255 is Neon Glowing, 100 is Quite Bright. - VisualFadeStart = 0, // Number of ticks the weapon has been firing before projectiles begin to fade their color VisualFadeEnd = 240, // How many ticks after fade began before it will be invisible. Textures = new[] {// WeaponLaser, ProjectileTrailLine, WarpBubble, etc.. "WeaponLaser", // Please always have this Line set, if this Section is enabled. }, TextureMode = Normal, // Normal, Cycle, Chaos, Wave - Segmentation = new SegmentDef - { - Enable = false, // If true Tracer TextureMode is ignored - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - SegmentLength = 0f, // Uses the values below. - SegmentGap = 0f, // Uses Tracer textures and values - Speed = 1f, // meters per second - Color = Color(red: 1, green: 2, blue: 2.5f, alpha: 1), - WidthMultiplier = 1f, - Reverse = false, - UseLineVariance = true, - WidthVariance = Random(start: 0f, end: 0f), - ColorVariance = Random(start: 0f, end: 0f) - } }, Trail = new TrailDef { @@ -3252,9 +884,7 @@ partial class Parts TextureMode = Normal, DecayTime = 30, // In Ticks. 1 = 1 Additional Tracer generated per motion, 33 is 33 lines drawn per projectile. Keep this number low. Color = Color(red: 15f, green: 15f, blue: 30f, alpha: 1f), - Back = false, CustomWidth = 0.3f, - UseWidthVariance = false, UseColorFade = true, }, OffsetEffect = new OffsetEffectDef @@ -3269,26 +899,10 @@ partial class Parts { TravelSound = "HeavyShellFlightSound", // SubtypeID for your Sound File. Travel, is sound generated around your Projectile in flight HitSound = "ImpMetalMetalCat0", - ShotSound = "", - ShieldHitSound = "", - PlayerHitSound = "", VoxelHitSound = "ImpMetalRockCat0", - FloatingHitSound = "", HitPlayChance = 1f, HitPlayShield = true, }, - Ejection = new EjectionDef // Optional Component, allows generation of Particle or Item (Typically magazine), on firing, to simulate Tank shell ejection - { - Type = Particle, // Particle or Item (Inventory Component) - Speed = 100f, // Speed inventory is ejected from in dummy direction - SpawnChance = 0.5f, // chance of triggering effect (0 - 1) - CompDef = new ComponentDef - { - ItemName = "", //InventoryComponent name - ItemLifeTime = 0, // how long item should exist in world - Delay = 0, // delay in ticks after shot before ejected - } - }, // Don't edit below this line }; private AmmoDef SmallRailgunSabot => new AmmoDef // Your ID, for slotting into the Weapon CS @@ -3299,266 +913,14 @@ partial class Parts EnergyCost = 0.081f, // Scaler for energy per shot (EnergyCost * BaseDamage * (RateOfFire / 3600) * BarrelsPerShot * TrajectilesPerBarrel). Uses EffectStrength instead of BaseDamage if EWAR. BaseDamage = 8000f, // Direct damage; one steel plate is worth 100. Mass = 25f, // In kilograms; how much force the impact will apply to the target. - Health = 0, // How much damage the projectile can take from other projectiles (base of 1 per hit) before dying; 0 disables this and makes the projectile untargetable. BackKickForce = 30000f, // Recoil. This is applied to the Parent Grid. - DecayPerShot = 0f, // Damage to the firing weapon itself. HardPointUsable = true, // Whether this is a primary ammo type fired directly by the turret. Set to false if this is a shrapnel ammoType and you don't want the turret to be able to select it directly. - EnergyMagazineSize = 0, // For energy weapons, how many shots to fire before reloading. - IgnoreWater = false, // Whether the projectile should be able to penetrate water when using WaterMod. - IgnoreVoxels = false, // Whether the projectile should be able to penetrate voxels. - Synchronize = false, // For future use - HeatModifier = -1f, // Allows this ammo to modify the amount of heat the weapon produces per shot. - Shape = new ShapeDef // Defines the collision shape of the projectile, defaults to LineShape and uses the visual Line Length if set to 0. - { - Shape = LineShape, // LineShape or SphereShape. Do not use SphereShape for fast moving projectiles if you care about precision. - Diameter = 0, // Diameter is minimum length of LineShape or minimum diameter of SphereShape. - }, - ObjectsHit = new ObjectsHitDef - { - MaxObjectsHit = 0, // Limits the number of entities (grids, players, projectiles) the projectile can penetrate; 0 = unlimited. - CountBlocks = false, // Counts individual blocks, not just entities hit. - }, - Fragment = new FragmentDef // Formerly known as Shrapnel. Spawns specified ammo fragments on projectile death (via hit or detonation). - { - AmmoRound = "", // AmmoRound field of the ammo to spawn. - Fragments = 0, // Number of projectiles to spawn. - Degrees = 0, // Cone in which to randomize direction of spawned projectiles. - Reverse = false, // Spawn projectiles backward instead of forward. - DropVelocity = false, // fragments will not inherit velocity from parent. - Offset = 0f, // Offsets the fragment spawn by this amount, in meters (positive forward, negative for backwards), value is read from parent ammo type. - Radial = 0f, // Determines starting angle for Degrees of spread above. IE, 0 degrees and 90 radial goes perpendicular to travel path - MaxChildren = 0, // number of maximum branches for fragments from the roots point of view, 0 is unlimited - IgnoreArming = true, // If true, ignore ArmOnHit or MinArmingTime in EndOfLife definitions - AdvOffset = Vector(x: 0, y: 0, z: 0), // advanced offsets the fragment by xyz coordinates relative to parent, value is read from fragment ammo type. - TimedSpawns = new TimedSpawnDef // disables FragOnEnd in favor of info specified below - { - Enable = false, // Enables TimedSpawns mechanism - Interval = 0, // Time between spawning fragments, in ticks, 0 means every tick, 1 means every other - StartTime = 0, // Time delay to start spawning fragments, in ticks, of total projectile life - MaxSpawns = 1, // Max number of fragment children to spawn - Proximity = 1000, // Starting distance from target bounding sphere to start spawning fragments, 0 disables this feature. No spawning outside this distance - ParentDies = true, // Parent dies once after it spawns its last child. - PointAtTarget = true, // Start fragment direction pointing at Target - PointType = Predict, // Point accuracy, Direct, Lead (always fire), Predict (only fire if it can hit) - GroupSize = 5, // Number of spawns in each group - GroupDelay = 120, // Delay between each group. - }, - }, - Pattern = new PatternDef - { - Patterns = new[] { // If enabled, set of multiple ammos to fire in order instead of the main ammo. - "", - }, - Mode = Fragment, // Select when to activate this pattern, options: Never, Weapon, Fragment, Both - TriggerChance = 1f, // This is % - Random = false, // This randomizes the number spawned at once, NOT the list order. - RandomMin = 1, - RandomMax = 1, - SkipParent = false, // Skip the Ammo itself, in the list - PatternSteps = 1, // Number of Ammos activated per round, will progress in order and loop. Ignored if Random = true. - }, - DamageScales = new DamageScaleDef - { - MaxIntegrity = 0f, // Blocks with integrity higher than this value will be immune to damage from this projectile; 0 = disabled. - DamageVoxels = false, // Whether to damage voxels. - SelfDamage = false, // Whether to damage the weapon's own grid. - HealthHitModifier = 2.5, // How much Health to subtract from another projectile on hit; defaults to 1 if zero or less. - VoxelHitModifier = 1, // Voxel damage multiplier; defaults to 1 if zero or less. - Characters = 1f, // Character damage multiplier; defaults to 1 if zero or less. - // For the following modifier values: -1 = disabled (higher performance), 0 = no damage, 0.01f = 1% damage, 2 = 200% damage. - FallOff = new FallOffDef - { - Distance = 2500f, // Distance at which damage begins falling off. - MinMultipler = -1f, // Value from 0.0001f to 1f where 0.1f would be a min damage of 10% of base damage. - }, - Grids = new GridSizeDef - { - Large = -1f, // Multiplier for damage against large grids. - Small = -1f, // Multiplier for damage against small grids. - }, - Armor = new ArmorDef - { - Armor = -1f, // Multiplier for damage against all armor. This is multiplied with the specific armor type multiplier (light, heavy). - Light = -1f, // Multiplier for damage against light armor. - Heavy = -1f, // Multiplier for damage against heavy armor. - NonArmor = -1f, // Multiplier for damage against every else. - }, - Shields = new ShieldDef - { - Modifier = -1f, // Multiplier for damage against shields. - Type = Default, // Damage vs healing against shields; Default, Heal - BypassModifier = -1f, // If greater than zero, the percentage of damage that will penetrate the shield. - }, - DamageType = new DamageTypes // Damage type of each element of the projectile's damage; Kinetic, Energy - { - Base = Kinetic, // Base Damage uses this - AreaEffect = Kinetic, - Detonation = Kinetic, - Shield = Kinetic, // Damage against shields is currently all of one type per projectile. Shield Bypass Weapons, always Deal Energy regardless of this line - }, - Deform = new DeformDef - { - DeformType = HitBlock, - DeformDelay = 30, - }, - Custom = new CustomScalesDef - { - SkipOthers = NoSkip, // Controls how projectile interacts with other blocks in relation to those defined here, NoSkip, Exclusive, Inclusive. - Types = new[] // List of blocks to apply custom damage multipliers to. - { - new CustomBlocksDef - { - SubTypeId = "Test1", - Modifier = -1f, - }, - new CustomBlocksDef - { - SubTypeId = "Test2", - Modifier = -1f, - }, - }, - }, - }, - AreaOfDamage = new AreaOfDamageDef - { - ByBlockHit = new ByBlockHitDef - { - Enable = false, - Radius = 5f, // Meters - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Pooled, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - EndOfLife = new EndOfLifeDef - { - Enable = false, - Radius = 5f, // Radius of AOE effect, in meters. - Damage = 5f, - Depth = 1f, // Max depth of AOE effect, in meters. 0=disabled, and AOE effect will reach to a depth of the radius value - MaxAbsorb = 0f, // Soft cutoff for damage, except for pooled falloff. If pooled falloff, limits max damage per block. - Falloff = Squeeze, //.NoFalloff applies the same damage to all blocks in radius - //.Linear drops evenly by distance from center out to max radius - //.Curve drops off damage sharply as it approaches the max radius - //.InvCurve drops off sharply from the middle and tapers to max radius - //.Squeeze does little damage to the middle, but rapidly increases damage toward max radius - //.Pooled damage behaves in a pooled manner that once exhausted damage ceases. - //.Exponential drops off exponentially. Does not scale to max radius - ArmOnlyOnHit = false, // Detonation only is available, After it hits something, when this is true. IE, if shot down, it won't explode. - MinArmingTime = 100, // In ticks, before the Ammo is allowed to explode, detonate or similar; This affects shrapnel spawning. - NoVisuals = false, - NoSound = false, - ParticleScale = 1, - CustomParticle = "", // Particle SubtypeID, from your Particle SBC - CustomSound = "", // SubtypeID from your Audio SBC, not a filename - Shape = Diamond, // Round or Diamond shape. Diamond is more performance friendly. - }, - }, - Ewar = new EwarDef - { - Enable = false, // Enables EWAR effects AND DISABLES BASE DAMAGE AND AOE DAMAGE!! - Type = EnergySink, // EnergySink, Emp, Offense, Nav, Dot, AntiSmart, JumpNull, Anchor, Tractor, Pull, Push, - Mode = Effect, // Effect , Field - Strength = 100f, - Radius = 5f, // Meters - Duration = 100, // In Ticks - StackDuration = true, // Combined Durations - Depletable = true, - MaxStacks = 10, // Max Debuffs at once - NoHitParticle = false, - /* - EnergySink : Targets & Shutdowns Power Supplies, such as Batteries & Reactor - Emp : Targets & Shutdown any Block capable of being powered - Offense : Targets & Shutdowns Weaponry - Nav : Targets & Shutdown Gyros or Locks them down - Dot : Deals Damage to Blocks in radius - AntiSmart : Effects & Scrambles the Targeting List of Affected Missiles - JumpNull : Shutdown & Stops any Active Jumps, or JumpDrive Units in radius - Tractor : Affects target with Physics - Pull : Affects target with Physics - Push : Affects target with Physics - Anchor : Targets & Shutdowns Thrusters - - */ - Force = new PushPullDef - { - ForceFrom = ProjectileLastPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - ForceTo = HitPosition, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - Position = TargetCenterOfMass, // ProjectileLastPosition, ProjectileOrigin, HitPosition, TargetCenter, TargetCenterOfMass - DisableRelativeMass = false, - TractorRange = 0, - ShooterFeelsForce = false, - }, - Field = new FieldDef - { - Interval = 0, // Time between each pulse, in game ticks (60 == 1 second), starts at 0 (59 == tick 60). - PulseChance = 0, // Chance from 0 - 100 that an entity in the field will be hit by any given pulse. - GrowTime = 0, // How many ticks it should take the field to grow to full size. - HideModel = false, // Hide the default bubble, or other model if specified. - ShowParticle = true, // Show Block damage effect. - TriggerRange = 250f, //range at which fields are triggered - Particle = new ParticleDef // Particle effect to generate at the field's position. - { - Name = "", // SubtypeId of field particle effect. - Extras = new ParticleOptionDef - { - Scale = 1, // Scale of effect. - }, - }, - }, - }, - Beams = new BeamDef - { - Enable = false, // Enable beam behaviour. Please have 3600 RPM, when this Setting is enabled. Please do not fire Beams into Voxels. - VirtualBeams = false, // Only one damaging beam, but with the effectiveness of the visual beams combined (better performance). - ConvergeBeams = false, // When using virtual beams, converge the visual beams to the location of the real beam. - RotateRealBeam = false, // The real beam is rotated between all visual beams, instead of centered between them. - OneParticle = false, // Only spawn one particle hit per beam weapon. - }, + NoGridOrArmorScaling = true, Trajectory = new TrajectoryDef { - Guidance = None, // None, Remote, TravelTo, Smart, DetectTravelTo, DetectSmart, DetectFixed - TargetLossDegree = 180f, // Degrees, Is pointed forward - TargetLossTime = 0, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MaxLifeTime = 300, // 0 is disabled, Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). time begins at 0 and time must EXCEED this value to trigger "time > maxValue". Please have a value for this, It stops Bad things. - AccelPerSec = 0f, // Meters Per Second. This is the spawning Speed of the Projectile, and used by turning. DesiredSpeed = 1000, // voxel phasing if you go above 5100 MaxTrajectory = 1400f, // Max Distance the projectile or beam can Travel. - DeaccelTime = 0, // 0 is disabled, a value causes the projectile to come to rest overtime, (Measured in game ticks, 60 = 1 second) - GravityMultiplier = 1f, // Gravity multiplier, influences the trajectory of the projectile, value greater than 0 to enable. Natural Gravity Only. - SpeedVariance = Random(start: 0, end: 0), // subtracts value from DesiredSpeed. Be warned, you can make your projectile go backwards. - RangeVariance = Random(start: 0, end: 0), // subtracts value from MaxTrajectory - MaxTrajectoryTime = 0, // How long the weapon must fire before it reaches MaxTrajectory. - Smarts = new SmartsDef - { - Inaccuracy = 0f, // 0 is perfect, hit accuracy will be a random num of meters between 0 and this value. - Aggressiveness = 1f, // controls how responsive tracking is. - MaxLateralThrust = 0.5, // controls how sharp the trajectile may turn - TrackingDelay = 0, // Measured in Shape diameter units traveled. - MaxChaseTime = 0, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - OverideTarget = true, // when set to true ammo picks its own target, does not use hardpoint's. - MaxTargets = 0, // Number of targets allowed before ending, 0 = unlimited - NoTargetExpire = false, // Expire without ever having a target at TargetLossTime - Roam = false, // Roam current area after target loss - KeepAliveAfterTargetLoss = false, // Whether to stop early death of projectile on target loss - OffsetRatio = 0.05f, // The ratio to offset the random direction (0 to 1) - OffsetTime = 60, // how often to offset degree, measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..) - }, - Mines = new MinesDef // Note: This is being investigated. Please report to Github, any issues. - { - DetectRadius = 0, - DeCloakRadius = 0, - FieldTime = 0, - Cloak = false, - Persist = false, - }, }, AmmoGraphics = new GraphicDef { @@ -3584,15 +946,6 @@ partial class Parts }, Particles = new AmmoParticleDef { - Ammo = new ParticleDef - { - Name = "", //ShipWelderArc - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - }, - }, Hit = new ParticleDef { Name = "MaterialHit_Metal_GatlingGun", @@ -3604,17 +957,6 @@ partial class Parts HitPlayChance = 1f, }, }, - Eject = new ParticleDef - { - Name = "", - ApplyToShield = true, - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Scale = 1, - HitPlayChance = 1f, - }, - }, }, Lines = new LineDef { @@ -3632,22 +974,6 @@ partial class Parts "WeaponLaser", // Please always have this Line set, if this Section is enabled. }, TextureMode = Normal, // Normal, Cycle, Chaos, Wave - Segmentation = new SegmentDef - { - Enable = false, // If true Tracer TextureMode is ignored - Textures = new[] { - "", // Please always have this Line set, if this Section is enabled. - }, - SegmentLength = 0f, // Uses the values below. - SegmentGap = 0f, // Uses Tracer textures and values - Speed = 1f, // meters per second - Color = Color(red: 1, green: 2, blue: 2.5f, alpha: 1), - WidthMultiplier = 1f, - Reverse = false, - UseLineVariance = true, - WidthVariance = Random(start: 0f, end: 0f), - ColorVariance = Random(start: 0f, end: 0f) - } }, Trail = new TrailDef { @@ -3675,26 +1001,10 @@ partial class Parts { TravelSound = "MediumShellFlightSound", // SubtypeID for your Sound File. Travel, is sound generated around your Projectile in flight HitSound = "ImpMetalMetalCat0", - ShotSound = "", - ShieldHitSound = "", - PlayerHitSound = "", VoxelHitSound = "ImpMetalRockCat0", - FloatingHitSound = "", HitPlayChance = 1f, HitPlayShield = true, }, - Ejection = new EjectionDef // Optional Component, allows generation of Particle or Item (Typically magazine), on firing, to simulate Tank shell ejection - { - Type = Particle, // Particle or Item (Inventory Component) - Speed = 100f, // Speed inventory is ejected from in dummy direction - SpawnChance = 0.5f, // chance of triggering effect (0 - 1) - CompDef = new ComponentDef - { - ItemName = "", //InventoryComponent name - ItemLifeTime = 0, // how long item should exist in world - Delay = 0, // delay in ticks after shot before ejected - } - }, // Don't edit below this line }; } } diff --git a/Data/Scripts/CoreSystems/Coreparts/Definitions/Artillery.cs b/Data/Scripts/CoreSystems/Coreparts/Definitions/Artillery.cs index 4f420456..3a56215a 100644 --- a/Data/Scripts/CoreSystems/Coreparts/Definitions/Artillery.cs +++ b/Data/Scripts/CoreSystems/Coreparts/Definitions/Artillery.cs @@ -5,7 +5,6 @@ using static CoreSystems.Support.WeaponDefinition.HardPointDef.Prediction; using static CoreSystems.Support.WeaponDefinition.TargetingDef.BlockTypes; using static CoreSystems.Support.WeaponDefinition.TargetingDef.Threat; -using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef; using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef.HardwareType; namespace Scripts { @@ -30,7 +29,6 @@ partial class Parts { Muzzles = new[] { "muzzle_missile_001", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "muzzle_missile_001", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -41,13 +39,6 @@ partial class Parts { SubSystems = new[] { Power, Utility, Offense, Thrust, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 2, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 500, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -57,96 +48,26 @@ partial class Parts { PartName = "Artillery", // Name of the weapon in terminal, should be unique for each weapon definition that shares a SubtypeId (i.e. multiweapons). DeviateShotAngle = 0.15f, // Projectile inaccuracy in degrees. AimingTolerance = 2f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. - AimLeadingPrediction = Off, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 0, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, - Ai = new AiDef - { - TrackTargets = false, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. - TurretAttached = false, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. - TurretController = false, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. - PrimaryTracking = false, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. - }, HardWare = new HardwareDef { - RotateRate = 0f, // Max traversal speed of azimuth subpart in radians per tick (0.1 is approximately 360 degrees per second). - ElevateRate = 0f, // Max traversal speed of elevation subpart in radians per tick. - MinAzimuth = 0, - MaxAzimuth = 0, - MinElevation = 0, - MaxElevation = 0, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.3f, // Inventory capacity in kL. IdlePower = 0.0025f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 80, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 720, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 1, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepLargeCalibreShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", - HardPointRotationSound = "", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 0, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, Graphics = new HardPointParticleDef @@ -154,34 +75,16 @@ partial class Parts { Effect1 = new ParticleDef { Name = "Muzzle_Flash_LargeCalibre", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. Extras = new ParticleOptionDef { - Loop = false, // Set this to the same as in the particle sbc! - Restart = false, // Whether to end a looping effect instantly when firing stops. Scale = 1f, // Scale of effect. }, }, - Effect2 = new ParticleDef - { - Name = "", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = false, - Scale = 1f, - }, - }, }, }, Ammos = new[] { ArtilleryShell, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; WeaponDefinition LargeBlockArtilleryTurret => new WeaponDefinition @@ -204,7 +107,6 @@ partial class Parts { "muzzle_missile_001", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A "muzzle_missile_002", }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "camera", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -215,13 +117,6 @@ partial class Parts { SubSystems = new[] { Power, Utility, Offense, Thrust, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 2, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 500, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -232,26 +127,12 @@ partial class Parts { DeviateShotAngle = 0.3f, // Projectile inaccuracy in degrees. AimingTolerance = 2f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. AimLeadingPrediction = Advanced, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 0, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, Ai = new AiDef { TrackTargets = true, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. TurretAttached = true, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. TurretController = true, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. PrimaryTracking = true, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. }, HardWare = new HardwareDef { @@ -261,66 +142,24 @@ partial class Parts { MaxAzimuth = 180, MinElevation = -15, MaxElevation = 60, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.6f, // Inventory capacity in kL. IdlePower = 0.02f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 80, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 720, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 2, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepLargeCalibreShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", HardPointRotationSound = "WepTurretGatlingRotate", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 0, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, Graphics = new HardPointParticleDef @@ -328,34 +167,16 @@ partial class Parts { Effect1 = new ParticleDef { Name = "Muzzle_Flash_LargeCalibre", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. Extras = new ParticleOptionDef { - Loop = false, // Set this to the same as in the particle sbc! - Restart = false, // Whether to end a looping effect instantly when firing stops. Scale = 1f, // Scale of effect. }, }, - Effect2 = new ParticleDef - { - Name = "", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = false, - Scale = 1f, - }, - }, }, }, Ammos = new[] { ArtilleryShell, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; // Don't edit below this line. diff --git a/Data/Scripts/CoreSystems/Coreparts/Definitions/Assault Cannons.cs b/Data/Scripts/CoreSystems/Coreparts/Definitions/Assault Cannons.cs index e9c78fcb..8851e0bf 100644 --- a/Data/Scripts/CoreSystems/Coreparts/Definitions/Assault Cannons.cs +++ b/Data/Scripts/CoreSystems/Coreparts/Definitions/Assault Cannons.cs @@ -5,7 +5,6 @@ using static CoreSystems.Support.WeaponDefinition.HardPointDef.Prediction; using static CoreSystems.Support.WeaponDefinition.TargetingDef.BlockTypes; using static CoreSystems.Support.WeaponDefinition.TargetingDef.Threat; -using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef; using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef.HardwareType; namespace Scripts { @@ -31,7 +30,6 @@ partial class Parts { "Muzzle_Missile_Left", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A "Muzzle_Missile_Right", }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "Muzzle_Missile_Left", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -42,13 +40,6 @@ partial class Parts { SubSystems = new[] { Utility, Offense, Thrust, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 1000, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -59,26 +50,12 @@ partial class Parts { DeviateShotAngle = 0.35f, // Projectile inaccuracy in degrees. AimingTolerance = 2f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. AimLeadingPrediction = Advanced, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 0, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, Ai = new AiDef { TrackTargets = true, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. TurretAttached = true, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. TurretController = true, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. PrimaryTracking = true, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. }, HardWare = new HardwareDef { @@ -88,66 +65,24 @@ partial class Parts { MaxAzimuth = 180, MinElevation = -20, MaxElevation = 75, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.18f, // Inventory capacity in kL. IdlePower = 0.01f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 180, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 360, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 2, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepMediumCalibreShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", HardPointRotationSound = "WepTurretGatlingRotate", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 0, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, Graphics = new HardPointParticleDef @@ -155,34 +90,16 @@ partial class Parts { Effect1 = new ParticleDef { Name = "Muzzle_Flash_MediumCalibre", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. Extras = new ParticleOptionDef { - Loop = false, // Set this to the same as in the particle sbc! - Restart = false, // Whether to end a looping effect instantly when firing stops. Scale = 1f, // Scale of effect. }, }, - Effect2 = new ParticleDef - { - Name = "", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = false, - Scale = 1f, - }, - }, }, }, Ammos = new[] { AssaultCannonShell, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; WeaponDefinition SmallBlockAssaultCannon => new WeaponDefinition @@ -204,7 +121,6 @@ partial class Parts { Muzzles = new[] { "Muzzle_Missile", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "Muzzle_Missile", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -215,13 +131,6 @@ partial class Parts { SubSystems = new[] { Utility, Offense, Thrust, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 1000, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -231,96 +140,25 @@ partial class Parts { PartName = "Assault Cannon", // Name of the weapon in terminal, should be unique for each weapon definition that shares a SubtypeId (i.e. multiweapons). DeviateShotAngle = 0.2f, // Projectile inaccuracy in degrees. AimingTolerance = 2f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. - AimLeadingPrediction = Off, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 0, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, - Ai = new AiDef - { - TrackTargets = false, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. - TurretAttached = false, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. - TurretController = false, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. - PrimaryTracking = false, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. - }, HardWare = new HardwareDef { - RotateRate = 0f, // Max traversal speed of azimuth subpart in radians per tick (0.1 is approximately 360 degrees per second). - ElevateRate = 0f, // Max traversal speed of elevation subpart in radians per tick. - MinAzimuth = 0, - MaxAzimuth = 0, - MinElevation = 0, - MaxElevation = 0, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.09f, // Inventory capacity in kL. IdlePower = 0.001f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 200, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 360, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 1, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepMediumCalibreShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", - HardPointRotationSound = "", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 0, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, Graphics = new HardPointParticleDef @@ -328,34 +166,16 @@ partial class Parts { Effect1 = new ParticleDef { Name = "Muzzle_Flash_MediumCalibre", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. Extras = new ParticleOptionDef { - Loop = false, // Set this to the same as in the particle sbc! - Restart = false, // Whether to end a looping effect instantly when firing stops. Scale = 1f, // Scale of effect. }, }, - Effect2 = new ParticleDef - { - Name = "", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = false, - Scale = 1f, - }, - }, }, }, Ammos = new[] { AssaultCannonShell, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; WeaponDefinition SmallBlockAssaultCannonTurret => new WeaponDefinition @@ -377,7 +197,6 @@ partial class Parts { Muzzles = new[] { "Muzzle_Missile", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "Muzzle_Missile", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -388,13 +207,6 @@ partial class Parts { SubSystems = new[] { Utility, Offense, Thrust, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 1000, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -405,26 +217,12 @@ partial class Parts { DeviateShotAngle = 0.5f, // Projectile inaccuracy in degrees. AimingTolerance = 2f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. AimLeadingPrediction = Advanced, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 0, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, Ai = new AiDef { TrackTargets = true, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. TurretAttached = true, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. TurretController = true, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. PrimaryTracking = true, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. }, HardWare = new HardwareDef { @@ -434,66 +232,24 @@ partial class Parts { MaxAzimuth = 180, MinElevation = -10, MaxElevation = 50, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.09f, // Inventory capacity in kL. IdlePower = 0.005f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 200, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 360, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 1, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepMediumCalibreShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", HardPointRotationSound = "WepTurretGatlingRotate", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 0, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, Graphics = new HardPointParticleDef @@ -501,25 +257,9 @@ partial class Parts { Effect1 = new ParticleDef { Name = "Muzzle_Flash_MediumCalibre", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. Extras = new ParticleOptionDef { - Loop = false, // Set this to the same as in the particle sbc! Restart = false, // Whether to end a looping effect instantly when firing stops. - Scale = 1f, // Scale of effect. - }, - }, - Effect2 = new ParticleDef - { - Name = "", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = false, - Scale = 1f, }, }, }, @@ -527,8 +267,6 @@ partial class Parts { Ammos = new[] { AssaultCannonShell, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; // Don't edit below this line. } diff --git a/Data/Scripts/CoreSystems/Coreparts/Definitions/Autocannons.cs b/Data/Scripts/CoreSystems/Coreparts/Definitions/Autocannons.cs index 5d017910..4b6b2484 100644 --- a/Data/Scripts/CoreSystems/Coreparts/Definitions/Autocannons.cs +++ b/Data/Scripts/CoreSystems/Coreparts/Definitions/Autocannons.cs @@ -5,7 +5,6 @@ using static CoreSystems.Support.WeaponDefinition.HardPointDef.Prediction; using static CoreSystems.Support.WeaponDefinition.TargetingDef.BlockTypes; using static CoreSystems.Support.WeaponDefinition.TargetingDef.Threat; -using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef; using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef.HardwareType; namespace Scripts { @@ -30,7 +29,6 @@ partial class Parts { Muzzles = new[] { "muzzle_projectile", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "muzzle_projectile", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -41,13 +39,6 @@ partial class Parts { SubSystems = new[] { Thrust, Utility, Offense, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 500, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -57,95 +48,25 @@ partial class Parts { PartName = "Autocannon", // Name of the weapon in terminal, should be unique for each weapon definition that shares a SubtypeId (i.e. multiweapons). DeviateShotAngle = 0.15f, // Projectile inaccuracy in degrees. AimingTolerance = 2f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. - AimLeadingPrediction = Off, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 0, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, - Ai = new AiDef - { - TrackTargets = false, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. - TurretAttached = false, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. - TurretController = false, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. - PrimaryTracking = false, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. - }, HardWare = new HardwareDef { - RotateRate = 0f, // Max traversal speed of azimuth subpart in radians per tick (0.1 is approximately 360 degrees per second). - ElevateRate = 0f, // Max traversal speed of elevation subpart in radians per tick. - MinAzimuth = 0, - MaxAzimuth = 0, - MinElevation = 0, - MaxElevation = 0, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.072f, // Inventory capacity in kL. IdlePower = 0.001f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 200, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 1, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 1, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepShipAutocannonShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", - HardPointRotationSound = "", // Audio played when turret is moving. - BarrelRotationSound = "", FireSoundEndDelay = 0, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, @@ -154,24 +75,18 @@ partial class Parts { Effect1 = new ParticleDef { Name = "Muzzle_Flash_Autocannon", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. Extras = new ParticleOptionDef { Loop = true, // Set this to the same as in the particle sbc! - Restart = false, // Whether to end a looping effect instantly when firing stops. Scale = 1f, // Scale of effect. }, }, Effect2 = new ParticleDef { Name = "Smoke_Autocannon", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), Extras = new ParticleOptionDef { Loop = true, // Set this to the same as in the particle sbc! - Restart = false, Scale = 1f, }, }, @@ -203,8 +118,6 @@ partial class Parts { Muzzles = new[] { "muzzle_missile_01", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. - Scope = "", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef { @@ -214,13 +127,6 @@ partial class Parts { SubSystems = new[] { Utility, Offense, Thrust, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 1000, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -231,26 +137,12 @@ partial class Parts { DeviateShotAngle = 0.25f, // Projectile inaccuracy in degrees. AimingTolerance = 2f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. AimLeadingPrediction = Accurate, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 0, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, Ai = new AiDef { TrackTargets = true, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. TurretAttached = true, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. TurretController = true, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. PrimaryTracking = true, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. }, HardWare = new HardwareDef { @@ -260,66 +152,25 @@ partial class Parts { MaxAzimuth = 180, MinElevation = -10, MaxElevation = 90, - HomeAzimuth = 0, // Default resting rotation angle HomeElevation = 1, // Default resting elevation InventorySize = 0.072f, // Inventory capacity in kL. IdlePower = 0.005f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 200, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 360, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 1, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepShipAutocannonShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", HardPointRotationSound = "WepTurretGatlingRotate", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 0, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, Graphics = new HardPointParticleDef @@ -327,24 +178,18 @@ partial class Parts { Effect1 = new ParticleDef { Name = "Muzzle_Flash_Autocannon", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. Extras = new ParticleOptionDef { Loop = true, // Set this to the same as in the particle sbc! - Restart = false, // Whether to end a looping effect instantly when firing stops. Scale = 1f, // Scale of effect. }, }, Effect2 = new ParticleDef { Name = "Smoke_Autocannon", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), Extras = new ParticleOptionDef { Loop = true, // Set this to the same as in the particle sbc! - Restart = false, Scale = 1f, }, }, @@ -353,8 +198,6 @@ partial class Parts { Ammos = new[] { AutocannonShell, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; // Don't edit below this line. } diff --git a/Data/Scripts/CoreSystems/Coreparts/Definitions/Gatlings.cs b/Data/Scripts/CoreSystems/Coreparts/Definitions/Gatlings.cs index ecea09c1..ae203a13 100644 --- a/Data/Scripts/CoreSystems/Coreparts/Definitions/Gatlings.cs +++ b/Data/Scripts/CoreSystems/Coreparts/Definitions/Gatlings.cs @@ -5,7 +5,6 @@ using static CoreSystems.Support.WeaponDefinition.HardPointDef.Prediction; using static CoreSystems.Support.WeaponDefinition.TargetingDef.BlockTypes; using static CoreSystems.Support.WeaponDefinition.TargetingDef.Threat; -using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef; using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef.HardwareType; namespace Scripts { @@ -30,7 +29,6 @@ partial class Parts { Muzzles = new[] { "muzzle_projectile_001", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "muzzle_projectile_001", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -41,13 +39,6 @@ partial class Parts { SubSystems = new[] { Offense, Thrust, Utility, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 1000, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -59,25 +50,12 @@ partial class Parts { AimingTolerance = 4f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. AimLeadingPrediction = Accurate, // Level of turret aim prediction; Off, Basic, Accurate, Advanced DelayCeaseFire = 10, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, Ai = new AiDef { TrackTargets = true, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. TurretAttached = true, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. TurretController = true, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. PrimaryTracking = true, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. }, HardWare = new HardwareDef { @@ -87,62 +65,27 @@ partial class Parts { MaxAzimuth = 180, MinElevation = -40, MaxElevation = 90, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.658f, // Inventory capacity in kL. IdlePower = 0.01f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, }, Other = new OtherDef { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. RotateBarrelAxis = 3, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 700, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 240, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 1, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). SpinFree = true, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepShipGatlingShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", HardPointRotationSound = "WepTurretGatlingRotate", // Audio played when turret is moving. BarrelRotationSound = "WepShipGatlingRotation", @@ -154,8 +97,6 @@ partial class Parts { Effect1 = new ParticleDef { Name = "Muzzle_Flash_Large", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. Extras = new ParticleOptionDef { Loop = true, // Set this to the same as in the particle sbc! @@ -166,12 +107,9 @@ partial class Parts { Effect2 = new ParticleDef { Name = "Smoke_LargeGunShot_WC", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), Extras = new ParticleOptionDef { Loop = true, // Set this to the same as in the particle sbc! - Restart = false, Scale = 1f, }, }, @@ -180,8 +118,6 @@ partial class Parts { Ammos = new[] { GatlingAmmo, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; WeaponDefinition SmallGatlingGun => new WeaponDefinition @@ -212,7 +148,6 @@ partial class Parts { Muzzles = new[] { "muzzle_projectile", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "muzzle_projectile", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -223,13 +158,6 @@ partial class Parts { SubSystems = new[] { Offense, Thrust, Utility, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 1000, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -239,94 +167,31 @@ partial class Parts { PartName = "Small Gatling Gun", // Name of the weapon in terminal, should be unique for each weapon definition that shares a SubtypeId (i.e. multiweapons). DeviateShotAngle = 0.3f, // Projectile inaccuracy in degrees. AimingTolerance = 4f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. - AimLeadingPrediction = Off, // Level of turret aim prediction; Off, Basic, Accurate, Advanced DelayCeaseFire = 10, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, - Ai = new AiDef - { - TrackTargets = false, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. - TurretAttached = false, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. - TurretController = false, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. - PrimaryTracking = false, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. - }, HardWare = new HardwareDef { - RotateRate = 0f, // Max traversal speed of azimuth subpart in radians per tick (0.1 is approximately 360 degrees per second). - ElevateRate = 0f, // Max traversal speed of elevation subpart in radians per tick. - MinAzimuth = 0, - MaxAzimuth = 0, - MinElevation = 0, - MaxElevation = 0, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.064f, // Inventory capacity in kL. IdlePower = 0.001f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, }, Other = new OtherDef { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. RotateBarrelAxis = 3, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 700, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 1, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 1, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). SpinFree = true, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepShipGatlingShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", - HardPointRotationSound = "", // Audio played when turret is moving. BarrelRotationSound = "WepShipGatlingRotation", FireSoundEndDelay = 10, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. @@ -336,8 +201,6 @@ partial class Parts { Effect1 = new ParticleDef { Name = "Muzzle_Flash_Large", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. Extras = new ParticleOptionDef { Loop = true, // Set this to the same as in the particle sbc! @@ -348,12 +211,9 @@ partial class Parts { Effect2 = new ParticleDef { Name = "Smoke_LargeGunShot_WC", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), Extras = new ParticleOptionDef { Loop = true, // Set this to the same as in the particle sbc! - Restart = false, Scale = 1f, }, }, @@ -362,8 +222,6 @@ partial class Parts { Ammos = new[] { GatlingAmmo, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; WeaponDefinition SmallGatlingTurret => new WeaponDefinition @@ -396,13 +254,6 @@ partial class Parts { SubSystems = new[] { Offense, Thrust, Utility, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 1000, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -414,25 +265,12 @@ partial class Parts { AimingTolerance = 4f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. AimLeadingPrediction = Accurate, // Level of turret aim prediction; Off, Basic, Accurate, Advanced DelayCeaseFire = 10, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, Ai = new AiDef { TrackTargets = true, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. TurretAttached = true, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. TurretController = true, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. PrimaryTracking = true, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. }, HardWare = new HardwareDef { @@ -442,62 +280,27 @@ partial class Parts { MaxAzimuth = 180, MinElevation = -10, MaxElevation = 90, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.36f, // Inventory capacity in kL. IdlePower = 0.005f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, }, Other = new OtherDef { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. RotateBarrelAxis = 3, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 700, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 360, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 1, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). SpinFree = true, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepShipGatlingShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", HardPointRotationSound = "WepTurretGatlingRotate", // Audio played when turret is moving. BarrelRotationSound = "WepShipGatlingRotation", @@ -509,8 +312,6 @@ partial class Parts { Effect1 = new ParticleDef { Name = "Muzzle_Flash_Large", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. Extras = new ParticleOptionDef { Loop = true, // Set this to the same as in the particle sbc! @@ -521,12 +322,9 @@ partial class Parts { Effect2 = new ParticleDef { Name = "Smoke_LargeGunShot_WC", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), Extras = new ParticleOptionDef { Loop = true, // Set this to the same as in the particle sbc! - Restart = false, Scale = 1f, }, }, @@ -535,8 +333,6 @@ partial class Parts { Ammos = new[] { GatlingAmmo, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; WeaponDefinition LargeGatlingTurretReskin => new WeaponDefinition @@ -558,7 +354,6 @@ partial class Parts { Muzzles = new[] { "muzzle_projectile_001", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "muzzle_projectile_001", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -569,13 +364,6 @@ partial class Parts { SubSystems = new[] { Offense, Thrust, Utility, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 1000, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -602,21 +390,9 @@ partial class Parts { MaxAzimuth = 180, MinElevation = -40, MaxElevation = 90, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.658f, // Inventory capacity in kL. IdlePower = 0.01f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, }, Loading = new LoadingDef { @@ -628,10 +404,8 @@ partial class Parts { }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepShipGatlingShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", HardPointRotationSound = "WepTurretGatlingRotate", // Audio played when turret is moving. BarrelRotationSound = "WepShipGatlingRotation", @@ -643,7 +417,6 @@ partial class Parts { Effect1 = new ParticleDef { Name = "Muzzle_Flash_Large", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. Offset = Vector(x: 0, y: 0, z: -1.1f), // Offsets the effect from the muzzle empty. Extras = new ParticleOptionDef { @@ -655,12 +428,9 @@ partial class Parts { Effect2 = new ParticleDef { Name = "Smoke_LargeGunShot_WC", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), Extras = new ParticleOptionDef { Loop = true, // Set this to the same as in the particle sbc! - Restart = false, Scale = 1f, }, }, @@ -669,11 +439,8 @@ partial class Parts { Ammos = new[] { GatlingAmmo, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; - WeaponDefinition SmallGatlingTurretReskin => new WeaponDefinition { Assignments = new ModelAssignmentsDef @@ -693,7 +460,6 @@ partial class Parts { Muzzles = new[] { "muzzle_projectile", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "muzzle_projectile", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -730,21 +496,9 @@ partial class Parts { MaxAzimuth = 180, MinElevation = -10, MaxElevation = 90, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.36f, // Inventory capacity in kL. IdlePower = 0.005f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, }, Loading = new LoadingDef { @@ -756,10 +510,8 @@ partial class Parts { }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepShipGatlingShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", HardPointRotationSound = "WepTurretGatlingRotate", // Audio played when turret is moving. BarrelRotationSound = "WepShipGatlingRotation", @@ -771,7 +523,6 @@ partial class Parts { Effect1 = new ParticleDef { Name = "Muzzle_Flash_Large", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. Offset = Vector(x: 0, y: 0, z: 0.3f), // Offsets the effect from the muzzle empty. Extras = new ParticleOptionDef { @@ -783,12 +534,9 @@ partial class Parts { Effect2 = new ParticleDef { Name = "Smoke_LargeGunShot_WC", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), Extras = new ParticleOptionDef { Loop = true, // Set this to the same as in the particle sbc! - Restart = false, Scale = 1f, }, }, @@ -797,10 +545,6 @@ partial class Parts { Ammos = new[] { GatlingAmmo, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; - - // Don't edit below this line. } } diff --git a/Data/Scripts/CoreSystems/Coreparts/Definitions/InteriorTurret.cs b/Data/Scripts/CoreSystems/Coreparts/Definitions/InteriorTurret.cs index 24224bd6..cfd72ecb 100644 --- a/Data/Scripts/CoreSystems/Coreparts/Definitions/InteriorTurret.cs +++ b/Data/Scripts/CoreSystems/Coreparts/Definitions/InteriorTurret.cs @@ -5,7 +5,6 @@ using static CoreSystems.Support.WeaponDefinition.HardPointDef.Prediction; using static CoreSystems.Support.WeaponDefinition.TargetingDef.BlockTypes; using static CoreSystems.Support.WeaponDefinition.TargetingDef.Threat; -using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef; using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef.HardwareType; namespace Scripts { @@ -30,7 +29,6 @@ partial class Parts { Muzzles = new[] { "muzzle_projectile", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "muzzle_projectile", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -42,12 +40,6 @@ partial class Parts { Thrust, Utility, Offense, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, ClosestFirst = true, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 500, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -59,25 +51,12 @@ partial class Parts { AimingTolerance = 1f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. AimLeadingPrediction = Accurate, // Level of turret aim prediction; Off, Basic, Accurate, Advanced DelayCeaseFire = 10, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, Ai = new AiDef { TrackTargets = true, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. TurretAttached = true, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. TurretController = true, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. PrimaryTracking = true, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. }, HardWare = new HardwareDef { @@ -87,65 +66,23 @@ partial class Parts { MaxAzimuth = 180, MinElevation = -76, MaxElevation = 90, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.08f, // Inventory capacity in kL. IdlePower = 0.01f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 600, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 180, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 1, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepTurretInteriorFire", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state - NoAmmoSound = "", HardPointRotationSound = "WepTurretGatlingRotate", // Audio played when turret is moving. - BarrelRotationSound = "", FireSoundEndDelay = 10, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, @@ -154,8 +91,6 @@ partial class Parts { Effect1 = new ParticleDef { Name = "Muzzle_Flash", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. Extras = new ParticleOptionDef { Loop = true, // Set this to the same as in the particle sbc! @@ -163,26 +98,12 @@ partial class Parts { Scale = 3f, // Scale of effect. }, }, - Effect2 = new ParticleDef - { - Name = "", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = false, - Scale = 3f, - }, - }, }, }, Ammos = new[] { InteriorAmmo, InteriorAmmoOld // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; // Don't edit below this line. diff --git a/Data/Scripts/CoreSystems/Coreparts/Definitions/MasterConfig.cs b/Data/Scripts/CoreSystems/Coreparts/Definitions/MasterConfig.cs index 2b4b5d23..4cfe0b1f 100644 --- a/Data/Scripts/CoreSystems/Coreparts/Definitions/MasterConfig.cs +++ b/Data/Scripts/CoreSystems/Coreparts/Definitions/MasterConfig.cs @@ -5,11 +5,6 @@ partial class Parts { internal Parts() { - // naming convention: WeaponDefinition Name - // - // Enable your definitions using the follow syntax: - // PartDefinitions(Your1stDefinition, Your2ndDefinition, Your3rdDefinition); - // PartDefinitions includes both weapons and phantoms PartDefinitions(LargeGatlingTurret, SmallGatlingGun, SmallGatlingTurret, diff --git a/Data/Scripts/CoreSystems/Coreparts/Definitions/Missiles.cs b/Data/Scripts/CoreSystems/Coreparts/Definitions/Missiles.cs index 75d92d89..0c8ae9d2 100644 --- a/Data/Scripts/CoreSystems/Coreparts/Definitions/Missiles.cs +++ b/Data/Scripts/CoreSystems/Coreparts/Definitions/Missiles.cs @@ -5,7 +5,6 @@ using static CoreSystems.Support.WeaponDefinition.HardPointDef.Prediction; using static CoreSystems.Support.WeaponDefinition.TargetingDef.BlockTypes; using static CoreSystems.Support.WeaponDefinition.TargetingDef.Threat; -using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef; using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef.HardwareType; namespace Scripts { @@ -48,7 +47,6 @@ partial class Parts { "muzzle_missile_018", "muzzle_missile_019", }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "muzzle_missile_010", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -59,13 +57,6 @@ partial class Parts { SubSystems = new[] { Thrust, Utility, Offense, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 1000, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -75,131 +66,32 @@ partial class Parts { PartName = "Large Missile Launcher", // Name of the weapon in terminal, should be unique for each weapon definition that shares a SubtypeId (i.e. multiweapons). DeviateShotAngle = 0.1f, // Projectile inaccuracy in degrees. AimingTolerance = 4f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. - AimLeadingPrediction = Off, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 0, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = true, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, - Ai = new AiDef - { - TrackTargets = false, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. - TurretAttached = false, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. - TurretController = false, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. - PrimaryTracking = false, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. - }, HardWare = new HardwareDef { - RotateRate = 0f, // Max traversal speed of azimuth subpart in radians per tick (0.1 is approximately 360 degrees per second). - ElevateRate = 0f, // Max traversal speed of elevation subpart in radians per tick. - MinAzimuth = 0, - MaxAzimuth = 0, - MinElevation = 0, - MaxElevation = 0, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 1.14f, // Inventory capacity in kL. IdlePower = 0.001f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 120, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 240, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 19, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepShipSmallMissileShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", HardPointRotationSound = "WepTurretGatlingRotate", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 0, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, - Graphics = new HardPointParticleDef - { - Effect1 = new ParticleDef - { - Name = "", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = true, // Whether to end a looping effect instantly when firing stops. - Scale = 1f, // Scale of effect. - }, - }, - Effect2 = new ParticleDef - { - Name = "", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = false, - Scale = 1f, - }, - }, - }, }, Ammos = new[] { MissileAmmo, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; WeaponDefinition LargeMissileTurret => new WeaponDefinition @@ -235,7 +127,6 @@ partial class Parts { "muzzle_missile_005", "muzzle_missile_006", }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "muzzle_missile_001", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -246,13 +137,6 @@ partial class Parts { SubSystems = new[] { Thrust, Utility, Offense, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 1000, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -263,26 +147,12 @@ partial class Parts { DeviateShotAngle = 0.5f, // Projectile inaccuracy in degrees. AimingTolerance = 4f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. AimLeadingPrediction = Accurate, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 0, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = true, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, Ai = new AiDef { TrackTargets = true, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. TurretAttached = true, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. TurretController = true, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. PrimaryTracking = true, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. }, HardWare = new HardwareDef { @@ -292,101 +162,30 @@ partial class Parts { MaxAzimuth = 180, MinElevation = -58, MaxElevation = 90, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.768f, // Inventory capacity in kL. IdlePower = 0.01f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 90, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 240, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 6, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepTurretMissileShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", HardPointRotationSound = "WepTurretGatlingRotate", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 0, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, - Graphics = new HardPointParticleDef - { - Effect1 = new ParticleDef - { - Name = "", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = true, // Whether to end a looping effect instantly when firing stops. - Scale = 1f, // Scale of effect. - }, - }, - Effect2 = new ParticleDef - { - Name = "", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = false, - Scale = 1f, - }, - }, - }, }, Ammos = new[] { MissileAmmo, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; WeaponDefinition SmallMissileLauncher => new WeaponDefinition @@ -419,7 +218,6 @@ partial class Parts { "muzzle_missile_003", "muzzle_missile_004", }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "muzzle_missile_001", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -430,13 +228,6 @@ partial class Parts { SubSystems = new[] { Thrust, Utility, Offense, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 1000, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -446,131 +237,32 @@ partial class Parts { PartName = "Small Missile Launcher", // Name of the weapon in terminal, should be unique for each weapon definition that shares a SubtypeId (i.e. multiweapons). DeviateShotAngle = 0.1f, // Projectile inaccuracy in degrees. AimingTolerance = 4f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. - AimLeadingPrediction = Off, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 0, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = true, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, - Ai = new AiDef - { - TrackTargets = false, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. - TurretAttached = false, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. - TurretController = false, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. - PrimaryTracking = false, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. - }, HardWare = new HardwareDef { - RotateRate = 0f, // Max traversal speed of azimuth subpart in radians per tick (0.1 is approximately 360 degrees per second). - ElevateRate = 0f, // Max traversal speed of elevation subpart in radians per tick. - MinAzimuth = 0, - MaxAzimuth = 0, - MinElevation = 0, - MaxElevation = 0, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.24f, // Inventory capacity in kL. IdlePower = 0.001f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 60, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 60, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 4, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepShipSmallMissileShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", HardPointRotationSound = "WepTurretGatlingRotate", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 0, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, - Graphics = new HardPointParticleDef - { - Effect1 = new ParticleDef - { - Name = "", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = true, // Whether to end a looping effect instantly when firing stops. - Scale = 1f, // Scale of effect. - }, - }, - Effect2 = new ParticleDef - { - Name = "", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = false, - Scale = 1f, - }, - }, - }, }, Ammos = new[] { MissileAmmo, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; WeaponDefinition SmallRocketLauncherReload => new WeaponDefinition @@ -595,7 +287,6 @@ partial class Parts { "muzzle_missile_003", "muzzle_missile_004", }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "muzzle_missile_002", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -606,13 +297,6 @@ partial class Parts { SubSystems = new[] { Thrust, Utility, Offense, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 1000, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -622,131 +306,32 @@ partial class Parts { PartName = "Reloadable Missile Launcher", // Name of the weapon in terminal, should be unique for each weapon definition that shares a SubtypeId (i.e. multiweapons). DeviateShotAngle = 0.1f, // Projectile inaccuracy in degrees. AimingTolerance = 4f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. - AimLeadingPrediction = Off, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 0, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = true, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, - Ai = new AiDef - { - TrackTargets = false, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. - TurretAttached = false, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. - TurretController = false, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. - PrimaryTracking = false, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. - }, HardWare = new HardwareDef { - RotateRate = 0f, // Max traversal speed of azimuth subpart in radians per tick (0.1 is approximately 360 degrees per second). - ElevateRate = 0f, // Max traversal speed of elevation subpart in radians per tick. - MinAzimuth = 0, - MaxAzimuth = 0, - MinElevation = 0, - MaxElevation = 0, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.245f, // Inventory capacity in kL. IdlePower = 0.001f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 60, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 60, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 4, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepShipSmallMissileShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", HardPointRotationSound = "WepTurretGatlingRotate", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 0, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, - Graphics = new HardPointParticleDef - { - Effect1 = new ParticleDef - { - Name = "", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = true, // Whether to end a looping effect instantly when firing stops. - Scale = 1f, // Scale of effect. - }, - }, - Effect2 = new ParticleDef - { - Name = "", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = false, - Scale = 1f, - }, - }, - }, }, Ammos = new[] { MissileAmmo, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; WeaponDefinition SmallMissileTurret => new WeaponDefinition @@ -789,13 +374,6 @@ partial class Parts { SubSystems = new[] { Thrust, Utility, Offense, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 1000, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -806,26 +384,12 @@ partial class Parts { DeviateShotAngle = 0.5f, // Projectile inaccuracy in degrees. AimingTolerance = 4f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. AimLeadingPrediction = Accurate, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 0, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = true, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, Ai = new AiDef { TrackTargets = true, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. TurretAttached = true, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. TurretController = true, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. PrimaryTracking = true, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. }, HardWare = new HardwareDef { @@ -835,101 +399,30 @@ partial class Parts { MaxAzimuth = 180, MinElevation = -8, MaxElevation = 90, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.36f, // Inventory capacity in kL. IdlePower = 0.005f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 90, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 360, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 2, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { - PreFiringSound = "", // Audio for warmup effect. FiringSound = "WepTurretMissileShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", HardPointRotationSound = "WepTurretGatlingRotate", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 0, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, - Graphics = new HardPointParticleDef - { - Effect1 = new ParticleDef - { - Name = "", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = true, // Whether to end a looping effect instantly when firing stops. - Scale = 1f, // Scale of effect. - }, - }, - Effect2 = new ParticleDef - { - Name = "", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = false, - Scale = 1f, - }, - }, - }, }, Ammos = new[] { MissileAmmo, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; // Don't edit below this line. } diff --git a/Data/Scripts/CoreSystems/Coreparts/Definitions/RailgunAnimations.cs b/Data/Scripts/CoreSystems/Coreparts/Definitions/RailgunAnimations.cs index fde06b65..09b323a9 100644 --- a/Data/Scripts/CoreSystems/Coreparts/Definitions/RailgunAnimations.cs +++ b/Data/Scripts/CoreSystems/Coreparts/Definitions/RailgunAnimations.cs @@ -2,8 +2,6 @@ using static CoreSystems.Support.WeaponDefinition; using static CoreSystems.Support.WeaponDefinition.AnimationDef; using static CoreSystems.Support.WeaponDefinition.AnimationDef.PartAnimationSetDef.EventTriggers; -using static CoreSystems.Support.WeaponDefinition.AnimationDef.RelMove.MoveType; -using static CoreSystems.Support.WeaponDefinition.AnimationDef.RelMove; namespace Scripts { // Don't edit above this line partial class Parts diff --git a/Data/Scripts/CoreSystems/Coreparts/Definitions/Railguns.cs b/Data/Scripts/CoreSystems/Coreparts/Definitions/Railguns.cs index 8359ef3e..d839f6b2 100644 --- a/Data/Scripts/CoreSystems/Coreparts/Definitions/Railguns.cs +++ b/Data/Scripts/CoreSystems/Coreparts/Definitions/Railguns.cs @@ -2,10 +2,8 @@ using static CoreSystems.Support.WeaponDefinition; using static CoreSystems.Support.WeaponDefinition.ModelAssignmentsDef; using static CoreSystems.Support.WeaponDefinition.HardPointDef; -using static CoreSystems.Support.WeaponDefinition.HardPointDef.Prediction; using static CoreSystems.Support.WeaponDefinition.TargetingDef.BlockTypes; using static CoreSystems.Support.WeaponDefinition.TargetingDef.Threat; -using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef; using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef.HardwareType; namespace Scripts { @@ -30,7 +28,6 @@ partial class Parts { Muzzles = new[] { "barrel_001", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "barrel_001", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -41,13 +38,6 @@ partial class Parts { SubSystems = new[] { Power, Utility, Offense, Thrust, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 2, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 500, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -57,84 +47,20 @@ partial class Parts { PartName = "Large Railgun", // Name of the weapon in terminal, should be unique for each weapon definition that shares a SubtypeId (i.e. multiweapons). DeviateShotAngle = 0f, // Projectile inaccuracy in degrees. AimingTolerance = 2f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. - AimLeadingPrediction = Off, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 0, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, - Ai = new AiDef - { - TrackTargets = false, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. - TurretAttached = false, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. - TurretController = false, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. - PrimaryTracking = false, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. - }, HardWare = new HardwareDef { - RotateRate = 0f, // Max traversal speed of azimuth subpart in radians per tick (0.1 is approximately 360 degrees per second). - ElevateRate = 0f, // Max traversal speed of elevation subpart in radians per tick. - MinAzimuth = 0, - MaxAzimuth = 0, - MinElevation = 0, - MaxElevation = 0, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.24f, // Inventory capacity in kL. IdlePower = 0.001f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 20, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 3600, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 1, // Number of physical magazines to consume on reload. DelayUntilFire = 120, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. StayCharged = true, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef @@ -142,46 +68,14 @@ partial class Parts { PreFiringSound = "WepRailgunLargeCharge", // Audio for warmup effect. FiringSound = "WepRailgunLargeShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", - HardPointRotationSound = "", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 0, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, - Graphics = new HardPointParticleDef - { - Effect1 = new ParticleDef - { - Name = "", // SubtypeId of muzzle particle effect. - Color = Color(red: 1, green: 1, blue: 1, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. - Extras = new ParticleOptionDef - { - Loop = false, // Set this to the same as in the particle sbc! - Restart = false, // Whether to end a looping effect instantly when firing stops. - Scale = 1f, // Scale of effect. - }, - }, - Effect2 = new ParticleDef - { - Name = "", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = false, - Scale = 1f, - }, - }, - }, }, Ammos = new[] { LargeRailgunSabot, // Must list all primary, shrapnel, and pattern ammos. }, Animations = LargeRailgunAnimation, - //Upgrades = UpgradeModules, }; WeaponDefinition SmallBlockRailgun => new WeaponDefinition @@ -203,7 +97,6 @@ partial class Parts { Muzzles = new[] { "barrel_001", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "barrel_001", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -214,13 +107,6 @@ partial class Parts { SubSystems = new[] { Power, Utility, Offense, Thrust, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, - ClosestFirst = false, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. - MaxTargetDistance = 0, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 2, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. StopTrackingSpeed = 500, // Do not track threats traveling faster than this speed; 0 = unlimited. @@ -230,133 +116,36 @@ partial class Parts { PartName = "Small Railgun", // Name of the weapon in terminal, should be unique for each weapon definition that shares a SubtypeId (i.e. multiweapons). DeviateShotAngle = 0f, // Projectile inaccuracy in degrees. AimingTolerance = 2f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. - AimLeadingPrediction = Off, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 0, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - - Ui = new UiDef - { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. - }, - Ai = new AiDef - { - TrackTargets = false, // Whether this weapon tracks its own targets, or (for multiweapons) relies on the weapon with PrimaryTracking enabled for target designation. Turrets Need this set to True. - TurretAttached = false, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. - TurretController = false, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. - PrimaryTracking = false, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. - }, HardWare = new HardwareDef { - RotateRate = 0f, // Max traversal speed of azimuth subpart in radians per tick (0.1 is approximately 360 degrees per second). - ElevateRate = 0f, // Max traversal speed of elevation subpart in radians per tick. - MinAzimuth = 0, - MaxAzimuth = 0, - MinElevation = 0, - MaxElevation = 0, - HomeAzimuth = 0, // Default resting rotation angle - HomeElevation = 0, // Default resting elevation InventorySize = 0.048f, // Inventory capacity in kL. IdlePower = 0.0001f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom - CriticalReaction = new CriticalDef - { - Enable = false, // Enables Warhead behaviour. - DefaultArmedTimer = 120, // Sets default countdown duration. - PreArmed = false, // Whether the warhead is armed by default when placed. Best left as false. - TerminalControls = true, // Whether the warhead should have terminal controls for arming and detonation. - AmmoRound = "", // Optional. If specified, the warhead will always use this ammo on detonation rather than the currently selected ammo. - }, - }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. }, Loading = new LoadingDef { RateOfFire = 20, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. TrajectilesPerBarrel = 1, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. ReloadTime = 1200, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). MagsToLoad = 1, // Number of physical magazines to consume on reload. DelayUntilFire = 30, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. + StayCharged = true, // Will start recharging whenever power cap is not full. }, Audio = new HardPointAudioDef { PreFiringSound = "WepRailgunSmallCharge", // Audio for warmup effect. FiringSound = "WepRailgunSmallShot", // Audio for firing. FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state NoAmmoSound = "WepShipGatlingNoAmmo", - HardPointRotationSound = "", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 0, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, - Graphics = new HardPointParticleDef - { - Effect1 = new ParticleDef - { - Name = "", // SubtypeId of muzzle particle effect. - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), // Deprecated, set color in particle sbc. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the effect from the muzzle empty. - Extras = new ParticleOptionDef - { - Loop = false, // Set this to the same as in the particle sbc! - Restart = false, // Whether to end a looping effect instantly when firing stops. - Scale = 1f, // Scale of effect. - }, - }, - Effect2 = new ParticleDef - { - Name = "", - Color = Color(red: 0, green: 0, blue: 0, alpha: 1), - Offset = Vector(x: 0, y: 0, z: 0), - Extras = new ParticleOptionDef - { - Loop = true, // Set this to the same as in the particle sbc! - Restart = false, - Scale = 1f, - }, - }, - }, }, Ammos = new[] { SmallRailgunSabot, // Must list all primary, shrapnel, and pattern ammos. }, Animations = SmallRailgunAnimation, - //Upgrades = UpgradeModules, }; - // Don't edit below this line. } } diff --git a/Data/Scripts/CoreSystems/Coreparts/Definitions/SearchLight.cs b/Data/Scripts/CoreSystems/Coreparts/Definitions/SearchLight.cs index 26cf8f82..4ffbe471 100644 --- a/Data/Scripts/CoreSystems/Coreparts/Definitions/SearchLight.cs +++ b/Data/Scripts/CoreSystems/Coreparts/Definitions/SearchLight.cs @@ -2,10 +2,8 @@ using static CoreSystems.Support.WeaponDefinition; using static CoreSystems.Support.WeaponDefinition.ModelAssignmentsDef; using static CoreSystems.Support.WeaponDefinition.HardPointDef; -using static CoreSystems.Support.WeaponDefinition.HardPointDef.Prediction; using static CoreSystems.Support.WeaponDefinition.TargetingDef.BlockTypes; using static CoreSystems.Support.WeaponDefinition.TargetingDef.Threat; -using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef; using static CoreSystems.Support.WeaponDefinition.HardPointDef.HardwareDef.HardwareType; namespace Scripts { @@ -30,7 +28,6 @@ partial class Parts { Muzzles = new[] { "spotlight", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "spotlight", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -42,12 +39,7 @@ partial class Parts { Thrust, Utility, Offense, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, ClosestFirst = true, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. MaxTargetDistance = 2500, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. ShootBlanks = true, @@ -57,17 +49,8 @@ partial class Parts { PartName = "Searchlight", // Name of the weapon in terminal, should be unique for each weapon definition that shares a SubtypeId (i.e. multiweapons). DeviateShotAngle = 0.1f, // Projectile inaccuracy in degrees. AimingTolerance = 1f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. - AimLeadingPrediction = Accurate, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 10, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - Ui = new UiDef { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. DisableStatus = true, // Do not display weapon status NoTarget, Reloading, NoAmmo, etc.. }, Ai = new AiDef @@ -76,9 +59,6 @@ partial class Parts { TurretAttached = true, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. TurretController = true, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. PrimaryTracking = true, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. TargetGridCenter = true, // Does not target blocks, instead it targets grid center. }, HardWare = new HardwareDef @@ -87,68 +67,20 @@ partial class Parts { ElevateRate = 0.04f, // Max traversal speed of elevation subpart in radians per tick. MinAzimuth = -180, MaxAzimuth = 180, - MinElevation = 0, MaxElevation = 90, - HomeAzimuth = 0, // Default resting rotation angle HomeElevation = 45, // Default resting elevation - InventorySize = 0, // Inventory capacity in kL. IdlePower = 0.01f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. - }, Loading = new LoadingDef { RateOfFire = 600, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. - TrajectilesPerBarrel = 0, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. - ReloadTime = 0, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - MagsToLoad = 0, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. - }, - Audio = new HardPointAudioDef - { - PreFiringSound = "", // Audio for warmup effect. - FiringSound = "", // Audio for firing. - FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state - NoAmmoSound = "", - HardPointRotationSound = "", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 10, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). - FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, }, Ammos = new[] { SpotLight, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; WeaponDefinition SmallSearchlight => new WeaponDefinition { @@ -169,7 +101,6 @@ partial class Parts { Muzzles = new[] { "spotlight", // Where your Projectiles spawn. Use numbers not Letters. IE Muzzle_01 not Muzzle_A }, - Ejector = "", // Optional; empty from which to eject "shells" if specified. Scope = "spotlight", // Where line of sight checks are performed from. Must be clear of block collision. }, Targeting = new TargetingDef @@ -181,12 +112,7 @@ partial class Parts { Thrust, Utility, Offense, Power, Production, Any, // Subsystem targeting priority: Offense, Utility, Power, Production, Thrust, Jumping, Steering, Any }, ClosestFirst = true, // Tries to pick closest targets first (blocks on grids, projectiles, etc...). - IgnoreDumbProjectiles = false, // Don't fire at non-smart projectiles. - LockedSmartOnly = false, // Only fire at smart projectiles that are locked on to parent grid. - MinimumDiameter = 0, // Minimum radius of threat to engage. - MaximumDiameter = 0, // Maximum radius of threat to engage; 0 = unlimited. MaxTargetDistance = 1500, // Maximum distance at which targets will be automatically shot at; 0 = unlimited. - MinTargetDistance = 0, // Minimum distance at which targets will be automatically shot at. TopTargets = 4, // Maximum number of targets to randomize between; 0 = unlimited. TopBlocks = 4, // Maximum number of blocks to randomize between; 0 = unlimited. ShootBlanks = true, @@ -196,17 +122,8 @@ partial class Parts { PartName = "Searchlight", // Name of the weapon in terminal, should be unique for each weapon definition that shares a SubtypeId (i.e. multiweapons). DeviateShotAngle = 0.1f, // Projectile inaccuracy in degrees. AimingTolerance = 1f, // How many degrees off target a turret can fire at. 0 - 180 firing angle. - AimLeadingPrediction = Accurate, // Level of turret aim prediction; Off, Basic, Accurate, Advanced - DelayCeaseFire = 10, // Measured in game ticks (6 = 100ms, 60 = 1 second, etc..). Length of time the weapon continues firing after trigger is released. - AddToleranceToTracking = false, // Allows turret to track to the edge of the AimingTolerance cone instead of dead centre. - CanShootSubmerged = false, // Whether the weapon can be fired underwater when using WaterMod. - Ui = new UiDef { - RateOfFire = false, // Enables terminal slider for changing rate of fire. - DamageModifier = false, // Enables terminal slider for changing damage per shot. - ToggleGuidance = false, // Enables terminal option to disable smart projectile guidance. - EnableOverload = false, // Enables terminal option to turn on Overload; this allows energy weapons to double damage per shot, at the cost of quadrupled power draw and heat gain, and 2% self damage on overheat. DisableStatus = true, // Do not display weapon status NoTarget, Reloading, NoAmmo, etc.. }, Ai = new AiDef @@ -215,9 +132,6 @@ partial class Parts { TurretAttached = true, // Whether this weapon is a turret and should have the UI and API options for such. Turrets Need this set to True. TurretController = true, // Whether this weapon can physically control the turret's movement. Turrets Need this set to True. PrimaryTracking = true, // For multiweapons: whether this weapon should designate targets for other weapons on the platform without their own tracking. - LockOnFocus = false, // If enabled, weapon will only fire at targets that have been HUD selected AND locked onto by pressing Numpad 0. - SuppressFire = false, // If enabled, weapon can only be fired manually. - OverrideLeads = false, // Disable target leading on fixed weapons, or allow it for turrets. TargetGridCenter = true, // Does not target blocks, instead it targets grid center. }, HardWare = new HardwareDef @@ -226,68 +140,20 @@ partial class Parts { ElevateRate = 0.04f, // Max traversal speed of elevation subpart in radians per tick. MinAzimuth = -180, MaxAzimuth = 180, - MinElevation = 0, MaxElevation = 90, - HomeAzimuth = 0, // Default resting rotation angle HomeElevation = 45, // Default resting elevation - InventorySize = 0, // Inventory capacity in kL. IdlePower = 0.01f, // Constant base power draw in MW. - FixedOffset = false, // Deprecated. - Offset = Vector(x: 0, y: 0, z: 0), // Offsets the aiming/firing line of the weapon, in metres. Type = BlockWeapon, // What type of weapon this is; BlockWeapon, HandWeapon, Phantom }, - Other = new OtherDef - { - ConstructPartCap = 0, // Maximum number of blocks with this weapon on a grid; 0 = unlimited. - RotateBarrelAxis = 0, // For spinning barrels, which axis to spin the barrel around; 0 = none. - EnergyPriority = 0, // Deprecated. - MuzzleCheck = false, // Whether the weapon should check LOS from each individual muzzle in addition to the scope. - Debug = false, // Force enables debug mode. - RestrictionRadius = 0, // Prevents other blocks of this type from being placed within this distance of the centre of the block. - CheckInflatedBox = false, // If true, the above distance check is performed from the edge of the block instead of the centre. - CheckForAnyWeapon = false, // If true, the check will fail if ANY weapon is present, not just weapons of the same subtype. - }, Loading = new LoadingDef { RateOfFire = 600, // Set this to 3600 for beam weapons. This is how fast your Gun fires. BarrelsPerShot = 1, // How many muzzles will fire a projectile per fire event. - TrajectilesPerBarrel = 0, // Number of projectiles per muzzle per fire event. - SkipBarrels = 0, // Number of muzzles to skip after each fire event. - ReloadTime = 0, // Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - MagsToLoad = 0, // Number of physical magazines to consume on reload. - DelayUntilFire = 0, // How long the weapon waits before shooting after being told to fire. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - HeatPerShot = 0, // Heat generated per shot. - MaxHeat = 100, // Max heat before weapon enters cooldown (70% of max heat). - Cooldown = .95f, // Percentage of max heat to be under to start firing again after overheat; accepts 0 - 0.95 - HeatSinkRate = 0, // Amount of heat lost per second. - DegradeRof = false, // Progressively lower rate of fire when over 80% heat threshold (80% of max heat). - ShotsInBurst = 0, // Use this if you don't want the weapon to fire an entire physical magazine in one go. Should not be more than your magazine capacity. - DelayAfterBurst = 0, // How long to spend "reloading" after each burst. Measured in game ticks (6 = 100ms, 60 = 1 seconds, etc..). - FireFull = false, // Whether the weapon should fire the full magazine (or the full burst instead if ShotsInBurst > 0), even if the target is lost or the player stops firing prematurely. - GiveUpAfter = false, // Whether the weapon should drop its current target and reacquire a new target after finishing its magazine or burst. - BarrelSpinRate = 0, // Visual only, 0 disables and uses RateOfFire. - DeterministicSpin = false, // Spin barrel position will always be relative to initial / starting positions (spin will not be as smooth). - SpinFree = false, // Spin barrel while not firing. - StayCharged = false, // Will start recharging whenever power cap is not full. - }, - Audio = new HardPointAudioDef - { - PreFiringSound = "", // Audio for warmup effect. - FiringSound = "", // Audio for firing. - FiringSoundPerShot = true, // Whether to replay the sound for each shot, or just loop over the entire track while firing. - ReloadSound = "", // Sound SubtypeID, for when your Weapon is in a reloading state - NoAmmoSound = "", - HardPointRotationSound = "", // Audio played when turret is moving. - BarrelRotationSound = "", - FireSoundEndDelay = 10, // How long the firing audio should keep playing after firing stops. Measured in game ticks(6 = 100ms, 60 = 1 seconds, etc..). - FireSoundNoBurst = true, // Don't stop firing sound from looping when delaying after burst. }, }, Ammos = new[] { SpotLight, // Must list all primary, shrapnel, and pattern ammos. }, - //Animations = Weapon75_Animation, - //Upgrades = UpgradeModules, }; // Don't edit below this line. diff --git a/Data/Scripts/CoreSystems/Definitions/CoreDefinitions.cs b/Data/Scripts/CoreSystems/Definitions/CoreDefinitions.cs index 4281815e..e52e8e23 100644 --- a/Data/Scripts/CoreSystems/Definitions/CoreDefinitions.cs +++ b/Data/Scripts/CoreSystems/Definitions/CoreDefinitions.cs @@ -486,6 +486,7 @@ public enum Prediction [ProtoMember(14)] internal bool CanShootSubmerged; [ProtoMember(15)] internal bool NpcSafe; [ProtoMember(16)] internal bool ScanTrackOnly; + [ProtoMember(17)] internal bool CanTargetSubmerged; [ProtoContract] public struct LoadingDef @@ -615,6 +616,9 @@ public struct OtherDef [ProtoMember(8)] internal bool CheckForAnyWeapon; [ProtoMember(9)] internal bool DisableLosCheck; [ProtoMember(10)] internal bool NoVoxelLosCheck; + [ProtoMember(11)] internal bool AllowScopeOutsideObb; + [ProtoMember(12)] internal bool ProhibitLGTargeting; + [ProtoMember(13)] internal bool ProhibitSGTargeting; } [ProtoContract] @@ -821,6 +825,9 @@ public struct AmmoParticleDef [ProtoMember(2)] internal ParticleDef Hit; [ProtoMember(3)] internal ParticleDef Eject; [ProtoMember(4)] internal ParticleDef WeaponEffect1Override; + [ProtoMember(5)] internal ParticleDef ShieldHit; + [ProtoMember(6)] internal ParticleDef VoxelHit; + [ProtoMember(7)] internal ParticleDef WaterHit; } [ProtoContract] @@ -1273,6 +1280,7 @@ public struct AmmoAudioDef [ProtoMember(7)] internal string FloatingHitSound; [ProtoMember(8)] internal string ShieldHitSound; [ProtoMember(9)] internal string ShotSound; + [ProtoMember(10)] internal string WaterHitSound; } [ProtoContract] @@ -1306,7 +1314,7 @@ internal enum GuidanceType [ProtoMember(14)] internal uint MaxTrajectoryTime; [ProtoMember(15)] internal ApproachDef[] Approaches; [ProtoMember(16)] internal double TotalAcceleration; - [ProtoMember(17)] internal OnHitDef OnHit; + [ProtoMember(17)] internal OnHitDef OnHit; //Deprecated [ProtoMember(18)] internal float DragPerSecond; [ProtoMember(19)] internal float DragMinSpeed; @@ -1338,6 +1346,7 @@ public struct SmartsDef [ProtoMember(23)] internal double MinTurnSpeed; [ProtoMember(24)] internal bool NoTargetApproach; [ProtoMember(25)] internal bool AltNavigation; + [ProtoMember(26)] internal bool IgnoreAntiSmarts; } [ProtoContract] @@ -1544,6 +1553,7 @@ public struct MinesDef [ProtoContract] public struct OnHitDef { + /* [ProtoMember(1)] internal int Duration; [ProtoMember(2)] internal int ProcInterval; [ProtoMember(3)] internal double ProcAmount; @@ -1552,6 +1562,7 @@ public struct OnHitDef [ProtoMember(6)] internal bool DieOnEnd; [ProtoMember(7)] internal bool StickOnHit; [ProtoMember(8)] internal bool AlignFragtoImpactAngle; + */ } } diff --git a/Data/Scripts/CoreSystems/Definitions/CoreSystems.cs b/Data/Scripts/CoreSystems/Definitions/CoreSystems.cs index 5826a78f..a9f49211 100644 --- a/Data/Scripts/CoreSystems/Definitions/CoreSystems.cs +++ b/Data/Scripts/CoreSystems/Definitions/CoreSystems.cs @@ -190,6 +190,8 @@ public AmmoType(AmmoDef ammoDef, MyDefinitionId ammoDefinitionId, MyDefinitionId public readonly bool TrackGrids; public readonly bool TrackCharacters; public readonly bool TrackMeteors; + public readonly bool TrackProhibitLG; + public readonly bool TrackProhibitSG; public readonly bool UniqueTargetPerWeapon; public readonly bool TrackNeutrals; public readonly bool DisableLosCheck; @@ -222,6 +224,7 @@ public AmmoType(AmmoDef ammoDef, MyDefinitionId ammoDefinitionId, MyDefinitionId public readonly bool GoHomeToReload; public readonly bool DropTargetUntilLoaded; public readonly bool NoVoxelLosCheck; + public readonly bool AllowScopeOutsideObb; public readonly double MaxTargetSpeed; public readonly double AzStep; public readonly double ElStep; @@ -301,6 +304,7 @@ public WeaponSystem(WeaponStructure structure, MyStringHash partNameIdHash, MySt GoHomeToReload = Values.HardPoint.Loading.GoHomeToReload; DropTargetUntilLoaded = Values.HardPoint.Loading.DropTargetUntilLoaded; NoVoxelLosCheck = Values.HardPoint.Other.NoVoxelLosCheck; + AllowScopeOutsideObb = Values.HardPoint.Other.AllowScopeOutsideObb; TopTargets = Values.Targeting.TopTargets; CycleTargets = Values.Targeting.CycleTargets; @@ -372,7 +376,8 @@ public WeaponSystem(WeaponStructure structure, MyStringHash partNameIdHash, MySt SubSystems(out TargetSubSystems, out OnlySubSystems); ValidTargetSize(out MinTargetRadius, out MaxTargetRadius); Session.CreateAnimationSets(Values.Animations, this, out WeaponAnimationSet, out PartEmissiveSet, out PartLinearMoveSet, out AnimationIdLookup, out PartAnimationLengths, out HeatingSubparts, out ParticleEvents, out EmissiveLookup); - + TrackProhibitLG = Values.HardPoint.Other.ProhibitLGTargeting; + TrackProhibitSG = Values.HardPoint.Other.ProhibitSGTargeting; // CheckForBadAnimations(); ApproximatePeakPower = WConst.IdlePower; @@ -779,22 +784,10 @@ internal WeaponConstants(WeaponDefinition values) if (wO.MinTargetDistance.HasValue) MinTargetDistance = Math.Max(wO.MinTargetDistance.Value, 0f); if (wO.RateOfFire.HasValue) RateOfFire = Math.Max(wO.RateOfFire.Value, 0); if (wO.ReloadTime.HasValue) ReloadTime = Math.Max(wO.ReloadTime.Value, 0); - if (wO.DeviateShotAngle.HasValue) DeviateShotAngleRads = MathHelper.ToRadians(Math.Max(wO.DeviateShotAngle.Value, 0f)); if (wO.AimingTolerance.HasValue) AimingToleranceRads = MathHelperD.ToRadians(wO.AimingTolerance.Value <= 0 ? 180 : wO.AimingTolerance.Value); - //if (wO.InventorySize.HasValue) - if (wO.HeatPerShot.HasValue) HeatPerShot = Math.Max(wO.HeatPerShot.Value, 0); - //if (wO.MaxHeat.HasValue) if (wO.HeatSinkRate.HasValue) HeatSinkRate = Math.Max(wO.HeatSinkRate.Value, 0); - //if (wO.Cooldown.HasValue) - - //if (wO.ConstructPartCap.HasValue) - //if (wO.RestrictionRadius.HasValue) - //if (wO.CheckInflatedBox.HasValue) - //if (wO.CheckForAnyWeapon.HasValue) - //if (wO.MuzzleCheck.HasValue) - if (wO.IdlePower.HasValue) IdlePower = Math.Max(wO.IdlePower.Value, 0.001f); } } diff --git a/Data/Scripts/CoreSystems/Definitions/PartAnimation.cs b/Data/Scripts/CoreSystems/Definitions/PartAnimation.cs index 193b3fcc..b390cda7 100644 --- a/Data/Scripts/CoreSystems/Definitions/PartAnimation.cs +++ b/Data/Scripts/CoreSystems/Definitions/PartAnimation.cs @@ -61,7 +61,6 @@ public struct EmissiveState internal bool Running; internal bool Triggered; internal bool CanPlay; - //internal bool Paused; internal uint StartTick; internal List PlayTicks; diff --git a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/AiValues.cs b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/AiValues.cs index 97c3dad6..17a905d8 100644 --- a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/AiValues.cs +++ b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/AiValues.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using ProtoBuf; +using ProtoBuf; namespace CoreSystems { diff --git a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/AmmoConstants.cs b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/AmmoConstants.cs index 9ce41767..8e631e7a 100644 --- a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/AmmoConstants.cs +++ b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/AmmoConstants.cs @@ -49,6 +49,7 @@ public enum Texture public readonly MySoundPair VoxelSoundPair; public readonly MySoundPair PlayerSoundPair; public readonly MySoundPair FloatingSoundPair; + public readonly MySoundPair WaterSoundPair; public readonly MyAmmoMagazineDefinition MagazineDef; public readonly ApproachConstants[] Approaches; public readonly AmmoDef[] AmmoPattern; @@ -76,7 +77,6 @@ public enum Texture public readonly Vector4 LinearSegmentColorEnd; public readonly Vector4 LinearTrailColor; public readonly string ModelPath; - public readonly string HitParticleStr; public readonly string DetParticleStr; public readonly string DetSoundStr; public readonly string ShotSoundStr; @@ -108,8 +108,6 @@ public enum Texture public readonly int FragGroupDelay; public readonly int DeformDelay; public readonly int OffsetTime; - public readonly uint OnHitProcInterval; - public readonly uint OnHitDuration; public readonly uint FakeVoxelHitTicks; public readonly bool HasApproaches; public readonly bool KeepAliveAfterTargetLoss; @@ -136,6 +134,9 @@ public enum Texture public readonly bool IsField; public readonly bool AmmoParticle; public readonly bool HitParticle; + public readonly bool ShieldHitParticle; + public readonly bool VoxelHitParticle; + public readonly bool WaterHitParticle; public readonly bool CustomDetParticle; public readonly bool FieldParticle; public readonly bool AmmoSkipAccel; @@ -161,6 +162,9 @@ public enum Texture public readonly bool AmmoParticleNoCull; public readonly bool FieldParticleNoCull; public readonly bool HitParticleNoCull; + public readonly bool ShieldHitParticleNoCull; + public readonly bool WaterHitParticleNoCull; + public readonly bool VoxelHitParticleNoCull; public readonly bool DrawLine; public readonly bool Ewar; public readonly bool NonAntiSmartEwar; @@ -230,6 +234,7 @@ public enum Texture public readonly bool PlayerSound; public readonly bool FloatingSound; public readonly bool ShieldSound; + public readonly bool WaterSound; public readonly bool IsDrone; public readonly bool IsSmart; public readonly bool AccelClearance; @@ -244,8 +249,8 @@ public enum Texture public readonly bool EwarFieldTrigger; public readonly bool ZeroEffortNav; public readonly bool ProjectilesFirst; - public readonly bool OnHit; public readonly bool OverrideWeaponEffect; + public readonly bool IgnoreAntiSmarts; public readonly float LargeGridDmgScale; public readonly float SmallGridDmgScale; public readonly float OffsetRatio; @@ -402,7 +407,7 @@ internal AmmoConstants(WeaponSystem.AmmoType ammo, WeaponDefinition wDef, Weapon ComputeSmarts(ammo, out IsSmart, out Roam, out NoTargetApproach, out AccelClearance, out OverrideTarget, out TargetOffSet, out FocusOnly, out FocusEviction, out NoSteering, out AdvancedSmartSteering, out KeepAliveAfterTargetLoss, out NoTargetExpire, out ZeroEffortNav, out ScanRange, out OffsetMinRangeSqr, - out Aggressiveness, out NavAcceleration, out MinTurnSpeedSqr, out OffsetRatio, out MaxChaseTime, out MaxTargets, out OffsetTime); + out Aggressiveness, out NavAcceleration, out MinTurnSpeedSqr, out OffsetRatio, out MaxChaseTime, out MaxTargets, out OffsetTime, out IgnoreAntiSmarts); IsGuided = TravelTo || IsMine || IsDrone || IsSmart; @@ -411,11 +416,17 @@ internal AmmoConstants(WeaponSystem.AmmoType ammo, WeaponDefinition wDef, Weapon AmmoParticleNoCull = ammo.AmmoDef.AmmoGraphics.Particles.Ammo.DisableCameraCulling; HitParticleNoCull = ammo.AmmoDef.AmmoGraphics.Particles.Hit.DisableCameraCulling; + ShieldHitParticleNoCull = ammo.AmmoDef.AmmoGraphics.Particles.ShieldHit.DisableCameraCulling; + VoxelHitParticleNoCull = ammo.AmmoDef.AmmoGraphics.Particles.VoxelHit.DisableCameraCulling; + WaterHitParticleNoCull = ammo.AmmoDef.AmmoGraphics.Particles.WaterHit.DisableCameraCulling; FieldParticleNoCull = ammo.AmmoDef.Ewar.Field.Particle.DisableCameraCulling; AmmoParticle = !string.IsNullOrEmpty(ammo.AmmoDef.AmmoGraphics.Particles.Ammo.Name); HitParticle = !string.IsNullOrEmpty(ammo.AmmoDef.AmmoGraphics.Particles.Hit.Name); - HitParticleStr = ammo.AmmoDef.AmmoGraphics.Particles.Hit.Name; + ShieldHitParticle = !string.IsNullOrEmpty(ammo.AmmoDef.AmmoGraphics.Particles.ShieldHit.Name); + VoxelHitParticle = !string.IsNullOrEmpty(ammo.AmmoDef.AmmoGraphics.Particles.VoxelHit.Name); + WaterHitParticle = !string.IsNullOrEmpty(ammo.AmmoDef.AmmoGraphics.Particles.WaterHit.Name); + EndOfLifeAv = !ammo.AmmoDef.AreaOfDamage.EndOfLife.NoVisuals && ammo.AmmoDef.AreaOfDamage.EndOfLife.Enable; OverrideWeaponEffect = !string.IsNullOrEmpty(ammo.AmmoDef.AmmoGraphics.Particles.WeaponEffect1Override.Name); @@ -493,12 +504,12 @@ internal AmmoConstants(WeaponSystem.AmmoType ammo, WeaponDefinition wDef, Weapon Energy(ammo, system, wDef, out EnergyAmmo, out MustCharge, out Reloadable, out EnergyCost, out EnergyMagSize, out ChargSize, out BurstMode, out HasShotReloadDelay, out PowerPerTick); Sound(ammo, system,out HitSound, out HitSoundPair, out AmmoTravelSound, out TravelSoundPair, out ShotSound, out ShotSoundPair, out DetonationSound, out DetSoundPair, out HitSoundDistSqr, out AmmoTravelSoundDistSqr, out AmmoSoundMaxDistSqr, - out ShotSoundDistSqr, out DetonationSoundDistSqr, out ShotSoundStr, out VoxelSound, out VoxelSoundPair, out FloatingSound, out FloatingSoundPair, out PlayerSound, out PlayerSoundPair, out ShieldSound, out ShieldSoundPair); + out ShotSoundDistSqr, out DetonationSoundDistSqr, out ShotSoundStr, out VoxelSound, out VoxelSoundPair, out FloatingSound, out FloatingSoundPair, out PlayerSound, out PlayerSoundPair, out ShieldSound, out ShieldSoundPair, out WaterSound, out WaterSoundPair); MagazineSize = EnergyAmmo ? EnergyMagSize : MagazineDef.Capacity; - if (EnergyAmmo && MagazineSize == 0) - Log.Line($"{ammo.AmmoDef.AmmoRound} has a magazine capacity of zero, Girax error detected! Check your magazine sbc entry for a tag"); + if (EnergyAmmo && MagazineSize == 0 && ammo.AmmoDef.HardPointUsable) + Log.Line($"{ammo.AmmoDef.AmmoRound} has a magazine capacity of zero, Girax error detected! Check your magazine sbc entry for a tag or ammo for EnergyMagazineSize"); MagsToLoad = wDef.HardPoint.Loading.MagsToLoad > 0 ? wDef.HardPoint.Loading.MagsToLoad : 1; MaxAmmo = MagsToLoad * MagazineSize; @@ -552,9 +563,6 @@ internal AmmoConstants(WeaponSystem.AmmoType ammo, WeaponDefinition wDef, Weapon ProjectilesFirst = system.ProjectilesFirst; PreComputedMath = new PreComputedMath(ammo, this); - - OnHit = false; - OnHitProcInterval = 0; } internal void Purge() @@ -591,7 +599,7 @@ internal void Purge() private void ComputeSmarts(WeaponSystem.AmmoType ammo, out bool isSmart, out bool roam, out bool noTargetApproach, out bool accelClearance, out bool overrideTarget, out bool targetOffSet, out bool focusOnly, out bool focusEviction, out bool noSteering, out bool advancedSmartSteering, out bool keepAliveAfterTargetLoss, out bool noTargetExpire, out bool zeroEffortNav, out double scanRange, out double offsetMinRangeSqr, - out double aggressiveness, out double navAcceleration, out double minTurnSpeedSqr, out float offsetRatio, out int maxChaseTime, out int maxTargets, out int offsetTime) + out double aggressiveness, out double navAcceleration, out double minTurnSpeedSqr, out float offsetRatio, out int maxChaseTime, out int maxTargets, out int offsetTime, out bool ignoreAntiSmarts) { isSmart = ammo.AmmoDef.Trajectory.Guidance == TrajectoryDef.GuidanceType.Smart || ammo.AmmoDef.Trajectory.Guidance == TrajectoryDef.GuidanceType.DetectSmart; @@ -626,6 +634,7 @@ private void ComputeSmarts(WeaponSystem.AmmoType ammo, out bool isSmart, out boo offsetTime = ammo.AmmoDef.Trajectory.Smarts.OffsetTime; noTargetApproach = ammo.AmmoDef.Trajectory.Smarts.NoTargetApproach; zeroEffortNav = ammo.AmmoDef.Trajectory.Smarts.AltNavigation; + ignoreAntiSmarts = ammo.AmmoDef.Trajectory.Smarts.IgnoreAntiSmarts; } @@ -1094,7 +1103,8 @@ private void Energy(WeaponSystem.AmmoType ammoPair, WeaponSystem system, WeaponD private void Sound(WeaponSystem.AmmoType ammo, WeaponSystem system, out bool hitSound, out MySoundPair hitSoundPair, out bool ammoTravelSound, out MySoundPair travelSoundPair, out bool shotSound, out MySoundPair shotSoundPair, out bool detSound, out MySoundPair detSoundPair, out float hitSoundDistSqr, out float ammoTravelSoundDistSqr, out float ammoSoundMaxDistSqr, out float shotSoundDistSqr, out float detSoundDistSqr, out string rawShotSoundStr, - out bool voxelSound, out MySoundPair voxelSoundPair, out bool floatingSound, out MySoundPair floatingSoundPair, out bool playerSound, out MySoundPair playerSoundPair, out bool shieldSound, out MySoundPair shieldSoundPair) + out bool voxelSound, out MySoundPair voxelSoundPair, out bool floatingSound, out MySoundPair floatingSoundPair, out bool playerSound, out MySoundPair playerSoundPair, out bool shieldSound, out MySoundPair shieldSoundPair, + out bool waterSound, out MySoundPair waterSoundPair) { var ammoDef = ammo.AmmoDef; var weaponShotSound = !string.IsNullOrEmpty(system.Values.HardPoint.Audio.FiringSound); @@ -1138,19 +1148,19 @@ private void Sound(WeaponSystem.AmmoType ammo, WeaponSystem system, out bool hit if (ob != null) hitSoundDistSqr = ob.MaxDistance * ob.MaxDistance; if (hitSoundDistSqr > ammoSoundMaxDistSqr) ammoSoundMaxDistSqr = hitSoundDistSqr; } - else if (ammoTravelSound && (id == travelSoundStr || id == ammoDef.AmmoAudio.TravelSound)) + if (ammoTravelSound && (id == travelSoundStr || id == ammoDef.AmmoAudio.TravelSound)) { var ob = def.GetObjectBuilder() as MyObjectBuilder_AudioDefinition; if (ob != null) ammoTravelSoundDistSqr = ob.MaxDistance * ob.MaxDistance; if (ammoTravelSoundDistSqr > ammoSoundMaxDistSqr) ammoSoundMaxDistSqr = ammoTravelSoundDistSqr; } - else if (shotSound && (id == shotSoundStr || id == rawShotSoundStr)) + if (shotSound && (id == shotSoundStr || id == rawShotSoundStr)) { var ob = def.GetObjectBuilder() as MyObjectBuilder_AudioDefinition; if (ob != null) shotSoundDistSqr = ob.MaxDistance * ob.MaxDistance; if (shotSoundDistSqr > ammoSoundMaxDistSqr) ammoSoundMaxDistSqr = shotSoundDistSqr; } - else if (detSound && (id == detSoundStr || id == DetSoundStr)) + if (detSound && (id == detSoundStr || id == DetSoundStr)) { var ob = def.GetObjectBuilder() as MyObjectBuilder_AudioDefinition; if (ob != null) detSoundDistSqr = ob.MaxDistance * ob.MaxDistance; @@ -1169,6 +1179,9 @@ private void Sound(WeaponSystem.AmmoType ammo, WeaponSystem system, out bool hit shieldSound = !string.IsNullOrEmpty(ammoDef.AmmoAudio.ShieldHitSound); shieldSoundPair = shieldSound ? new MySoundPair(ammoDef.AmmoAudio.ShieldHitSound, false) : hitSound ? new MySoundPair(ammoDef.AmmoAudio.HitSound, false) : null; + + waterSound = !string.IsNullOrEmpty(ammoDef.AmmoAudio.WaterHitSound); + waterSoundPair = waterSound ? new MySoundPair(ammoDef.AmmoAudio.WaterHitSound, false) : null; } private MyEntity PrimeEntityActivator() @@ -1244,34 +1257,6 @@ private void LoadModifiers(AmmoDef ammoDef, out AmmoOverride overrides, out bool } - //private void GetModifiableValues(AmmoDef ammoDef, out float baseDamage, out float health, out float gravityMultiplier, out float maxTrajectory, out float maxTrajectorySqr, out bool energyBaseDmg, out bool energyAreaDmg, out bool energyDetDmg, out bool energyShieldDmg, out double shieldModifier, out float fallOffDistance, out float fallOffMinMult, out float mass, out float shieldBypassRaw) - //{ - // baseDamage = AmmoModsFound && _modifierMap[BaseDmgStr].HasData() ? _modifierMap[BaseDmgStr].GetAsFloat : ammoDef.BaseDamage; - - // if (baseDamage < 0.000001) - // baseDamage = 0.000001f; - - // health = AmmoModsFound && _modifierMap[HealthStr].HasData() ? _modifierMap[HealthStr].GetAsFloat : ammoDef.Health; - // gravityMultiplier = AmmoModsFound && _modifierMap[GravityStr].HasData() ? _modifierMap[GravityStr].GetAsFloat : ammoDef.Trajectory.GravityMultiplier; - // maxTrajectory = AmmoModsFound && _modifierMap[MaxTrajStr].HasData() ? _modifierMap[MaxTrajStr].GetAsFloat : ammoDef.Trajectory.MaxTrajectory; - // maxTrajectorySqr = maxTrajectory * maxTrajectory; - // energyBaseDmg = AmmoModsFound && _modifierMap[EnergyBaseDmgStr].HasData() ? _modifierMap[EnergyBaseDmgStr].GetAsBool : ammoDef.DamageScales.DamageType.Base != DamageTypes.Damage.Kinetic; - // energyAreaDmg = AmmoModsFound && _modifierMap[EnergyAreaDmgStr].HasData() ? _modifierMap[EnergyAreaDmgStr].GetAsBool : ammoDef.DamageScales.DamageType.AreaEffect != DamageTypes.Damage.Kinetic; - // energyDetDmg = AmmoModsFound && _modifierMap[EnergyDetDmgStr].HasData() ? _modifierMap[EnergyDetDmgStr].GetAsBool : ammoDef.DamageScales.DamageType.Detonation != DamageTypes.Damage.Kinetic; - // energyShieldDmg = AmmoModsFound && _modifierMap[EnergyShieldDmgStr].HasData() ? _modifierMap[EnergyShieldDmgStr].GetAsBool : ammoDef.DamageScales.DamageType.Shield != DamageTypes.Damage.Kinetic; - - // var givenShieldModifier = AmmoModsFound && _modifierMap[ShieldModStr].HasData() ? _modifierMap[ShieldModStr].GetAsDouble : ammoDef.DamageScales.Shields.Modifier; - // shieldModifier = givenShieldModifier < 0 ? 1 : givenShieldModifier; - - // fallOffDistance = AmmoModsFound && _modifierMap[FallOffDistanceStr].HasData() ? _modifierMap[FallOffDistanceStr].GetAsFloat : ammoDef.DamageScales.FallOff.Distance; - // fallOffMinMult = AmmoModsFound && _modifierMap[FallOffMinMultStr].HasData() ? _modifierMap[FallOffMinMultStr].GetAsFloat : ammoDef.DamageScales.FallOff.MinMultipler; - - // mass = AmmoModsFound && _modifierMap[MassStr].HasData() ? _modifierMap[MassStr].GetAsFloat : ammoDef.Mass; - - // shieldBypassRaw = AmmoModsFound && _modifierMap[ShieldBypassStr].HasData() ? _modifierMap[ShieldBypassStr].GetAsFloat : ammoDef.DamageScales.Shields.BypassModifier; - //} - - private int mexLogLevel = 0; private void GetPeakDps(WeaponSystem.AmmoType ammoDef, WeaponSystem system, WeaponDefinition wDef, out float peakDps, out float effectiveDps, out float dpsWoInaccuracy, out float shotsPerSec, out float realShotsPerSec, out float baseDps, out float areaDps, out float detDps, out float realShotsPerMin) { diff --git a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/ConstructValues.cs b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/ConstructValues.cs index 7c94db5d..17d56e20 100644 --- a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/ConstructValues.cs +++ b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/ConstructValues.cs @@ -6,7 +6,6 @@ namespace CoreSystems [ProtoContract] public class ConstructDataValues { - //[ProtoMember(1)] public int Version = Session.VersionControl; [ProtoMember(2)] public FocusData FocusData; public bool Sync(Constructs construct, ConstructDataValues sync, bool localCall = false) diff --git a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Control/ProtoControl.cs b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Control/ProtoControl.cs index 17dcccf4..d9243301 100644 --- a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Control/ProtoControl.cs +++ b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Control/ProtoControl.cs @@ -1,11 +1,8 @@ using CoreSystems.Platform; using CoreSystems.Support; using ProtoBuf; -using Sandbox.ModAPI; -using System; using System.ComponentModel; using static CoreSystems.Support.CoreComponent; -using static CoreSystems.Support.WeaponDefinition.TargetingDef; namespace CoreSystems { diff --git a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/CoreSettings.cs b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/CoreSettings.cs index 58fa3e15..b7bbac47 100644 --- a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/CoreSettings.cs +++ b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/CoreSettings.cs @@ -211,6 +211,8 @@ public class ArmorOverride [ProtoMember(22)] public Overrides DefinitionOverrides; [ProtoMember(23)] public float LargeGridDamageMultiplier = 1; [ProtoMember(24)] public float SmallGridDamageMultiplier = 1; + [ProtoMember(25)] public bool ProhibitHUDPainter = false; + } [ProtoContract] diff --git a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Misc.cs b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Misc.cs index b7e817ac..010108ad 100644 --- a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Misc.cs +++ b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Misc.cs @@ -1,9 +1,7 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using CoreSystems.Platform; using CoreSystems.Support; using ProtoBuf; -using static VRage.Game.ObjectBuilders.Definitions.MyObjectBuilder_GameDefinition; namespace CoreSystems { @@ -63,9 +61,6 @@ internal class PlayerMouseData [ProtoContract] public class WeaponRandomGenerator { - //[ProtoMember(1)] public int TurretCurrentCounter; - //[ProtoMember(2)] public int ClientProjectileCurrentCounter; - //[ProtoMember(3)] public int AcquireCurrentCounter; [ProtoMember(4)] public int CurrentSeed; public XorShiftRandomStruct TurretRandom; public XorShiftRandomStruct AcquireRandom; diff --git a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/PacketTypes.cs b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/PacketTypes.cs index 68461593..1bb080ef 100644 --- a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/PacketTypes.cs +++ b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/PacketTypes.cs @@ -1,8 +1,6 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel; using CoreSystems.Settings; -using CoreSystems.Support; using ProtoBuf; using VRageMath; using static CoreSystems.Support.CoreComponent; @@ -106,7 +104,7 @@ public enum PacketType [ProtoInclude(40, typeof(ControlStatePacket))] [ProtoInclude(41, typeof(BlackListPacket))] [ProtoInclude(42, typeof(DronePacket))] - [ProtoInclude(43, typeof(HandWeaponDebugPacket))] + //[ProtoInclude(43, typeof(HandWeaponDebugPacket))] [ProtoInclude(44, typeof(PingPacket))] [ProtoInclude(45, typeof(ProjectileSyncTargetPacket))] @@ -155,22 +153,6 @@ public override void CleanUp() } } - [ProtoContract] - public class HandWeaponDebugPacket : Packet - { - [ProtoMember(1)] internal uint LastHitTick = uint.MaxValue; - [ProtoMember(2)] internal uint LastShootTick = uint.MaxValue; - [ProtoMember(3)] internal Vector3D ShootStart; - [ProtoMember(4)] internal Vector3D ShootEnd; - [ProtoMember(5)] internal Vector3D HitStart; - [ProtoMember(6)] internal Vector3D HitEnd; - - public override void CleanUp() - { - base.CleanUp(); - } - } - [ProtoContract] public class ProjectileSyncPositionPacket : Packet { diff --git a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Upgrade/ProtoUpgrade.cs b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Upgrade/ProtoUpgrade.cs index 0ac7037a..627141bf 100644 --- a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Upgrade/ProtoUpgrade.cs +++ b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Upgrade/ProtoUpgrade.cs @@ -1,7 +1,6 @@ using System; using System.ComponentModel; using CoreSystems.Platform; -using CoreSystems.Support; using ProtoBuf; using static CoreSystems.Support.WeaponDefinition.TargetingDef; using static CoreSystems.Support.CoreComponent; diff --git a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Weapon/ProtoWeapon.cs b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Weapon/ProtoWeapon.cs index 1cf29cbe..5bd3015f 100644 --- a/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Weapon/ProtoWeapon.cs +++ b/Data/Scripts/CoreSystems/Definitions/SerializedConfigs/Weapon/ProtoWeapon.cs @@ -597,6 +597,7 @@ public enum MoveModes Moving, Mobile, Moored, + ShipAny } public enum ControlModes diff --git a/Data/Scripts/CoreSystems/EntityComp/Controls/Control/ControlActions.cs b/Data/Scripts/CoreSystems/EntityComp/Controls/Control/ControlActions.cs index a655ac6f..a6d50366 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Controls/Control/ControlActions.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Controls/Control/ControlActions.cs @@ -1,10 +1,7 @@ -using System; -using System.Text; +using System.Text; using CoreSystems.Platform; using CoreSystems.Support; using Sandbox.ModAPI; -using VRageMath; -using static CoreSystems.Support.CoreComponent.Trigger; namespace CoreSystems.Control { @@ -47,16 +44,6 @@ internal static void TerminActionCycleShootModeControl(IMyTerminalBlock blk) ControlSys.ControlComponent.RequestSetValue(comp, "ShootMode", value, Session.I.PlayerId); } - internal static void ShootModeWriterControl(IMyTerminalBlock blk, StringBuilder sb) - { - var comp = blk.Components.Get() as ControlSys.ControlComponent; - if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; - - var altAiControlName = !comp.HasAim && comp.Data.Repo.Values.Set.Overrides.ShootMode == Weapon.ShootManager.ShootModes.AiShoot ? InActive : comp.Data.Repo.Values.Set.Overrides.ShootMode.ToString(); - sb.Append(altAiControlName); - } - - internal static void TerminalActionMovementModeControl(IMyTerminalBlock blk) { @@ -65,7 +52,7 @@ internal static void TerminalActionMovementModeControl(IMyTerminalBlock blk) return; var numValue = (int)comp.Data.Repo.Values.Set.Overrides.MoveMode; - var value = numValue + 1 <= 3 ? numValue + 1 : 0; + var value = numValue + 1 <= 4 ? numValue + 1 : 0; ControlSys.ControlComponent.RequestSetValue(comp, "MovementModes", value, Session.I.PlayerId); } @@ -301,6 +288,14 @@ internal static void TerminalActionToggleSmallGridControl(IMyTerminalBlock blk) #endregion #region Writters + internal static void ShootModeWriterControl(IMyTerminalBlock blk, StringBuilder sb) + { + var comp = blk.Components.Get() as ControlSys.ControlComponent; + if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; + + var altAiControlName = !comp.HasAim && comp.Data.Repo.Values.Set.Overrides.ShootMode == Weapon.ShootManager.ShootModes.AiShoot ? Localization.GetText("ControlsInactive") : Localization.GetText("Shoot" + comp.Data.Repo.Values.Set.Overrides.ShootMode); + sb.Append(altAiControlName); + } internal static void ShareFireControlWriterControl(IMyTerminalBlock blk, StringBuilder sb) { @@ -439,7 +434,7 @@ internal static void ControlStateWriterControl(IMyTerminalBlock blk, StringBuild { var comp = blk.Components.Get() as ControlSys.ControlComponent; if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; - sb.Append(comp.Data.Repo.Values.Set.Overrides.Control); + sb.Append(Localization.GetText("Control" + comp.Data.Repo.Values.Set.Overrides.Control)); } internal static void MovementModeWriterControl(IMyTerminalBlock blk, StringBuilder sb) @@ -447,7 +442,7 @@ internal static void MovementModeWriterControl(IMyTerminalBlock blk, StringBuild var comp = blk.Components.Get() as ControlSys.ControlComponent; if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; - sb.Append(comp.Data.Repo.Values.Set.Overrides.MoveMode); + sb.Append(Localization.GetText("Move" + comp.Data.Repo.Values.Set.Overrides.MoveMode)); } internal static void SubSystemWriterControl(IMyTerminalBlock blk, StringBuilder sb) @@ -455,7 +450,7 @@ internal static void SubSystemWriterControl(IMyTerminalBlock blk, StringBuilder var comp = blk.Components.Get() as ControlSys.ControlComponent; if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; - sb.Append(comp.Data.Repo.Values.Set.Overrides.SubSystem); + sb.Append(Localization.GetText("Subtype" + comp.Data.Repo.Values.Set.Overrides.SubSystem)); } internal static void RepelWriterControl(IMyTerminalBlock blk, StringBuilder sb) diff --git a/Data/Scripts/CoreSystems/EntityComp/Controls/Control/ControlUi.cs b/Data/Scripts/CoreSystems/EntityComp/Controls/Control/ControlUi.cs index 8e98baea..fe404444 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Controls/Control/ControlUi.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Controls/Control/ControlUi.cs @@ -4,11 +4,9 @@ using CoreSystems.Support; using Sandbox.Game.Entities; using Sandbox.ModAPI; -using VRage.Game; using VRage.Game.Entity; using VRage.ModAPI; using VRage.Utils; -using VRageMath; namespace CoreSystems { diff --git a/Data/Scripts/CoreSystems/EntityComp/Controls/CreateCustomActions.cs b/Data/Scripts/CoreSystems/EntityComp/Controls/CreateCustomActions.cs index 9a1a4682..40863467 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Controls/CreateCustomActions.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Controls/CreateCustomActions.cs @@ -374,10 +374,10 @@ public static void CreateLargeGrid(Session session) { var action = MyAPIGateway.TerminalControls.CreateAction("LargeGrid"); action.Icon = @"Textures\GUI\Icons\Actions\Toggle.dds"; - action.Name = new StringBuilder("Target Large Grids"); + action.Name = new StringBuilder(Localization.GetText("ActionTargetLargeGrids")); action.Action = CustomActions.TerminalActionToggleLargeGrid; action.Writer = CustomActions.LargeGridWriter; - action.Enabled = TerminalHelpers.HasTracking; + action.Enabled = TerminalHelpers.HasTrackingNoSizeProhibition; action.ValidForGroups = true; MyAPIGateway.TerminalControls.AddAction(action); @@ -388,10 +388,10 @@ public static void CreateSmallGrid(Session session) { var action = MyAPIGateway.TerminalControls.CreateAction("SmallGrid"); action.Icon = @"Textures\GUI\Icons\Actions\Toggle.dds"; - action.Name = new StringBuilder("Target Small Grids"); + action.Name = new StringBuilder(Localization.GetText("ActionTargetSmallGrids")); action.Action = CustomActions.TerminalActionToggleSmallGrid; action.Writer = CustomActions.SmallGridWriter; - action.Enabled = TerminalHelpers.HasTracking; + action.Enabled = TerminalHelpers.HasTrackingNoSizeProhibition; action.ValidForGroups = true; MyAPIGateway.TerminalControls.AddAction(action); @@ -401,7 +401,7 @@ public static void CreateAngularTracking(Session session) { var action = MyAPIGateway.TerminalControls.CreateAction("AngularTracking"); action.Icon = @"Textures\GUI\Icons\Actions\Toggle.dds"; - action.Name = new StringBuilder("Predict Targets Angular Motion"); + action.Name = new StringBuilder(Localization.GetText("TrackAngular")); action.Action = CustomActions.TerminalActionToggleAngularTracking; action.Writer = CustomActions.AngularTrackingWriter; action.Enabled = TerminalHelpers.HasTracking; @@ -415,7 +415,7 @@ internal static void CreateObjectiveMode(Session session) { var action = MyAPIGateway.TerminalControls.CreateAction("ObjectiveMode"); action.Icon = @"Textures\GUI\Icons\Actions\Toggle.dds"; - action.Name = new StringBuilder("Cycle Objective Mode");//Need localization input + action.Name = new StringBuilder(Localization.GetText("ActionCycleObjective")); action.Action = CustomActions.TerminActionCycleObjectiveMode; action.Writer = CustomActions.ObjectiveModeWriter; action.Enabled = TerminalHelpers.HasTracking; @@ -433,7 +433,7 @@ public static void CreateFocusTargets(Session session) action.Name = new StringBuilder(Localization.GetText("ActionFocusTargets")); action.Action = CustomActions.TerminalActionToggleFocusTargets; action.Writer = CustomActions.FocusTargetsWriter; - action.Enabled = TerminalHelpers.HasTracking; + action.Enabled = TerminalHelpers.HasTrackingExceptCommSlave; action.ValidForGroups = true; MyAPIGateway.TerminalControls.AddAction(action); @@ -504,6 +504,31 @@ public static void CreateMinSize(Session session) session.CustomActions.Add(action1); } + public static void CreateMaxRange(Session session) + { + var action0 = MyAPIGateway.TerminalControls.CreateAction("MaxRange Increase"); + action0.Icon = @"Textures\GUI\Icons\Actions\Increase.dds"; + action0.Name = new StringBuilder(Localization.GetText("ActionMaxRangeIncrease")); + action0.Action = CustomActions.TerminalActionMaxRangeIncrease; + action0.Writer = CustomActions.MaxRangeWriter; + action0.Enabled = TerminalHelpers.HasTracking; + action0.ValidForGroups = true; + + MyAPIGateway.TerminalControls.AddAction(action0); + session.CustomActions.Add(action0); + + var action1 = MyAPIGateway.TerminalControls.CreateAction("MaxRange Decrease"); + action1.Icon = @"Textures\GUI\Icons\Actions\Decrease.dds"; + action1.Name = new StringBuilder(Localization.GetText("ActionMaxRangeDecrease")); + action1.Action = CustomActions.TerminalActionMaxRangeDecrease; + action1.Writer = CustomActions.MaxRangeWriter; + action1.Enabled = TerminalHelpers.HasTracking; + action1.ValidForGroups = true; + + MyAPIGateway.TerminalControls.AddAction(action1); + session.CustomActions.Add(action1); + } + public static void CreateMovementState(Session session) { var action = MyAPIGateway.TerminalControls.CreateAction("TrackingMode"); @@ -609,43 +634,6 @@ public static void CreateDecoy(Session session) session.CustomActions.Add(action); } - internal static void CreateOnOffActionSet(Session session, IMyTerminalControlOnOffSwitch tc, string name, Func enabler, bool group = false) - { - var action0 = MyAPIGateway.TerminalControls.CreateAction($"WC_{name}_Toggle"); - action0.Icon = @"Textures\GUI\Icons\Actions\Toggle.dds"; - action0.Name = new StringBuilder(Localization.GetTextWithoutFallback($"{name} Toggle On/Off")); - action0.Action = b => tc.Setter(b, !tc.Getter(b)); - action0.Writer = (b, t) => t.Append(tc.Getter(b) ? tc.OnText : tc.OffText); - action0.Enabled = enabler; - action0.ValidForGroups = group; - - MyAPIGateway.TerminalControls.AddAction(action0); - session.CustomActions.Add(action0); - - var action1 = MyAPIGateway.TerminalControls.CreateAction($"WC_{name}_Toggle_On"); - action1.Icon = @"Textures\GUI\Icons\Actions\SwitchOn.dds"; - action1.Name = new StringBuilder(Localization.GetTextWithoutFallback($"{name} On")); - action1.Action = b => tc.Setter(b, true); - action1.Writer = (b, t) => t.Append(tc.Getter(b) ? tc.OnText : tc.OffText); - action1.Enabled = enabler; - action1.ValidForGroups = group; - - MyAPIGateway.TerminalControls.AddAction(action1); - session.CustomActions.Add(action1); - - var action2 = MyAPIGateway.TerminalControls.CreateAction($"WC_{name}_Toggle_Off"); - action2.Icon = @"Textures\GUI\Icons\Actions\SwitchOff.dds"; - action2.Name = new StringBuilder(Localization.GetTextWithoutFallback($"{name} Off")); - action2.Action = b => tc.Setter(b, true); - action2.Writer = (b, t) => t.Append(tc.Getter(b) ? tc.OnText : tc.OffText); - action2.Enabled = enabler; - action2.ValidForGroups = group; - - MyAPIGateway.TerminalControls.AddAction(action2); - session.CustomActions.Add(action2); - - } - internal static void CreateOnOffActionSet(Session session, IMyTerminalControlCheckbox tc, string name, Func enabler, bool group = false) { var action0 = MyAPIGateway.TerminalControls.CreateAction($"WC_{name}_Toggle"); diff --git a/Data/Scripts/CoreSystems/EntityComp/Controls/TerminalHelpers.cs b/Data/Scripts/CoreSystems/EntityComp/Controls/TerminalHelpers.cs index 1b5e294a..0c4a2dae 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Controls/TerminalHelpers.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Controls/TerminalHelpers.cs @@ -6,10 +6,8 @@ using Sandbox.ModAPI; using Sandbox.ModAPI.Interfaces.Terminal; using SpaceEngineers.Game.ModAPI; -using VRage.Game.Entity; using VRage.ModAPI; using VRage.Utils; -using VRageMath; namespace CoreSystems.Control { @@ -17,15 +15,9 @@ public static class TerminalHelpers { internal static void AddUiControls(Session session) where T : IMyTerminalBlock { - - //AddComboboxNoAction(session, "Shoot Mode", Localization.GetText("TerminalShootModeTitle"), Localization.GetText("TerminalShootModeTooltip"), BlockUi.GetShootModes, BlockUi.RequestShootModes, BlockUi.ListShootModesNoBurst, Istrue); AddComboboxNoAction(session, "Shoot Mode", Localization.GetText("TerminalShootModeTitle"), Localization.GetText("TerminalShootModeTooltip"), BlockUi.GetShootModes, BlockUi.RequestShootModes, BlockUi.ListShootModes, IsNotBomb); - AddSliderRof(session, "Weapon ROF", Localization.GetText("TerminalWeaponROFTitle"), Localization.GetText("TerminalWeaponROFTooltip"), BlockUi.GetRof, BlockUi.RequestSetRof, UiRofSlider, BlockUi.GetMinRof, BlockUi.GetMaxRof); - AddCheckbox(session, "Overload", Localization.GetText("TerminalOverloadTitle"), Localization.GetText("TerminalOverloadTooltip"), BlockUi.GetOverload, BlockUi.RequestSetOverload, true, UiOverLoad); - - AddWeaponCrticalTimeSliderRange(session, "Detonation", Localization.GetText("TerminalDetonationTitle"), Localization.GetText("TerminalDetonationTooltip"), BlockUi.GetArmedTimer, BlockUi.RequestSetArmedTimer, NotCounting, CanBeArmed, BlockUi.GetMinCriticalTime, BlockUi.GetMaxCriticalTime, true); AddButtonNoAction(session, "StartCount", Localization.GetText("TerminalStartCountTitle"), Localization.GetText("TerminalStartCountTooltip"), BlockUi.StartCountDown, NotCounting, CanBeArmed); AddButtonNoAction(session, "StopCount", Localization.GetText("TerminalStopCountTitle"), Localization.GetText("TerminalStopCountTooltip"), BlockUi.StopCountDown, IsCounting, CanBeArmed); @@ -37,48 +29,30 @@ internal static void AddUiControls(Session session) where T : IMyTerminalBloc internal static void AddTurretOrTrackingControls(Session session) where T : IMyTerminalBlock { AddComboboxNoAction(session, "ControlModes", Localization.GetText("TerminalControlModesTitle"), Localization.GetText("TerminalControlModesTooltip"), BlockUi.GetControlMode, BlockUi.RequestControlMode, BlockUi.ListControlModes, TurretOrGuidedAmmo); - - AddComboboxNoAction(session, "ObjectiveMode", "Objective Mode", "Select when to cease firing at a block", BlockUi.GetObjectiveMode, BlockUi.RequestObjectiveMode, BlockUi.ListObjectiveModes, HasTracking); - - AddComboboxNoAction(session, "PickAmmo", Localization.GetText("TerminalPickAmmoTitle"), Localization.GetText("TerminalPickAmmoTooltip"), BlockUi.GetAmmos, BlockUi.RequestSetAmmo, BlockUi.ListAmmos, AmmoSelection); - - AddComboboxNoAction(session, "PickSubSystem", Localization.GetText("TerminalPickSubSystemTitle"), Localization.GetText("TerminalPickSubSystemTooltip"), BlockUi.GetSubSystem, BlockUi.RequestSubSystem, BlockUi.ListSubSystems, HasTracking); - + AddComboboxNoAction(session, "ObjectiveMode", Localization.GetText("TerminalObjectiveTitle"), Localization.GetText("TerminalObjectiveTooltip"), BlockUi.GetObjectiveMode, BlockUi.RequestObjectiveMode, BlockUi.ListObjectiveModes, HasTracking); AddComboboxNoAction(session, "TrackingMode", Localization.GetText("TerminalTrackingModeTitle"), Localization.GetText("TerminalTrackingModeTooltip"), BlockUi.GetMovementMode, BlockUi.RequestMovementMode, BlockUi.ListMovementModes, HasTracking); - + AddComboboxNoAction(session, "PickAmmo", Localization.GetText("TerminalPickAmmoTitle"), Localization.GetText("TerminalPickAmmoTooltip"), BlockUi.GetAmmos, BlockUi.RequestSetAmmo, BlockUi.ListAmmos, AmmoSelection); + AddButtonNoAction(session, "ForceReload", Localization.GetText("ForceReload"), Localization.GetText("TerminalForceReloadTooltip"), BlockUi.ForceReload, EnableForceReload, AmmoSelection); AddWeaponRangeSliderNoAction(session, "Weapon Range", Localization.GetText("TerminalWeaponRangeTitle"), Localization.GetText("TerminalWeaponRangeTooltip"), BlockUi.GetRange, BlockUi.RequestSetRange, BlockUi.ShowRange, BlockUi.GetMinRange, BlockUi.GetMaxRange, true, false); Separator(session, "WC_sep2", HasTracking); - AddOnOffSwitchNoAction(session, "ReportTarget", Localization.GetText("TerminalReportTargetTitle"), Localization.GetText("TerminalReportTargetTooltip"), BlockUi.GetReportTarget, BlockUi.RequestSetReportTarget, true, UiReportTarget); + AddOnOffSwitchNoAction(session, "SubSystems", Localization.GetText("TerminalSubSystemsTitle"), Localization.GetText("TerminalSubSystemsTooltip"), BlockUi.GetSubSystems, BlockUi.RequestSetSubSystems, true, HasTracking); + AddComboboxNoAction(session, "PickSubSystem", Localization.GetText("TerminalPickSubSystemTitle"), Localization.GetText("TerminalPickSubSystemTooltip"), BlockUi.GetSubSystem, BlockUi.RequestSubSystem, BlockUi.ListSubSystems, HasTracking); - AddOnOffSwitchNoAction(session, "Neutrals", Localization.GetText("TerminalNeutralsTitle"), Localization.GetText("TerminalNeutralsTooltip"), BlockUi.GetNeutrals, BlockUi.RequestSetNeutrals, true, HasTrackingNeutrals); + AddOnOffSwitchNoAction(session, "FocusFire", Localization.GetText("TerminalFocusFireTitle"), Localization.GetText("TerminalFocusFireTooltip"), BlockUi.GetFocusFire, BlockUi.RequestSetFocusFire, true, HasTrackingExceptCommSlave); + AddOnOffSwitchNoAction(session, "Repel", Localization.GetText("TerminalRepelTitle"), Localization.GetText("TerminalRepelTooltip"), BlockUi.GetRepel, BlockUi.RequestSetRepel, true, HasTracking); + AddOnOffSwitchNoAction(session, "Neutrals", Localization.GetText("TerminalNeutralsTitle"), Localization.GetText("TerminalNeutralsTooltip"), BlockUi.GetNeutrals, BlockUi.RequestSetNeutrals, true, HasTrackingNeutrals); AddOnOffSwitchNoAction(session, "Unowned", Localization.GetText("TerminalUnownedTitle"), Localization.GetText("TerminalUnownedTooltip"), BlockUi.GetUnowned, BlockUi.RequestSetUnowned, true, HasTrackingUnowned); - - //AddOnOffSwitchNoAction(session, "Friendly", Localization.GetText("TerminalFriendlyTitle"), Localization.GetText("TerminalFriendlyTooltip"), BlockUi.GetFriendly, BlockUi.RequestSetFriendly, true, HasTrackingAndTrackFriendly); - + AddOnOffSwitchNoAction(session, "Grids", Localization.GetText("TerminalGridsTitle"), Localization.GetText("TerminalGridsTooltip"), BlockUi.GetGrids, BlockUi.RequestSetGrids, true, TrackGrids); + AddOnOffSwitchNoAction(session, "LargeGrid", Localization.GetText("TerminalLGTitle"), Localization.GetText("TerminalLGTooltip"), BlockUi.GetLargeGrid, BlockUi.RequestSetLargeGrid, true, HasTrackingNoSizeProhibition); + AddOnOffSwitchNoAction(session, "SmallGrid", Localization.GetText("TerminalSGTitle"), Localization.GetText("TerminalSGTooltip"), BlockUi.GetSmallGrid, BlockUi.RequestSetSmallGrid, true, HasTrackingNoSizeProhibition); AddOnOffSwitchNoAction(session, "Biologicals", Localization.GetText("TerminalBiologicalsTitle"), Localization.GetText("TerminalBiologicalsTooltip"), BlockUi.GetBiologicals, BlockUi.RequestSetBiologicals, true, TrackBiologicals); - - AddOnOffSwitchNoAction(session, "Projectiles", Localization.GetText("TerminalProjectilesTitle"), Localization.GetText("TerminalProjectilesTooltip"), BlockUi.GetProjectiles, BlockUi.RequestSetProjectiles, true, TrackProjectiles); - + AddOnOffSwitchNoAction(session, "Projectiles", Localization.GetText("TerminalProjectilesTitle"), Localization.GetText("TerminalProjectilesTooltip"), BlockUi.GetProjectiles, BlockUi.RequestSetProjectiles, true, TrackProjectiles); AddOnOffSwitchNoAction(session, "Supporting PD", Localization.GetText("TerminalSupportingPDTitle"), Localization.GetText("TerminalSupportingPDTooltip"), BlockUi.GetSupportingPD, BlockUi.RequestSetSupportingPD, true, UiDisableSupportingPD); - AddOnOffSwitchNoAction(session, "Meteors", Localization.GetText("TerminalMeteorsTitle"), Localization.GetText("TerminalMeteorsTooltip"), BlockUi.GetMeteors, BlockUi.RequestSetMeteors, true, TrackMeteors); - AddOnOffSwitchNoAction(session, "Grids", Localization.GetText("TerminalGridsTitle"), Localization.GetText("TerminalGridsTooltip"), BlockUi.GetGrids, BlockUi.RequestSetGrids, true, TrackGrids); - - AddOnOffSwitchNoAction(session, "FocusFire", Localization.GetText("TerminalFocusFireTitle"), Localization.GetText("TerminalFocusFireTooltip"), BlockUi.GetFocusFire, BlockUi.RequestSetFocusFire, true, HasTracking); - - AddOnOffSwitchNoAction(session, "SubSystems", Localization.GetText("TerminalSubSystemsTitle"), Localization.GetText("TerminalSubSystemsTooltip"), BlockUi.GetSubSystems, BlockUi.RequestSetSubSystems, true, HasTracking); - - AddOnOffSwitchNoAction(session, "Repel", Localization.GetText("TerminalRepelTitle"), Localization.GetText("TerminalRepelTooltip"), BlockUi.GetRepel, BlockUi.RequestSetRepel, true, HasTracking); - - AddOnOffSwitchNoAction(session, "LargeGrid", "Large Grid", "Target large grids", BlockUi.GetLargeGrid, BlockUi.RequestSetLargeGrid, true, HasTracking); - - AddOnOffSwitchNoAction(session, "SmallGrid", "Small Grid", "Target small grids", BlockUi.GetSmallGrid, BlockUi.RequestSetSmallGrid, true, HasTracking); - - Separator(session, "WC_sep3", IsTrue); AddWeaponBurstCountSliderRange(session, "Burst Count", Localization.GetText("TerminalBurstShotsTitle"), Localization.GetText("TerminalBurstShotsTooltip"), BlockUi.GetBurstCount, BlockUi.RequestSetBurstCount, CanBurstIsNotBomb, BlockUi.GetMinBurstCount, BlockUi.GetMaxBurstCount, true); @@ -90,70 +64,40 @@ internal static void AddTurretOrTrackingControls(Session session) where T : I AddLeadGroupSliderRange(session, "Target Group", Localization.GetText("TerminalTargetGroupTitle"), Localization.GetText("TerminalTargetGroupTooltip"), BlockUi.GetLeadGroup, BlockUi.RequestSetLeadGroup, TargetLead, BlockUi.GetMinLeadGroup, BlockUi.GetMaxLeadGroup, true); AddWeaponCameraSliderRange(session, "Camera Channel", Localization.GetText("TerminalCameraChannelTitle"), Localization.GetText("TerminalCameraChannelTooltip"), BlockUi.GetWeaponCamera, BlockUi.RequestSetBlockCamera, HasTracking, BlockUi.GetMinCameraChannel, BlockUi.GetMaxCameraChannel, true); - AddListBoxNoAction(session, "Friend", "Friend", "Friend list", BlockUi.FriendFill, BlockUi.FriendSelect, IsDrone, 1, true, true); AddListBoxNoAction(session, "Enemy", "Enemy", "Enemy list", BlockUi.EnemyFill, BlockUi.EnemySelect, IsDrone, 1, true, true); - //AddListBoxNoAction(session, "Position", "Position", "Position list", BlockUi.PositionFill, BlockUi.PositionSelect, IsDrone, 1, true, true); Suppressed for now as it's inop - - - Separator(session, "WC_sep5", HasTracking); + AddOnOffSwitchNoAction(session, "ReportTarget", Localization.GetText("TerminalReportTargetTitle"), Localization.GetText("TerminalReportTargetTooltip"), BlockUi.GetReportTarget, BlockUi.RequestSetReportTarget, true, UiReportTarget); } internal static void AddTurretControlBlockControls(Session session) where T : IMyTerminalBlock { CtcAddListBoxNoAction(session, "ToolsAndWeapons", "Available tools and weapons", "Auto populated by weaponcore", BlockUi.ToolWeaponFill, BlockUi.ToolWeaponSelect, CtcIsReady, 4, true); - CtcAddCheckboxNoAction(session, "Advanced", Localization.GetText("TerminalAdvancedTitle"), Localization.GetText("TerminalAdvancedTooltip"), BlockUi.GetAdvancedControl, BlockUi.RequestAdvancedControl, true, CtcIsReady); CtcAddOnOffSwitchNoAction(session, "ShareFireControlEnabled", Localization.GetText("TerminalShareFireControlTitle"), Localization.GetText("TerminalShareFireControlTooltip"), BlockUi.GetShareFireControlControl, BlockUi.RequestShareFireControlControl, true, CtcIsReady); - CtcAddOnOffSwitchNoAction(session, "WCAiEnabled", Localization.GetText("TerminalAiEnabledTitle"), Localization.GetText("TerminalAiEnabledTooltip"), BlockUi.GetAiEnabledControl, BlockUi.RequestSetAiEnabledControl, true, CtcIsReady); + CtcAddComboboxNoAction(session, "ControlModes", Localization.GetText("TerminalControlModesTitle"), Localization.GetText("TerminalControlModesTooltip"), BlockUi.GetControlModeControl, BlockUi.RequestControlModeControl, BlockUi.ListControlModes, CtcIsReady); + CtcAddComboboxNoAction(session, "TrackingMode", Localization.GetText("TerminalTrackingModeTitle"), Localization.GetText("TerminalTrackingModeTooltip"), BlockUi.GetMovementModeControl, BlockUi.RequestMovementModeControl, BlockUi.ListMovementModes, CtcIsReady); + AddWeaponCtcRangeSliderNoAction(session, "Weapon Range", Localization.GetText("TerminalWeaponRangeTitle"), Localization.GetText("TerminalWeaponRangeTooltip"), BlockUi.GetRangeControl, BlockUi.RequestSetRangeControl, CtcIsReady, BlockUi.GetMinRangeControl, BlockUi.GetMaxRangeControl, true, false); Separator(session, "WC_sep2", IsTrue); - AddWeaponCtcRangeSliderNoAction(session, "Weapon Range", Localization.GetText("TerminalWeaponRangeTitle"), Localization.GetText("TerminalWeaponRangeTooltip"), BlockUi.GetRangeControl, BlockUi.RequestSetRangeControl, CtcIsReady, BlockUi.GetMinRangeControl, BlockUi.GetMaxRangeControl, true, false); + CtcAddOnOffSwitchNoAction(session, "SubSystems", Localization.GetText("TerminalSubSystemsTitle"), Localization.GetText("TerminalSubSystemsTooltip"), BlockUi.GetSubSystemsControl, BlockUi.RequestSetSubSystemsControl, true, CtcIsReady); + CtcAddComboboxNoAction(session, "PickSubSystem", Localization.GetText("TerminalPickSubSystemTitle"), Localization.GetText("TerminalPickSubSystemTooltip"), BlockUi.GetSubSystemControl, BlockUi.RequestSubSystemControl, BlockUi.ListSubSystems, CtcIsReady); - CtcAddOnOffSwitchNoAction(session, "ReportTarget", Localization.GetText("TerminalReportTargetTitle"), Localization.GetText("TerminalReportTargetTooltip"), BlockUi.GetReportTargetControl, BlockUi.RequestSetReportTargetControl, true, CtcIsReady); + CtcAddOnOffSwitchNoAction(session, "FocusFire", Localization.GetText("TerminalFocusFireTitle"), Localization.GetText("TerminalFocusFireTooltip"), BlockUi.GetFocusFireControl, BlockUi.RequestSetFocusFireControl, true, CtcIsReady); + CtcAddOnOffSwitchNoAction(session, "Repel", Localization.GetText("TerminalRepelTitle"), Localization.GetText("TerminalRepelTooltip"), BlockUi.GetRepelControl, BlockUi.RequestSetRepelControl, true, CtcIsReady); CtcAddOnOffSwitchNoAction(session, "Neutrals", Localization.GetText("TerminalNeutralsTitle"), Localization.GetText("TerminalNeutralsTooltip"), BlockUi.GetNeutralsControl, BlockUi.RequestSetNeutralsControl, true, CtcIsReady); - CtcAddOnOffSwitchNoAction(session, "Unowned", Localization.GetText("TerminalUnownedTitle"), Localization.GetText("TerminalUnownedTooltip"), BlockUi.GetUnownedControl, BlockUi.RequestSetUnownedControl, true, CtcIsReady); - + CtcAddOnOffSwitchNoAction(session, "Grids", Localization.GetText("TerminalGridsTitle"), Localization.GetText("TerminalGridsTooltip"), BlockUi.GetGridsControl, BlockUi.RequestSetGridsControl, true, CtcIsReady); + CtcAddOnOffSwitchNoAction(session, "LargeGrid", Localization.GetText("TerminalLGTitle"), Localization.GetText("TerminalLGTooltip"), BlockUi.GetLargeGridControl, BlockUi.RequestSetLargeGridControl, true, CtcIsReady); + CtcAddOnOffSwitchNoAction(session, "SmallGrid", Localization.GetText("TerminalSGTitle"), Localization.GetText("TerminalSGTooltip"), BlockUi.GetSmallGridControl, BlockUi.RequestSetSmallGridControl, true, CtcIsReady); CtcAddOnOffSwitchNoAction(session, "Biologicals", Localization.GetText("TerminalBiologicalsTitle"), Localization.GetText("TerminalBiologicalsTooltip"), BlockUi.GetBiologicalsControl, BlockUi.RequestSetBiologicalsControl, true, CtcIsReady); - CtcAddOnOffSwitchNoAction(session, "Projectiles", Localization.GetText("TerminalProjectilesTitle"), Localization.GetText("TerminalProjectilesTooltip"), BlockUi.GetProjectilesControl, BlockUi.RequestSetProjectilesControl, true, CtcIsReady); - CtcAddOnOffSwitchNoAction(session, "Supporting PD", Localization.GetText("TerminalSupportingPDTitle"), Localization.GetText("TerminalSupportingPDTooltip"), BlockUi.GetSupportingPDControl, BlockUi.RequestSetSupportingPDControl, true, CtcIsReady); - CtcAddOnOffSwitchNoAction(session, "Meteors", Localization.GetText("TerminalMeteorsTitle"), Localization.GetText("TerminalMeteorsTooltip"), BlockUi.GetMeteorsControl, BlockUi.RequestSetMeteorsControl, true, CtcIsReady); - - CtcAddOnOffSwitchNoAction(session, "Grids", Localization.GetText("TerminalGridsTitle"), Localization.GetText("TerminalGridsTooltip"), BlockUi.GetGridsControl, BlockUi.RequestSetGridsControl, true, CtcIsReady); - - CtcAddOnOffSwitchNoAction(session, "FocusFire", Localization.GetText("TerminalFocusFireTitle"), Localization.GetText("TerminalFocusFireTooltip"), BlockUi.GetFocusFireControl, BlockUi.RequestSetFocusFireControl, true, CtcIsReady); - - CtcAddOnOffSwitchNoAction(session, "SubSystems", Localization.GetText("TerminalSubSystemsTitle"), Localization.GetText("TerminalSubSystemsTooltip"), BlockUi.GetSubSystemsControl, BlockUi.RequestSetSubSystemsControl, true, CtcIsReady); - - CtcAddOnOffSwitchNoAction(session, "Repel", Localization.GetText("TerminalRepelTitle"), Localization.GetText("TerminalRepelTooltip"), BlockUi.GetRepelControl, BlockUi.RequestSetRepelControl, true, CtcIsReady); - - CtcAddOnOffSwitchNoAction(session, "LargeGrid", "Large Grid", "Target large grids", BlockUi.GetLargeGridControl, BlockUi.RequestSetLargeGridControl, true, CtcIsReady); - - CtcAddOnOffSwitchNoAction(session, "SmallGrid", "Small Grid", "Target small grids", BlockUi.GetSmallGridControl, BlockUi.RequestSetSmallGridControl, true, CtcIsReady); - - Separator(session, "WC_sep3", IsTrue); - - CtcAddComboboxNoAction(session, "PickSubSystem", Localization.GetText("TerminalPickSubSystemTitle"), Localization.GetText("TerminalPickSubSystemTooltip"), BlockUi.GetSubSystemControl, BlockUi.RequestSubSystemControl, BlockUi.ListSubSystems, CtcIsReady); - - CtcAddComboboxNoAction(session, "TrackingMode", Localization.GetText("TerminalTrackingModeTitle"), Localization.GetText("TerminalTrackingModeTooltip"), BlockUi.GetMovementModeControl, BlockUi.RequestMovementModeControl, BlockUi.ListMovementModes, CtcIsReady); - - //CtcAddComboboxNoAction(session, "Shoot Mode", Localization.GetText("TerminalShootModeTitle"), Localization.GetText("TerminalShootModeTooltip"), BlockUi.CtcGetShootModes, BlockUi.CtcRequestShootModes, BlockUi.CtcListShootModes, CtcIsReady); - - CtcAddComboboxNoAction(session, "ControlModes", Localization.GetText("TerminalControlModesTitle"), Localization.GetText("TerminalControlModesTooltip"), BlockUi.GetControlModeControl, BlockUi.RequestControlModeControl, BlockUi.ListControlModes, CtcIsReady); - - //AddWeaponCameraSliderRange(session, "Camera Channel", Localization.GetText("TerminalCameraChannelTitle"), Localization.GetText("TerminalCameraChannelTooltip"), BlockUi.GetWeaponCamera, BlockUi.RequestSetBlockCamera, HasTracking, BlockUi.GetMinCameraChannel, BlockUi.GetMaxCameraChannel, true); - - //AddLeadGroupSliderRange(session, "Target Group", Localization.GetText("TerminalTargetGroupTitle"), Localization.GetText("TerminalTargetGroupTooltip"), BlockUi.GetLeadGroup, BlockUi.RequestSetLeadGroup, TargetLead, BlockUi.GetMinLeadGroup, BlockUi.GetMaxLeadGroup, true); - - Separator(session, "WC_sep4", IsTrue); + CtcAddOnOffSwitchNoAction(session, "ReportTarget", Localization.GetText("TerminalReportTargetTitle"), Localization.GetText("TerminalReportTargetTooltip"), BlockUi.GetReportTargetControl, BlockUi.RequestSetReportTargetControl, true, CtcIsReady); } internal static void AddSearchlightControls(Session session) where T : IMyTerminalBlock @@ -161,27 +105,15 @@ internal static void AddSearchlightControls(Session session) where T : IMyTer Separator(session, "WC_sep2", HasTracking); AddWeaponRangeSliderNoAction(session, "Weapon Range", Localization.GetText("TerminalWeaponRangeTitle"), Localization.GetText("TerminalWeaponRangeTooltip"), BlockUi.GetRange, BlockUi.RequestSetRange, BlockUi.ShowRange, BlockUi.GetMinRange, BlockUi.GetMaxRange, true, false); - AddOnOffSwitchNoAction(session, "Neutrals", Localization.GetText("TerminalNeutralsTitle"), Localization.GetText("TerminalNeutralsTooltip"), BlockUi.GetNeutrals, BlockUi.RequestSetNeutrals, true, HasTrackingNeutrals); - AddOnOffSwitchNoAction(session, "Unowned", Localization.GetText("TerminalUnownedTitle"), Localization.GetText("TerminalUnownedTooltip"), BlockUi.GetUnowned, BlockUi.RequestSetUnowned, true, HasTrackingUnowned); - - //AddOnOffSwitchNoAction(session, "Friendly", Localization.GetText("TerminalFriendlyTitle"), Localization.GetText("TerminalFriendlyTooltip"), BlockUi.GetFriendly, BlockUi.RequestSetFriendly, true, HasTrackingAndTrackFriendly); - + AddOnOffSwitchNoAction(session, "Grids", Localization.GetText("TerminalGridsTitle"), Localization.GetText("TerminalGridsTooltip"), BlockUi.GetGrids, BlockUi.RequestSetGrids, true, TrackGrids); + AddOnOffSwitchNoAction(session, "LargeGrid", Localization.GetText("TerminalLGTitle"), Localization.GetText("TerminalLGTooltip"), BlockUi.GetLargeGrid, BlockUi.RequestSetLargeGrid, true, HasTrackingNoSizeProhibition); + AddOnOffSwitchNoAction(session, "SmallGrid", Localization.GetText("TerminalSGTitle"), Localization.GetText("TerminalSGTooltip"), BlockUi.GetSmallGrid, BlockUi.RequestSetSmallGrid, true, HasTrackingNoSizeProhibition); AddOnOffSwitchNoAction(session, "Biologicals", Localization.GetText("TerminalBiologicalsTitle"), Localization.GetText("TerminalBiologicalsTooltip"), BlockUi.GetBiologicals, BlockUi.RequestSetBiologicals, true, TrackBiologicals); - AddOnOffSwitchNoAction(session, "Projectiles", Localization.GetText("TerminalProjectilesTitle"), Localization.GetText("TerminalProjectilesTooltip"), BlockUi.GetProjectiles, BlockUi.RequestSetProjectiles, true, TrackProjectiles); - AddOnOffSwitchNoAction(session, "Meteors", Localization.GetText("TerminalMeteorsTitle"), Localization.GetText("TerminalMeteorsTooltip"), BlockUi.GetMeteors, BlockUi.RequestSetMeteors, true, TrackMeteors); - - AddOnOffSwitchNoAction(session, "Grids", Localization.GetText("TerminalGridsTitle"), Localization.GetText("TerminalGridsTooltip"), BlockUi.GetGrids, BlockUi.RequestSetGrids, true, TrackGrids); - - AddOnOffSwitchNoAction(session, "LargeGrid", "Large Grid", "Target large grids", BlockUi.GetLargeGrid, BlockUi.RequestSetLargeGrid, true, HasTracking); - - AddOnOffSwitchNoAction(session, "SmallGrid", "Small Grid", "Target small grids", BlockUi.GetSmallGrid, BlockUi.RequestSetSmallGrid, true, HasTracking); - AddWeaponCameraSliderRange(session, "Camera Channel", Localization.GetText("TerminalCameraChannelTitle"), Localization.GetText("TerminalCameraChannelTooltip"), BlockUi.GetWeaponCamera, BlockUi.RequestSetBlockCamera, HasTracking, BlockUi.GetMinCameraChannel, BlockUi.GetMaxCameraChannel, true); - } internal static void AddDecoyControls(Session session) where T : IMyTerminalBlock { @@ -207,9 +139,9 @@ internal static void CreateGenericControls(Session session) where T : IMyTerm Separator(session, "WC_sep4", IsTrue); AddOnOffSwitchNoAction(session, "ShareFireControlEnabled", Localization.GetText("TerminalShareFireControlTitle"), Localization.GetText("TerminalShareFireControlTooltip"), BlockUi.GetShareFireControl, BlockUi.RequestShareFireControl, true, HasTracking); - AddOnOffSwitchNoAction(session, "Shoot", Localization.GetText("TerminalShootTitle"), Localization.GetText("TerminalShootTooltip"), BlockUi.GetShoot, BlockUi.RequestSetShoot, true, IsNotBomb); + AddOnOffSwitchNoAction(session, "Shoot", Localization.GetText("TerminalShootTitle"), Localization.GetText("TerminalShootTooltip"), BlockUi.GetShoot, BlockUi.RequestSetShoot, true, IsNotBomb); AddOnOffSwitchNoAction(session, "Override", Localization.GetText("TerminalOverrideTitle"), Localization.GetText("TerminalOverrideTooltip"), BlockUi.GetOverride, BlockUi.RequestOverride, true, OverrideTarget); - AddOnOffSwitchNoAction(session, "AngularTracking", Localization.GetText("TerminalAngularTitle"), Localization.GetText("TerminalAngularTooltip"), BlockUi.GetAngularTracking, BlockUi.RequestAngularTracking, true, IsNotBomb); + AddOnOffSwitchNoAction(session, "AngularTracking", Localization.GetText("TerminalAngularTitle"), Localization.GetText("TerminalAngularTooltip"), BlockUi.GetAngularTracking, BlockUi.RequestAngularTracking, true, HasTracking); } internal static void CreateGenericArmor(Session session) where T : IMyTerminalBlock @@ -313,6 +245,24 @@ internal static bool AmmoSelection(IMyTerminalBlock block) return comp.ConsumableSelectionPartIds.Count > 0; } + internal static bool EnableForceReload(IMyTerminalBlock block) + { + var comp = block?.Components?.Get() as Weapon.WeaponComponent; + var valid = comp != null && comp.Platform.State == CorePlatform.PlatformState.Ready && comp.Type == CoreComponent.CompType.Weapon && comp.Data?.Repo != null; + if (!valid || Session.I.PlayerId != comp.Data.Repo.Values.State.PlayerId && !comp.TakeOwnerShip()) + return false; + bool enable = false; + for (int i = 0; i < comp.Collection.Count; i++) + { + var wep = comp.Collection[i]; + if (!wep.System.HasAmmoSelection) + continue; + if (wep.DelayedCycleId != -1 && wep.ActiveAmmoDef != wep.System.AmmoTypes[wep.DelayedCycleId]) + enable = true; + } + return enable; + } + internal static bool CanBurst(IMyTerminalBlock block) { var comp = block?.Components?.Get() as Weapon.WeaponComponent; @@ -460,8 +410,19 @@ internal static bool HasTracking(IMyTerminalBlock block) return (comp.HasTracking || comp.HasGuidance) && !comp.HasAlternateUi; } + internal static bool HasTrackingNoSizeProhibition(IMyTerminalBlock block) + { + var comp = block?.Components?.Get() as Weapon.WeaponComponent; - internal static bool HasTrackingUnowned(IMyTerminalBlock block) + var valid = comp != null && comp.Platform.State == CorePlatform.PlatformState.Ready && comp.Data?.Repo != null; + + if (!valid || Session.I.PlayerId != comp.Data.Repo.Values.State.PlayerId && !comp.TakeOwnerShip() || comp.PrimaryWeapon.System.TrackProhibitLG || comp.PrimaryWeapon.System.TrackProhibitSG) + return false; + + return (comp.HasTracking || comp.HasGuidance) && !comp.HasAlternateUi; + } + + internal static bool HasTrackingExceptCommSlave(IMyTerminalBlock block) { var comp = block?.Components?.Get() as Weapon.WeaponComponent; @@ -470,10 +431,10 @@ internal static bool HasTrackingUnowned(IMyTerminalBlock block) if (!valid || Session.I.PlayerId != comp.Data.Repo.Values.State.PlayerId && !comp.TakeOwnerShip()) return false; - return (comp.HasTracking || comp.HasGuidance) && !comp.HasAlternateUi; + return !comp.PrimaryWeapon.System.TargetSlaving && (comp.HasTracking || comp.HasGuidance) && !comp.HasAlternateUi; } - internal static bool HasTrackingNeutrals(IMyTerminalBlock block) + internal static bool HasTrackingUnowned(IMyTerminalBlock block) { var comp = block?.Components?.Get() as Weapon.WeaponComponent; @@ -484,7 +445,8 @@ internal static bool HasTrackingNeutrals(IMyTerminalBlock block) return (comp.HasTracking || comp.HasGuidance) && !comp.HasAlternateUi; } - internal static bool HasTrackingAndTrackFriendly(IMyTerminalBlock block) + + internal static bool HasTrackingNeutrals(IMyTerminalBlock block) { var comp = block?.Components?.Get() as Weapon.WeaponComponent; @@ -493,7 +455,7 @@ internal static bool HasTrackingAndTrackFriendly(IMyTerminalBlock block) if (!valid || Session.I.PlayerId != comp.Data.Repo.Values.State.PlayerId && !comp.TakeOwnerShip()) return false; - return (comp.HasTracking || comp.HasGuidance || comp.HasAlternateUi); + return (comp.HasTracking || comp.HasGuidance) && !comp.HasAlternateUi; } internal static bool IsArmed(IMyTerminalBlock block) @@ -868,26 +830,6 @@ internal static IMyTerminalControlSlider AddLeadGroupSliderRange(Session sess return c; } - internal static IMyTerminalControlOnOffSwitch AddWeaponOnOff(Session session, string name, string title, string tooltip, string onText, string offText, Func getter, Action setter, Func visibleGetter) where T : IMyTerminalBlock - { - var c = MyAPIGateway.TerminalControls.CreateControl($"WC_Enable"); - - c.Title = MyStringId.GetOrCompute(title); - c.Tooltip = MyStringId.GetOrCompute(tooltip); - c.OnText = MyStringId.GetOrCompute(onText); - c.OffText = MyStringId.GetOrCompute(offText); - c.Enabled = IsReady; - c.Visible = visibleGetter; - c.Getter = IsReady; - c.Setter = setter; - MyAPIGateway.TerminalControls.AddControl(c); - session.CustomControls.Add(c); - - CreateCustomActions.CreateOnOffActionSet(session, c, name, visibleGetter); - - return c; - } - internal static IMyTerminalControlSeparator Separator(Session session, string name, Func visibleGettter) where T : IMyTerminalBlock { var c = MyAPIGateway.TerminalControls.CreateControl(name); diff --git a/Data/Scripts/CoreSystems/EntityComp/Controls/Weapon/WeaponActions.cs b/Data/Scripts/CoreSystems/EntityComp/Controls/Weapon/WeaponActions.cs index d066249f..fdf228d2 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Controls/Weapon/WeaponActions.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Controls/Weapon/WeaponActions.cs @@ -3,6 +3,7 @@ using CoreSystems.Platform; using CoreSystems.Support; using Sandbox.ModAPI; +using VRage.Utils; using VRageMath; using static CoreSystems.Support.CoreComponent.Trigger; @@ -115,6 +116,8 @@ internal static void TerminalActionKeyShoot(IMyTerminalBlock blk) var mode = comp.Data.Repo.Values.Set.Overrides.ShootMode; if (mode == Weapon.ShootManager.ShootModes.KeyToggle || mode == Weapon.ShootManager.ShootModes.KeyFire) { + if (!comp.Data.Repo.Values.Set.Overrides.Override && comp.HasRequireTarget && comp.PrimaryWeapon.Target.CurrentState != Target.States.Acquired) + return; var keyToggle = mode == Weapon.ShootManager.ShootModes.KeyToggle; var signal = keyToggle ? Weapon.ShootManager.Signals.KeyToggle : Weapon.ShootManager.Signals.Once; var on = comp.Data.Repo.Values.State.Trigger == On; @@ -150,7 +153,7 @@ internal static void TerminalActionMovementMode(IMyTerminalBlock blk) return; var numValue = (int)comp.Data.Repo.Values.Set.Overrides.MoveMode; - var value = numValue + 1 <= 3 ? numValue + 1 : 0; + var value = numValue + 1 <= 4 ? numValue + 1 : 0; Weapon.WeaponComponent.RequestSetValue(comp, "MovementModes", value, Session.I.PlayerId); } @@ -406,6 +409,90 @@ internal static void TerminalActionMinSizeDecrease(IMyTerminalBlock blk) Weapon.WeaponComponent.RequestSetValue(comp, "MinSize", newValue, Session.I.PlayerId); } + internal static void TerminalActionMaxRangeIncrease(IMyTerminalBlock block) + { + var comp = block?.Components?.Get() as Weapon.WeaponComponent; + if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; + + var curRange = comp.Data.Repo.Values.Set.Range; + var maxRange = 0f; + for (int i = 0; i < comp.Collection.Count; i++) + { + var w = comp.Collection[i]; + var curMax = w.GetMaxWeaponRange(); + if (curMax > maxRange) + maxRange = (float)curMax; + } + + var delta = maxRange * 0.1f; + if (curRange == maxRange) + return; + else if (curRange + delta > maxRange) + curRange = maxRange; + else + curRange += delta; + + if (!MyUtils.IsEqual(curRange, comp.Data.Repo.Values.Set.Range)) + { + if (Session.I.IsServer) + { + comp.Data.Repo.Values.Set.Range = curRange; + Weapon.WeaponComponent.SetRange(comp); + if (Session.I.MpActive) + Session.I.SendComp(comp); + } + else + Session.I.SendSetCompFloatRequest(comp, curRange, PacketType.RequestSetRange); + } + } + + internal static void TerminalActionMaxRangeDecrease(IMyTerminalBlock block) + { + var comp = block?.Components?.Get() as Weapon.WeaponComponent; + if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; + + var curRange = comp.Data.Repo.Values.Set.Range; + + var minRange = float.MaxValue; + for (int i = 0; i < comp.Collection.Count; i++) + { + var w = comp.Collection[i]; + var curMin = w.System.WConst.MinTargetDistance; + if (curMin < minRange) + minRange = (float)curMin; + } + + var maxRange = 0f; + for (int i = 0; i < comp.Collection.Count; i++) + { + var w = comp.Collection[i]; + var curMax = w.GetMaxWeaponRange(); + if (curMax > maxRange) + maxRange = (float)curMax; + } + + var delta = maxRange * 0.1f; + if (curRange == minRange) + return; + else if (curRange - delta < minRange) + curRange = minRange; + else + curRange -= delta; + + if (!MyUtils.IsEqual(curRange, comp.Data.Repo.Values.Set.Range)) + { + if (Session.I.IsServer) + { + comp.Data.Repo.Values.Set.Range = curRange; + Weapon.WeaponComponent.SetRange(comp); + if (Session.I.MpActive) + Session.I.SendComp(comp); + } + else + Session.I.SendSetCompFloatRequest(comp, curRange, PacketType.RequestSetRange); + } + } + internal static void TerminalActionCycleAmmo(IMyTerminalBlock block) { var comp = block?.Components?.Get() as Weapon.WeaponComponent; @@ -506,9 +593,9 @@ internal static void ArmWriter(IMyTerminalBlock blk, StringBuilder sb) var comp = blk.Components.Get() as Weapon.WeaponComponent; if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; if (comp.Data.Repo.Values.Set.Overrides.Armed) - sb.Append("Armed"); + sb.Append(Localization.GetText("BombArmed")); else - sb.Append("Disarmed"); + sb.Append(Localization.GetText("BombDisarmed")); } internal static void ShootStateWriter(IMyTerminalBlock blk, StringBuilder sb) @@ -653,21 +740,27 @@ internal static void MaxSizeWriter(IMyTerminalBlock blk, StringBuilder sb) { var comp = blk.Components.Get() as Weapon.WeaponComponent; if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; - sb.Append(comp.Data.Repo.Values.Set.Overrides.MaxSize); + sb.Append($"Mx:{comp.Data.Repo.Values.Set.Overrides.MaxSize}"); } internal static void MinSizeWriter(IMyTerminalBlock blk, StringBuilder sb) { var comp = blk.Components.Get() as Weapon.WeaponComponent; if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; - sb.Append(comp.Data.Repo.Values.Set.Overrides.MinSize); + sb.Append($"Mn:{comp.Data.Repo.Values.Set.Overrides.MinSize}"); + } + internal static void MaxRangeWriter(IMyTerminalBlock blk, StringBuilder sb) + { + var comp = blk.Components.Get() as Weapon.WeaponComponent; + if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; + sb.Append($"{comp.Data.Repo.Values.Set.Range}m"); } internal static void ControlStateWriter(IMyTerminalBlock blk, StringBuilder sb) { var comp = blk.Components.Get() as Weapon.WeaponComponent; if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; - sb.Append(comp.Data.Repo.Values.Set.Overrides.Control); + sb.Append(Localization.GetText("Control" + comp.Data.Repo.Values.Set.Overrides.Control)); } internal static void MovementModeWriter(IMyTerminalBlock blk, StringBuilder sb) @@ -675,7 +768,7 @@ internal static void MovementModeWriter(IMyTerminalBlock blk, StringBuilder sb) var comp = blk.Components.Get() as Weapon.WeaponComponent; if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; - sb.Append(comp.Data.Repo.Values.Set.Overrides.MoveMode); + sb.Append(Localization.GetText("Move" + comp.Data.Repo.Values.Set.Overrides.MoveMode)); } internal static void SubSystemWriter(IMyTerminalBlock blk, StringBuilder sb) @@ -683,7 +776,7 @@ internal static void SubSystemWriter(IMyTerminalBlock blk, StringBuilder sb) var comp = blk.Components.Get() as Weapon.WeaponComponent; if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; - sb.Append(comp.Data.Repo.Values.Set.Overrides.SubSystem); + sb.Append(Localization.GetText("Subtype" + comp.Data.Repo.Values.Set.Overrides.SubSystem)); } internal static void ShootModeWriter(IMyTerminalBlock blk, StringBuilder sb) @@ -691,7 +784,7 @@ internal static void ShootModeWriter(IMyTerminalBlock blk, StringBuilder sb) var comp = blk.Components.Get() as Weapon.WeaponComponent; if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; - var altAiControlName = !comp.HasAim && comp.Data.Repo.Values.Set.Overrides.ShootMode == Weapon.ShootManager.ShootModes.AiShoot ? InActive : comp.Data.Repo.Values.Set.Overrides.ShootMode.ToString(); + var altAiControlName = !comp.HasAim && comp.Data.Repo.Values.Set.Overrides.ShootMode == Weapon.ShootManager.ShootModes.AiShoot ? Localization.GetText("ControlsInactive") : Localization.GetText("Shoot" + comp.Data.Repo.Values.Set.Overrides.ShootMode); sb.Append(altAiControlName); } @@ -700,16 +793,15 @@ internal static void ObjectiveModeWriter(IMyTerminalBlock blk, StringBuilder sb) var comp = blk.Components.Get() as Weapon.WeaponComponent; if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; - sb.Append(comp.Data.Repo.Values.Set.Overrides.ObjectiveMode); + sb.Append(Localization.GetText("Obj" + comp.Data.Repo.Values.Set.Overrides.ObjectiveMode)); } - private const string InActive = "Inactive"; internal static void MouseToggleWriter(IMyTerminalBlock blk, StringBuilder sb) { var comp = blk.Components.Get() as Weapon.WeaponComponent; if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; - var message = comp.Data.Repo.Values.Set.Overrides.ShootMode == Weapon.ShootManager.ShootModes.MouseControl ? comp.Data.Repo.Values.Set.Overrides.ShootMode.ToString() : InActive; + var message = comp.Data.Repo.Values.Set.Overrides.ShootMode == Weapon.ShootManager.ShootModes.MouseControl ? Localization.GetText("ShootMouse") : Localization.GetText("ControlsInactive"); sb.Append(message); } @@ -719,7 +811,7 @@ internal static void DecoyWriter(IMyTerminalBlock blk, StringBuilder sb) long value; if (long.TryParse(blk.CustomData, out value)) { - sb.Append(((WeaponDefinition.TargetingDef.BlockTypes)value).ToString()); + sb.Append(Localization.GetText("Subtype" + (WeaponDefinition.TargetingDef.BlockTypes)value)); } } @@ -728,7 +820,7 @@ internal static void CameraWriter(IMyTerminalBlock blk, StringBuilder sb) long value; if (long.TryParse(blk.CustomData, out value)) { - var group = $"Camera Channel {value}"; + var group = $"{Localization.GetText("TerminalCameraCameraChannelTitle")} {value}"; sb.Append(group); } } diff --git a/Data/Scripts/CoreSystems/EntityComp/Controls/Weapon/WeaponUi.cs b/Data/Scripts/CoreSystems/EntityComp/Controls/Weapon/WeaponUi.cs index 8cae6999..71618102 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Controls/Weapon/WeaponUi.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Controls/Weapon/WeaponUi.cs @@ -9,8 +9,6 @@ using VRage.ModAPI; using VRage.Utils; using VRageMath; -using WeaponCore.Data.Scripts.CoreSystems.Ui.Targeting; -using static VRage.Game.ObjectBuilders.Definitions.MyObjectBuilder_GameDefinition; namespace CoreSystems { @@ -587,6 +585,17 @@ internal static void RequestSetAmmo(IMyTerminalBlock block, long newValue) wep.QueueAmmoChange((int)newValue); } + block.ShowInToolbarConfig = !block.ShowInToolbarConfig; //#keen + block.ShowInToolbarConfig = !block.ShowInToolbarConfig; + } + + internal static void ForceReload(IMyTerminalBlock block) + { + var comp = block?.Components?.Get() as Weapon.WeaponComponent; + if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return; + comp.RequestForceReload(); + block.ShowInToolbarConfig = !block.ShowInToolbarConfig; //#keen + block.ShowInToolbarConfig = !block.ShowInToolbarConfig; } @@ -621,10 +630,10 @@ internal static void ListShootModes(List shootMod private static readonly List ShootModeList = new List { - new MyTerminalControlComboBoxItem { Key = 0, Value = MyStringId.GetOrCompute($"{(Weapon.ShootManager.ShootModes)0}") }, - new MyTerminalControlComboBoxItem { Key = 1, Value = MyStringId.GetOrCompute($"{(Weapon.ShootManager.ShootModes)1}") }, - new MyTerminalControlComboBoxItem { Key = 2, Value = MyStringId.GetOrCompute($"{(Weapon.ShootManager.ShootModes)2}") }, - new MyTerminalControlComboBoxItem { Key = 3, Value = MyStringId.GetOrCompute($"{(Weapon.ShootManager.ShootModes)3}") }, + new MyTerminalControlComboBoxItem { Key = 0, Value = MyStringId.GetOrCompute(Localization.GetText("ShootAiShoot")) }, + new MyTerminalControlComboBoxItem { Key = 1, Value = MyStringId.GetOrCompute(Localization.GetText("ShootMouse")) }, + new MyTerminalControlComboBoxItem { Key = 2, Value = MyStringId.GetOrCompute(Localization.GetText("ShootKeyToggle")) }, + new MyTerminalControlComboBoxItem { Key = 3, Value = MyStringId.GetOrCompute(Localization.GetText("ShootKey")) }, }; internal static long GetSubSystem(IMyTerminalBlock block) @@ -649,14 +658,14 @@ internal static void ListSubSystems(List subSyste private static readonly List SubList = new List { - new MyTerminalControlComboBoxItem { Key = 0, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)0}") }, - new MyTerminalControlComboBoxItem { Key = 1, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)1}") }, - new MyTerminalControlComboBoxItem { Key = 2, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)2}") }, - new MyTerminalControlComboBoxItem { Key = 3, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)3}") }, - new MyTerminalControlComboBoxItem { Key = 4, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)4}") }, - new MyTerminalControlComboBoxItem { Key = 5, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)5}") }, - new MyTerminalControlComboBoxItem { Key = 6, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)6}") }, - new MyTerminalControlComboBoxItem { Key = 7, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)7}") }, + new MyTerminalControlComboBoxItem { Key = 0, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypeAny")) }, + new MyTerminalControlComboBoxItem { Key = 1, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypeOffense")) }, + new MyTerminalControlComboBoxItem { Key = 2, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypeUtility")) }, + new MyTerminalControlComboBoxItem { Key = 3, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypePower")) }, + new MyTerminalControlComboBoxItem { Key = 4, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypeProduction")) }, + new MyTerminalControlComboBoxItem { Key = 5, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypeThrust")) }, + new MyTerminalControlComboBoxItem { Key = 6, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypeJumping")) }, + new MyTerminalControlComboBoxItem { Key = 7, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypeSteering")) }, }; internal static long GetMovementMode(IMyTerminalBlock block) @@ -681,10 +690,12 @@ internal static void ListMovementModes(List moveL private static readonly List MoveList = new List { - new MyTerminalControlComboBoxItem { Key = 0, Value = MyStringId.GetOrCompute($"{(ProtoWeaponOverrides.MoveModes)0}") }, - new MyTerminalControlComboBoxItem { Key = 1, Value = MyStringId.GetOrCompute($"{(ProtoWeaponOverrides.MoveModes)1}") }, - new MyTerminalControlComboBoxItem { Key = 2, Value = MyStringId.GetOrCompute($"{(ProtoWeaponOverrides.MoveModes)2}") }, - new MyTerminalControlComboBoxItem { Key = 3, Value = MyStringId.GetOrCompute($"{(ProtoWeaponOverrides.MoveModes)3}") }, + new MyTerminalControlComboBoxItem { Key = 0, Value = MyStringId.GetOrCompute(Localization.GetText("MoveAny")) }, + new MyTerminalControlComboBoxItem { Key = 1, Value = MyStringId.GetOrCompute(Localization.GetText("MoveMoving")) }, + new MyTerminalControlComboBoxItem { Key = 2, Value = MyStringId.GetOrCompute(Localization.GetText("MoveMobile")) }, + new MyTerminalControlComboBoxItem { Key = 3, Value = MyStringId.GetOrCompute(Localization.GetText("MoveMoored")) }, + new MyTerminalControlComboBoxItem { Key = 4, Value = MyStringId.GetOrCompute(Localization.GetText("MoveShipAny")) }, + }; internal static long GetObjectiveMode(IMyTerminalBlock block) @@ -709,9 +720,9 @@ internal static void ListObjectiveModes(List move private static readonly List ObjectiveList = new List { - new MyTerminalControlComboBoxItem { Key = 0, Value = MyStringId.GetOrCompute($"{(ProtoWeaponOverrides.ObjectiveModes)0}") }, - new MyTerminalControlComboBoxItem { Key = 1, Value = MyStringId.GetOrCompute($"{(ProtoWeaponOverrides.ObjectiveModes)1}") }, - new MyTerminalControlComboBoxItem { Key = 2, Value = MyStringId.GetOrCompute($"{(ProtoWeaponOverrides.ObjectiveModes)2}") }, + new MyTerminalControlComboBoxItem { Key = 0, Value = MyStringId.GetOrCompute(Localization.GetText("ObjDefault")) }, + new MyTerminalControlComboBoxItem { Key = 1, Value = MyStringId.GetOrCompute(Localization.GetText("ObjDisabled")) }, + new MyTerminalControlComboBoxItem { Key = 2, Value = MyStringId.GetOrCompute(Localization.GetText("ObjDestroyed")) }, }; internal static long GetControlMode(IMyTerminalBlock block) @@ -1027,7 +1038,8 @@ internal static float GetMaxBurstDelay(IMyTerminalBlock block) var comp = block?.Components?.Get() as Weapon.WeaponComponent; if (comp == null || comp.Platform.State != CorePlatform.PlatformState.Ready) return 0; - return 300; + var priReload = comp.Collection[0].System.WConst.ReloadTime * 3; + return priReload < 600 ? 600 : priReload; } internal static float GetMinSequenceId(IMyTerminalBlock block) @@ -1131,9 +1143,9 @@ internal static void ListControlModes(List contro private static readonly List ControlList = new List { - new MyTerminalControlComboBoxItem { Key = 0, Value = MyStringId.GetOrCompute($"{(ProtoWeaponOverrides.ControlModes)0}") }, - new MyTerminalControlComboBoxItem { Key = 1, Value = MyStringId.GetOrCompute($"{(ProtoWeaponOverrides.ControlModes)1}") }, - new MyTerminalControlComboBoxItem { Key = 2, Value = MyStringId.GetOrCompute($"{(ProtoWeaponOverrides.ControlModes)2}") }, + new MyTerminalControlComboBoxItem { Key = 0, Value = MyStringId.GetOrCompute(Localization.GetText("ControlAuto")) }, + new MyTerminalControlComboBoxItem { Key = 1, Value = MyStringId.GetOrCompute(Localization.GetText("ControlManual")) }, + new MyTerminalControlComboBoxItem { Key = 2, Value = MyStringId.GetOrCompute(Localization.GetText("ControlPainter")) }, }; internal static void ListDecoySubSystems(List subSystemList) @@ -1143,13 +1155,13 @@ internal static void ListDecoySubSystems(List sub private static readonly List DecoySubList = new List() { - new MyTerminalControlComboBoxItem() { Key = 1, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)1}") }, - new MyTerminalControlComboBoxItem() { Key = 2, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)2}") }, - new MyTerminalControlComboBoxItem() { Key = 3, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)3}") }, - new MyTerminalControlComboBoxItem() { Key = 4, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)4}") }, - new MyTerminalControlComboBoxItem() { Key = 5, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)5}") }, - new MyTerminalControlComboBoxItem() { Key = 6, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)6}") }, - new MyTerminalControlComboBoxItem() { Key = 7, Value = MyStringId.GetOrCompute($"{(WeaponDefinition.TargetingDef.BlockTypes)7}") }, + new MyTerminalControlComboBoxItem { Key = 1, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypeOffense")) }, + new MyTerminalControlComboBoxItem { Key = 2, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypeUtility")) }, + new MyTerminalControlComboBoxItem { Key = 3, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypePower")) }, + new MyTerminalControlComboBoxItem { Key = 4, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypeProduction")) }, + new MyTerminalControlComboBoxItem { Key = 5, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypeThrust")) }, + new MyTerminalControlComboBoxItem { Key = 6, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypeJumping")) }, + new MyTerminalControlComboBoxItem { Key = 7, Value = MyStringId.GetOrCompute(Localization.GetText("SubtypeSteering")) }, }; } } diff --git a/Data/Scripts/CoreSystems/EntityComp/EntityEvents.cs b/Data/Scripts/CoreSystems/EntityComp/EntityEvents.cs index c48bc659..69f36974 100644 --- a/Data/Scripts/CoreSystems/EntityComp/EntityEvents.cs +++ b/Data/Scripts/CoreSystems/EntityComp/EntityEvents.cs @@ -2,7 +2,6 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Text; -using CoreSystems.Control; using CoreSystems.Platform; using CoreSystems.Projectiles; using Sandbox.Game.Entities; @@ -12,10 +11,8 @@ using VRage.Game; using VRage.Game.Entity; using VRage.Game.ModAPI; -using VRageMath; using static CoreSystems.Platform.CorePlatform; using static CoreSystems.Session; -using static VRage.Game.ObjectBuilders.Definitions.MyObjectBuilder_GameDefinition; namespace CoreSystems.Support { @@ -146,12 +143,6 @@ private void OnContentsChanged(MyInventoryBase inv, MyPhysicalInventoryItem item } } - private static void OnMarkForClose(MyEntity myEntity) - { - - } - - private void IsWorkingChanged(MyCubeBlock myCubeBlock) { var wasFunctional = IsFunctional; @@ -221,227 +212,117 @@ internal string GetSystemStatus() private void AppendingCustomInfoWeapon(IMyTerminalBlock block, StringBuilder stringBuilder) { - try + var comp = ((Weapon.WeaponComponent)this); + /* + var r = "[color=#DDFF0000]"; //ARGB in hex values + var y = "[color=#DDFFFF00]"; + var g = "[color=#DD00FF00]"; + var e = "[/color]"; + stringBuilder.Append($"{r}Red{e} {y}Yellow{e} {g}Green{e}"); + */ + + var collection = comp.HasAlternateUi ? SortAndGetTargetTypes() : TypeSpecific != CompTypeSpecific.Phantom ? Platform.Weapons : Platform.Phantoms; + var debug = Debug || comp.Data.Repo.Values.Set.Overrides.Debug; + var advanced = (I.Settings.ClientConfig.AdvancedMode || debug) && !comp.HasAlternateUi; + if (HasServerOverrides) + stringBuilder.Append($"\n{Localization.GetText("WeaponInfoServerModdedLine1")}\n") + .Append($"\n{Localization.GetText("WeaponInfoServerModdedLine2")}"); + + if (comp.PrimaryWeapon.System.TrackProhibitLG) + stringBuilder.Append($"\nCannot target large grids!"); + + if (comp.PrimaryWeapon.System.TrackProhibitSG) + stringBuilder.Append($"\nCannot target small grids!"); + + //Start of new formatting + if (IdlePower > 0.01) + stringBuilder.Append($"\n{Localization.GetText("WeaponInfoIdlePower")}: {IdlePower:0.00} {Localization.GetText("WeaponInfoMWLabel")}"); + + for (int i = 0; i < collection.Count; i++) { - var comp = ((Weapon.WeaponComponent)this); - /* - var r = "[color=#DDFF0000]"; //ARGB in hex values - var y = "[color=#DDFFFF00]"; - var g = "[color=#DD00FF00]"; - var e = "[/color]"; - stringBuilder.Append($"{r}Red{e} {y}Yellow{e} {g}Green{e}"); - */ - - var collection = comp.HasAlternateUi ? SortAndGetTargetTypes() : TypeSpecific != CompTypeSpecific.Phantom ? Platform.Weapons : Platform.Phantoms; - var debug = Debug || comp.Data.Repo.Values.Set.Overrides.Debug; - var advanced = (I.Settings.ClientConfig.AdvancedMode || debug) && !comp.HasAlternateUi; - if (HasServerOverrides) - stringBuilder.Append($"\nWeapon modified by server!\n") - .Append($"Report issues to server admins.\n"); - - //Start of new formatting - if (IdlePower > 0.01) - stringBuilder.Append($"\nIdle Power: " + IdlePower.ToString("0.00") + " MW"); - - for (int i = 0; i < collection.Count; i++) + var w = collection[i]; + string shots = ""; + if ((w.ActiveAmmoDef.AmmoDef.Const.EnergyAmmo || w.ActiveAmmoDef.AmmoDef.Const.IsHybrid) && !comp.HasAlternateUi) { - var w = collection[i]; - string shots = ""; - if ((w.ActiveAmmoDef.AmmoDef.Const.EnergyAmmo || w.ActiveAmmoDef.AmmoDef.Const.IsHybrid) && !comp.HasAlternateUi) - { - var chargeTime = w.AssignedPower > 0 ? (int)((w.MaxCharge - w.ProtoWeaponAmmo.CurrentCharge) / w.AssignedPower * MyEngineConstants.PHYSICS_STEP_SIZE_IN_SECONDS) : 0; - shots += "\nDraw/Max: " + (SinkPower - IdlePower).ToString("0.00") + "/" + w.ActiveAmmoDef.AmmoDef.Const.PowerPerTick.ToString("0.00") + " MW" + - $"\n{(chargeTime == 0 ? "Power: Charged" : "Power: Charged in " + chargeTime + "s")}"; - } - - var endReturn = i + 1 != collection.Count ? "\n" : string.Empty; - var timeToLoad = (int)(w.ReloadEndTick - Session.I.Tick) / 60; - var showName = w.ActiveAmmoDef.AmmoDef.Const.TerminalName != w.ActiveAmmoDef.AmmoDef.Const.MagazineDef.DisplayNameText; - var displayName = showName ? w.ActiveAmmoDef.AmmoDef.Const.TerminalName + " (" + w.ActiveAmmoDef.AmmoDef.Const.MagazineDef.DisplayNameText + ")" : w.ActiveAmmoDef.AmmoDef.Const.TerminalName; - stringBuilder.Append($"\n\n" + w.System.PartName + - shots + - $" {(w.ActiveAmmoDef.AmmoDef.Const.EnergyAmmo ? string.Empty : "\nAmmo: " + (w.Loading ? timeToLoad < 0 ? "Waiting on charge" : "Loaded in " + timeToLoad + "s": w.ProtoWeaponAmmo.CurrentAmmo > 0 ? "Loaded " + w.ProtoWeaponAmmo.CurrentAmmo + "x " + displayName : "No Ammo"))}" + - $" {(w.ActiveAmmoDef.AmmoDef.Const.RequiresTarget ? "\n" + Localization.GetText("WeaponInfoHasTarget") + ": " + w.Target.HasTarget : string.Empty)}" + - $" {(w.ActiveAmmoDef.AmmoDef.Const.RequiresTarget ? "\n" + Localization.GetText("WeaponInfoLoS") + ": " + (w.Target.HasTarget ? "" + !w.PauseShoot : "No Target") : string.Empty)}" + - endReturn); + var chargeTime = w.AssignedPower > 0 ? (int)((w.MaxCharge - w.ProtoWeaponAmmo.CurrentCharge) / w.AssignedPower * MyEngineConstants.PHYSICS_STEP_SIZE_IN_SECONDS) : 0; + shots += $"\n{Localization.GetText("WeaponInfoDrawOverMax")}: {SinkPower - IdlePower:0.00}/ {w.ActiveAmmoDef.AmmoDef.Const.PowerPerTick:0.00} {Localization.GetText("WeaponInfoMWLabel")}" + + $"\n{(chargeTime == 0 ? Localization.GetText("WeaponInfoPowerCharged") : Localization.GetText("WeaponInfoPowerChargedIn") + " " + chargeTime + Localization.GetText("WeaponInfoSeconds"))}"; } + + var endReturn = i + 1 != collection.Count ? "\n" : string.Empty; + var timeToLoad = (int)(w.ReloadEndTick - Session.I.Tick) / 60; + var showName = w.ActiveAmmoDef.AmmoDef.Const.TerminalName != w.ActiveAmmoDef.AmmoDef.Const.MagazineDef.DisplayNameText; + var displayName = showName ? w.ActiveAmmoDef.AmmoDef.Const.TerminalName + " (" + w.ActiveAmmoDef.AmmoDef.Const.MagazineDef.DisplayNameText + ")" : w.ActiveAmmoDef.AmmoDef.Const.TerminalName; + stringBuilder.Append($"\n\n" + w.System.PartName + + shots + + $" {(w.ActiveAmmoDef.AmmoDef.Const.EnergyAmmo ? string.Empty : $"\n{Localization.GetText("WeaponInfoAmmoLabel")}: " + (w.Loading ? timeToLoad < 0 ? Localization.GetText("WeaponInfoWaitingCharge") : Localization.GetText("WeaponInfoLoadedIn") + " " + timeToLoad + Localization.GetText("WeaponInfoSeconds") : w.ProtoWeaponAmmo.CurrentAmmo > 0 ? Localization.GetText("WeaponInfoLoaded") + " " + w.ProtoWeaponAmmo.CurrentAmmo + "x " + displayName : w.Comp.CurrentInventoryVolume > 0 ? Localization.GetText("WeaponInfoCheckAmmoType") : Localization.GetText("WeaponInfoNoammo")))}" + + $" {(w.ActiveAmmoDef.AmmoDef.Const.RequiresTarget ? "\n" + Localization.GetText("WeaponInfoHasTarget") + ": " + (w.Target.HasTarget ? Localization.GetText("WeaponTargTrue") : w.Comp.MasterAi.DetectionInfo.SomethingInRange && (w.Target.CurrentState == Target.States.NotSet || w.Target.CurrentState == Target.States.Expired) ? Localization.GetText("WeaponTargNeedSelection") : w.MinTargetDistanceSqr > 0 && (comp.MasterAi.DetectionInfo.OtherRangeSqr < w.MinTargetDistanceSqr || comp.MasterAi.DetectionInfo.PriorityRangeSqr < w.MinTargetDistanceSqr) ? Localization.GetText("WeaponTargTooClose") : w.BaseComp.MasterAi.DetectionInfo.SomethingInRange ? Localization.GetText("WeaponTargRange") : Localization.GetText("WeaponTargFalse")) : string.Empty)}" + + $" {(w.ActiveAmmoDef.AmmoDef.Const.RequiresTarget ? "\n" + Localization.GetText("WeaponInfoLoS") + ": " + (w.Target.HasTarget ? "" + !w.PauseShoot : Localization.GetText("WeaponInfoNoTarget")) : string.Empty)}" + + endReturn); + } - if (HeatPerSecond > 0) - stringBuilder.Append($"\nHeat per Sec/Max: {HeatPerSecond}/{MaxHeat}" + - $"\n{Localization.GetText("WeaponInfoCurrentHeat")}: {CurrentHeat:0.} W ({(CurrentHeat / MaxHeat):P})"); + if (HeatPerSecond > 0) + stringBuilder.Append($"\n{Localization.GetText("WeaponInfoHeatPerSecOverMax")}: {HeatPerSecond}/{MaxHeat}" + + $"\n{Localization.GetText("WeaponInfoCurrentHeat")}: {CurrentHeat:0.} W ({(CurrentHeat / MaxHeat):P})"); - if (advanced) + if (advanced) + { + stringBuilder.Append($"\n\n{Localization.GetText("WeaponInfoStatsHeader")}" + + $"\n{Localization.GetText("WeaponInfoDPSLabel")}: {comp.PeakDps:0.}"); + for (int i = 0; i < collection.Count; i++) { - stringBuilder.Append($"\n\n--- Stats ---" + - $"\nDPS: {comp.PeakDps:0.}"); - for (int i = 0; i < collection.Count; i++) + var w = collection[i]; + stringBuilder.Append($" {(collection.Count > 1 ? "\n{w.FriendlyName}" : string.Empty)}" + + $"{(w.MinTargetDistance > 0 ? $"\n{Localization.GetText("WeaponInfoMinRange")}: {w.MinTargetDistance}{Localization.GetText("WeaponInfoMeter")}" : string.Empty)}" + + $"\n{Localization.GetText("WeaponInfoMaxRange")}: {w.MaxTargetDistance}{Localization.GetText("WeaponInfoMeter")}" + + $"\n{Localization.GetText("WeaponInfoROF")}: {w.ActiveAmmoDef.AmmoDef.Const.RealShotsPerMin:0.}{Localization.GetText("WeaponInfoPerMin")}"); + if(w.ActiveAmmoDef.AmmoDef.Const.RequiresTarget) { - var w = collection[i]; - stringBuilder.Append($" {(collection.Count > 1 ? "\n{w.FriendlyName}" : string.Empty)}" + - $"{(w.MinTargetDistance > 0 ? "\nMin Range: " + w.MinTargetDistance + "m" : string.Empty)}" + - $"\nMax Range: {w.MaxTargetDistance}m" + - $"\nRoF: {w.ActiveAmmoDef.AmmoDef.Const.RealShotsPerMin}/min"); - if(w.ActiveAmmoDef.AmmoDef.Const.RequiresTarget) + var targ = $"{Localization.GetText("WeaponInfoTargetLabel")}: "; + if (w.Target.HasTarget && w.Target.TargetObject != null) { - var targ = "Target: "; - if (w.Target.HasTarget && w.Target.TargetObject != null) + var pTarg = w.Target.TargetObject as Projectile; + var eTarg = w.Target.TargetObject as MyEntity; + if(pTarg != null) { - var pTarg = w.Target.TargetObject as Projectile; - var eTarg = w.Target.TargetObject as MyEntity; - if(pTarg != null) - { - targ += "Projectile"; - } - else if (eTarg != null) - { - var topEnt = eTarg.GetTopMostParent(); - var grid = topEnt as MyCubeGrid; - var suit = eTarg as IMyCharacter; - if (grid != null) - targ += topEnt.DisplayName; - else if (suit != null) - targ += suit.DisplayName; - } + targ += Localization.GetText("WeaponInfoProjectileLabel"); } - else - targ += "none"; - stringBuilder.Append($"\n{targ}"); - } - - string otherAmmo = null; - if (!comp.HasAlternateUi) - { - for (int j = 0; j < w.System.AmmoTypes.Length; j++) + else if (eTarg != null) { - var ammo = w.System.AmmoTypes[j]; - if (!ammo.AmmoDef.Const.IsTurretSelectable || string.IsNullOrEmpty(ammo.AmmoDef.AmmoRound) || ammo.AmmoDef.AmmoRound == "Energy") - continue; - - if (otherAmmo == null) - otherAmmo = "\n\nAmmo Types (Mag if different):"; - var showName = ammo.AmmoDef.Const.TerminalName != ammo.AmmoDef.Const.MagazineDef.DisplayNameText && ammo.AmmoDef.Const.MagazineDef.DisplayNameText != "Energy"; - otherAmmo += $"\n{ammo.AmmoDef.Const.TerminalName} {(showName ? "(" + ammo.AmmoDef.Const.MagazineDef.DisplayNameText + ")" : "")}"; + var topEnt = eTarg.GetTopMostParent(); + var grid = topEnt as MyCubeGrid; + var suit = eTarg as IMyCharacter; + if (grid != null) + targ += topEnt.DisplayName; + else if (suit != null) + targ += suit.DisplayName; } - - if (otherAmmo != null) - stringBuilder.Append(otherAmmo); } + else + targ += Localization.GetText("WeaponInfoNoneTarget"); + stringBuilder.Append($"\n{targ}"); } - } - /////// - - /* OLD STUFF - - if (advanced) - { - stringBuilder.Append($"\n{Localization.GetText("WeaponInfoConstructDPS")}: " + Ai.EffectiveDps.ToString("e2")) - .Append($"\n{Localization.GetText("WeaponInfoPeakDps")}: " + comp.PeakDps.ToString("0.0")) - .Append($"\n{Localization.GetText("WeaponInfoBaseDps")}: " + comp.BaseDps.ToString("0.0")) - .Append($"\n{Localization.GetText("WeaponInfoAreaDps")}: " + comp.AreaDps.ToString("0.0")) - .Append($"\n{Localization.GetText("WeaponInfoExplode")}: " + comp.DetDps.ToString("0.0")) - .Append("\n") - .Append($"\n{Localization.GetText("WeaponTotalEffect")}: " + comp.TotalEffect.ToString("e2")) - .Append($"\n " + Ai.Construct.RootAi?.Construct.TotalEffect.ToString("e2")) - .Append($"\n{Localization.GetText("WeaponTotalEffectAvgDps")}: " + comp.AverageEffect.ToString("N0") + " - (" + comp.AddEffect.ToString("N0") + ")") - .Append($"\n " + Ai.Construct.RootAi?.Construct.AverageEffect.ToString("N0") + " - (" + Ai.Construct.RootAi?.Construct.AddEffect.ToString("N0") + ")"); - } - else - { - if (!comp.HasAlternateUi) - stringBuilder.Append($"\n{Localization.GetText("WeaponInfoPeakDps")}: " + comp.PeakDps.ToString("0.0")); - } - - - if (HeatPerSecond > 0 && advanced) - stringBuilder.Append("\n__________________________________" ) - .Append($"\n{Localization.GetText("WeaponInfoHeatGenerated")}: {HeatPerSecond:0.0} W ({(HeatPerSecond / MaxHeat) :P}/s)") - .Append($"\n{Localization.GetText("WeaponInfoHeatDissipated")}: {HeatSinkRate:0.0} W ({(HeatSinkRate / MaxHeat):P}/s)") - .Append($"\n{Localization.GetText("WeaponInfoCurrentHeat")}: {CurrentHeat:0.0} J ({(CurrentHeat / MaxHeat):P})"); - - if (!comp.HasAlternateUi && advanced) - { - stringBuilder.Append(advanced ? "\n__________________________________\n" : string.Empty) - .Append($"\n{Localization.GetText("WeaponInfoShotsPerSec")}: " + comp.RealShotsPerSec.ToString("0.00"));//+ " (" + comp.ShotsPerSec.ToString("0.00") + ")") - - if(SinkPower > 0.01) - stringBuilder.Append($"\n{Localization.GetText("WeaponInfoCurrentDraw")}: " + SinkPower.ToString("0.00") + " MW"); - } - - if (comp.HasEnergyWeapon && advanced) - stringBuilder.Append($"\n{Localization.GetText("WeaponInfoRequiredPower")}: " + Platform.Structure.ActualPeakPowerCombined.ToString("0.00") + " MW"); + string otherAmmo = null; if (!comp.HasAlternateUi) - stringBuilder.Append($"\n\n{Localization.GetText("WeaponInfoDividerLineWeapon")}"); - - for (int i = 0; i < collection.Count; i++) { - var w = collection[i]; - string shots; - if ((w.ActiveAmmoDef.AmmoDef.Const.EnergyAmmo || w.ActiveAmmoDef.AmmoDef.Const.IsHybrid) && !comp.HasAlternateUi) + for (int j = 0; j < w.System.AmmoTypes.Length; j++) { - var chargeTime = w.AssignedPower > 0 ? (int)((w.MaxCharge - w.ProtoWeaponAmmo.CurrentCharge) / w.AssignedPower * MyEngineConstants.PHYSICS_STEP_SIZE_IN_SECONDS) : 0; - - shots = $"\nCharge: {(chargeTime == 0 ? "Charged" : "" + chargeTime + " s remaining" )}"; //(w.Comp.ModOverride ? "NPC Override" : w.Charging.ToString()) + (chargeTime == 0f ? " Charged" : " ("+ chargeTime+")"); - shots += "\nCurrent/Max(MW): " + (SinkPower - IdlePower).ToString("0.00") + "/" + w.ActiveAmmoDef.AmmoDef.Const.PowerPerTick.ToString("0.00"); - - if (w.ActiveAmmoDef.AmmoDef.Const.IsHybrid) shots += "\n" + w.ActiveAmmoDef.AmmoDef.AmmoRound + ": " + w.ProtoWeaponAmmo.CurrentAmmo; + var ammo = w.System.AmmoTypes[j]; + if (!ammo.AmmoDef.Const.IsTurretSelectable || string.IsNullOrEmpty(ammo.AmmoDef.AmmoRound) || ammo.AmmoDef.AmmoRound == "Energy") + continue; + + if (otherAmmo == null) + otherAmmo = $"\n\n{Localization.GetText("WeaponInfoAmmoType")}:"; + var showName = ammo.AmmoDef.Const.TerminalName != ammo.AmmoDef.Const.MagazineDef.DisplayNameText && ammo.AmmoDef.Const.MagazineDef.DisplayNameText != "Energy"; + otherAmmo += $"\n{ammo.AmmoDef.Const.TerminalName} {(showName ? "(" + ammo.AmmoDef.Const.MagazineDef.DisplayNameText + ")" : "")}"; } - else shots = "\n" + w.ActiveAmmoDef.AmmoDef.AmmoRound + ": " + w.ProtoWeaponAmmo.CurrentAmmo; - - var burst = advanced && w.ActiveAmmoDef.AmmoDef.Const.BurstMode && w.System.ShotsPerBurst > 1 && !comp.HasAlternateUi ? $"\nShootMode: " + w.ShotsFired + "(" + w.System.ShotsPerBurst + $") - {Localization.GetText("WeaponInfoDelay")}: " + w .System.Values.HardPoint.Loading.DelayAfterBurst : string.Empty; - - var endReturn = i + 1 != collection.Count ? "\n" : string.Empty; - - if (!comp.HasAlternateUi) - stringBuilder.Append($"\n{Localization.GetText("WeaponInfoName")}: " + w.System.PartName + shots + burst + - $" {(w.ActiveAmmoDef.AmmoDef.Const.RequiresTarget ? "\n" + Localization.GetText("WeaponInfoHasTarget") + ": " + w.Target.HasTarget.ToString() : "")}" + // \n{Localization.GetText("WeaponInfoHasTarget")}: " + (w.ActiveAmmoDef.AmmoDef.Const.RequiresTarget ? w.Target.HasTarget.ToString() : "n/a") + - $"\n{Localization.GetText("WeaponInfoReloading")}: " + w.Loading + - $" {(w.ActiveAmmoDef.AmmoDef.Const.RequiresTarget ? "\n" + Localization.GetText("WeaponInfoLoS") + ": " + !w.PauseShoot : "")}" + - endReturn); - else - stringBuilder.Append($"\n{Localization.GetText("WeaponInfoName")}: " + w.System.PartName + (w.Target.HasTarget ? $"\n{Localization.GetText("WeaponInfoTargetState")}: " + w.Target.CurrentState : string.Empty)); - - string otherAmmo = null; - if (!comp.HasAlternateUi) - { - for (int j = 0; j < w.System.AmmoTypes.Length; j++) - { - var ammo = w.System.AmmoTypes[j]; - if (ammo == w.ActiveAmmoDef || !ammo.AmmoDef.Const.IsTurretSelectable || string.IsNullOrEmpty(ammo.AmmoDef.AmmoRound) || ammo.AmmoDef.AmmoRound == "Energy") - continue; - - if (otherAmmo == null) - otherAmmo = "\n\nAlternate Magazines:"; - - otherAmmo += $"\n{ammo.AmmoDef.AmmoRound}"; - } - - if (otherAmmo != null) - stringBuilder.Append(otherAmmo); - } + if (otherAmmo != null) + stringBuilder.Append(otherAmmo); } - - if (advanced) - { - foreach (var weapon in collection) - { - var chargeTime = weapon.AssignedPower > 0 ? (int)((weapon.MaxCharge - weapon.ProtoWeaponAmmo.CurrentCharge) / weapon.AssignedPower * MyEngineConstants.PHYSICS_STEP_SIZE_IN_SECONDS) : 0; - stringBuilder.Append($"\n\nWeapon: {weapon.System.PartName} - Enabled: {IsWorking}"); - stringBuilder.Append($"\nTargetState: {weapon.Target.CurrentState} - Manual: {weapon.BaseComp.UserControlled || weapon.Target.TargetState == Target.TargetStates.IsFake}"); - stringBuilder.Append($"\nEvent: {weapon.LastEvent} - ProtoWeaponAmmo :{!weapon.NoMagsToLoad}"); - stringBuilder.Append($"\nOverHeat: {weapon.PartState.Overheated} - Shooting: {weapon.IsShooting}"); - stringBuilder.Append($"\nisAligned: {weapon.Target.IsAligned}"); - stringBuilder.Append($"\nCanShoot: {weapon.ShotReady} - Charging: {weapon.Charging}"); - stringBuilder.Append($"\nAiShooting: {weapon.AiShooting}"); - stringBuilder.Append($"\n{(weapon.ActiveAmmoDef.AmmoDef.Const.EnergyAmmo ? "ChargeSize: " + weapon.ActiveAmmoDef.AmmoDef.Const.ChargSize : "MagSize: " + weapon.ActiveAmmoDef.AmmoDef.Const.MagazineSize)} ({weapon.ProtoWeaponAmmo.CurrentCharge})"); - stringBuilder.Append($"\nChargeTime: {chargeTime}"); - stringBuilder.Append($"\nCharging: {weapon.Charging}({weapon.ActiveAmmoDef.AmmoDef.Const.MustCharge})"); - } - } - */ + } } - catch (Exception ex) { Log.Line($"Exception in Weapon AppendingCustomInfo: {ex}", null, true); } } private List SortAndGetTargetTypes() diff --git a/Data/Scripts/CoreSystems/EntityComp/EntityInit.cs b/Data/Scripts/CoreSystems/EntityComp/EntityInit.cs index 34807914..0bb1d80b 100644 --- a/Data/Scripts/CoreSystems/EntityComp/EntityInit.cs +++ b/Data/Scripts/CoreSystems/EntityComp/EntityInit.cs @@ -1,10 +1,6 @@ -using System; -using CoreSystems.Platform; +using CoreSystems.Platform; using Sandbox.Game; -using Sandbox.Game.Entities; using Sandbox.ModAPI; -using VRage; -using VRage.Game.ModAPI; using static CoreSystems.CompData; namespace CoreSystems.Support { diff --git a/Data/Scripts/CoreSystems/EntityComp/EntityRun.cs b/Data/Scripts/CoreSystems/EntityComp/EntityRun.cs index 35b6641b..8aca676d 100644 --- a/Data/Scripts/CoreSystems/EntityComp/EntityRun.cs +++ b/Data/Scripts/CoreSystems/EntityComp/EntityRun.cs @@ -1,5 +1,4 @@ -using System; -using CoreSystems.Platform; +using CoreSystems.Platform; using Sandbox.Game.Entities; using Sandbox.ModAPI; using VRage.Game.Components; @@ -227,7 +226,10 @@ internal void OnAddedToSceneTasks(bool firstRun) foreach (var weapon in Platform.Weapons) { var scopeInfo = weapon.GetScope.Info; - if (!obb.Contains(ref scopeInfo.Position)) + + if (weapon.Comp.PrimaryWeapon.System.AllowScopeOutsideObb) + weapon.ScopeDistToCheckPos = 0; + else if (!obb.Contains(ref scopeInfo.Position)) { var rayBack = new RayD(scopeInfo.Position, -scopeInfo.Direction); weapon.ScopeDistToCheckPos = obb.Intersects(ref rayBack) ?? 0; diff --git a/Data/Scripts/CoreSystems/EntityComp/EntityState.cs b/Data/Scripts/CoreSystems/EntityComp/EntityState.cs index 53a417f6..d43248c7 100644 --- a/Data/Scripts/CoreSystems/EntityComp/EntityState.cs +++ b/Data/Scripts/CoreSystems/EntityComp/EntityState.cs @@ -1,9 +1,7 @@ -using System; -using CoreSystems.Platform; +using CoreSystems.Platform; using Sandbox.Game.Entities; using VRage.Game.Entity; using static CoreSystems.Support.WeaponDefinition.AnimationDef.PartAnimationSetDef; -using static VRage.Game.ObjectBuilders.Definitions.MyObjectBuilder_GameDefinition; namespace CoreSystems.Support { @@ -59,47 +57,42 @@ internal void WakeupComp() internal void SubpartClosed(MyEntity ent) { - try + if (ent == null) { - if (ent == null) - { - Log.Line($"SubpartClosed had null entity"); - return; - } + Log.Line($"SubpartClosed had null entity"); + return; + } - using (CoreEntity.Pin()) + using (CoreEntity.Pin()) + { + ent.OnClose -= SubpartClosed; + if (!CoreEntity.MarkedForClose && Platform.State == CorePlatform.PlatformState.Ready) { - ent.OnClose -= SubpartClosed; - if (!CoreEntity.MarkedForClose && Platform.State == CorePlatform.PlatformState.Ready) + if (Type == CompType.Weapon) + Platform.ResetParts(); + Status = Start.Started; + + foreach (var w in Platform.Weapons) { - if (Type == CompType.Weapon) - Platform.ResetParts(); - Status = Start.Started; + w.Azimuth = 0; + w.Elevation = 0; + w.Elevation = 0; + + if (w.ActiveAmmoDef.AmmoDef.Const.MustCharge) + w.ExitCharger = true; - foreach (var w in Platform.Weapons) + if (!FunctionalBlock.Enabled) + w.EventTriggerStateChanged(EventTriggers.TurnOff, true); + else if (w.AnimationsSet.ContainsKey(EventTriggers.TurnOn)) + Session.I.FutureEvents.Schedule(w.TurnOnAV, null, 100); + + if (w.ProtoWeaponAmmo.CurrentAmmo == 0) { - w.Azimuth = 0; - w.Elevation = 0; - w.Elevation = 0; - - if (w.ActiveAmmoDef.AmmoDef.Const.MustCharge) - w.ExitCharger = true; - - if (!FunctionalBlock.Enabled) - w.EventTriggerStateChanged(EventTriggers.TurnOff, true); - else if (w.AnimationsSet.ContainsKey(EventTriggers.TurnOn)) - Session.I.FutureEvents.Schedule(w.TurnOnAV, null, 100); - - if (w.ProtoWeaponAmmo.CurrentAmmo == 0) - { - w.EventTriggerStateChanged(EventTriggers.EmptyOnGameLoad, true); - } + w.EventTriggerStateChanged(EventTriggers.EmptyOnGameLoad, true); } } } } - catch (Exception ex) { Log.Line($"Exception in SubpartClosed: {ex}", null, true); - } } internal void ForceClose(object o) diff --git a/Data/Scripts/CoreSystems/EntityComp/EntitySupport.cs b/Data/Scripts/CoreSystems/EntityComp/EntitySupport.cs index d5e2a4c6..f44f2830 100644 --- a/Data/Scripts/CoreSystems/EntityComp/EntitySupport.cs +++ b/Data/Scripts/CoreSystems/EntityComp/EntitySupport.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.ObjectModel; using CoreSystems.Platform; using Sandbox.Game.Entities; using Sandbox.ModAPI.Weapons; diff --git a/Data/Scripts/CoreSystems/EntityComp/ModelSupport/RecursiveSubparts.cs b/Data/Scripts/CoreSystems/EntityComp/ModelSupport/RecursiveSubparts.cs index b60a690f..6367f1cf 100644 --- a/Data/Scripts/CoreSystems/EntityComp/ModelSupport/RecursiveSubparts.cs +++ b/Data/Scripts/CoreSystems/EntityComp/ModelSupport/RecursiveSubparts.cs @@ -5,7 +5,6 @@ using VRage.Game.Entity; using VRage.Game.ModAPI; using VRage.ModAPI; -using VRage.Utils; using VRageMath; namespace CoreSystems.Support diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlComp.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlComp.cs index 99ef6403..cda70389 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlComp.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlComp.cs @@ -7,7 +7,6 @@ using VRage.Game.Entity; using VRage.Utils; using VRageMath; -using static VRage.Game.ObjectBuilders.Definitions.MyObjectBuilder_GameDefinition; namespace CoreSystems.Platform { diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlData.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlData.cs index 7f3bc9f9..3c4e489a 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlData.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlData.cs @@ -2,7 +2,6 @@ using CoreSystems.Support; using Sandbox.ModAPI; using VRageMath; -using static VRage.Game.ObjectBuilders.Definitions.MyObjectBuilder_GameDefinition; namespace CoreSystems.Platform { @@ -91,7 +90,7 @@ internal bool ValidFakeTargetInfo(long playerId, out Ai.FakeTarget.FakeWorldTarg if (Session.I.PlayerDummyTargets.TryGetValue(playerId, out fakeTargets)) { var validManual = Comp.Data.Repo.Values.Set.Overrides.Control == ProtoWeaponOverrides.ControlModes.Manual && Comp.Data.Repo.Values.State.TrackingReticle && fakeTargets.ManualTarget.FakeInfo.WorldPosition != Vector3D.Zero; - var validPainter = Comp.Data.Repo.Values.Set.Overrides.Control == ProtoWeaponOverrides.ControlModes.Painter && fakeTargets.PaintedTarget.LocalPosition != Vector3D.Zero; + var validPainter = !Session.I.Settings.Enforcement.ProhibitHUDPainter && Comp.Data.Repo.Values.Set.Overrides.Control == ProtoWeaponOverrides.ControlModes.Painter && fakeTargets.PaintedTarget.LocalPosition != Vector3D.Zero; var fakeTarget = validPainter && preferPainted ? fakeTargets.PaintedTarget : validManual ? fakeTargets.ManualTarget : null; if (fakeTarget == null) return false; diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlFields.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlFields.cs index 66a55d8e..4cb86b71 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlFields.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlFields.cs @@ -1,6 +1,5 @@ using CoreSystems.Support; using Sandbox.ModAPI; -using System.Runtime.Remoting.Metadata.W3cXsd2001; using VRage.Utils; using VRageMath; diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlTracking.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlTracking.cs index b20d8583..93ad2e3a 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlTracking.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Control/ControlTracking.cs @@ -64,7 +64,13 @@ internal static bool TrajectoryEstimation(ControlSys control, out Vector3D targe var maxRangeSqr = fakeTargetInfo != null && topAi.Construct.RootAi != null ? topAi.Construct.RootAi.MaxTargetingRangeSqr : cValues.Set.Range * cValues.Set.Range; bool valid; - topAi.RotorTargetPosition = Weapon.TrajectoryEstimation(weapon, targetCenter, targetVel, targetAcc, shooterPos, out valid, false, cValues.Set.Overrides.AngularTracking); + if (weapon.ActiveAmmoDef.AmmoDef.Const.IsBeamWeapon) + { + valid = true; + topAi.RotorTargetPosition = targetCenter; + } + else + topAi.RotorTargetPosition = Weapon.TrajectoryEstimation(weapon, targetCenter, targetVel, targetAcc, shooterPos, out valid, false, cValues.Set.Overrides.AngularTracking); targetDirection = Vector3D.Normalize(topAi.RotorTargetPosition - shooterPos); return valid && Vector3D.DistanceSquared(topAi.RotorTargetPosition, shooterPos) < maxRangeSqr; } diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/PartFields.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/PartFields.cs index 4daf36ff..4641041e 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/PartFields.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/PartFields.cs @@ -1,14 +1,9 @@ -using System; -using System.Collections.Generic; -using CoreSystems.Support; -using VRageMath; +using CoreSystems.Support; namespace CoreSystems.Platform { public partial class Part { - //internal readonly List> Monitors = new List>(); - internal CoreComponent BaseComp; internal CoreSystem CoreSystem; internal PartAcquire Acquire; @@ -40,8 +35,6 @@ internal void Init(CoreComponent comp, CoreSystem system, int partId) Acquire = new PartAcquire(this); UniquePartId = Session.I.UniquePartId; ShortLoadId = Session.I.ShortLoadAssigner(); - //for (int i = 0; i < BaseComp.Monitors[PartId].Count; i++) - // Monitors.Add(BaseComp.Monitors[PartId][i]); } diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Support/SupportCharge.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Support/SupportCharge.cs index 99cadf0c..af5bd09c 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Support/SupportCharge.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Support/SupportCharge.cs @@ -1,6 +1,4 @@ -using Sandbox.Game.Entities; - -namespace CoreSystems.Platform +namespace CoreSystems.Platform { public partial class SupportSys { diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Support/SupportComp.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Support/SupportComp.cs index ff6d30a3..158e3362 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Support/SupportComp.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Support/SupportComp.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CoreSystems.Support; -using Sandbox.Game.Entities; using VRage.Game; using VRage.Game.Entity; diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Support/SupportMisc.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Support/SupportMisc.cs index 89d33059..114dcaed 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Support/SupportMisc.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Support/SupportMisc.cs @@ -1,5 +1,4 @@ using System.Collections.Concurrent; -using Sandbox.Game.Entities; using VRage.Game.ModAPI; using static CoreSystems.Support.SupportDefinition.SupportEffect.Protections; diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Upgrade/UpgradeComp.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Upgrade/UpgradeComp.cs index 27ffb003..818049ee 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Upgrade/UpgradeComp.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Upgrade/UpgradeComp.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CoreSystems.Support; -using Sandbox.Game.Entities; using VRage.Game; using VRage.Game.Entity; diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponAv.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponAv.cs index 8da79651..f1ca7056 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponAv.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponAv.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using CoreSystems.Support; -using Sandbox.ModAPI; using VRage.Game; using VRageMath; using static CoreSystems.Support.PartAnimation; diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponComp.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponComp.cs index 857d9c9b..a0a2bb6a 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponComp.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponComp.cs @@ -9,7 +9,6 @@ using Sandbox.ModAPI.Weapons; using VRage.Game; using VRage.Game.Entity; -using VRage.Game.ModAPI; using VRage.ModAPI; using VRage.ObjectBuilders; using VRage.Utils; @@ -59,6 +58,7 @@ public partial class WeaponComponent : CoreComponent internal bool HasDisabledBurst; internal bool HasRofSlider; internal bool ShootSubmerged; + internal bool TargetSubmerged; internal bool HasTracking; internal bool HasRequireTarget; internal bool HasDrone; @@ -425,7 +425,6 @@ internal void DetectStateChanges(bool masterChange) Ai.DetectOtherSignals = true; var wasAsleep = IsAsleep; IsAsleep = false; - //IsDisabled = Ai.TouchingWater && !ShootSubmerged && Ai.WaterVolume.Contains(CoreEntity.PositionComp.WorldAABB.Center) != ContainmentType.Disjoint; //submerged wep check if (Ai.TouchingWater && !ShootSubmerged) { var projectedPos = CoreEntity.PositionComp.WorldAABB.Center + (Vector3D.Normalize(CoreEntity.PositionComp.WorldVolume.Center- Ai.ClosestPlanetCenter) * CoreEntity.PositionComp.WorldVolume.Radius); diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponController.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponController.cs index ca7a7fb5..d1692ff5 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponController.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponController.cs @@ -1,11 +1,9 @@ using System; using CoreSystems.Support; -using VRage.Game.Entity; using VRage.Utils; using VRageMath; using static CoreSystems.Support.WeaponDefinition.AnimationDef.PartAnimationSetDef; using static CoreSystems.Support.CoreComponent; -using static VRage.Game.ObjectBuilders.Definitions.MyObjectBuilder_GameDefinition; namespace CoreSystems.Platform { @@ -257,79 +255,75 @@ internal void UpdatePivotPos() internal void UpdateWeaponHeat(object o = null) { - try + if (!System.ProhibitCoolingWhenOff || System.ProhibitCoolingWhenOff && Comp.Cube.IsWorking) { - if (!System.ProhibitCoolingWhenOff || System.ProhibitCoolingWhenOff && Comp.Cube.IsWorking) - { - var hsRateMod = HsRate + (float)Comp.HeatLoss; - Comp.CurrentHeat = Comp.CurrentHeat >= hsRateMod ? Comp.CurrentHeat - hsRateMod : 0; - PartState.Heat = PartState.Heat >= hsRateMod ? PartState.Heat - hsRateMod : 0; - Comp.HeatLoss = 0; - } - - var set = PartState.Heat - LastHeat > 0.001 || PartState.Heat - LastHeat < 0.001; - - LastHeatUpdateTick = Session.I.Tick; + var hsRateMod = HsRate + (float)Comp.HeatLoss; + Comp.CurrentHeat = Comp.CurrentHeat >= hsRateMod ? Comp.CurrentHeat - hsRateMod : 0; + PartState.Heat = PartState.Heat >= hsRateMod ? PartState.Heat - hsRateMod : 0; + Comp.HeatLoss = 0; + } - if (!Session.I.DedicatedServer) - { - var heatOffset = HeatPerc = PartState.Heat / System.MaxHeat; + var set = PartState.Heat - LastHeat > 0.001 || PartState.Heat - LastHeat < 0.001; - if (set && heatOffset > .33) - { - if (heatOffset > 1) heatOffset = 1; + LastHeatUpdateTick = Session.I.Tick; - heatOffset -= .33f; + if (!Session.I.DedicatedServer) + { + var heatOffset = HeatPerc = PartState.Heat / System.MaxHeat; - var intensity = .7f * heatOffset; + if (set && heatOffset > .33) + { + if (heatOffset > 1) heatOffset = 1; - var color = Session.I.HeatEmissives[(int)(heatOffset * 100)]; + heatOffset -= .33f; - for(int i = 0; i < HeatingParts.Count; i++) - HeatingParts[i]?.SetEmissiveParts("Heating", color, intensity); - } - else if (set) - for(int i = 0; i < HeatingParts.Count; i++) - HeatingParts[i]?.SetEmissiveParts("Heating", Color.Transparent, 0); + var intensity = .7f * heatOffset; - LastHeat = PartState.Heat; - } + var color = Session.I.HeatEmissives[(int)(heatOffset * 100)]; - if (set && System.DegRof && PartState.Heat >= (System.MaxHeat * .8)) - { - CurrentlyDegrading = true; - UpdateRof(); + for(int i = 0; i < HeatingParts.Count; i++) + HeatingParts[i]?.SetEmissiveParts("Heating", color, intensity); } - else if (set && CurrentlyDegrading) - { - if (PartState.Heat <= (System.MaxHeat * .4)) - CurrentlyDegrading = false; + else if (set) + for(int i = 0; i < HeatingParts.Count; i++) + HeatingParts[i]?.SetEmissiveParts("Heating", Color.Transparent, 0); - UpdateRof(); - } + LastHeat = PartState.Heat; + } - if (PartState.Overheated && PartState.Heat <= (System.MaxHeat * System.WepCoolDown)) - { - EventTriggerStateChanged(EventTriggers.Overheated, false); - if (Session.I.IsServer) - { - PartState.Overheated = false; - OverHeatCountDown = 0; - if (Session.I.MpActive) - Session.I.SendState(Comp); - } + if (set && System.DegRof && PartState.Heat >= (System.MaxHeat * .8)) + { + CurrentlyDegrading = true; + UpdateRof(); + } + else if (set && CurrentlyDegrading) + { + if (PartState.Heat <= (System.MaxHeat * .4)) + CurrentlyDegrading = false; - } + UpdateRof(); + } - if (PartState.Heat > 0) - Session.I.FutureEvents.Schedule(UpdateWeaponHeat, null, 20); - else + if (PartState.Overheated && PartState.Heat <= (System.MaxHeat * System.WepCoolDown)) + { + EventTriggerStateChanged(EventTriggers.Overheated, false); + if (Session.I.IsServer) { - HeatLoopRunning = false; - LastHeatUpdateTick = 0; + PartState.Overheated = false; + OverHeatCountDown = 0; + if (Session.I.MpActive) + Session.I.SendState(Comp); } + + } + + if (PartState.Heat > 0) + Session.I.FutureEvents.Schedule(UpdateWeaponHeat, null, 20); + else + { + HeatLoopRunning = false; + LastHeatUpdateTick = 0; } - catch (Exception ex) { Log.Line($"Exception in UpdateWeaponHeat: {ex} - {System == null}- BaseComp:{Comp == null} - ProtoRepo:{Comp?.Data.Repo == null} - Weapons:{Comp.Data.Repo?.Values.State.Weapons[PartId] == null}", null, true); } } internal void UpdateRof() diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponData.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponData.cs index 69b10782..09846e84 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponData.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponData.cs @@ -137,7 +137,20 @@ internal void Load() ProtoRepoBase = Repo; if (Comp.TypeSpecific == CoreComponent.CompTypeSpecific.Rifle) Comp.AmmoStorage(true); - + else if (Comp.TypeSpecific != CoreComponent.CompTypeSpecific.Phantom && Comp.Cube != null && Session.I.IsServer && !Session.I.IsCreative && Comp.Cube.BlockDefinition.Id.SubtypeName == "LargeInteriorTurret") //"NPCLargeInteriorTurret" + { + var wep = collection[0]; + if (wep.System.AmmoTypes.Length == 2) + foreach (var item in wep.BaseComp.CoreInventory.GetItems()) + { + if (wep.System.AmmoTypes[wep.Reload.AmmoTypeId].AmmoDef.AmmoMagazine == item.Content.SubtypeName) + break; + else if (item.Content.SubtypeName == "NATO_5p56x45mm") + wep.ProposedAmmoId = 1; + else if (item.Content.SubtypeName == "RapidFireAutomaticRifleGun_Mag_50rd") + wep.ProposedAmmoId = 0; + } + } } internal void Change(DataState state) diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponFields.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponFields.cs index c90215cc..4c2bad87 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponFields.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponFields.cs @@ -2,25 +2,19 @@ using System.Collections.Generic; using CoreSystems.Projectiles; using CoreSystems.Support; -using Sandbox.Definitions; using Sandbox.Game.Entities; -using Sandbox.Game.Lights; using VRage.Game; using VRage.Game.Entity; using VRage.Game.ModAPI; -using VRage.ObjectBuilders; using VRage.Utils; using VRageMath; -using VRageRender.Lights; using static CoreSystems.Session; using static CoreSystems.Support.WeaponDefinition.AnimationDef.PartAnimationSetDef; -using static VRage.Game.ObjectBuilders.Definitions.MyObjectBuilder_GameDefinition; namespace CoreSystems.Platform { public partial class Weapon : Part { - internal volatile bool Casting; private readonly int _numOfMuzzles; private readonly int _numModelBarrels; private readonly HashSet _muzzlesToFire = new HashSet(); @@ -120,9 +114,6 @@ public partial class Weapon : Part internal Matrix[] BarrelRotationPerShot = new Matrix[10]; internal string FriendlyName = string.Empty; - internal string FriendlyNameNoAmmo = string.Empty; - internal string FriendlyNameNoTarget = string.Empty; - internal string FriendlyNameNoSubsystem = string.Empty; internal string AmmoName = ""; internal string AmmoNameTerminal = ""; @@ -235,6 +226,7 @@ public partial class Weapon : Part internal bool PlayingHardPointSound; internal bool VanillaTracking; internal bool RotorTurretTracking; + internal bool RotorTurretSlaving; internal bool ShotReady { @@ -274,6 +266,7 @@ internal Weapon(MyEntity entity, WeaponSystem system, int partId, WeaponComponen if (c.MustCharge) CanUseChargeAmmo = true; if (c.IsBeamWeapon) CanUseBeams = true; if (c.HitParticle) hitParticle = true; + if (c.ShieldHitParticle) hitParticle = true; } comp.HasEnergyWeapon = comp.HasEnergyWeapon || CanUseEnergyAmmo || CanUseHybridAmmo; @@ -437,88 +430,8 @@ internal Weapon(MyEntity entity, WeaponSystem system, int partId, WeaponComponen if (System.HasAntiSmart) Session.I.AntiSmartActive = true; - - if (Session.I.HandlesInput && Comp.IsBlock) - { - //InitLight(Color.Red, 99, 1, out Light); - } - } - - private void InitLight(Vector4 color, float radius, float falloff, out MyLight light) - { - var cube = Comp.Cube; - - light = new MyLight(); - light.Start(color, cube.CubeGrid.GridScale * radius, cube.DisplayNameText); - light.ReflectorOn = true; - light.LightType = MyLightType.SPOTLIGHT; - light.ReflectorTexture = @"Textures\Lights\reflector_large.dds"; ; - light.Falloff = 0.3f; - light.GlossFactor = 0.0f; - light.ReflectorGlossFactor = 1f; - light.ReflectorFalloff = 0.5f; - light.GlareOn = light.LightOn; - light.GlareQuerySize = GlareQuerySizeDef; - light.GlareType = MyGlareTypeEnum.Directional; - light.GlareSize = _flare.Size; - light.SubGlares = _flare.SubGlares; - - //light.ReflectorIntensity = 10f; - //light.ReflectorRange = 100; // how far the projected light goes - //light.ReflectorConeDegrees = 90; // projected light angle in degrees, max 179. - //light.CastShadows = true; - - - cube.Render.NeedsDrawFromParent = true; - light.Position = Scope.Info.Position + (Scope.Info.Direction * 1); - light.UpdateLight(); - - //light.GlareSize = new Vector2(1, 1); // glare size in X and Y. - //light.GlareIntensity = 2; - //light.GlareMaxDistance = 50; - //light.SubGlares = GetFlareDefinition("InteriorLight").SubGlares; // subtype name from flares.sbc - //light.GlareType = MyGlareTypeEnum.Normal; // usable values: MyGlareTypeEnum.Normal, MyGlareTypeEnum.Distant, MyGlareTypeEnum.Directional - //light.GlareQuerySize = 0.5f; // glare "box" size, affects occlusion and fade occlussion - //light.GlareQueryShift = 1f; // no idea - //light.ParentID = cube.Render.GetRenderObjectID(); - //this.UpdateIntensity(); } - - public static MyFlareDefinition GetFlareDefinition(string flareSubtypeId) - { - if (string.IsNullOrEmpty(flareSubtypeId)) - throw new ArgumentException("flareSubtypeId must not be null or empty!"); - var flareDefId = new MyDefinitionId(typeof(MyObjectBuilder_FlareDefinition), flareSubtypeId); - var flareDef = MyDefinitionManager.Static.GetDefinition(flareDefId) as MyFlareDefinition; - - if (flareDef == null) - throw new Exception($"Couldn't find flare subtype {flareSubtypeId}"); - - return flareDef; - } - - private readonly MyFlareDefinition _flare = new MyFlareDefinition() ; - private float GlareQuerySizeDef => Comp.Cube.CubeGrid.GridScale * (true ? 0.5f : 0.1f); - - /* - private void UpdateIntensity() - { - float num1 = this.m_lightingLogic.CurrentLightPower * this.m_lightingLogic.Intensity; - foreach (MyLight light in this.m_lightingLogic.Lights) - { - light.ReflectorIntensity = num1 * 8f; - light.Intensity = num1 * 0.3f; - float num2 = num1 / this.m_lightingLogic.IntensityBounds.Max; - float num3 = this.m_flare.Intensity * num1; - if (num3 < (double)this.m_flare.Intensity) - num3 = this.m_flare.Intensity; - light.GlareIntensity = num3; - light.GlareSize = this.m_flare.Size * (float)((double)num2 / 2.0 + 0.5); - this.m_lightingLogic.BulbColor = this.m_lightingLogic.ComputeBulbColor(); - } - } - */ private void FuckMyLife() { var azPartMatrix = AzimuthPart.Entity.PositionComp.LocalMatrixRef; diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponHand.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponHand.cs index 6b835fd1..22dcc127 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponHand.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponHand.cs @@ -1,5 +1,4 @@ -using CoreSystems.Projectiles; -using CoreSystems.Support; +using CoreSystems.Support; using Sandbox.Common.ObjectBuilders; using Sandbox.Game.Entities; using Sandbox.Game.Entities.Character.Components; diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponReload.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponReload.cs index f6daf7f2..d4e45f06 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponReload.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponReload.cs @@ -1,5 +1,6 @@ using System; using CoreSystems.Support; +using VRage.Game.Entity; using VRage.Utils; using static CoreSystems.Support.CoreComponent; using static CoreSystems.Support.WeaponDefinition.AnimationDef.PartAnimationSetDef; @@ -255,35 +256,31 @@ internal bool ServerReload() ++ClientStartId; ++Reload.LifetimeLoads; - if (!ActiveAmmoDef.AmmoDef.Const.EnergyAmmo) { - + if (!ActiveAmmoDef.AmmoDef.Const.EnergyAmmo) + { var isPhantom = Comp.TypeSpecific == CompTypeSpecific.Phantom; Reload.MagsLoaded = ActiveAmmoDef.AmmoDef.Const.MagsToLoad <= Reload.CurrentMags || Session.I.IsCreative ? ActiveAmmoDef.AmmoDef.Const.MagsToLoad : Reload.CurrentMags; - - if (!Session.I.IsCreative) + + if (!Session.I.IsCreative && !isPhantom) { - if (!isPhantom && Comp.CoreInventory.ItemsCanBeRemoved(Reload.MagsLoaded, ActiveAmmoDef.AmmoDef.Const.AmmoItem)) + if (Comp.CoreInventory.ItemsCanBeRemoved(Reload.MagsLoaded, ActiveAmmoDef.AmmoDef.Const.AmmoItem)) { - if (System.HasAmmoSelection) { - var magItem = Comp.CoreInventory.FindItem(ActiveAmmoDef.AmmoDefinitionId) ?? ActiveAmmoDef.AmmoDef.Const.AmmoItem; - Comp.CoreInventory.RemoveItems(magItem.ItemId, Reload.MagsLoaded); - } + MyPhysicalInventoryItem magItem; + if (System.HasAmmoSelection) + magItem = Comp.CoreInventory.FindItem(ActiveAmmoDef.AmmoDefinitionId) ?? ActiveAmmoDef.AmmoDef.Const.AmmoItem; else - { - var magItem = Comp.TypeSpecific == CompTypeSpecific.Rifle ? Comp.CoreInventory.FindItem(ActiveAmmoDef.AmmoDefinitionId) ?? ActiveAmmoDef.AmmoDef.Const.AmmoItem : ActiveAmmoDef.AmmoDef.Const.AmmoItem; - Comp.CoreInventory.RemoveItems(magItem.ItemId, Reload.MagsLoaded); - } + magItem = Comp.TypeSpecific == CompTypeSpecific.Rifle ? Comp.CoreInventory.FindItem(ActiveAmmoDef.AmmoDefinitionId) ?? ActiveAmmoDef.AmmoDef.Const.AmmoItem : ActiveAmmoDef.AmmoDef.Const.AmmoItem; + Comp.CoreInventory.RemoveItems(magItem.ItemId, Reload.MagsLoaded); } - else if (!isPhantom && Comp.CoreInventory.ItemCount > 0 && Comp.CoreInventory.ContainItems(Reload.MagsLoaded, ActiveAmmoDef.AmmoDef.Const.AmmoItem.Content)) - { + else if (Comp.CoreInventory.ItemCount > 0 && Comp.CoreInventory.ContainItems(Reload.MagsLoaded, ActiveAmmoDef.AmmoDef.Const.AmmoItem.Content)) Comp.CoreInventory.Remove(ActiveAmmoDef.AmmoDef.Const.AmmoItem, Reload.MagsLoaded); - } } - Reload.CurrentMags = !isPhantom ? Comp.CoreInventory.GetItemAmount(ActiveAmmoDef.AmmoDefinitionId).ToIntSafe() : Reload.CurrentMags - Reload.MagsLoaded; if (Reload.CurrentMags == 0) CheckInventorySystem = true; } + else + Reload.MagsLoaded = ActiveAmmoDef.AmmoDef.Const.MagsToLoad; StartReload(); return true; diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponShoot.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponShoot.cs index f3acec35..f89020c1 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponShoot.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponShoot.cs @@ -360,7 +360,7 @@ private void GiveUpTarget() private void OverHeat() { - if (!Session.I.IsClient && Comp.Data.Repo.Values.Set.Overload > 1) + if (Session.I.IsServer && Comp.Data.Repo.Values.Set.Overload > 1) { var dmg = .02f * Comp.MaxIntegrity; Comp.Slim.DoDamage(dmg, MyDamageType.Environment, true, null, Comp.TopEntity.EntityId); diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponState.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponState.cs index b8263607..d3e884b0 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponState.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponState.cs @@ -1,5 +1,4 @@ using System; -using CoreSystems.Projectiles; using System.Collections.Generic; using CoreSystems.Support; using Sandbox.Game.Entities; @@ -53,7 +52,7 @@ internal bool ValidFakeTargetInfo(long playerId, out Ai.FakeTarget.FakeWorldTarg if (Session.I.PlayerDummyTargets.TryGetValue(playerId, out fakeTargets)) { var validManual = Comp.Data.Repo.Values.Set.Overrides.Control == ProtoWeaponOverrides.ControlModes.Manual && Comp.Data.Repo.Values.State.TrackingReticle && fakeTargets.ManualTarget.FakeInfo.WorldPosition != Vector3D.Zero; - var validPainter = Comp.Data.Repo.Values.Set.Overrides.Control == ProtoWeaponOverrides.ControlModes.Painter && fakeTargets.PaintedTarget.LocalPosition != Vector3D.Zero; + var validPainter = !Session.I.Settings.Enforcement.ProhibitHUDPainter && Comp.Data.Repo.Values.Set.Overrides.Control == ProtoWeaponOverrides.ControlModes.Painter && fakeTargets.PaintedTarget.LocalPosition != Vector3D.Zero; var fakeTarget = validPainter && preferPainted ? fakeTargets.PaintedTarget : validManual ? fakeTargets.ManualTarget : null; if (fakeTarget == null) { @@ -461,15 +460,7 @@ internal Vector3D PbRandomizePredictedPosition(Vector3D predictedPos) return predictedPos + _cachedPredictedOffset; } - internal enum FriendlyNames - { - Normal, - NoAmmo, - NoSubSystems, - NoTarget, - } - - internal string UpdateAndGetFriendlyName(FriendlyNames type) + internal void UpdateAndGetFriendlyName() { string weaponName; @@ -482,28 +473,12 @@ internal string UpdateAndGetFriendlyName(FriendlyNames type) update = !weaponName.Equals(FriendlyName); } else - { weaponName = System.ShortName; - } if (update) { - FriendlyName = weaponName; - FriendlyNameNoTarget = weaponName + Hud.NoTargetStr; - FriendlyNameNoAmmo = weaponName + Hud.NoAmmoStr; - FriendlyNameNoSubsystem = weaponName + Hud.NoSubSystemStr; - } - - switch (type) - { - case FriendlyNames.NoAmmo: - return FriendlyNameNoAmmo; - case FriendlyNames.NoTarget: - return FriendlyNameNoTarget; - case FriendlyNames.NoSubSystems: - return FriendlyNameNoSubsystem; - default: - return FriendlyName; + var nameLen = weaponName.Length; + FriendlyName = nameLen > 30 ? weaponName.Remove(30, nameLen - 30) : weaponName; } } } diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponTracking.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponTracking.cs index de611a88..590f9580 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponTracking.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponTracking.cs @@ -14,7 +14,6 @@ using static CoreSystems.Support.WeaponDefinition.AnimationDef.PartAnimationSetDef; using CollisionLayers = Sandbox.Engine.Physics.MyPhysics.CollisionLayers; using static CoreSystems.Support.MathFuncs; -using VRage.Game.ObjectBuilders.Components; namespace CoreSystems.Platform { @@ -128,20 +127,9 @@ internal static void LeadTarget(Weapon weapon, MyEntity target, out Vector3D tar obb.Center = targetPos; weapon.TargetBox = obb; - - //var obbAbsMax = obb.HalfExtent.AbsMax(); - //var maxRangeSqr = obbAbsMax + weapon.MaxTargetDistance; - //var minRangeSqr = obbAbsMax + weapon.MinTargetDistance; - - //maxRangeSqr *= maxRangeSqr; - //minRangeSqr *= minRangeSqr; - //double rangeToTarget; - //Vector3D.DistanceSquared(ref targetPos, ref weapon.MyPivotPos, out rangeToTarget); - //couldHit = validEstimate && rangeToTarget <= maxRangeSqr && rangeToTarget >= minRangeSqr; couldHit = validEstimate; bool canTrack = false; - //if (validEstimate && rangeToTarget <= maxRangeSqr && rangeToTarget >= minRangeSqr) if (validEstimate) { var targetDir = targetPos - weapon.MyPivotPos; @@ -171,6 +159,7 @@ internal static void LeadTarget(Weapon weapon, MyEntity target, out Vector3D tar canTrack = IsDotProductWithinTolerance(ref weapon.MyPivotFwd, ref targetDir, weapon.AimingTolerance); } willHit = canTrack; + weapon.Target.ValidEstimate = willHit; } internal static bool CanShootTargetObb(Weapon weapon, MyEntity entity, Vector3D targetLinVel, Vector3D targetAccel, out Vector3D targetPos) @@ -368,6 +357,7 @@ internal static bool TrackingTarget(Weapon w, Target target, out bool targetLock if (Vector3D.IsZero(targetAccel, 5E-03)) targetAccel = Vector3.Zero; targetPos = TrajectoryEstimation(w, targetCenter, targetLinVel, targetAccel, w.MyPivotPos, out validEstimate, false, baseData.Set.Overrides.AngularTracking); + w.Target.ValidEstimate = validEstimate; } else targetPos = targetCenter; @@ -448,7 +438,7 @@ internal static bool TrackingTarget(Weapon w, Target target, out bool targetLock if (baseData.State.Control == ProtoWeaponState.ControlMode.Camera || w.Comp.FakeMode || session.IsServer && baseData.Set.Overrides.Repel && ai.DetectionInfo.DroneInRange && target.IsDrone && (session.AwakeCount == w.Acquire.SlotId || ai.Construct.RootAi.Construct.LastDroneTick == session.Tick) && Ai.SwitchToDrone(w)) return true; - var rayCheckTest = isTracking && (isAligned || locked) && baseData.State.Control != ProtoWeaponState.ControlMode.Camera && (w.ActiveAmmoDef.AmmoDef.Trajectory.Guidance != TrajectoryDef.GuidanceType.Smart && w.ActiveAmmoDef.AmmoDef.Trajectory.Guidance != TrajectoryDef.GuidanceType.DroneAdvanced) && !w.System.DisableLosCheck && (!w.Casting && session.Tick - w.Comp.LastRayCastTick > 29 || w.System.Values.HardPoint.Other.MuzzleCheck && session.Tick - w.LastMuzzleCheck > 29); + var rayCheckTest = isTracking && (isAligned || locked) && baseData.State.Control != ProtoWeaponState.ControlMode.Camera && (w.ActiveAmmoDef.AmmoDef.Trajectory.Guidance != TrajectoryDef.GuidanceType.Smart && w.ActiveAmmoDef.AmmoDef.Trajectory.Guidance != TrajectoryDef.GuidanceType.DroneAdvanced) && !w.System.DisableLosCheck && (session.Tick - w.Comp.LastRayCastTick > 29 || w.System.Values.HardPoint.Other.MuzzleCheck && session.Tick - w.LastMuzzleCheck > 29); var trackingTimeLimit = w.System.MaxTrackingTime && session.Tick - w.Target.ChangeTick > w.System.MaxTrackingTicks; if (session.IsServer && (rayCheckTest && !w.RayCheckTest(rangeToTargetSqr) || trackingTimeLimit)) @@ -608,269 +598,6 @@ internal void SmartLosDebug() DsDebugDraw.DrawLine(line, hit ? Color.Red : Color.Blue, 0.05f); } } - - internal static Vector3D TrajectoryEstimationOld(Weapon weapon, Vector3D targetPos, Vector3D targetVel, Vector3D targetAcc, Vector3D shooterPos, bool trackAngular, out bool valid, bool overrideMode = false, bool setAdvOverride = false, bool skipAccel = false) - { - valid = true; - var comp = weapon.Comp; - var ai = comp.Ai; - var session = Session.I; - var ammoDef = weapon.ActiveAmmoDef.AmmoDef; - var origTargetPos = targetPos; //Need these original values for debug draws later - var origTargetVel = targetVel; - - if (ai.VelocityUpdateTick != session.Tick) - { - ai.TopEntityVolume.Center = comp.TopEntity.PositionComp.WorldVolume.Center; - ai.TopEntityVel = comp.TopEntity.Physics?.LinearVelocity ?? Vector3D.Zero; - ai.IsStatic = comp.TopEntity.Physics?.IsStatic ?? false; - ai.VelocityUpdateTick = session.Tick; - } - - var updateGravity = ammoDef.Const.FeelsGravity && ai.InPlanetGravity; - - if (updateGravity && session.Tick - weapon.GravityTick > 119) - { - weapon.GravityTick = session.Tick; - float interference; - weapon.GravityPoint = session.Physics.CalculateNaturalGravityAt(weapon.MyPivotPos, out interference); - weapon.GravityUnitDir = weapon.GravityPoint; - weapon.GravityLength = weapon.GravityUnitDir.Normalize(); - } - else if (!updateGravity) - weapon.GravityPoint = Vector3D.Zero; - - var gravityMultiplier = ammoDef.Const.FeelsGravity && !MyUtils.IsZero(weapon.GravityPoint) ? ammoDef.Const.GravityMultiplier : 0f; - bool hasGravity = gravityMultiplier > 1e-6 && !MyUtils.IsZero(weapon.GravityPoint); - - var targetMaxSpeed = Session.I.MaxEntitySpeed; - shooterPos = MyUtils.IsZero(shooterPos) ? weapon.MyPivotPos : shooterPos; - - var shooterVel = (Vector3D)weapon.Comp.Ai.TopEntityVel; - var projectileMaxSpeed = ammoDef.Const.DesiredProjectileSpeed; - var projectileInitSpeed = ammoDef.Trajectory.AccelPerSec * MyEngineConstants.UPDATE_STEP_SIZE_IN_SECONDS; - var projectileAccMag = ammoDef.Trajectory.AccelPerSec; - var basic = weapon.System.Prediction != Prediction.Advanced && !overrideMode || overrideMode && !setAdvOverride; - - if (basic && weapon.System.Prediction == Prediction.Accurate && hasGravity && ai.InPlanetGravity) - { - basic = false; - skipAccel = true; - } - - Vector3D deltaPos = targetPos - shooterPos; - Vector3D deltaVel = targetVel - shooterVel; - Vector3D deltaPosNorm; - double deltaLength = 0; - if (Vector3D.IsZero(deltaPos)) - { - deltaPosNorm = Vector3D.Zero; - } - else if (Vector3D.IsUnit(ref deltaPos)) - { - deltaPosNorm = deltaPos; - deltaLength = 1; - } - else - { - deltaPosNorm = deltaPos; - deltaLength = deltaPosNorm.Normalize(); - } - - double closingSpeed; - Vector3D.Dot(ref deltaVel, ref deltaPosNorm, out closingSpeed); - - Vector3D closingVel = closingSpeed * deltaPosNorm; - Vector3D lateralVel = deltaVel - closingVel; - double projectileMaxSpeedSqr = projectileMaxSpeed * projectileMaxSpeed; - double ttiDiff = projectileMaxSpeedSqr - lateralVel.LengthSquared(); - - if (ttiDiff < 0) - { - valid = false; - return targetPos; - } - - double projectileClosingSpeed = Math.Sqrt(ttiDiff) - closingSpeed; - - double closingDistance; - Vector3D.Dot(ref deltaPos, ref deltaPosNorm, out closingDistance); - - double timeToIntercept = ttiDiff < 0 ? 0 : closingDistance / projectileClosingSpeed; - - if (timeToIntercept < 0) - { - valid = false; - return targetPos; - } - - double maxSpeedSqr = targetMaxSpeed * targetMaxSpeed; - double shooterVelScaleFactor = 1; - bool projectileAccelerates = projectileAccMag > 1e-6; - - if (!basic && projectileAccelerates) - shooterVelScaleFactor = Math.Min(1, (projectileMaxSpeed - projectileInitSpeed) / projectileAccMag); - - Vector3D estimatedImpactPoint = targetPos + timeToIntercept * (targetVel - shooterVel * shooterVelScaleFactor); - - if (basic) - return estimatedImpactPoint; - - Vector3D aimDirection = estimatedImpactPoint - shooterPos; - - Vector3D projectileVel = shooterVel; - Vector3D projectilePos = shooterPos; - - Vector3D aimDirectionNorm; - if (projectileAccelerates) - { - - if (Vector3D.IsZero(deltaPos)) aimDirectionNorm = Vector3D.Zero; - else if (Vector3D.IsUnit(ref deltaPos)) aimDirectionNorm = aimDirection; - else aimDirectionNorm = Vector3D.Normalize(aimDirection); - projectileVel += aimDirectionNorm * projectileInitSpeed; - } - else - { - - if (targetAcc.LengthSquared() < 1 && !hasGravity) - return estimatedImpactPoint; - - if (Vector3D.IsZero(deltaPos)) aimDirectionNorm = Vector3D.Zero; - else if (Vector3D.IsUnit(ref deltaPos)) aimDirectionNorm = aimDirection; - else Vector3D.Normalize(ref aimDirection, out aimDirectionNorm); - projectileVel += aimDirectionNorm * projectileMaxSpeed; - } - - var deepSim = projectileAccelerates || hasGravity; - var count = deepSim ? 320 : 60; - - double dt = Math.Max(MyEngineConstants.UPDATE_STEP_SIZE_IN_SECONDS, timeToIntercept / count); // This can be a const somewhere - double dtSqr = dt * dt; - Vector3D targetAccStep = targetAcc * dt; - Vector3D projectileAccStep = aimDirectionNorm * projectileAccMag * dt; - - Vector3D aimOffset = Vector3D.Zero; - - //BD Todo: Clamp this for projectiles OR targets that don't accelerate - if (!skipAccel && (projectileAccelerates || targetVel.LengthSquared() >= 0.01)) - { - for (int i = 0; i < count; ++i) - { - - targetVel += targetAccStep; - - if (targetVel.LengthSquared() > maxSpeedSqr) - { - Vector3D targetNormVel; - Vector3D.Normalize(ref targetVel, out targetNormVel); - targetVel = targetNormVel * targetMaxSpeed; - } - - targetPos += targetVel * dt; - if (projectileAccelerates) - { - - projectileVel += projectileAccStep; - if (projectileVel.LengthSquared() > projectileMaxSpeedSqr) - { - Vector3D pNormVel; - Vector3D.Normalize(ref projectileVel, out pNormVel); - projectileVel = pNormVel * projectileMaxSpeed; - } - } - - projectilePos += projectileVel * dt; - Vector3D diff = (targetPos - projectilePos); - double diffLenSq = diff.LengthSquared(); - aimOffset = diff; - if (diffLenSq < projectileMaxSpeedSqr * dtSqr || Vector3D.Dot(diff, aimDirectionNorm) < 0) - break; - } - } - - Vector3D perpendicularAimOffset = !skipAccel ? aimOffset - Vector3D.Dot(aimOffset, aimDirectionNorm) * aimDirectionNorm : Vector3D.Zero; - - Vector3D gravityOffset = Vector3D.Zero; - //gravity nonsense for differing elevations - if (hasGravity && ai.InPlanetGravity) - { - var targetAngle = Math.Acos(Vector3D.Dot(weapon.GravityPoint, deltaPos) / (weapon.GravityLength * deltaLength)); - double elevationDifference; - if (targetAngle >= 1.5708) //Target is above weapon - { - targetAngle -= 1.5708; //angle-90 - elevationDifference = -Math.Sin(targetAngle) * deltaLength; - } - else //Target is below weapon - { - targetAngle = 1.5708 - targetAngle; //90-angle - elevationDifference = -Math.Sin(targetAngle) * deltaLength; - } - var horizontalDistance = Math.Sqrt(deltaLength * deltaLength - elevationDifference * elevationDifference); - - //Minimized for my sanity - var g = -(weapon.GravityLength * gravityMultiplier); - var v = projectileMaxSpeed; - var h = elevationDifference; - var d = horizontalDistance; - - var angleCheck = (v * v * v * v) - 2 * (v * v) * -h * g - (g * g) * (d * d); - - if (angleCheck <= 0) - { - valid = false; - return estimatedImpactPoint + perpendicularAimOffset + gravityOffset; - - } - - //lord help me - var angleSqrt = Math.Sqrt(angleCheck); - var angle1 = -Math.Atan((v * v + angleSqrt) / (g * d));//Higher angle - var angle2 = -Math.Atan((v * v - angleSqrt) / (g * d));//Lower angle //Try angle 2 first (the lower one) - - var verticalDistance = Math.Tan(angle2) * horizontalDistance; //without below-the-horizon modifier - gravityOffset = new Vector3D((verticalDistance + Math.Abs(elevationDifference)) * -weapon.GravityUnitDir); - if (angle1 > 1.57) - { - return estimatedImpactPoint + perpendicularAimOffset + gravityOffset; - } - - var targetAimPoint = estimatedImpactPoint + perpendicularAimOffset + gravityOffset; - var targetDirection = targetAimPoint - shooterPos; - - bool isTracking; - if (!weapon.RotorTurretTracking && weapon.TurretController && !WeaponLookAt(weapon, ref targetDirection, deltaLength * deltaLength, false, true, DebugCaller.TrajectoryEstimation, out isTracking)) //Angle 2 obscured, switch to angle 1 - { - verticalDistance = Math.Tan(angle1) * horizontalDistance; - gravityOffset = new Vector3D((verticalDistance + Math.Abs(elevationDifference)) * -weapon.GravityUnitDir); - } - else if (weapon.RotorTurretTracking && weapon.Comp.Ai.ControlComp != null && !RotorTurretLookAt(weapon.Comp.Ai.ControlComp.Platform.Control, ref targetDirection, deltaLength * deltaLength)) - { - verticalDistance = Math.Tan(angle1) * horizontalDistance; - gravityOffset = new Vector3D((verticalDistance + Math.Abs(elevationDifference)) * -weapon.GravityUnitDir); - } - } - - if (false) - { - //OldAdvanced - DsDebugDraw.DrawLine(new LineD(origTargetPos, estimatedImpactPoint + perpendicularAimOffset + gravityOffset), Color.Yellow, 2f); - - //OldBasic - Vector3D estimatedImpactPointbasicOld = origTargetPos + (ttiDiff < 0 ? 0 : closingDistance / projectileClosingSpeed) * (origTargetVel - shooterVel); - DsDebugDraw.DrawLine(new LineD(origTargetPos, estimatedImpactPointbasicOld), Color.Green, 2f); - - //New algo - var tempCoord = TrajectoryEstimation(weapon, origTargetPos, origTargetVel, targetAcc, shooterPos, out valid, false, trackAngular); - DsDebugDraw.DrawLine(new LineD(origTargetPos, tempCoord), Color.Red, 2); - return tempCoord; - } - MyAPIGateway.Utilities.ShowNotification($"Old Mode: {(basic ? " basic" : " advanced")} {(updateGravity ? " w/ grav" : " no grav")} {(skipAccel ? "" : " w/ proj accel")} ", 16); - - return estimatedImpactPoint + perpendicularAimOffset + gravityOffset; - } - public static bool QuarticSolver(ref double timeToIntercept, Vector3D relativePosition, Vector3D relativeVelocity, Vector3D acceleration, double projectileSpeed, double[] coefficients, double tolerance = 1e-3, int maxIterations = 10) { var oneOverSpeedSq = projectileSpeed > 0 ? 1.0 / (projectileSpeed * projectileSpeed) : 0; @@ -1056,10 +783,6 @@ internal static Vector3D TrajectoryEstimation(Weapon weapon, Vector3D targetPos, } } } - - //DsDebugDraw.DrawLine(new LineD(targetPos, aimPoint + gravityOffset), Color.Red, 1); - //MyAPIGateway.Utilities.ShowNotification($"New Mode: {(useSimple ? "Simple" : "Advanced")} {(updateGravity ? " w/ grav" : " no grav")} {(ammoDef.Const.AmmoSkipAccel ? " no proj accel" : "w/ proj accel")}",16); - return aimPoint + gravityOffset; } @@ -1125,7 +848,6 @@ private static bool ComputeAngular(MyCubeGrid grid, Ai ai, WeaponDefinition.Ammo public void ManualShootRayCallBack(IHitInfo hitInfo) { - Casting = false; var masterWeapon = System.TrackTargets ? this : Comp.PrimaryWeapon; var grid = hitInfo.HitEntity as MyCubeGrid; @@ -1244,8 +966,9 @@ private bool RayCheckTest(double rangeToTargetSqr) if (Target.TargetState == Target.TargetStates.IsFake) { - Casting = true; - Session.I.Physics.CastRayParallel(ref trackingCheckPosition, ref Target.TargetPos, filter, ManualShootRayCallBack); + IHitInfo fakeHitInfo; + Session.I.Physics.CastRay(trackingCheckPosition, Target.TargetPos, out fakeHitInfo, filter); + ManualShootRayCallBack(fakeHitInfo); return true; } @@ -1301,14 +1024,14 @@ private bool RayCheckTest(double rangeToTargetSqr) var targetPos = pTarget?.Position ?? eTarget?.PositionComp.WorldAABB.Center ?? Vector3D.Zero; var distToTargetSqr = Vector3D.DistanceSquared(targetPos, trackingCheckPosition); - if (distToTargetSqr > MaxTargetDistanceSqr && distToTargetSqr < MinTargetDistanceSqr) + if (distToTargetSqr > MaxTargetDistanceSqr || distToTargetSqr < MinTargetDistanceSqr) //TODO this was &&, will that ever trip for a wep with min and max range? { masterWeapon.Target.Reset(Session.I.Tick, Target.States.RayCheckDistExceeded); if (masterWeapon != this) Target.Reset(Session.I.Tick, Target.States.RayCheckDistExceeded); return false; } WaterData water = null; - if (Session.I.WaterApiLoaded && !ActiveAmmoDef.AmmoDef.IgnoreWater && Comp.Ai.InPlanetGravity && Comp.Ai.MyPlanet != null && Session.I.WaterMap.TryGetValue(Comp.Ai.MyPlanet.EntityId, out water)) + if (Session.I.WaterApiLoaded && !(ActiveAmmoDef.AmmoDef.IgnoreWater || Comp.TargetSubmerged) && Comp.Ai.InPlanetGravity && Comp.Ai.MyPlanet != null && Session.I.WaterMap.TryGetValue(Comp.Ai.MyPlanet.EntityId, out water)) { var waterSphere = new BoundingSphereD(Comp.Ai.MyPlanet.PositionComp.WorldAABB.Center, water.MinRadius); if (waterSphere.Contains(targetPos) != ContainmentType.Disjoint) @@ -1318,8 +1041,11 @@ private bool RayCheckTest(double rangeToTargetSqr) return false; } } - Casting = true; - Session.I.Physics.CastRayParallel(ref trackingCheckPosition, ref targetPos, filter, RayCallBack.NormalShootRayCallBack); + IHitInfo rayHitInfo; + Session.I.Physics.CastRay(trackingCheckPosition, targetPos, out rayHitInfo); + + RayCallBack.NormalShootRayCallBack(rayHitInfo); + return true; } diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponTypes.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponTypes.cs index 4e1c91f3..261ea475 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponTypes.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponTypes.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using CoreSystems.Projectiles; +using CoreSystems.Projectiles; using CoreSystems.Support; using Sandbox.Game.Entities; using VRage.Game.Entity; @@ -26,17 +24,14 @@ public void NormalShootRayCallBack(IHitInfo hitInfo) var eTarget = Weapon.Target.TargetObject as MyEntity; if (pTarget == null && eTarget == null) return; - - Weapon.Casting = false; Weapon.PauseShoot = false; var masterWeapon = Weapon.System.TrackTargets ? Weapon : Weapon.Comp.PrimaryWeapon; - var ignoreTargets = Weapon.Target.TargetState == Target.TargetStates.IsProjectile || Weapon.Target.TargetObject is IMyCharacter; + var ignoreTargets = Weapon.Target.TargetState == Target.TargetStates.IsProjectile || (eTarget != null && Weapon.Target.TargetObject is IMyCharacter); var scope = Weapon.GetScope; var trackingCheckPosition = scope.CachedPos; double rayDist = 0; - - if (Session.I.DebugLos) + if (Session.I.DebugLos && hitInfo != null) { var hitPos = hitInfo.Position; if (rayDist <= 0) Vector3D.Distance(ref trackingCheckPosition, ref hitPos, out rayDist); @@ -44,16 +39,15 @@ public void NormalShootRayCallBack(IHitInfo hitInfo) Session.I.AddLosCheck(new Session.LosDebug { Part = Weapon, HitTick = Session.I.Tick, Line = new LineD(trackingCheckPosition, hitPos) }); } - if (Weapon.Comp.Ai.ShieldNear) { - - var targetPos = pTarget?.Position ?? eTarget.PositionComp.WorldMatrixRef.Translation; + var targetPos = pTarget?.Position ?? eTarget.PositionComp.WorldVolume.Center; var targetDir = targetPos - trackingCheckPosition; if (Weapon.HitFriendlyShield(trackingCheckPosition, targetPos, targetDir)) { masterWeapon.Target.Reset(Session.I.Tick, Target.States.RayCheckFriendly); if (masterWeapon != Weapon) Weapon.Target.Reset(Session.I.Tick, Target.States.RayCheckFriendly); + Weapon.PauseShoot = true; return; } } @@ -61,11 +55,17 @@ public void NormalShootRayCallBack(IHitInfo hitInfo) var hitTopEnt = (MyEntity)hitInfo?.HitEntity?.GetTopMostParent(); if (hitTopEnt == null) { - if (ignoreTargets) + if (Weapon.System.TargetGridCenter && eTarget != null) + hitTopEnt = eTarget; + else + { + if (ignoreTargets) + return; + masterWeapon.Target.Reset(Session.I.Tick, Target.States.RayCheckMiss); + if (masterWeapon != Weapon) Weapon.Target.Reset(Session.I.Tick, Target.States.RayCheckMiss); + Weapon.PauseShoot = true; return; - masterWeapon.Target.Reset(Session.I.Tick, Target.States.RayCheckMiss); - if (masterWeapon != Weapon) Weapon.Target.Reset(Session.I.Tick, Target.States.RayCheckMiss); - return; + } } var targetTopEnt = eTarget?.GetTopMostParent(); @@ -77,10 +77,12 @@ public void NormalShootRayCallBack(IHitInfo hitInfo) if (unexpectedHit) { + if (hitTopEnt is MyVoxelBase && !Weapon.System.ScanNonThreats) { masterWeapon.Target.Reset(Session.I.Tick, Target.States.RayCheckVoxel); if (masterWeapon != Weapon) Weapon.Target.Reset(Session.I.Tick, Target.States.RayCheckVoxel); + Weapon.PauseShoot = true; return; } @@ -97,9 +99,11 @@ public void NormalShootRayCallBack(IHitInfo hitInfo) { masterWeapon.Target.Reset(Session.I.Tick, Target.States.RayCheckFriendly); if (masterWeapon != Weapon) Weapon.Target.Reset(Session.I.Tick, Target.States.RayCheckFriendly); + Weapon.PauseShoot = true; return; } return; + } if (Weapon.System.ClosestFirst && topAsGrid != null && topAsGrid == targetTopEnt) { @@ -108,11 +112,9 @@ public void NormalShootRayCallBack(IHitInfo hitInfo) var maxChange = halfExtMin > minSize ? halfExtMin : minSize; var targetPos = eTarget.PositionComp.WorldAABB.Center; var weaponPos = trackingCheckPosition; - if (rayDist <= 0) Vector3D.Distance(ref weaponPos, ref targetPos, out rayDist); - var newHitShortDist = rayDist * (1 - hitInfo.Fraction); - var distanceToTarget = rayDist * hitInfo.Fraction; - + var newHitShortDist = hitInfo == null ? rayDist : rayDist * (1 - hitInfo.Fraction); + var distanceToTarget = hitInfo == null ? rayDist : rayDist * hitInfo.Fraction; var shortDistExceed = newHitShortDist - Weapon.Target.HitShortDist > maxChange; var escapeDistExceed = distanceToTarget - Weapon.Target.OrigDistance > Weapon.Target.OrigDistance; if (shortDistExceed || escapeDistExceed) @@ -121,6 +123,7 @@ public void NormalShootRayCallBack(IHitInfo hitInfo) if (masterWeapon != Weapon) Weapon.Target.Reset(Session.I.Tick, Target.States.RayCheckDistOffset); } } + } } diff --git a/Data/Scripts/CoreSystems/EntityComp/PlatformInit.cs b/Data/Scripts/CoreSystems/EntityComp/PlatformInit.cs index b04cfa49..65363621 100644 --- a/Data/Scripts/CoreSystems/EntityComp/PlatformInit.cs +++ b/Data/Scripts/CoreSystems/EntityComp/PlatformInit.cs @@ -8,7 +8,6 @@ using static CoreSystems.Support.CoreComponent.Start; using static CoreSystems.Support.CoreComponent.CompTypeSpecific; using static CoreSystems.Support.WeaponDefinition.AnimationDef.PartAnimationSetDef; -using Sandbox.Game.World; namespace CoreSystems.Platform { @@ -717,13 +716,14 @@ internal void SetupWeaponUi(Weapon w) w.Comp.HasDelayToFire = w.Comp.HasDelayToFire || w.System.DelayToFire > 0; w.Comp.ShootSubmerged = w.Comp.ShootSubmerged || w.System.Values.HardPoint.CanShootSubmerged; + w.Comp.TargetSubmerged = w.Comp.TargetSubmerged || w.System.Values.HardPoint.CanTargetSubmerged; w.Comp.HasDisabledBurst = w.Comp.Structure.MultiParts || w.System.MaxAmmoCount <= 1; w.BaseComp.HasServerOverrides = w.BaseComp.HasServerOverrides || w.System.WConst.HasServerOverrides; if (w.System.MaxAmmoCount > w.Comp.MaxAmmoCount) w.Comp.MaxAmmoCount = w.System.MaxAmmoCount; - if (ui.EnableOverload || ui.RateOfFire || ui.ToggleGuidance) // removed ui.DamageModifier explit + if (ui.EnableOverload || ui.RateOfFire || ui.ToggleGuidance) w.BaseComp.UiEnabled = true; if (w.System.HasAmmoSelection) diff --git a/Data/Scripts/CoreSystems/Projectiles/Dtree.cs b/Data/Scripts/CoreSystems/Projectiles/Dtree.cs index e23edac5..d46e64f6 100644 --- a/Data/Scripts/CoreSystems/Projectiles/Dtree.cs +++ b/Data/Scripts/CoreSystems/Projectiles/Dtree.cs @@ -26,17 +26,6 @@ internal static void UnregisterProjectile(Projectile projectile) s.ProjectileTree.RemoveProxy(projectile.PruningProxyId); projectile.PruningProxyId = -1; } - - internal static void OnProjectileMoved(Projectile projectile, ref Vector3D velocity) - { - if (projectile.PruningProxyId == -1) - return; - BoundingSphereD sphere = new BoundingSphereD(projectile.Position, projectile.Info.AmmoDef.Const.LargestHitSize); - BoundingBoxD result; - BoundingBoxD.CreateFromSphere(ref sphere, out result); - Session.I.ProjectileTree.MoveProxy(projectile.PruningProxyId, ref result, velocity); - } - internal static void GetAllProjectilesInSphere(Session session, ref BoundingSphereD sphere, List result, bool clearList = true) { session.ProjectileTree.OverlapAllBoundingSphere(ref sphere, result, clearList); diff --git a/Data/Scripts/CoreSystems/Projectiles/Projectile.cs b/Data/Scripts/CoreSystems/Projectiles/Projectile.cs index 310fa68a..32f7ef7e 100644 --- a/Data/Scripts/CoreSystems/Projectiles/Projectile.cs +++ b/Data/Scripts/CoreSystems/Projectiles/Projectile.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using CoreSystems.Support; using Jakaria.API; using Sandbox.Game.Entities; @@ -304,11 +303,26 @@ internal void Start() Info.AvShot = session.Av.AvShotPool.Count > 0 ? session.Av.AvShotPool.Pop() : new AvShot(session); Info.AvShot.Init(Info, (aConst.DeltaVelocityPerTick * Session.I.DeltaTimeRatio), MaxSpeed, ref Direction); Info.AvShot.SetupSounds(distanceFromCameraSqr); //Pool initted sounds per Projectile type... this is expensive - if (aConst.HitParticle && !aConst.IsBeamWeapon || aConst.EndOfLifeAoe && !ammoDef.AreaOfDamage.EndOfLife.NoVisuals) + if (aConst.HitParticle || aConst.EndOfLifeAoe && !ammoDef.AreaOfDamage.EndOfLife.NoVisuals) { var hitPlayChance = Info.AmmoDef.AmmoGraphics.Particles.Hit.Extras.HitPlayChance; Info.AvShot.HitParticleActive = hitPlayChance >= 1 || hitPlayChance >= MyUtils.GetRandomDouble(0.0f, 1f); } + if (aConst.ShieldHitParticle || aConst.EndOfLifeAoe && !ammoDef.AreaOfDamage.EndOfLife.NoVisuals) + { + var hitPlayChance = Info.AmmoDef.AmmoGraphics.Particles.ShieldHit.Extras.HitPlayChance; + Info.AvShot.ShieldHitParticleActive = hitPlayChance >= 1 || hitPlayChance >= MyUtils.GetRandomDouble(0.0f, 1f); + } + if (aConst.VoxelHitParticle || aConst.EndOfLifeAoe && !ammoDef.AreaOfDamage.EndOfLife.NoVisuals) + { + var hitPlayChance = Info.AmmoDef.AmmoGraphics.Particles.VoxelHit.Extras.HitPlayChance; + Info.AvShot.VoxelHitParticleActive = hitPlayChance >= 1 || hitPlayChance >= MyUtils.GetRandomDouble(0.0f, 1f); + } + if (aConst.WaterHitParticle || aConst.EndOfLifeAoe && !ammoDef.AreaOfDamage.EndOfLife.NoVisuals) + { + var hitPlayChance = Info.AmmoDef.AmmoGraphics.Particles.WaterHit.Extras.HitPlayChance; + Info.AvShot.WaterHitParticleActive = hitPlayChance >= 1 || hitPlayChance >= MyUtils.GetRandomDouble(0.0f, 1f); + } if (aConst.PrimeModel || aConst.TriggerModel) { @@ -3395,11 +3409,11 @@ internal void EwarEffects() var nStorage = netted.Info.Storage; var nAconst = netted.Info.AmmoDef.Const; - if (nStorage.RequestedStage >= 0 && nStorage.RequestedStage < nAconst.ApproachesCount && nAconst.Approaches[nStorage.RequestedStage].IgnoreAntiSmart) + if (nAconst.IgnoreAntiSmarts || (nStorage.RequestedStage >= 0 && nStorage.RequestedStage < nAconst.ApproachesCount && nAconst.Approaches[nStorage.RequestedStage].IgnoreAntiSmart)) continue; if (Info.Random.NextDouble() * 100f < aConst.PulseChance || !aConst.EwarField) { - Info.BaseEwarPool -= (float)netted.Info.AmmoDef.Const.HealthHitModifier; + Info.BaseEwarPool -= (float)nAconst.HealthHitModifier; if (Info.BaseEwarPool <= 0 && Info.BaseHealthPool-- > 0) { Info.EwarActive = true; @@ -3428,13 +3442,13 @@ internal void EwarEffects() var nStorage = netted.Info.Storage; var nAconst = netted.Info.AmmoDef.Const; - if (nStorage.RequestedStage >= 0 && nStorage.RequestedStage < nAconst.ApproachesCount && nAconst.Approaches[nStorage.RequestedStage].IgnoreAntiSmart) + if (nAconst.IgnoreAntiSmarts || (nStorage.RequestedStage >= 0 && nStorage.RequestedStage < nAconst.ApproachesCount && nAconst.Approaches[nStorage.RequestedStage].IgnoreAntiSmart)) continue; if (Info.Random.NextDouble() * 100f < aConst.PulseChance || !aConst.EwarField) { - if (Info.BaseEwarPool - netted.Info.AmmoDef.Const.Health >= 0) + if (Info.BaseEwarPool - nAconst.Health >= 0) { - Info.BaseEwarPool -= netted.Info.AmmoDef.Const.Health; + Info.BaseEwarPool -= nAconst.Health; Info.EwarActive = true; netted.Info.Target.TargetObject = this; netted.Info.Target.TargetState = Target.TargetStates.IsProjectile; diff --git a/Data/Scripts/CoreSystems/Projectiles/ProjectileGen.cs b/Data/Scripts/CoreSystems/Projectiles/ProjectileGen.cs index 2f6f8703..6b596f7b 100644 --- a/Data/Scripts/CoreSystems/Projectiles/ProjectileGen.cs +++ b/Data/Scripts/CoreSystems/Projectiles/ProjectileGen.cs @@ -1,6 +1,5 @@ using CoreSystems.Support; using Sandbox.Game.Entities; -using System; using VRage.Game.Entity; using VRageMath; using static CoreSystems.Support.NewProjectile; diff --git a/Data/Scripts/CoreSystems/Projectiles/ProjectileHits.cs b/Data/Scripts/CoreSystems/Projectiles/ProjectileHits.cs index 89f06d5e..bba5a838 100644 --- a/Data/Scripts/CoreSystems/Projectiles/ProjectileHits.cs +++ b/Data/Scripts/CoreSystems/Projectiles/ProjectileHits.cs @@ -5,7 +5,6 @@ using Sandbox.Game.Entities; using Sandbox.ModAPI; using VRage; -using VRage.Game.Components; using VRage.Game.Entity; using VRage.Game.ModAPI; using VRage.Game.ModAPI.Interfaces; @@ -18,7 +17,6 @@ using Jakaria.API; using static CoreSystems.Projectiles.Projectile; using static CoreSystems.Support.VoxelIntersect; -using System.Runtime.CompilerServices; namespace CoreSystems.Projectiles { @@ -163,7 +161,6 @@ internal void InitialHitCheck(Projectile p, bool lineCheck) var shrapnelSpawn = p.Info.IsFragment && p.Info.PrevRelativeAge <= -1; if (Vector3D.Transform(!shrapnelSpawn ? info.Origin : coreEntity.PositionComp.WorldMatrixRef.Translation, shieldInfo.Value.Item3.Item1).LengthSquared() > 1) { - var dist = MathFuncs.IntersectEllipsoid(shieldInfo.Value.Item3.Item1, shieldInfo.Value.Item3.Item2, new RayD(beamFrom, direction)); if (target.TargetState == Target.TargetStates.IsProjectile && Vector3D.Transform(((Projectile)target.TargetObject).Position, shieldInfo.Value.Item3.Item1).LengthSquared() <= 1) projetileInShield = true; @@ -177,9 +174,9 @@ internal void InitialHitCheck(Projectile p, bool lineCheck) hitEntity.EventType = Shield; var hitPos = beamFrom + (direction * dist.Value); - hitEntity.HitPos = beamFrom + (direction * dist.Value); + hitEntity.HitPos = hitPos; hitEntity.HitDist = dist; - + hitEntity.ShieldHitAngle = MathFuncs.ShieldHitAngle(shieldInfo.Value.Item3.Item1, shieldInfo.Value.Item3.Item2, new RayD(beamFrom, direction)); var weakendShield = shieldInfo.Value.Item4.Item2 || shieldInfo.Value.Item4.Item3 < shieldInfo.Value.Item4.Item4; if (weakendShield || shieldInfo.Value.Item2.Item2) @@ -216,7 +213,7 @@ internal void InitialHitCheck(Projectile p, bool lineCheck) { //if (((MyCubeGrid)shieldInfo.Value.Item1.CubeGrid).DebugName.Contains("test")) // Log.Line($"resist: RNG:{normalized} <= penChance:{threshold} - ammo:{info.AmmoDef.AmmoRound} - sPerc:{shieldInfo.Value.Item2.Item5} - heat:{shieldInfo.Value.Item2.Item6} - threshold:{shieldInfo.Value.Item2.Item5 / (1 + (shieldInfo.Value.Item2.Item6 * 0.01))}"); - + p.Info.ShieldBypassMod = 1f; } @@ -230,7 +227,8 @@ internal void InitialHitCheck(Projectile p, bool lineCheck) info.ShieldBypassMod = aConst.ShieldDamageBypassMod; } } - else continue; + else + continue; } } else @@ -379,15 +377,7 @@ internal void InitialHitCheck(Projectile p, bool lineCheck) hitEntity.EventType = info.FirstWaterHitTick != tick ? Voxel : Water; } else if (voxelState == VoxelIntersectBranch.DeferedMissUpdate || voxelState == VoxelIntersectBranch.DeferFullCheck) - { FullVoxelCheck(p, voxel, voxelState, lineCheck); - /* - lock (DeferedVoxels) - { - DeferedVoxels.Add(new DeferedVoxels { Projectile = p, Branch = voxelState, Voxel = voxel, LineCheck = lineCheck}); - } - */ - } } else if (ent.Physics != null && !ent.Physics.IsPhantom && !ent.IsPreview && grid != null) { @@ -491,6 +481,9 @@ internal void InitialHitCheck(Projectile p, bool lineCheck) if (hitEntity != null) { + if (info.ShieldBypassed && hitEntity.EventType != Shield) + info.ShieldBypassedHitOther = true; + var hitEnt = hitEntity.EventType != Shield ? ent : (MyEntity)shieldInfo.Value.Item1; if (hitEnt != null) { @@ -633,133 +626,139 @@ internal void ProjectileHit(Projectile p, Projectile target, bool lineCheck, ref internal bool GenerateHitInfo(Projectile p) { - try + var info = p.Info; + var count = info.HitList.Count; + if (count > 1) { - var info = p.Info; - var count = info.HitList.Count; - if (count > 1) - { - try { info.HitList.Sort((x, y) => GetEntityCompareDist(x, y, info)); } // Unable to sort because the IComparer.Compare() method returns inconsistent results - catch (Exception ex) { Log.Line($"p.Info.HitList.Sort failed: {ex} - weapon:{info.Weapon.System.PartName} - ammo:{info.AmmoDef.AmmoRound} - hitCount:{info.HitList.Count}", null, true); } - } - else GetEntityCompareDist(info.HitList[0], null, info); + try { info.HitList.Sort((x, y) => GetEntityCompareDist(x, y, info)); } // Unable to sort because the IComparer.Compare() method returns inconsistent results + catch (Exception ex) { Log.Line($"p.Info.HitList.Sort failed: {ex} - weapon:{info.Weapon.System.PartName} - ammo:{info.AmmoDef.AmmoRound} - hitCount:{info.HitList.Count}", null, true); } + } + else GetEntityCompareDist(info.HitList[0], null, info); - try - { - var pulseTrigger = false; - var voxelFound = false; - for (int i = info.HitList.Count - 1; i >= 0; i--) - { - var ent = info.HitList[i]; - if (ent.EventType == Voxel) - voxelFound = true; - - if (!ent.Hit) { - if (ent.PulseTrigger) pulseTrigger = true; - info.HitList.RemoveAtFast(i); - ent.Clean(); - } - else break; - } - if (pulseTrigger) - { + var pulseTrigger = false; + var voxelFound = false; + for (int i = info.HitList.Count - 1; i >= 0; i--) + { + var ent = info.HitList[i]; + if (ent.EventType == Voxel) + voxelFound = true; + + if (!ent.Hit) { + if (ent.PulseTrigger) pulseTrigger = true; + info.HitList.RemoveAtFast(i); + ent.Clean(); + } + else break; + } - info.ExpandingEwarField = true; - p.DistanceToTravelSqr = info.DistanceTraveled * info.DistanceTraveled; - p.PrevVelocity = p.Velocity; - p.Velocity = Vector3D.Zero; - info.ProHit.LastHit = p.Position; - info.HitList.Clear(); - return false; - } + if (pulseTrigger) + { - var finalCount = info.HitList.Count; - try - { - if (finalCount > 0) - { - var aConst = info.AmmoDef.Const; - try - { - if (voxelFound && info.HitList[0].EventType != Voxel && aConst.IsBeamWeapon) - info.VoxelCache.HitRefreshed = 0; - } - catch (Exception ex) { Log.Line($"Exception in HitRefreshed finalCount: {ex}", null, true); } + info.ExpandingEwarField = true; + p.DistanceToTravelSqr = info.DistanceTraveled * info.DistanceTraveled; + p.PrevVelocity = p.Velocity; + p.Velocity = Vector3D.Zero; + info.ProHit.LastHit = p.Position; + info.HitList.Clear(); + return false; + } - var checkHit = (!aConst.IsBeamWeapon || !info.ShieldBypassed || finalCount > 1); + var finalCount = info.HitList.Count; - var blockingEnt = !info.ShieldBypassed || finalCount == 1 ? 0 : 1; - var hitEntity = info.HitList[blockingEnt]; - if (hitEntity == null) - { - Log.Line($"null hitEntity"); - return false; - } + if (finalCount > 0) + { + var aConst = info.AmmoDef.Const; + if (voxelFound && info.HitList[0].EventType != Voxel && aConst.IsBeamWeapon) + info.VoxelCache.HitRefreshed = 0; - if (!checkHit) - hitEntity.HitPos = p.Beam.To; + var checkHit = (!aConst.IsBeamWeapon || !info.ShieldBypassed || finalCount > 1); - info.ProHit.Entity = hitEntity.Entity; - info.ProHit.LastHit = hitEntity.HitPos ?? p.Beam.To; + var blockingEnt = !info.ShieldBypassed || finalCount == 1 ? 0 : 1; + var hitEntity = info.HitList[blockingEnt]; + if (hitEntity == null) + { + Log.Line($"null hitEntity"); + return false; + } - if (aConst.OnHit && Session.I.Tick >= info.ProHit.EndTick) - { - info.ProHit.EndTick = Session.I.Tick + aConst.OnHitDuration; - } + if (!checkHit) + hitEntity.HitPos = p.Beam.To; - if (p.EnableAv || aConst.VirtualBeams) - { - Vector3D lastHitVel = Vector3D.Zero; - if (hitEntity.EventType == Shield) - { - var cube = hitEntity.Entity as MyCubeBlock; - if (cube?.CubeGrid?.Physics != null) - lastHitVel = cube.CubeGrid.Physics.LinearVelocity; - } - else if (hitEntity.Projectile != null) - lastHitVel = hitEntity.Projectile?.Velocity ?? Vector3D.Zero; - else if (hitEntity.Entity?.Physics != null) - lastHitVel = hitEntity.Entity?.Physics.LinearVelocity ?? Vector3D.Zero; - else lastHitVel = Vector3D.Zero; - - Vector3D visualHitPos; - if (hitEntity.Entity is MyCubeGrid) - { - IHitInfo hitInfo = null; - if (Session.I.HandlesInput && hitEntity.HitPos.HasValue && Vector3D.DistanceSquared(hitEntity.HitPos.Value, Session.I.CameraPos) < 22500 && Session.I.CameraFrustrum.Contains(hitEntity.HitPos.Value) != ContainmentType.Disjoint) - { - var entSphere = hitEntity.Entity.PositionComp.WorldVolume; - var from = hitEntity.Intersection.From + (hitEntity.Intersection.Direction * MyUtils.GetSmallestDistanceToSphereAlwaysPositive(ref hitEntity.Intersection.From, ref entSphere)); - var to = hitEntity.HitPos.Value + (hitEntity.Intersection.Direction * 3f); - Session.I.Physics.CastRay(from, to, out hitInfo, CollisionLayers.NoVoxelCollisionLayer); - } - visualHitPos = hitInfo?.HitEntity != null ? hitInfo.Position : hitEntity.HitPos ?? p.Beam.To; - } - else visualHitPos = hitEntity.HitPos ?? p.Beam.To; - - if (p.EnableAv) { - info.AvShot.LastHitShield = hitEntity.EventType == Shield; - info.AvShot.Hit = new Hit { Entity = hitEntity.Entity, EventType = hitEntity.EventType, HitTick = Session.I.Tick, HitVelocity = lastHitVel, LastHit = visualHitPos, SurfaceHit = visualHitPos }; - } - else if (aConst.VirtualBeams) - AvShot.UpdateVirtualBeams(p, info, hitEntity, visualHitPos, lastHitVel, true); + info.ProHit.Entity = hitEntity.Entity; + info.ProHit.LastHit = hitEntity.HitPos ?? p.Beam.To; - if (info.AimedShot && Session.I.TrackingAi != null && Session.I.TargetUi.HitIncrease < 0.1d && info.Ai.ControlComp == null && (aConst.FixedFireAmmo || info.Weapon.Comp.Data.Repo.Values.Set.Overrides.Control != ProtoWeaponOverrides.ControlModes.Auto)) - Session.I.TargetUi.SetHit(info); - } + if (p.EnableAv || aConst.VirtualBeams) + { + Vector3D lastHitVel = Vector3D.Zero; + if (hitEntity.EventType == Shield) + { + var cube = hitEntity.Entity as MyCubeBlock; + if (cube?.CubeGrid?.Physics != null) + lastHitVel = cube.CubeGrid.Physics.LinearVelocity; + } + else if (hitEntity.Projectile != null) + lastHitVel = hitEntity.Projectile?.Velocity ?? Vector3D.Zero; + else if (hitEntity.Entity?.Physics != null) + lastHitVel = hitEntity.Entity?.Physics.LinearVelocity ?? Vector3D.Zero; + else lastHitVel = Vector3D.Zero; + + Vector3D visualHitPos; + if (hitEntity.Entity is MyCubeGrid) + { + IHitInfo hitInfo = null; + if (Session.I.HandlesInput && hitEntity.HitPos.HasValue && Vector3D.DistanceSquared(hitEntity.HitPos.Value, Session.I.CameraPos) < 22500 && Session.I.CameraFrustrum.Contains(hitEntity.HitPos.Value) != ContainmentType.Disjoint) + { + var entSphere = hitEntity.Entity.PositionComp.WorldVolume; + var from = hitEntity.Intersection.From + (hitEntity.Intersection.Direction * MyUtils.GetSmallestDistanceToSphereAlwaysPositive(ref hitEntity.Intersection.From, ref entSphere)); + var to = hitEntity.HitPos.Value + (hitEntity.Intersection.Direction * 3f); + Session.I.Physics.CastRay(from, to, out hitInfo, CollisionLayers.NoVoxelCollisionLayer); + } + visualHitPos = hitInfo?.HitEntity != null ? hitInfo.Position : hitEntity.HitPos ?? p.Beam.To; + } + else visualHitPos = hitEntity.HitPos ?? p.Beam.To; + if (p.EnableAv) + { + info.AvShot.LastHitShield = hitEntity.EventType == Shield; + info.AvShot.ShieldHitAngle = hitEntity.ShieldHitAngle; + info.AvShot.Hit = new Hit { Entity = hitEntity.Entity, EventType = hitEntity.EventType, HitTick = Session.I.Tick, HitVelocity = lastHitVel, LastHit = visualHitPos, SurfaceHit = visualHitPos}; + } + else if (aConst.VirtualBeams) + AvShot.UpdateVirtualBeams(p, info, hitEntity, visualHitPos, lastHitVel, true); + if (info.AimedShot && Session.I.TrackingAi != null && Session.I.TargetUi.HitIncrease < 0.1d && info.Ai.ControlComp == null && (aConst.FixedFireAmmo || info.Weapon.Comp.Data.Repo.Values.Set.Overrides.Control != ProtoWeaponOverrides.ControlModes.Auto)) + Session.I.TargetUi.SetHit(info); + } - return true; + if (info.HitList.Count > 1 && info.BlockList.Count > 1) + { + //Sort list of blocks hit by dist in KVP + info.BlockList.SortNoAlloc((b, a) => b.Value.CompareTo(a.Value)); + /* + //Determine order of grids hit, incl repeats + var gridList = new List(); + for (int i = 0; i < info.BlockList.Count; i++) + { + if (i == 0) + { + gridList.Add(info.BlockList[i].Key.CubeGrid); + continue; } - + if (info.BlockList[i - 1].Key.CubeGrid != info.BlockList[i].Key.CubeGrid) + gridList.Add(info.BlockList[i].Key.CubeGrid); } - catch (Exception ex) { Log.Line($"Exception in GenerateHitInfo1: {ex}", null, true); } - } - catch (Exception ex) { Log.Line($"Exception in GenerateHitInfo2: {ex}", null, true); } + //Logging readout only + Log.Line("Grids hit:"); + for (int i = 0; i < gridList.Count; i++) + Log.Line($"{gridList[i].DisplayName}"); + Log.Line("Blocks hit:"); + for (int i = 0; i < info.BlockList.Count; i++) + Log.Line($"Blk: {info.BlockList[i].Key.BlockDefinition.DisplayNameText} {info.BlockList[i].Value} {info.BlockList[i].Key.CubeGrid.DisplayName}"); + */ + } + return true; } - catch (Exception ex) { Log.Line($"Exception in GenerateHitInfo3: {ex}", null, true); } return false; } @@ -831,6 +830,19 @@ internal int GetEntityCompareDist(HitEntity x, HitEntity y, ProInfo info) if (hitEnt.SelfHit && (Vector3D.DistanceSquared(hitPos, hitEnt.Info.Origin) <= grid.GridSize * grid.GridSize) && hitEnt.EventType != Field) continue; + IMySlimBlock lastBlockHit = null; + var ewarWeaponDamage = info.EwarActive && aConst.SelfDamage && hitEnt.EventType == Effect; + for (int j = 0; j < hitEnt.Vector3ICache.Count; j++) + { + var posI = hitEnt.Vector3ICache[j]; + var firstBlock = grid.GetCubeBlock(posI) as IMySlimBlock; + if (firstBlock != null && firstBlock != lastBlockHit && !firstBlock.IsDestroyed && (hitEnt.Info.Ai.AiType != Ai.AiTypes.Grid || firstBlock != hitEnt.Info.Weapon.Comp.Cube?.SlimBlock || ewarWeaponDamage && firstBlock == hitEnt.Info.Weapon.Comp.Cube?.SlimBlock)) + { + var blockDist = Vector3D.DistanceSquared(grid.GridIntegerToWorld(posI), beam.From); + info.BlockList.Add(new KeyValuePair(firstBlock, blockDist)); + } + } + if (!ewarActive) GetAndSortBlocksInSphere(hitEnt.Info.AmmoDef, hitEnt.Info.Weapon.System, grid, hitEnt.PruneSphere, false, hitEnt.Blocks); @@ -856,6 +868,10 @@ internal int GetEntityCompareDist(HitEntity x, HitEntity y, ProInfo info) { lastBlockHit = firstBlock; hitEnt.Blocks.Add(new HitEntity.RootBlocks {Block = firstBlock, QueryPos = posI}); + var blockDist = Vector3D.DistanceSquared(grid.GridIntegerToWorld(posI), beam.From); + info.BlockList.Add(new KeyValuePair(firstBlock, blockDist)); + + if (closestBlockFound) continue; MyOrientedBoundingBoxD obb; var fat = firstBlock.FatBlock; @@ -914,6 +930,9 @@ internal int GetEntityCompareDist(HitEntity x, HitEntity y, ProInfo info) hitEnt.Miss = !closestBlockFound; } } + + if (hitEnt.HitPos != null && info.ShieldBypassedHitOther && info.AvShot?.HitParticle == AvShot.ParticleState.Dirty) + info.AvShot.HitParticle = AvShot.ParticleState.Custom; } else if (voxel != null) { @@ -1102,8 +1121,6 @@ internal static void GetAndSortBlocksInSphere(WeaponDefinition.AmmoDef ammoDef, } else { - //usage: - //var dict = (Dictionary)GetHackDict((IMySlimBlock) null); var tmpList = Session.I.SlimPool.Get(); Session.GetBlocksInsideSphereFast(grid, ref sphere, true, tmpList); @@ -1123,7 +1140,5 @@ internal static void GetAndSortBlocksInSphere(WeaponDefinition.AmmoDef ammoDef, return Vector3D.DistanceSquared(aPos, hitPos).CompareTo(Vector3D.DistanceSquared(bPos, hitPos)); }); } - public static object GetHackDict(TVal valueType) => new Dictionary(); - } } diff --git a/Data/Scripts/CoreSystems/Projectiles/ProjectileTypes.cs b/Data/Scripts/CoreSystems/Projectiles/ProjectileTypes.cs index 3c1960a3..fa553f82 100644 --- a/Data/Scripts/CoreSystems/Projectiles/ProjectileTypes.cs +++ b/Data/Scripts/CoreSystems/Projectiles/ProjectileTypes.cs @@ -18,6 +18,7 @@ public class ProInfo internal readonly Target Target = new Target(); internal readonly SmartStorage Storage = new SmartStorage(); internal readonly List HitList = new List(); + internal readonly List> BlockList = new List>(); internal readonly ProHit ProHit = new ProHit(); internal List> ProHits; internal int[] PatternShuffle; @@ -70,6 +71,7 @@ public class ProInfo internal bool AimedShot; internal bool DoDamage; internal bool ShieldBypassed; + internal bool ShieldBypassedHitOther; internal bool ShieldKeepBypass; internal bool ShieldInLine; internal uint FirstWaterHitTick; @@ -113,8 +115,9 @@ internal void Clean() Target.Reset(Session.I.Tick, Target.States.ProjectileClean); HitList.Clear(); - - if(aConst.IsGuided) + BlockList.Clear(); + + if (aConst.IsGuided) Storage.Clean(this); @@ -436,6 +439,7 @@ public enum Type public Type EventType; public int DamageMulti = 1; public Stack Pool; + public Vector3D ShieldHitAngle; public void Clean() { Vector3ICache.Clear(); @@ -479,14 +483,6 @@ internal class ProHit { internal MyEntity Entity; internal Vector3D LastHit; - internal uint EndTick; - internal int ProcInterval; - internal double ProcAmount; - internal bool ProcOnVoxels; - internal bool FragOnProc; - internal bool DieOnEnd; - internal bool StickOnHit; - internal bool AlignFragtoImpactAngle; } internal class WeaponFrameCache @@ -749,10 +745,5 @@ internal void GrowPlanetCache(Vector3D hitPos) Vector3D.Distance(ref PlanetSphere.Center, ref hitPos, out dist); PlanetSphere = new BoundingSphereD(PlanetSphere.Center, dist); } - - internal void DebugDraw() - { - DsDebugDraw.DrawSphere(HitSphere, Color.Red); - } } } diff --git a/Data/Scripts/CoreSystems/Session/SessionCompMgr.cs b/Data/Scripts/CoreSystems/Session/SessionCompMgr.cs index 7537a7b1..060a0764 100644 --- a/Data/Scripts/CoreSystems/Session/SessionCompMgr.cs +++ b/Data/Scripts/CoreSystems/Session/SessionCompMgr.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Remoting.Metadata.W3cXsd2001; +using System.Collections.Generic; using CoreSystems.Platform; using CoreSystems.Support; using Sandbox.Game.Entities; @@ -10,7 +8,6 @@ using VRage.Game.Entity; using VRage.Utils; using VRageMath; -using static VRage.Game.ObjectBuilders.Definitions.MyObjectBuilder_GameDefinition; namespace CoreSystems { diff --git a/Data/Scripts/CoreSystems/Session/SessionControls.cs b/Data/Scripts/CoreSystems/Session/SessionControls.cs index 72903deb..d7c670c2 100644 --- a/Data/Scripts/CoreSystems/Session/SessionControls.cs +++ b/Data/Scripts/CoreSystems/Session/SessionControls.cs @@ -8,7 +8,6 @@ using Sandbox.ModAPI; using Sandbox.ModAPI.Interfaces.Terminal; using SpaceEngineers.Game.ModAPI; -using VRage.Utils; using static CoreSystems.Support.CoreComponent.Trigger; using static CoreSystems.Support.WeaponDefinition.AnimationDef.PartAnimationSetDef; namespace CoreSystems @@ -213,83 +212,89 @@ internal static void CreateCustomCameraActions(Session session) where T : IMy } internal static void CreateCustomActionSet(Session session) where T : IMyTerminalBlock { + CreateCustomActions.CreateShootMode(session); CreateCustomActions.CreateArmReaction(session); CreateCustomActions.CreateTriggerNow(session); + CreateCustomActions.CreateKeyShoot(session); + CreateCustomActions.CreateMouseToggle(session); CreateCustomActions.CreateShootToggle(session); CreateCustomActions.CreateShootOn(session); CreateCustomActions.CreateShootOff(session); - CreateCustomActions.CreateShootMode(session); - CreateCustomActions.CreateKeyShoot(session); - CreateCustomActions.CreateMouseToggle(session); - CreateCustomActions.CreateSubSystems(session); + CreateCustomActions.CreateAngularTracking(session); CreateCustomActions.CreateControlModes(session); - CreateCustomActions.CreateCycleAmmo(session); + CreateCustomActions.CreateObjectiveMode(session); CreateCustomActions.CreateMovementState(session); + CreateCustomActions.CreateCycleAmmo(session); CreateCustomActions.CreateForceReload(session); - CreateCustomActions.CreateFocusTargets(session); + CreateCustomActions.CreateFocusSubSystem(session); - CreateCustomActions.CreateGrids(session); + CreateCustomActions.CreateSubSystems(session); + + CreateCustomActions.CreateFocusTargets(session); + CreateCustomActions.CreateRepelMode(session); + CreateCustomActions.CreateNeutrals(session); - CreateCustomActions.CreateFriendly(session); CreateCustomActions.CreateUnowned(session); + CreateCustomActions.CreateGrids(session); + CreateCustomActions.CreateLargeGrid(session); + CreateCustomActions.CreateSmallGrid(session); + CreateCustomActions.CreateBiologicals(session); CreateCustomActions.CreateProjectiles(session); CreateCustomActions.CreateSupportingPD(session); - CreateCustomActions.CreateBiologicals(session); CreateCustomActions.CreateMeteors(session); - CreateCustomActions.CreateWeaponCameraChannels(session); + CreateCustomActions.CreateLeadGroups(session); - CreateCustomActions.CreateRepelMode(session); - CreateCustomActions.CreateMaxSize(session); - CreateCustomActions.CreateMinSize(session); + CreateCustomActions.CreateWeaponCameraChannels(session); CreateCustomActions.CreateSelectFriend(session); CreateCustomActions.CreateSelectEnemy(session); - //CreateCustomActions.CreateSelectPosition(session); Suppressed for now as it's inop - CreateCustomActions.CreateLargeGrid(session); - CreateCustomActions.CreateSmallGrid(session); - CreateCustomActions.CreateAngularTracking(session); - CreateCustomActions.CreateObjectiveMode(session); + + CreateCustomActions.CreateMaxRange(session); + + CreateCustomActions.CreateMinSize(session); + CreateCustomActions.CreateMaxSize(session); + //CreateCustomActions.CreateFriendly(session); } internal static void CreateTurretControllerActions(Session session) where T : IMyTerminalBlock { CreateCustomActions.CreateShareFireControlControl(session); CreateCustomActions.CreateAiEnabledControl(session); - CreateCustomActions.CreateNeutralsControl(session); - CreateCustomActions.CreateFriendlyControl(session); - CreateCustomActions.CreateUnownedControl(session); - + CreateCustomActions.CreateControlModesControl(session); CreateCustomActions.CreateMovementStateControl(session); - //CreateCustomActions.CreateShootModeControl(session); + CreateCustomActions.CreateFocusSubSystemControl(session); CreateCustomActions.CreateSubSystemsControl(session); - CreateCustomActions.CreateControlModesControl(session); - CreateCustomActions.CreateProjectilesControl(session); - CreateCustomActions.CreateSupportingPDControl(session); - CreateCustomActions.CreateBiologicalsControl(session); - CreateCustomActions.CreateMeteorsControl(session); - CreateCustomActions.CreateGridsControl(session); + CreateCustomActions.CreateFocusTargetsControl(session); - CreateCustomActions.CreateFocusSubSystemControl(session); - CreateCustomActions.CreateMaxSizeControl(session); - CreateCustomActions.CreateMinSizeControl(session); CreateCustomActions.CreateRepelModeControl(session); + + CreateCustomActions.CreateNeutralsControl(session); + CreateCustomActions.CreateUnownedControl(session); + CreateCustomActions.CreateGridsControl(session); CreateCustomActions.CreateLargeGridControl(session); CreateCustomActions.CreateSmallGridControl(session); + CreateCustomActions.CreateBiologicalsControl(session); + CreateCustomActions.CreateProjectilesControl(session); + CreateCustomActions.CreateSupportingPDControl(session); + CreateCustomActions.CreateMeteorsControl(session); + + CreateCustomActions.CreateMinSizeControl(session); + CreateCustomActions.CreateMaxSizeControl(session); + //CreateCustomActions.CreateFriendlyControl(session); } internal static void CreateSearchlightActions(Session session) where T : IMyTerminalBlock { CreateCustomActions.CreateNeutralsControl(session); - //CreateCustomActions.CreateFriendlyControl(session); //This even work for a "turret"? CreateCustomActions.CreateUnownedControl(session); - CreateCustomActions.CreateProjectilesControl(session); - CreateCustomActions.CreateBiologicalsControl(session); - CreateCustomActions.CreateMeteorsControl(session); CreateCustomActions.CreateGridsControl(session); - CreateCustomActions.CreateMaxSizeControl(session); - CreateCustomActions.CreateMinSizeControl(session); CreateCustomActions.CreateLargeGridControl(session); CreateCustomActions.CreateSmallGridControl(session); + CreateCustomActions.CreateBiologicalsControl(session); + CreateCustomActions.CreateProjectilesControl(session); + CreateCustomActions.CreateMeteorsControl(session); CreateCustomActions.CreateWeaponCameraChannels(session); + CreateCustomActions.CreateMinSizeControl(session); + CreateCustomActions.CreateMaxSizeControl(session); } internal static void CreateCustomActionSetArmorEnhancer(Session session) where T: IMyTerminalBlock @@ -549,13 +554,14 @@ internal static void AlterActions(Session session) { "WC_Shoot", "WC_AngularTracking", - "WC_Override", + "WC_Repel", + "WC_Unowned", + "WC_Supporting PD", "WC_ShareFireControlEnabled", - "WC_ControlModes", + "WC_ObjectiveMode", "WC_TrackingMode", "WC_ReportTarget", "WC_FocusFire", - "WC_Repel", "Camera Channel", "Weapon Group Id", "Sequence Id", @@ -573,21 +579,23 @@ internal static void AlterActions(Session session) { "WC_Shoot", "AngularTracking", - "ShootToggle", - "MinSize Decrease", - "MinSize Increase", - "MaxSize Decrease", - "MaxSize Increase", "WC_RepelMode", + //"ShootToggle", + "ObjectiveMode", + "SupportingPD", + "Friendly", "WC_Decrease_LeadGroup", "WC_Increase_LeadGroup", "WC_Decrease_CameraChannel", "WC_Increase_CameraChannel", - "FocusSubSystem", + //"FocusSubSystem", "FocusTargets", "TrackingMode", - "ControlModes", - + //"ControlModes", + "MinSize Decrease", + "MinSize Increase", + "MaxSize Decrease", + "MaxSize Increase", }; private static readonly HashSet HideCombatControls = new HashSet() @@ -597,7 +605,6 @@ internal static void AlterActions(Session session) "OffensiveCombatCircleOrbit_SelectedToolsList", "OffensiveCombatCircleOrbit_AvailableWeapons", - "OffensiveCombatStayAtRange_SelectedWeapons", "OffensiveCombatStayAtRange_AddSelectedTool", "OffensiveCombatStayAtRange_SelectedToolsList", @@ -620,8 +627,10 @@ internal static void AlterControls(Session session) where T : IMyTerminalBloc var c = controls[i]; if (session.AlteredControls.Contains(c)) continue; - if (!_visibleControls.Contains(c.Id)) { - c.Visible = TerminalHelpers.NotWcBlock; + if (!_visibleControls.Contains(c.Id)) + { + var prevVisibleFunc = c.Visible; // caching to avoid an infinite recursive loop + c.Visible = block => (prevVisibleFunc?.Invoke(block) ?? true) && TerminalHelpers.NotWcBlock(block); session.AlteredControls.Add(c); continue; } diff --git a/Data/Scripts/CoreSystems/Session/SessionDamageMgr.cs b/Data/Scripts/CoreSystems/Session/SessionDamageMgr.cs index 97824a26..8d885d96 100644 --- a/Data/Scripts/CoreSystems/Session/SessionDamageMgr.cs +++ b/Data/Scripts/CoreSystems/Session/SessionDamageMgr.cs @@ -124,7 +124,6 @@ internal void ProcessHits() internal readonly List Clean = new List(); internal void DefferedDestroy() { - var sync = MpActive && (DedicatedServer || IsServer); Clean.Clear(); _destroyedSlims.Clear(); foreach (var d in DeferredDestroy) @@ -146,7 +145,7 @@ internal void DefferedDestroy() { var info = collection[i]; if (!info.Block.IsDestroyed) - info.Block.DoDamage(info.ScaledDamage, info.DamageType, sync, null, info.AttackerId, 0, info.DetonateAmmo); + info.Block.DoDamage(info.ScaledDamage, info.DamageType, IsServer, null, info.AttackerId, 0, info.DetonateAmmo); } collection.Clear(); } @@ -350,74 +349,51 @@ private void DamageShield(HitEntity hitEnt, ProInfo info) // silly levels of inl private void DamageGrid(HitEntity hitEnt, ProInfo t) { - var grid = hitEnt.Entity as MyCubeGrid; - if (grid == null || grid.MarkedForClose || !hitEnt.HitPos.HasValue || hitEnt.Blocks == null) + //var grid = hitEnt.Entity as MyCubeGrid; + if (!hitEnt.HitPos.HasValue || hitEnt.Blocks == null) { hitEnt.Blocks?.Clear(); return; } - - if (t.AmmoDef.DamageScales.Shields.Type == ShieldDef.ShieldType.Heal || (!t.AmmoDef.Const.SelfDamage && !t.AmmoDef.Const.IsCriticalReaction && !t.Storage.SmartReady) && t.Ai.AiType == Ai.AiTypes.Grid && t.Ai.GridEntity.IsInSameLogicalGroupAs(grid) || !grid.DestructibleBlocks || grid.Immune || grid.GridGeneralDamageModifier <= 0) + + if (t.AmmoDef.DamageScales.Shields.Type == ShieldDef.ShieldType.Heal || (!t.AmmoDef.Const.SelfDamage && !t.AmmoDef.Const.IsCriticalReaction && !t.Storage.SmartReady) && t.Ai.AiType == Ai.AiTypes.Grid && t.Ai.GridEntity.IsInSameLogicalGroupAs(hitEnt.Blocks[0].Block.CubeGrid)) { t.BaseDamagePool = 0; return; } //Global & modifiers - var canDamage = t.DoDamage; - - var directDmgGlobal = Settings.Enforcement.DirectDamageModifer * hitEnt.DamageMulti; - var areaDmgGlobal = Settings.Enforcement.AreaDamageModifer * hitEnt.DamageMulti; - var sync = DedicatedServer; - float gridDamageModifier = grid.GridGeneralDamageModifier; - var gridBlockCount = grid.CubeBlocks.Count; IMySlimBlock rootBlock = null; var d = t.AmmoDef.DamageScales; var armor = t.AmmoDef.DamageScales.Armor; - var maxIntegrity = d.MaxIntegrity; //Target/targeting Info - var largeGrid = grid.GridSizeEnum == MyCubeSize.Large; var attackerId = t.Weapon.Comp.CoreEntity.EntityId; var maxObjects = t.AmmoDef.Const.MaxObjectsHit; - var gridMatrix = grid.PositionComp.WorldMatrixRef; var distTraveled = t.AmmoDef.Const.IsBeamWeapon ? hitEnt.HitDist ?? t.DistanceTraveled : t.DistanceTraveled; - - var direction = hitEnt.Intersection; - - var deformType = d.Deform.DeformType; var deformDelay = t.AmmoDef.Const.DeformDelay; - //Ammo properties - var hitMass = t.AmmoDef.Const.Mass; //overall primary falloff scaling var fallOff = t.AmmoDef.Const.FallOffScaling && distTraveled > t.AmmoDef.Const.FallOffDistance; var fallOffMultipler = 1d; if (fallOff) - { fallOffMultipler = (float)MathHelperD.Clamp(1.0 - ((distTraveled - t.AmmoDef.Const.FallOffDistance) / (t.AmmoDef.Const.MaxTrajectory - t.AmmoDef.Const.FallOffDistance)), t.AmmoDef.DamageScales.FallOff.MinMultipler, 1); - } + //hit & damage loop info var basePool = t.BaseDamagePool; var hits = 1; if (t.AmmoDef.Const.VirtualBeams) - { hits = t.Weapon.WeaponCache.Hits; - } - var partialShield = t.ShieldInLine && !t.ShieldBypassed && SApi.MatchEntToShieldFast(grid, true) != null; var objectsHit = t.ObjectsHit; - var blockCount = hitEnt.Blocks.Count; + var blockCount = t.BlockList.Count; var countBlocksAsObjects = t.AmmoDef.ObjectsHit.CountBlocks; - - - //General damage data - + //Generics used for both AOE and detonation var aoeFalloff = Falloff.NoFalloff; var aoeShape = AoeShape.Diamond; var hasAoe = t.AmmoDef.AreaOfDamage.ByBlockHit.Enable; var hasDet = t.AmmoDef.AreaOfDamage.EndOfLife.Enable && t.RelativeAge >= t.AmmoDef.AreaOfDamage.EndOfLife.MinArmingTime; - var damageType = t.ShieldBypassed ? ShieldBypassDamageType : hasAoe || hasDet ? MyDamageType.Explosion : MyDamageType.Bullet; + //Switches and setup for damage types/event loops var detRequested = false; var detActive = false; @@ -429,18 +405,7 @@ private void DamageGrid(HitEntity hitEnt, ProInfo t) var smallVsLargeBuff = 1f; var cutoff = t.AmmoDef.BaseDamageCutoff; var useBaseCutoff = cutoff > 0; - if (!Settings.Enforcement.DisableSmallVsLargeBuff && t.Ai.AiType == Ai.AiTypes.Grid && grid.GridSizeEnum != t.Ai.GridEntity.GridSizeEnum) - { - if (t.Ai.GridEntity.GridSizeEnum == MyCubeSize.Large) { - if (aConst.SmallGridDmgScale < 0 && aConst.LargeGridDmgScale < 0) - smallVsLargeBuff = 0.25f; - } - } - var gridSizeBuff = 1f; - if (grid.GridSizeEnum == MyCubeSize.Large) - gridSizeBuff = Settings.Enforcement.LargeGridDamageMultiplier; - else - gridSizeBuff = Settings.Enforcement.SmallGridDamageMultiplier; + var appliedImpulse = false; for (int i = 0; i < blockCount; i++) @@ -453,6 +418,23 @@ private void DamageGrid(HitEntity hitEnt, ProInfo t) else if(hasDet && objectsHit >= maxObjects && t.AmmoDef.ObjectsHit.SkipBlocksForAOE) basePool = 0; + //var rootInfo = hitEnt.Blocks[i]; + //rootBlock = rootInfo.Block; + rootBlock = t.BlockList[i].Key; + + //Grid specific + var grid = rootBlock.CubeGrid as MyCubeGrid; + if (grid.MarkedForClose || grid.IsPreview || !grid.DestructibleBlocks || grid.Immune || grid.GridGeneralDamageModifier <= 0) + continue; + + float gridDamageModifier = grid.GridGeneralDamageModifier; + var gridBlockCount = grid.CubeBlocks.Count; + var largeGrid = grid.GridSizeEnum == MyCubeSize.Large; + var gridSizeBuff = grid.GridSizeEnum == MyCubeSize.Large ? Settings.Enforcement.LargeGridDamageMultiplier : Settings.Enforcement.SmallGridDamageMultiplier; + var partialShield = t.ShieldInLine && !t.ShieldBypassed && SApi.MatchEntToShieldFast(grid, true) != null; + if (!Settings.Enforcement.DisableSmallVsLargeBuff && t.Ai.AiType == Ai.AiTypes.Grid && grid.GridSizeEnum != t.Ai.GridEntity.GridSizeEnum && t.Ai.GridEntity.GridSizeEnum == MyCubeSize.Large && aConst.SmallGridDmgScale < 0 && aConst.LargeGridDmgScale < 0) + smallVsLargeBuff = 0.25f; + var aoeAbsorb = 0d; var aoeDepth = 0d; var aoeDmgTally = 0d; @@ -461,7 +443,6 @@ private void DamageGrid(HitEntity hitEnt, ProInfo t) var aoeIsPool = false; var aoeHits = 0; - if (hasAoe && !detRequested)//load in AOE vars { aoeDamage = aConst.ByBlockHitDamage; @@ -483,8 +464,7 @@ private void DamageGrid(HitEntity hitEnt, ProInfo t) aoeIsPool = aoeFalloff == Falloff.Pooled; } - var rootInfo = hitEnt.Blocks[i]; - rootBlock = rootInfo.Block; + if (!detRequested) { if (IsServer && _destroyedSlims.Contains(rootBlock) || IsClient && _destroyedSlimsClient.Contains(rootBlock)) @@ -524,7 +504,7 @@ private void DamageGrid(HitEntity hitEnt, ProInfo t) if (hasAoe && !detRequested || hasDet && detRequested) { detRequested = false; - RadiantAoe(ref rootInfo, grid, aoeRadius, aoeDepth, direction, ref maxAoeDistance, out foundAoeBlocks, aoeShape, showHits, out aoeHits); + RadiantAoe(rootBlock.Position, grid, aoeRadius, aoeDepth, hitEnt.Intersection, ref maxAoeDistance, out foundAoeBlocks, aoeShape, showHits, out aoeHits); } var blockStages = maxAoeDistance + 1; @@ -585,9 +565,9 @@ private void DamageGrid(HitEntity hitEnt, ProInfo t) var blockHp = (double)(!IsClient ? block.Integrity - block.AccumulatedDamage : (_slimHealthClient.TryGetValue(block, out cachedIntegrity) ? cachedIntegrity : block.Integrity)); var blockDmgModifier = cubeBlockDef.GeneralDamageMultiplier; double damageScale = hits; - double directDamageScale = directDmgGlobal; - double areaDamageScale = areaDmgGlobal; - double detDamageScale = areaDmgGlobal; + double directDamageScale = Settings.Enforcement.DirectDamageModifer * hitEnt.DamageMulti; + double areaDamageScale = Settings.Enforcement.AreaDamageModifer * hitEnt.DamageMulti; + double detDamageScale = areaDamageScale; //Damage scaling for blocktypes if (aConst.DamageScaling || !MyUtils.IsEqual(blockDmgModifier, 1f) || !MyUtils.IsEqual(gridDamageModifier, 1f)) @@ -597,7 +577,7 @@ private void DamageGrid(HitEntity hitEnt, ProInfo t) else blockHp = (blockHp / blockDmgModifier / gridDamageModifier); - if (maxIntegrity > 0 && blockHp > maxIntegrity) + if (d.MaxIntegrity > 0 && blockHp > d.MaxIntegrity) { basePool = 0; continue; @@ -769,22 +749,23 @@ private void DamageGrid(HitEntity hitEnt, ProInfo t) } } + //Log.Line($"Damaged {block.BlockDefinition.DisplayNameText} on {block.CubeGrid.DisplayName}"); //Apply damage - if (canDamage) + if (t.DoDamage) { try { - if (Session.IsServer && !appliedImpulse && primaryDamage && hitMass > 0 ) + if (Session.IsServer && !appliedImpulse && primaryDamage && t.AmmoDef.Const.Mass > 0 ) { appliedImpulse = true; var speed = !t.AmmoDef.Const.IsBeamWeapon && t.AmmoDef.Const.DesiredProjectileSpeed > 0 ? t.AmmoDef.Const.DesiredProjectileSpeed : 1; - ApplyProjectileForce(grid, grid.GridIntegerToWorld(rootBlock.Position), hitEnt.Intersection.Direction, (hitMass * speed)); + ApplyProjectileForce(grid, grid.GridIntegerToWorld(rootBlock.Position), hitEnt.Intersection.Direction, (t.AmmoDef.Const.Mass * speed)); } if (!deadBlock || gridBlockCount < 2500) { - block.DoDamage(scaledDamage, damageType, sync, null, attackerId); + block.DoDamage(scaledDamage, damageType, IsServer, null, attackerId); var remainingHp = blockHp - scaledDamage; @@ -792,13 +773,13 @@ private void DamageGrid(HitEntity hitEnt, ProInfo t) { uint lastDeformTick; MyCube myCube; - if (deformType == DeformDef.DeformTypes.HitBlock && primaryDamage && (deformDelay == 1 || !_slimLastDeformTick.TryGetValue(block, out lastDeformTick) || Tick - lastDeformTick >= deformDelay) && grid.TryGetCube(block.Position, out myCube)) + if (d.Deform.DeformType == DeformDef.DeformTypes.HitBlock && primaryDamage && (deformDelay == 1 || !_slimLastDeformTick.TryGetValue(block, out lastDeformTick) || Tick - lastDeformTick >= deformDelay) && grid.TryGetCube(block.Position, out myCube)) { grid.ApplyDestructionDeformation(myCube.CubeBlock, 0f, new MyHitInfo(), attackerId); if (deformDelay > 1) _slimLastDeformTick[block] = Tick; } - else if (deformType == DeformDef.DeformTypes.AllDamagedBlocks && (deformDelay == 1 || !_slimLastDeformTick.TryGetValue(block, out lastDeformTick) || Tick - lastDeformTick >= deformDelay) && grid.TryGetCube(block.Position, out myCube)) + else if (d.Deform.DeformType == DeformDef.DeformTypes.AllDamagedBlocks && (deformDelay == 1 || !_slimLastDeformTick.TryGetValue(block, out lastDeformTick) || Tick - lastDeformTick >= deformDelay) && grid.TryGetCube(block.Position, out myCube)) { grid.ApplyDestructionDeformation(myCube.CubeBlock, 0f, new MyHitInfo(), attackerId); if (deformDelay > 1) @@ -899,7 +880,8 @@ private void DamageGrid(HitEntity hitEnt, ProInfo t) Vector3 halfExt; rootBlock.ComputeScaledHalfExtents(out halfExt); var blockBox = new BoundingBoxD(-halfExt, halfExt); - gridMatrix.Translation = grid.GridIntegerToWorld(rootBlock.Position); + var gridMatrix = rootBlock.CubeGrid.PositionComp.WorldMatrixRef; + gridMatrix.Translation = rootBlock.CubeGrid.GridIntegerToWorld(rootBlock.Position); obb = new MyOrientedBoundingBoxD(blockBox, gridMatrix); } @@ -916,6 +898,7 @@ private void DamageGrid(HitEntity hitEnt, ProInfo t) t.BaseDamagePool = basePool; hitEnt.Blocks.Clear(); + t.BlockList.Clear(); } @@ -932,8 +915,6 @@ private void DamageDestObj(HitEntity hitEnt, ProInfo info) var areaDmgGlobal = Settings.Enforcement.AreaDamageModifer; var shieldHeal = info.AmmoDef.DamageScales.Shields.Type == ShieldDef.ShieldType.Heal; - var sync = MpActive && IsServer; - var attackerId = info.Weapon.Comp.CoreEntity.EntityId; var objHp = destObj.Integrity; @@ -980,7 +961,7 @@ private void DamageDestObj(HitEntity hitEnt, ProInfo info) info.ProHits = info.ProHits != null && ProHitPool.Count > 0 ? ProHitPool.Pop() : new List>(); info.ProHits.Add(new MyTuple(hitEnt.Intersection.To, hitEnt.Entity, (float)scaledDamage)); } - destObj.DoDamage(scaledDamage, !info.ShieldBypassed ? MyDamageType.Bullet : MyDamageType.Drill, sync, null, attackerId); + destObj.DoDamage(scaledDamage, !info.ShieldBypassed ? MyDamageType.Bullet : MyDamageType.Drill, IsServer, null, attackerId); } if (info.AmmoDef.Const.Mass > 0) @@ -1142,57 +1123,51 @@ private void DamageVoxel(HitEntity hitEnt, ProInfo info, HitEntity.Type type) info.ObjectsHit++; float damageScale = 1 * directDmgGlobal; - if (info.AmmoDef.Const.VirtualBeams) damageScale *= info.Weapon.WeaponCache.Hits; + if (info.AmmoDef.Const.VirtualBeams) + damageScale *= info.Weapon.WeaponCache.Hits; var scaledDamage = info.BaseDamagePool * damageScale; - + + //Falloff var distTraveled = info.AmmoDef.Const.IsBeamWeapon ? hitEnt.HitDist ?? info.DistanceTraveled : info.DistanceTraveled; - var fallOff = info.AmmoDef.Const.FallOffScaling && distTraveled > info.AmmoDef.Const.FallOffDistance; - - if (fallOff) - { - var fallOffMultipler = (float)MathHelperD.Clamp(1.0 - ((distTraveled - info.AmmoDef.Const.FallOffDistance) / (info.AmmoDef.Const.MaxTrajectory - info.AmmoDef.Const.FallOffDistance)), info.AmmoDef.DamageScales.FallOff.MinMultipler, 1); - scaledDamage *= fallOffMultipler; - } + if (info.AmmoDef.Const.FallOffScaling && distTraveled > info.AmmoDef.Const.FallOffDistance) + scaledDamage *= (float)MathHelperD.Clamp(1.0 - ((distTraveled - info.AmmoDef.Const.FallOffDistance) / (info.AmmoDef.Const.MaxTrajectory - info.AmmoDef.Const.FallOffDistance)), info.AmmoDef.DamageScales.FallOff.MinMultipler, 1); var oRadius = info.AmmoDef.Const.ByBlockHitRadius; var minTestRadius = distTraveled - info.PrevDistanceTraveled; var tRadius = oRadius < minTestRadius && !info.AmmoDef.Const.IsBeamWeapon ? minTestRadius : oRadius; var objHp = (int)MathHelper.Clamp(MathFuncs.VolumeCube(MathFuncs.LargestCubeInSphere(tRadius)), 5000, double.MaxValue); - if (tRadius > 5) objHp *= 5; + if (tRadius > 5) + objHp *= 5; if (scaledDamage < objHp) { var reduceBy = objHp / scaledDamage; oRadius /= reduceBy; - if (oRadius < 1) oRadius = 1; - + if (oRadius < 1) + oRadius = 1; info.BaseDamagePool = 0; } else { info.BaseDamagePool -= objHp; - if (oRadius < minTestRadius) oRadius = minTestRadius; + if (oRadius < minTestRadius) + oRadius = minTestRadius; } var cut = aConst.FakeVoxelHitTicks == 0 || aConst.FakeVoxelHitTicks == Tick; if (cut) { var radius = (float)(oRadius * info.AmmoDef.Const.VoxelHitModifier); + var dRadius = detonateOnEnd ? info.AmmoDef.Const.EndOfLifeDepth < info.AmmoDef.Const.EndOfLifeRadius ? info.AmmoDef.Const.EndOfLifeDepth : info.AmmoDef.Const.EndOfLifeRadius : -1; + if (dRadius != -1 && dRadius < 1.5) + dRadius = 1.5f; + if (detonateOnEnd && info.BaseDamagePool <= 0 && dRadius > radius) + radius = dRadius; destObj.PerformCutOutSphereFast(hitInfo.Position, radius, true); } - if (detonateOnEnd && info.BaseDamagePool <= 0 && cut) - { - var dRadius = info.AmmoDef.Const.EndOfLifeRadius; - - if (dRadius < 1.5) dRadius = 1.5f; - - if (info.DoDamage) - destObj.PerformCutOutSphereFast(hitInfo.Position, dRadius, true); - } - if (GlobalDamageHandlerActive) { info.ProHits = info.ProHits != null && ProHitPool.Count > 0 ? ProHitPool.Pop() : new List>(); @@ -1200,10 +1175,9 @@ private void DamageVoxel(HitEntity hitEnt, ProInfo info, HitEntity.Type type) } } } - } - public void RadiantAoe(ref HitEntity.RootBlocks rootInfo, MyCubeGrid grid, double radius, double depth, LineD direction, ref int maxDbc, out bool foundSomething, AoeShape shape, bool showHits,out int aoeHits) //added depth and angle + public void RadiantAoe(Vector3I rootInfo, MyCubeGrid grid, double radius, double depth, LineD direction, ref int maxDbc, out bool foundSomething, AoeShape shape, bool showHits,out int aoeHits) //added depth and angle { if (depth <= 0) { @@ -1214,7 +1188,7 @@ public void RadiantAoe(ref HitEntity.RootBlocks rootInfo, MyCubeGrid grid, doubl //Log.Line($"Start"); //var watch = System.Diagnostics.Stopwatch.StartNew(); - var rootHitPos = rootInfo.QueryPos; //local cube grid + var rootHitPos = rootInfo; //local cube grid var localfrom = grid.WorldToGridScaledLocal(direction.From); var localto = grid.WorldToGridScaledLocal(direction.To); var gridsize = grid.GridSizeR; @@ -1458,25 +1432,5 @@ internal bool RayAccuracyCheck(HitEntity hitEnt, IMySlimBlock block) } return false; } - - private bool RayAccuracyCheck(HitEntity hitEnt, IMyCharacter character) - { - var box = character.PositionComp.WorldAABB; - var ray = new RayD(ref hitEnt.Intersection.From, ref hitEnt.Intersection.Direction); - var rayHit = ray.Intersects(box); - if (rayHit != null) - { - var hitPos = hitEnt.Intersection.From + (hitEnt.Intersection.Direction * (rayHit.Value - 0.1f)); - IHitInfo hitInfo; - if (Physics.CastRay(hitPos, hitEnt.Intersection.To, out hitInfo, 15)) - { - var hit = (MyEntity)hitInfo.HitEntity; - var hitPoint = hitInfo.Position + (hitEnt.Intersection.Direction * 0.1f); - var rayHitTarget = box.Contains(hitPoint) != ContainmentType.Disjoint && hit == character; - return rayHitTarget; - } - } - return false; - } } } diff --git a/Data/Scripts/CoreSystems/Session/SessionEvents.cs b/Data/Scripts/CoreSystems/Session/SessionEvents.cs index ea339761..cec3cde7 100644 --- a/Data/Scripts/CoreSystems/Session/SessionEvents.cs +++ b/Data/Scripts/CoreSystems/Session/SessionEvents.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Linq; using System.Text; using CoreSystems.Platform; using CoreSystems.Support; @@ -13,7 +12,6 @@ using VRage.Collections; using VRage.Game.Entity; using VRage.Game.ModAPI; -using VRageMath; using static CoreSystems.Support.Ai; using IMyControllableEntity = VRage.Game.ModAPI.Interfaces.IMyControllableEntity; diff --git a/Data/Scripts/CoreSystems/Session/SessionEwar.cs b/Data/Scripts/CoreSystems/Session/SessionEwar.cs index 50cf26b8..49b0b90f 100644 --- a/Data/Scripts/CoreSystems/Session/SessionEwar.cs +++ b/Data/Scripts/CoreSystems/Session/SessionEwar.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Text; using CoreSystems.Support; using Sandbox.Game.Entities; using Sandbox.ModAPI; @@ -270,7 +269,7 @@ private void ComputeEffects(MyCubeGrid grid, AmmoDef ammoDef, double damagePool, { if (scaledDamage < blockHp || gridBlockCount < 1000) { - block.DoDamage((float) scaledDamage, MyDamageType.Explosion, sync, null, attackerId, 0, false); + block.DoDamage((float) scaledDamage, MyDamageType.Explosion, true, null, attackerId, 0, false); } else { diff --git a/Data/Scripts/CoreSystems/Session/SessionFields.cs b/Data/Scripts/CoreSystems/Session/SessionFields.cs index 55895c2c..3f0b020b 100644 --- a/Data/Scripts/CoreSystems/Session/SessionFields.cs +++ b/Data/Scripts/CoreSystems/Session/SessionFields.cs @@ -332,6 +332,14 @@ public partial class Session internal Projectiles.Projectiles Projectiles; internal ApiBackend Api; internal Action ProjectileAddedCallback = (location, health) => { }; + /// + /// WcApi action for feeding targets to grid AI. Overrides default if not null. + /// + internal Action> ScanTargetsAction = null; + /// + /// WcApi function for checking if a weapon's target is allowed. Defaults true if null. + /// + internal Func ValidateWeaponTargetFunc = null; internal ShieldApi SApi = new ShieldApi(); internal NetworkReporter Reporter = new NetworkReporter(); internal MyStorageData TmpStorage = new MyStorageData(); @@ -417,7 +425,6 @@ public partial class Session internal double SyncDistSqr; internal double SyncBufferedDistSqr; internal double SyncDist; - internal double MaxEntitySpeed; internal double Load; internal double ScaleFov; internal double RayMissAmounts; diff --git a/Data/Scripts/CoreSystems/Session/SessionInit.cs b/Data/Scripts/CoreSystems/Session/SessionInit.cs index b66f3851..f3e5e421 100644 --- a/Data/Scripts/CoreSystems/Session/SessionInit.cs +++ b/Data/Scripts/CoreSystems/Session/SessionInit.cs @@ -46,21 +46,9 @@ private void BeforeStartInit() if (HandlesInput) MyAPIGateway.Utilities.MessageEntered += ChatMessageSet; - var env = MyDefinitionManager.Static.EnvironmentDefinition; - if (env.LargeShipMaxSpeed > MaxEntitySpeed) MaxEntitySpeed = env.LargeShipMaxSpeed; - else if (env.SmallShipMaxSpeed > MaxEntitySpeed) MaxEntitySpeed = env.SmallShipMaxSpeed; - if (MpActive) - { - SyncDist = MyAPIGateway.Session.SessionSettings.SyncDistance; - SyncDistSqr = SyncDist * SyncDist; - SyncBufferedDistSqr = SyncDistSqr + 250000; - } - else - { - SyncDist = MyAPIGateway.Session.SessionSettings.ViewDistance; - SyncDistSqr = SyncDist * SyncDist; - SyncBufferedDistSqr = (SyncDist + 500) * (SyncDist + 500); - } + SyncDist = MpActive ? MyAPIGateway.Session.SessionSettings.SyncDistance : MyAPIGateway.Session.SessionSettings.ViewDistance; + SyncDistSqr = SyncDist * SyncDist; + SyncBufferedDistSqr = SyncDistSqr + 250000; PreFetchMaxDist = MyAPIGateway.Session.SessionSettings.PrefetchShapeRayLengthLimit - 1; @@ -71,7 +59,6 @@ private void BeforeStartInit() GenerateButtonMap(); Settings = new CoreSettings(this); ReallyStupidKeenShit(); - CounterKeenLogMessage(); var control = MyAPIGateway.Input.GetGameControl(MyStringId.GetOrCompute("RELOAD")); UiInput.ReloadKey = control.GetKeyboardControl(); diff --git a/Data/Scripts/CoreSystems/Session/SessionLocalPlayer.cs b/Data/Scripts/CoreSystems/Session/SessionLocalPlayer.cs index 4a628ec2..ddcea868 100644 --- a/Data/Scripts/CoreSystems/Session/SessionLocalPlayer.cs +++ b/Data/Scripts/CoreSystems/Session/SessionLocalPlayer.cs @@ -8,11 +8,9 @@ using VRage.Game.Entity; using VRage.Game.ModAPI; using VRage.Input; -using VRage.ObjectBuilders; using VRage.Utils; using VRageMath; using static CoreSystems.Support.Ai; -using static VRage.Game.MyObjectBuilder_ControllerSchemaDefinition; namespace CoreSystems { diff --git a/Data/Scripts/CoreSystems/Session/SessionModHandlers.cs b/Data/Scripts/CoreSystems/Session/SessionModHandlers.cs index b674a735..d16a5983 100644 --- a/Data/Scripts/CoreSystems/Session/SessionModHandlers.cs +++ b/Data/Scripts/CoreSystems/Session/SessionModHandlers.cs @@ -1,11 +1,8 @@ using System; using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; using CoreSystems.Support; using Sandbox.Definitions; using Sandbox.ModAPI; -using VRage; using VRage.Utils; namespace CoreSystems diff --git a/Data/Scripts/CoreSystems/Session/SessionNetwork.cs b/Data/Scripts/CoreSystems/Session/SessionNetwork.cs index 53216a3b..c388e109 100644 --- a/Data/Scripts/CoreSystems/Session/SessionNetwork.cs +++ b/Data/Scripts/CoreSystems/Session/SessionNetwork.cs @@ -105,11 +105,6 @@ private bool ProccessClientPacket(PacketObj packetObj, bool firstRun = true) ClientProjectileTargetSyncs(packetObj); break; } - case PacketType.HandWeaponDebug: - { - ClientHandDebug(packetObj); - break; - } case PacketType.AimTargetUpdate: { ClientFakeTargetUpdate(packetObj); diff --git a/Data/Scripts/CoreSystems/Session/SessionNetworkCMethods.cs b/Data/Scripts/CoreSystems/Session/SessionNetworkCMethods.cs index 3c328e6f..797c9704 100644 --- a/Data/Scripts/CoreSystems/Session/SessionNetworkCMethods.cs +++ b/Data/Scripts/CoreSystems/Session/SessionNetworkCMethods.cs @@ -1,11 +1,8 @@ -using System.Collections.Generic; -using CoreSystems.Platform; +using CoreSystems.Platform; using CoreSystems.Projectiles; using CoreSystems.Support; using Sandbox.Game.Entities; -using Sandbox.ModAPI; using VRage.Game.Entity; -using static CoreSystems.Session; using static CoreSystems.Support.Ai; namespace CoreSystems { @@ -456,18 +453,6 @@ private bool ClientSentReport(PacketObj data) } - private bool ClientHandDebug(PacketObj data) - { - var packet = data.Packet; - var debugPacket = (HandWeaponDebugPacket)packet; - if (debugPacket == null) return Error(data, Msg("HandDebug")); - { - DrawHandDebug(debugPacket); - } - data.Report.PacketValid = true; - return true; - } - private bool ClientProjectilePosSyncs(PacketObj data) { var packet = data.Packet; diff --git a/Data/Scripts/CoreSystems/Session/SessionNetworkSMethods.cs b/Data/Scripts/CoreSystems/Session/SessionNetworkSMethods.cs index 2f1665b3..03cf0cc2 100644 --- a/Data/Scripts/CoreSystems/Session/SessionNetworkSMethods.cs +++ b/Data/Scripts/CoreSystems/Session/SessionNetworkSMethods.cs @@ -2,7 +2,6 @@ using CoreSystems.Support; using Sandbox.Game.Entities; using Sandbox.ModAPI; -using VRage.Game.Entity; using VRageMath; using static CoreSystems.Platform.ControlSys; using static CoreSystems.Support.Focus; diff --git a/Data/Scripts/CoreSystems/Session/SessionNetworkSupport.cs b/Data/Scripts/CoreSystems/Session/SessionNetworkSupport.cs index e1b3591d..1a04d5f8 100644 --- a/Data/Scripts/CoreSystems/Session/SessionNetworkSupport.cs +++ b/Data/Scripts/CoreSystems/Session/SessionNetworkSupport.cs @@ -1,13 +1,9 @@ using System; using CoreSystems.Platform; using CoreSystems.Support; -using Sandbox.ModAPI; -using VRage; using VRage.Game.Entity; -using VRage.Game.ModAPI; using VRageMath; using static CoreSystems.Platform.ControlSys; -using static CoreSystems.Platform.Weapon.ShootManager; using static CoreSystems.Support.CoreComponent; namespace CoreSystems @@ -103,24 +99,6 @@ public void CleanUp() #endregion #region ServerOnly - - internal readonly HandWeaponDebugPacket HandDebugPacketPacket = new HandWeaponDebugPacket {PType = PacketType.HandWeaponDebug}; - private void SendHandDebugInfo(Weapon weapon) - { - PlayerMap player; - if (Players.TryGetValue(weapon.Comp.Data.Repo.Values.State.PlayerId, out player)) - { - HandDebugPacketPacket.SenderId = player.Player.SteamUserId; - - PacketsToClient.Add(new PacketInfo - { - SingleClient = true, - Unreliable = true, - Packet = HandDebugPacketPacket - }); - } - } - private void SendProjectilePosSyncs() { var packet = ProtoWeaponProPosPacketPool.Count > 0 ? ProtoWeaponProPosPacketPool.Pop() : new ProjectileSyncPositionPacket (); diff --git a/Data/Scripts/CoreSystems/Session/SessionRun.cs b/Data/Scripts/CoreSystems/Session/SessionRun.cs index bddf2076..0fc13f2e 100644 --- a/Data/Scripts/CoreSystems/Session/SessionRun.cs +++ b/Data/Scripts/CoreSystems/Session/SessionRun.cs @@ -243,7 +243,7 @@ public override void UpdateAfterSimulation() if (WaterApiLoaded && (Tick3600 || WaterMap.IsEmpty)) UpdateWaters(); - if (HandlesInput && Tick30) + if (HandlesInput && Tick30 && (Settings?.Enforcement?.ProhibitHUDPainter != null ? !Settings.Enforcement.ProhibitHUDPainter : true )) UpdatePlayerPainters(); if (DebugLos && Tick1800) { diff --git a/Data/Scripts/CoreSystems/Session/SessionSupport.cs b/Data/Scripts/CoreSystems/Session/SessionSupport.cs index ad008cda..d963bd30 100644 --- a/Data/Scripts/CoreSystems/Session/SessionSupport.cs +++ b/Data/Scripts/CoreSystems/Session/SessionSupport.cs @@ -83,18 +83,7 @@ internal void Timings() if (IsServer && PbActivate && !PbApiInited) Api.PbInit(); if (HandlesInput && !ClientCheck && Tick > 1200) - { - if (IsClient) - { - if (ServerVersion != ModContext.ModName) - { - var message = $"::CoreSystems Version Mismatch:: Server:{ServerVersion} - Client:{ModContext.ModName} - Unexpected behavior may occur."; - Log.Line(message); - //MyAPIGateway.Utilities.ShowNotification(message, 10000, "Red"); - } - } ClientCheck = true; - } } LCount++; @@ -146,8 +135,6 @@ internal void Timings() if (!PlayersLoaded && KeenFuckery()) PlayersLoaded = true; - - //Api.PbHackDetection(); } internal void AddLosCheck(LosDebug debug) @@ -257,45 +244,6 @@ internal void VisualDebuging() else ShowLocalNotify($"[Approach] Completed on stage:{ApproachDebug.Stage} - {ApproachDebug.Start1}:{ApproachDebug.Start2}:{ApproachDebug.End1}:{ApproachDebug.End2} - {ApproachDebug.TimeSinceSpawn}:{ApproachDebug.NextSpawn}", 2000, "White"); } - - /* - if (Tick - _clientHandDebug.LastHitTick < 1200 || Tick - _clientHandDebug.LastShootTick < 1200) - { - if (_clientHandDebug.ShootStart != Vector3D.Zero) - DsDebugDraw.DrawLine(_clientHandDebug.ShootStart, _clientHandDebug.ShootEnd, Color.Blue, 0.2f); - if (_clientHandDebug.HitStart != Vector3D.Zero) - DsDebugDraw.DrawLine(_clientHandDebug.HitStart, _clientHandDebug.HitEnd, Color.Red, 0.2f); - } - - if (Tick - _clientHandDebug2.LastHitTick < 1200 || Tick - _clientHandDebug2.LastShootTick < 1200) - { - if (_clientHandDebug2.ShootStart != Vector3D.Zero) - DsDebugDraw.DrawLine(_clientHandDebug2.ShootStart, _clientHandDebug2.ShootEnd, Color.Green, 0.2f); - if (_clientHandDebug2.HitStart != Vector3D.Zero) - DsDebugDraw.DrawLine(_clientHandDebug2.HitStart, _clientHandDebug2.HitEnd, Color.Yellow, 0.2f); - } - */ - } - - public void AddHandHitDebug(Vector3D start, Vector3D end, bool shoot) - { - var packet = HandlesInput ? _clientHandDebug2 : HandDebugPacketPacket; - if (shoot) - { - packet.LastShootTick = Tick + 1; - packet.LastHitTick = uint.MaxValue; - packet.ShootStart = start; - packet.ShootEnd = end; - packet.HitStart = Vector3D.Zero; - packet.HitEnd = Vector3D.Zero; - } - else - { - packet.LastHitTick = Tick + 1; - packet.HitStart = start; - packet.HitEnd = end; - } - } private double _drawCpuTime; @@ -874,12 +822,10 @@ private void ChatMessageSet(string message, ref bool sendToOthers) private uint _lastIncompatibleMessageTick = uint.MaxValue; internal void RemoveIncompatibleBlock(object o) { - var cube = o as MyCubeBlock; - if (cube != null) + try { - - var processCube = !cube.MarkedForClose && !cube.Closed && cube.SlimBlock != null && cube.BlockDefinition != null && cube.CubeGrid != null && !cube.CubeGrid.IsPreview && cube.CubeGrid.Physics != null && !cube.CubeGrid.MarkedForClose; - if (processCube) + var cube = o as MyCubeBlock; + if (cube != null && !cube.MarkedForClose && !cube.Closed && cube.SlimBlock != null && cube.BlockDefinition != null && cube.CubeGrid != null && !cube.CubeGrid.IsPreview && cube.CubeGrid.Physics != null && !cube.CubeGrid.MarkedForClose) { if (BrokenMod(cube)) return; @@ -916,6 +862,12 @@ internal void RemoveIncompatibleBlock(object o) } } } + catch (Exception ex) + { + var errorMsg = $"WC exception in RemoveIncompatibleBlock. Settings.Enforcement null: {Settings?.Enforcement == null} Unsupported mode: {Settings?.Enforcement?.UnsupportedMode} \n{ex}"; + MyLog.Default.Error(errorMsg); + throw ex; + } } private readonly HashSet _unsupportedBlockNames = new HashSet(); @@ -1125,26 +1077,6 @@ internal void CheckToolbarForVanilla(MyCubeBlock cube) } } - private readonly HandWeaponDebugPacket _clientHandDebug = new HandWeaponDebugPacket(); - private readonly HandWeaponDebugPacket _clientHandDebug2 = new HandWeaponDebugPacket(); - - private void DrawHandDebug(HandWeaponDebugPacket hDebug) - { - _clientHandDebug.ShootStart = hDebug.ShootStart; - _clientHandDebug.ShootEnd = hDebug.ShootEnd; - _clientHandDebug.HitStart = hDebug.HitStart; - _clientHandDebug.HitEnd = hDebug.HitEnd; - _clientHandDebug.LastHitTick = Tick; - _clientHandDebug.LastShootTick = Tick; - } - - private static void CounterKeenLogMessage(bool console = true) - { - var message = "\n***\n [CoreSystems] Ignore log messages from keen stating 'Mod CoreSystems is accessing physics from parallel threads'\n CS is using a thread safe parallel.for, not a parallel task\n***"; - if (console) MyLog.Default.WriteLineAndConsole(message); - else MyLog.Default.WriteLine(message); - } - internal static double ModRadius(double radius, bool largeBlock) { if (largeBlock && radius < 3) radius = 3; @@ -1162,6 +1094,9 @@ public void WeaponDebug(Weapon w) DsDebugDraw.DrawLine(w.MyAimTestLine, Color.Black, 0.07f); DsDebugDraw.DrawSingleVec(w.MyPivotPos, 1f, Color.White); DsDebugDraw.DrawLine(w.AzimuthFwdLine.From, w.AzimuthFwdLine.To, Color.Cyan, 0.05f); + DsDebugDraw.DrawLine(w.GetScope.Info.Position, w.GetScope.Info.Position + w.GetScope.Info.Direction * 10, Color.Yellow, 0.05f); + DsDebugDraw.DrawSingleVec(w.GetScope.Info.Position, 0.5f, Color.Yellow); + //DsDebugDraw.DrawLine(w.MyCenterTestLine, Color.Green, 0.05f); //DsDebugDraw.DrawBox(w.targetBox, Color.Plum); //DsDebugDraw.DrawLine(w.LimitLine.From, w.LimitLine.To, Color.Orange, 0.05f); @@ -1191,7 +1126,7 @@ private void ModChecker() ShieldMod = true; else if (mod.PublishedFileId == 1931509062 || mod.PublishedFileId == 1995197719 || mod.PublishedFileId == 2006751214 || mod.PublishedFileId == 2015560129) ReplaceVanilla = true; - else if (mod.GetPath().Contains("AppData\\Roaming\\SpaceEngineers\\Mods\\VanillaReplacement") || mod.Name.Contains("WCVanilla") || mod.FriendlyName.Contains("WCVanilla")) + else if (mod.GetPath().Contains("AppData\\Roaming\\SpaceEngineers\\Mods\\VanillaReplacement") || mod.Name.Contains("WCVanilla") || mod.FriendlyName != null && mod.FriendlyName.Contains("WCVanilla")) ReplaceVanilla = true; else if (mod.PublishedFileId == 2189703321 || mod.PublishedFileId == 2496225055 || mod.PublishedFileId == 2726343161 || mod.PublishedFileId == 2734980390) { @@ -1201,7 +1136,7 @@ private void ModChecker() WaterMod = true; } - SuppressWc = !SUtils.ModActivate(ModContext, Session); + SuppressWc = LocalVersion ? false : !SUtils.ModActivate(ModContext, Session); if (!SuppressWc && !ReplaceVanilla) { @@ -1424,13 +1359,6 @@ private void InitDelayedHandWeapons() } } - public enum CubeTypes - { - All, - Slims, - Fats, - } - internal void DeferredPlayerLocks() { foreach (var p in DeferredPlayerLock) @@ -1465,41 +1393,6 @@ internal void UpdateLocalCharacterInfo() PlayerPos = Vector3D.Zero; } - public static void GetCubesInRange(MyCubeGrid grid, MyCubeBlock rootBlock, int cubeDistance, HashSet resultSet, out Vector3I min, out Vector3I max, CubeTypes types = CubeTypes.All) - { - resultSet.Clear(); - min = rootBlock.Min - cubeDistance; - max = rootBlock.Max + cubeDistance; - var gridMin = grid.Min; - var gridMax = grid.Max; - - Vector3I.Max(ref min, ref gridMin, out min); - Vector3I.Min(ref max, ref gridMax, out max); - - var iter = new Vector3I_RangeIterator(ref min, ref max); - - var next = rootBlock.Position; - while (iter.IsValid()) { - - MyCube myCube; - if (grid.TryGetCube(next, out myCube) && myCube.CubeBlock != rootBlock.SlimBlock) { - - var slim = (IMySlimBlock)myCube.CubeBlock; - - if (next == slim.Position) { - - if (types == CubeTypes.Slims && slim.FatBlock == null) - resultSet.Add(myCube); - else if (types == CubeTypes.Fats && slim.FatBlock != null) - resultSet.Add(myCube); - else if (types == CubeTypes.All) - resultSet.Add(myCube); - } - } - iter.GetNext(out next); - } - } - private void ColorAreas() { var color = ColorArmorToggle ? SUtils.ColorToHSVOffset(Color.Black) : SUtils.ColorToHSVOffset(Color.OrangeRed); @@ -1592,6 +1485,9 @@ public bool IsPartAreaRestricted(MyStringHash subtype, MyOrientedBoundingBoxD cu var checkSphere = restriction.RestrictionRadius > 0; var querySphere = new BoundingSphereD(cubeBoundingBox.Center, queryRadius); + if (myGrid.Hierarchy == null) + return false; + myGrid.Hierarchy.QuerySphere(ref querySphere, _tmpNearByBlocks); foreach (var grid in ai.SubGridCache) { @@ -1700,17 +1596,20 @@ internal void LoadVanillaData() VanillaIds[largeMissileMedCalId] = largeMissileMedCal; VanillaCoreIds[largeMissileMedCal] = largeMissileMedCalId; - var smallLargeMissile = MyStringHash.GetOrCompute("LargeMissileLauncher"); var smallLargeMissileId = new MyDefinitionId(typeof(MyObjectBuilder_SmallMissileLauncher), "LargeMissileLauncher"); VanillaIds[smallLargeMissileId] = smallLargeMissile; VanillaCoreIds[smallLargeMissile] = smallLargeMissileId; + var largeRailgun = MyStringHash.GetOrCompute("LargeRailgun"); + var largeRailgunId = new MyDefinitionId(typeof(MyObjectBuilder_ConveyorSorter), "LargeRailgun"); + VanillaIds[largeRailgunId] = largeRailgun; + VanillaCoreIds[largeRailgun] = largeRailgunId; - var smallLargeMissileReload = MyStringHash.GetOrCompute("LargeRailgun"); - var smallLargeMissileReloadId = new MyDefinitionId(typeof(MyObjectBuilder_SmallMissileLauncherReload), "LargeRailgun"); - VanillaIds[smallLargeMissileReloadId] = smallLargeMissileReload; - VanillaCoreIds[smallLargeMissileReload] = smallLargeMissileReloadId; + var SmallRailgun = MyStringHash.GetOrCompute("SmallRailgun"); + var SmallRailgunId = new MyDefinitionId(typeof(MyObjectBuilder_ConveyorSorter), "SmallRailgun"); + VanillaIds[SmallRailgunId] = SmallRailgun; + VanillaCoreIds[SmallRailgun] = SmallRailgunId; var smallLargeMissileLargeCal = MyStringHash.GetOrCompute("LargeBlockLargeCalibreGun"); var smallLargeMissileLargeCalId = new MyDefinitionId(typeof(MyObjectBuilder_SmallMissileLauncher), "LargeBlockLargeCalibreGun"); @@ -1732,16 +1631,31 @@ internal void LoadVanillaData() VanillaIds[smallAutoTurretId] = smallAutoTurret; VanillaCoreIds[smallAutoTurret] = smallAutoTurretId; + var smallMissileTurret = MyStringHash.GetOrCompute("SmallMissileTurret"); + var smallMissileTurretId = new MyDefinitionId(typeof(MyObjectBuilder_LargeMissileTurret), "SmallMissileTurret"); + VanillaIds[smallMissileTurretId] = smallMissileTurret; + VanillaCoreIds[smallMissileTurret] = smallMissileTurretId; + var smallMedCalGun = MyStringHash.GetOrCompute("SmallBlockMediumCalibreGun"); var smallMedCalGunId = new MyDefinitionId(typeof(MyObjectBuilder_SmallMissileLauncherReload), "SmallBlockMediumCalibreGun"); VanillaIds[smallMedCalGunId] = smallMedCalGun; VanillaCoreIds[smallMedCalGun] = smallMedCalGunId; + var smallMedCalTurret = MyStringHash.GetOrCompute("SmallBlockMediumCalibreTurret"); + var smallMedCalTurretId = new MyDefinitionId(typeof(MyObjectBuilder_LargeMissileTurret), "SmallBlockMediumCalibreTurret"); + VanillaIds[smallMedCalTurretId] = smallMedCalTurret; + VanillaCoreIds[smallMedCalTurret] = smallMedCalTurretId; + var smallGatAuto = MyStringHash.GetOrCompute("SmallBlockAutocannon"); var smallGatAutoId = new MyDefinitionId(typeof(MyObjectBuilder_SmallGatlingGun), "SmallBlockAutocannon"); VanillaIds[smallGatAutoId] = smallGatAuto; VanillaCoreIds[smallGatAuto] = smallGatAutoId; + var smallGatReskin = MyStringHash.GetOrCompute("SmallGatlingTurretReskin"); + var smallGatReskinId = new MyDefinitionId(typeof(MyObjectBuilder_LargeGatlingTurret), "SmallGatlingTurretReskin"); + VanillaIds[smallGatReskinId] = smallGatReskin; + VanillaCoreIds[smallGatReskin] = smallGatReskinId; + var smallRocketReload = MyStringHash.GetOrCompute("SmallRocketLauncherReload"); var smallRocketReloadId = new MyDefinitionId(typeof(MyObjectBuilder_SmallMissileLauncherReload), "SmallRocketLauncherReload"); VanillaIds[smallRocketReloadId] = smallRocketReload; @@ -1752,6 +1666,11 @@ internal void LoadVanillaData() VanillaIds[smallGat2Id] = smallGat2; VanillaCoreIds[smallGat2] = smallGat2Id; + var smallGatTurret = MyStringHash.GetOrCompute("SmallGatlingTurret"); + var smallGatTurretId = new MyDefinitionId(typeof(MyObjectBuilder_LargeGatlingTurret), "SmallGatlingTurret"); + VanillaIds[smallGatTurretId] = smallGatTurret; + VanillaCoreIds[smallGatTurret] = smallGatTurretId; + var largeSearch = MyStringHash.GetOrCompute("LargeSearchlight"); var largeSearchId = new MyDefinitionId(typeof(MyObjectBuilder_SearchlightDefinition), "LargeSearchlight"); VanillaIds[largeSearchId] = largeSearch; @@ -1767,18 +1686,13 @@ internal void LoadVanillaData() VanillaIds[largeGatReskinId] = largeGatReskin; VanillaCoreIds[largeGatReskin] = largeGatReskinId; - var smallGatReskin = MyStringHash.GetOrCompute("SmallGatlingTurretReskin"); - var smallGatReskinId = new MyDefinitionId(typeof(MyObjectBuilder_LargeTurretBaseDefinition), "SmallGatlingTurretReskin"); - VanillaIds[smallGatReskinId] = smallGatReskin; - VanillaCoreIds[smallGatReskin] = smallGatReskinId; - var largeMissileReskin = MyStringHash.GetOrCompute("LargeMissileTurretReskin"); - var largeMissileReskinId = new MyDefinitionId(typeof(MyObjectBuilder_LargeTurretBaseDefinition), "LargeMissileTurretReskin"); + var largeMissileReskinId = new MyDefinitionId(typeof(MyObjectBuilder_LargeMissileTurret), "LargeMissileTurretReskin"); VanillaIds[largeMissileReskinId] = largeMissileReskin; VanillaCoreIds[largeMissileReskin] = largeMissileReskinId; var smallMissileReskin = MyStringHash.GetOrCompute("SmallMissileTurretReskin"); - var smallMissileReskinId = new MyDefinitionId(typeof(MyObjectBuilder_LargeTurretBaseDefinition), "SmallMissileTurretReskin"); + var smallMissileReskinId = new MyDefinitionId(typeof(MyObjectBuilder_LargeMissileTurret), "SmallMissileTurretReskin"); VanillaIds[smallMissileReskinId] = smallMissileReskin; VanillaCoreIds[smallMissileReskin] = smallMissileReskinId; @@ -1850,15 +1764,6 @@ internal void UpdateEnforcement() } Log.Line($"WC Version: {ModVersion}"); - if (IsClient && Settings.Enforcement.Version > ModVersion) - WarnClientAboutOldVersion(); - } - - private void WarnClientAboutOldVersion() - { - var message = "Your WeaponCore version is [older than the servers]! This is likely due to a [corrupted download], please follow directions on [WC Steam Page] to correct"; - ShowLocalNotify(message, 30000); - Log.Line(message); } } } diff --git a/Data/Scripts/CoreSystems/Session/SessionUpdate.cs b/Data/Scripts/CoreSystems/Session/SessionUpdate.cs index d1237bb5..ecd194a3 100644 --- a/Data/Scripts/CoreSystems/Session/SessionUpdate.cs +++ b/Data/Scripts/CoreSystems/Session/SessionUpdate.cs @@ -369,7 +369,11 @@ private void AiLoop() { cComp.ToolsAndWeapons.Clear(); foreach (var comp in cPart.TopAi.WeaponComps) + { cComp.ToolsAndWeapons.Add(comp.CoreEntity); + if(comp != cPart.TopAi.RootComp) + comp.PrimaryWeapon.RotorTurretSlaving = true; + } foreach (var tool in cPart.TopAi.Tools) cComp.ToolsAndWeapons.Add((MyEntity)tool); } @@ -409,12 +413,12 @@ private void AiLoop() var primaryWeapon = cPart.TopAi.RootComp.PrimaryWeapon; primaryWeapon.RotorTurretTracking = true; + primaryWeapon.RotorTurretSlaving = false; if (IsServer && cValues.Set.Range < 0 && primaryWeapon.MaxTargetDistance > 0) BlockUi.RequestSetRangeControl(cComp.TerminalBlock, (float) primaryWeapon.MaxTargetDistance); var validTarget = primaryWeapon.Target.TargetState == TargetStates.IsEntity || primaryWeapon.Target.TargetState == TargetStates.IsFake || primaryWeapon.Target.TargetState == TargetStates.IsProjectile; - var noTarget = false; var desiredDirection = Vector3D.Zero; @@ -438,7 +442,7 @@ private void AiLoop() continue; } - if (!cComp.TrackTarget(cComp.Platform.Control.BaseMap, cComp.Platform.Control.OtherMap, ref desiredDirection)) + if (!cComp.TrackTarget(cComp.Platform.Control.BaseMap, cComp.Platform.Control.OtherMap, ref desiredDirection)) continue; } @@ -614,7 +618,7 @@ private void AiLoop() /// /// Update Weapon Hud Info /// - var addWeaponToHud = HandlesInput && !w.System.DisableStatus && (w.HeatPerc >= 0.01 || (w.ShowReload && (w.Loading || w.Reload.WaitForClient)) || ((aConst.CanReportTargetStatus || ai.ControlComp != null) && wValues.Set.ReportTarget && !w.Target.HasTarget && grids && (wComp.DetectOtherSignals && ai.DetectionInfo.OtherInRange || ai.DetectionInfo.PriorityInRange) && ai.DetectionInfo.TargetInRange(w))); + var addWeaponToHud = HandlesInput && !w.System.DisableStatus && (w.HeatPerc >= 0.01 || (w.ShowReload && (w.Loading || w.Reload.WaitForClient)) || ((aConst.CanReportTargetStatus || ai.ControlComp != null) && wValues.Set.ReportTarget && (!w.Target.HasTarget || w.Target.TargetState == TargetStates.IsFake) && grids && (wComp.DetectOtherSignals && ai.DetectionInfo.OtherInRange || ai.DetectionInfo.PriorityInRange) && ai.DetectionInfo.TargetInRange(w))); if (addWeaponToHud && !Session.Config.MinimalHud && !enforcement.DisableHudReload && !Settings.ClientConfig.HideReload && (ActiveControlBlock != null && ai.SubGridCache.Contains(ActiveControlBlock.CubeGrid) || PlayerHandWeapon != null && IdToCompMap.ContainsKey(((IMyGunBaseUser)PlayerHandWeapon).OwnerId))) { @@ -647,7 +651,7 @@ private void AiLoop() { w.Target.Reset(Tick, States.Expired, !wComp.ManualMode); } - else if (eTarget != null && (eTarget.MarkedForClose || (cTarget!= null && (cTarget.IsDead || cTarget.Integrity <= 0)) || !rootConstruct.HadFocus && weaponAcquires && aConst.SkipAimChecks && !w.RotorTurretTracking || wComp.UserControlled && !w.System.SuppressFire)) + else if (eTarget != null && (eTarget.MarkedForClose || (cTarget!= null && (cTarget.IsDead || cTarget.Integrity <= 0)) || !rootConstruct.HadFocus && weaponAcquires && aConst.SkipAimChecks && !w.RotorTurretTracking && !w.RotorTurretSlaving || wComp.UserControlled && !w.System.SuppressFire)) { w.Target.Reset(Tick, States.Expired); } @@ -723,6 +727,14 @@ private void AiLoop() Dictionary masterTargets; var seek = weaponReady && (acquireReady || w.ProjectilesNear) && (!w.System.TargetSlaving || rootConstruct.TrackedTargets.TryGetValue(w.System.StorageLocation, out masterTargets) && masterTargets.Count > 0); var fakeRequest = wComp.FakeMode && w.Target.TargetState != TargetStates.IsFake && wComp.UserControlled; + var syncCTC = w.RotorTurretSlaving && ai.ControlComp != null && ai.RootComp?.PrimaryWeapon != null && (bool)ai.RootComp.PrimaryWeapon.Target?.HasTarget && w.Target.TopEntityId != ai.RootComp.PrimaryWeapon.Target.TopEntityId; + + if (syncCTC) + { + var ctcPriTarg = ai.RootComp.PrimaryWeapon.Target; + w.Target.Set(ctcPriTarg.TargetObject, ctcPriTarg.TargetPos, ctcPriTarg.HitShortDist, ctcPriTarg.OrigDistance, ctcPriTarg.TopEntityId); + w.Target.TargetChanged = true; + } if (seek || fakeRequest) { @@ -914,7 +926,7 @@ private void ShootWeapons() var w = ShootingWeapons[i]; var invalidWeapon = w.Comp.CoreEntity.MarkedForClose || w.Comp.Ai == null || w.Comp.Ai.Concealed || w.Comp.Ai.MarkedForClose || w.Comp.TopEntity.MarkedForClose || w.Comp.Platform.State != CorePlatform.PlatformState.Ready; var smartTimer = w.ActiveAmmoDef.AmmoDef.Trajectory.Guidance == Smart && w.System.TurretMovement == WeaponSystem.TurretType.Fixed && (QCount == w.ShortLoadId && w.Target.HasTarget && Tick - w.LastSmartLosCheck > 240 || Tick - w.LastSmartLosCheck > 1200); - var quickSkip = invalidWeapon || w.Comp.IsBlock && smartTimer && !w.SmartLos() || w.PauseShoot || w.LiveSmarts >= w.System.MaxActiveProjectiles || (w.ProtoWeaponAmmo.CurrentAmmo == 0 && w.ClientMakeUpShots == 0) && w.ActiveAmmoDef.AmmoDef.Const.Reloadable; + var quickSkip = invalidWeapon || w.Comp.IsBlock && smartTimer && !w.System.DisableLosCheck && !w.SmartLos() || w.PauseShoot || w.LiveSmarts >= w.System.MaxActiveProjectiles || (w.ProtoWeaponAmmo.CurrentAmmo == 0 && w.ClientMakeUpShots == 0) && w.ActiveAmmoDef.AmmoDef.Const.Reloadable; if (quickSkip) continue; w.Shoot(); diff --git a/Data/Scripts/CoreSystems/Support/Draw/DrawExts.cs b/Data/Scripts/CoreSystems/Support/Draw/DrawExts.cs index f9bedb99..d2791a9f 100644 --- a/Data/Scripts/CoreSystems/Support/Draw/DrawExts.cs +++ b/Data/Scripts/CoreSystems/Support/Draw/DrawExts.cs @@ -2,7 +2,6 @@ using VRage.Game; using VRage.Utils; using VRageMath; -using VRageRender; using BlendTypeEnum = VRageRender.MyBillboard.BlendTypeEnum; namespace CoreSystems.Support diff --git a/Data/Scripts/CoreSystems/Support/DsAutoResetEvent.cs b/Data/Scripts/CoreSystems/Support/DsAutoResetEvent.cs deleted file mode 100644 index e758e0c7..00000000 --- a/Data/Scripts/CoreSystems/Support/DsAutoResetEvent.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Threading; -using VRage; - -namespace CoreSystems.Support -{ - internal class DsAutoResetEvent - { - private readonly FastResourceLock _lock = new FastResourceLock(); - private int _waiters; - - public void WaitOne() - { - _lock.AcquireExclusive(); - _waiters = 1; - _lock.AcquireExclusive(); - _lock.ReleaseExclusive(); - } - - public void Set() - { - if (Interlocked.Exchange(ref _waiters, 0) > 0) - _lock.ReleaseExclusive(); - } - } - - internal class DsPulseEvent - { - private readonly object _signal = new object(); - private bool _signalSet; - - public void WaitOne() - { - lock (_signal) - { - while (!_signalSet) - { - Monitor.Wait(_signal); - } - _signalSet = false; - } - } - - public void Set() - { - lock (_signal) - { - _signalSet = true; - Monitor.Pulse(_signal); - } - } - } -} diff --git a/Data/Scripts/CoreSystems/Support/GridIntersect.cs b/Data/Scripts/CoreSystems/Support/GridIntersect.cs index 5134f7c7..ae62d4b5 100644 --- a/Data/Scripts/CoreSystems/Support/GridIntersect.cs +++ b/Data/Scripts/CoreSystems/Support/GridIntersect.cs @@ -141,20 +141,6 @@ internal static bool BresenhamGridIntersection(MyCubeGrid grid, ref Vector3D wor } return false; } - - public static IMySlimBlock FirstBlock(this IMyCubeGrid grid, Vector3D worldStart, Vector3D worldEnd, - Func pred = null, Vector3I? gridSizeInflate = null) - { - for (var itr = CellEnumerator.EnumerateGridCells(grid, worldStart, worldEnd, gridSizeInflate); - itr.IsValid; - itr.MoveNext()) - { - var block = grid.GetCubeBlock(itr.Current); - if (block != null && (pred == null || pred.Invoke(block))) - return block; - } - return null; - } } public struct CellEnumerator diff --git a/Data/Scripts/CoreSystems/Support/Localization.cs b/Data/Scripts/CoreSystems/Support/Localization.cs index c90a3be2..34174230 100644 --- a/Data/Scripts/CoreSystems/Support/Localization.cs +++ b/Data/Scripts/CoreSystems/Support/Localization.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Sandbox.ModAPI; using VRage; @@ -25,11 +25,11 @@ public static class Localization { "TerminalSwitchOn", "On" }, { "TerminalSwitchOff", "Off" }, { "TerminalReportTargetTitle", "Enable Report Target" }, - { "TerminalReportTargetTooltip", "Report if weapon has target on HUD" }, + { "TerminalReportTargetTooltip", "Report if weapon has target on right hand HUD\nTurn off to suppress 'No Target' text" }, { "TerminalWeaponROFTitle", "Change Rate of Fire" }, { "TerminalWeaponROFTooltip", "Change rate of fire" }, { "TerminalOverloadTitle", "Overload Damage" }, - { "TerminalOverloadTooltip", "Overload damage" }, + { "TerminalOverloadTooltip", "For energy weapons- double damage output, quadruple energy and heat, will damage weapon if overheated" }, { "TerminalDetonationTitle", "Detonation time" }, { "TerminalDetonationTooltip", "Detonation time" }, { "TerminalGravityTitle", "Gravity Offset" }, @@ -39,65 +39,57 @@ public static class Localization { "TerminalStopCountTitle", "Stop Countdown" }, { "TerminalStopCountTooltip", "Stop Countdown" }, { "TerminalArmTitle", "Arm Reaction" }, - { "TerminalArmTooltip", "When checked, the warhead can be detonated manually or by unwary handle." }, + { "TerminalArmTooltip", "When checked, the warhead can be detonated manually or by unwary handling" }, { "TerminalTriggerTitle", "Trigger" }, { "TerminalTriggerTooltip", "Trigger" }, - { "TerminalWeaponRangeTitle", "Aiming Radius" }, - { "TerminalWeaponRangeTooltip", "Change the min/max targeting range" }, + { "TerminalWeaponRangeTitle", "Aiming Range" }, + { "TerminalWeaponRangeTooltip", "Set the max targeting range for Auto (AI Control) mode" }, { "TerminalNeutralsTitle", "Target Neutrals" }, - { "TerminalNeutralsTooltip", "Fire on targets that are neutral" }, + { "TerminalNeutralsTooltip", "Engage targets that are neutral" }, { "TerminalUnownedTitle", "Target Unowned" }, - { "TerminalUnownedTooltip", "Fire on targets with no owner" }, + { "TerminalUnownedTooltip", "Engage targets with no owner" }, { "TerminalFriendlyTitle", "Track NonThreats" }, { "TerminalFriendlyTooltip", "Track non-threating objects" }, { "TerminalBiologicalsTitle", "Target Biologicals" }, - { "TerminalBiologicalsTooltip", "Fire on players and biological NPCs" }, + { "TerminalBiologicalsTooltip", "Engage players and creatures" }, { "TerminalProjectilesTitle", "Target Projectiles" }, - { "TerminalProjectilesTooltip", "Fire on incoming projectiles" }, + { "TerminalProjectilesTooltip", "Fire on projectiles" }, { "TerminalSupportingPDTitle", "Supportive Point Defense" }, - { "TerminalSupportingPDTooltip", "Fire on all enemy projectiles, regardless of target" }, + { "TerminalSupportingPDTooltip", "Fire on all enemy projectiles in range, regardless of target\nTurn off to only engage projectiles targeting your grid" }, { "TerminalMeteorsTitle", "Target Meteors" }, - { "TerminalMeteorsTooltip", "Target Meteors" }, + { "TerminalMeteorsTooltip", "Target meteors" }, { "TerminalGridsTitle", "Target Grids" }, - { "TerminalGridsTooltip", "Target Grids" }, + { "TerminalGridsTooltip", "Target grids, based on size toggles below" }, { "TerminalFocusFireTitle", "Target FocusFire" }, - { "TerminalFocusFireTooltip", "Only fire on the hud-selected target" }, + { "TerminalFocusFireTooltip", "Only fire on the hud-selected target\nWILL NOT AUTO ENGAGE OTHER TARGETS" }, { "TerminalSubSystemsTitle", "Target SubSystems" }, - { "TerminalSubSystemsTooltip", "Target specific SubSystems of a target" }, + { "TerminalSubSystemsTooltip", "Only target selected subsystems on enemy grid, if present" }, { "TerminalRepelTitle", "Repel Mode" }, { "TerminalRepelTooltip", "Aggressively focus on and repel small threats (not projectiles)" }, { "TerminalPickAmmoTitle", "Pick Ammo" }, - { "TerminalPickAmmoTooltip", "Select the ammo type to use" }, - { "TerminalPickSubSystemTitle", "Pick SubSystem" }, - { "TerminalPickSubSystemTooltip", "Select the target subsystem to focus fire on" }, - { "TerminalTrackingModeTitle", "Tracking Mode" }, - { "TerminalTrackingModeTooltip", "Movement fire control requirements" }, + { "TerminalPickAmmoTooltip", "Select the ammo type to load next\nTo swap immediately, click 'Force Reload' below" }, + { "TerminalPickSubSystemTitle", "Targeted SubSystem" }, + { "TerminalPickSubSystemTooltip", "Select subsystem to target (When Target SubSystems is on)" }, + { "TerminalTrackingModeTitle", "Movement Mode" }, + { "TerminalTrackingModeTooltip", "Filters for grids in motion, stopped, or stations" }, { "TerminalControlModesTitle", "Control Mode" }, { "TerminalControlModesTooltip", "Select the aim control mode for the weapon" }, { "TerminalCameraChannelTitle", "Weapon Camera Channel" }, { "TerminalCameraChannelTooltip", "Assign this weapon to a camera channel" }, { "TerminalBurstShotsTitle", "Burst Shot Count" }, { "TerminalBurstShotsTooltip", "The number of shots to burst at a time" }, - { "TerminalBurstDelayTitle", "Shot Delay" }, { "TerminalBurstDelayTooltip", "The number game ticks (60 per second) to delay between shots" }, - - { "TerminalSequenceIdTitle", "Weapon Sequence id" }, { "TerminalSequenceIdTooltip", "Assign this weapon a unique sequence id per weapon group, used for sequence firing" }, - { "TerminalWeaponGroupIdTitle", "Weapon Group id" }, { "TerminalWeaponGroupIdTooltip", "Assign this weapon to a sequence group, used for sequence firing" }, - - { "TerminalShootModeTitle", "Shoot Mode" }, - { "TerminalShootModeTooltip", "Set the weapon's mode, fire once, burst fire, mouse click, key toggle mode" }, - + { "TerminalShootModeTitle", "Trigger Mode" }, + { "TerminalShootModeTooltip", "Select what will make the weapon fire" }, { "TerminalAiEnabledTitle", "Enable AI" }, { "TerminalAiEnabledTooltip", "Automatically aim and fire at targets" }, - { "TerminalShareFireControlTitle", "Share Control" }, - { "TerminalShareFireControlTooltip", "Weapons with manual/painter/mousecontrol enabled will respond when using the Control button above" }, - + { "TerminalShareFireControlTooltip", "Other weapons with manual/painter/mousecontrol enabled will follow\nthe aimpoint and fire when using the Control button above" }, { "TerminalTargetGroupTitle", "Target Lead Group" }, { "TerminalTargetGroupTooltip", "Assign this weapon to target lead group" }, { "TerminalDecoyPickSubSystemTitle", "Pick SubSystem" }, @@ -105,50 +97,51 @@ public static class Localization { "TerminalCameraCameraChannelTitle", "Camera Channel" }, { "TerminalCameraCameraChannelTooltip", "Assign the camera weapon channel to this camera" }, { "TerminalDebugTitle", "Debug" }, - { "TerminalDebugTooltip", "Debug On/Off" }, - { "TerminalAdvancedTitle", "Advanced Features" }, - { "TerminalAdvancedTooltip", "This enables more advanced UI features that tend to be confusing to new users" }, + { "TerminalAdvancedTitle", "Advanced WC Features" }, + { "TerminalAdvancedTooltip", "This enables more advanced WC UI features/options" }, { "TerminalShootTitle", "Shoot" }, - { "TerminalShootTooltip", "Shoot On/Off Toggle, this will be retired, replaced by Shoot Mode KeyToggle" }, + { "TerminalShootTooltip", "Shoot On/Off toggle" }, { "ActionStateOn", "On" }, { "ActionStateOff", "Off" }, - { "ActionWCShootMode", "Cycle Shoot Modes" }, - { "ActionWCMouseToggle", "Toggle Mouse Shoot (Mode: MouseControl)" }, - { "ActionFire", "Shoot (Modes: KeyToggle/KeyFire)" }, + { "ActionWCShootMode", "Cycle Trigger Mode" }, + { "ActionWCMouseToggle", "Toggle Mouse Control Trigger Mode" }, + { "ActionFire", "Shoot (Trigger Modes: Key Toggle & Key Fire)" }, { "ForceReload", "Force Reload" }, + { "TerminalForceReloadTooltip", "Forces weapon to swap to newly selected ammo type\nWill return ammo to weapon inventory if there is space" }, { "ActionShoot", "Shoot On/Off" }, { "ActionShoot_Off", "Shoot Off" }, { "ActionShoot_On", "Shoot On" }, - { "ActionSubSystems", "Cycle SubSystems" }, + { "ActionSubSystems", "Cycle Targeted SubSystems" }, { "ActionNextCameraChannel", "Next Channel" }, { "ActionPreviousCameraChannel", "Previous Channel" }, - { "ActionControlModes", "Control Mode" }, - { "ActionNeutrals", "Neutrals On/Off" }, - { "ActionProjectiles", "Projectiles On/Off" }, + { "ActionControlModes", "Cycle Control Mode" }, + { "ActionNeutrals", "Target Neutrals On/Off" }, + { "ActionProjectiles", "Target Projectiles On/Off" }, { "ActionSupportingPD", "Supporting PD On/Off" }, - { "ActionBiologicals", "Biologicals On/Off" }, - { "ActionMeteors", "Meteors On/Off" }, - { "ActionGrids", "Grids On/Off" }, - { "ActionFriendly", "Friendly On/Off" }, - { "ActionUnowned", "Unowned On/Off" }, - { "ActionFocusTargets", "FocusTargets On/Off" }, - { "ActionFocusSubSystem", "FocusSubSystem On/Off" }, - { "ActionMaxSizeIncrease", "MaxSize Increase" }, - { "ActionMaxSizeDecrease", "MaxSize Decrease" }, - { "ActionMinSizeIncrease", "MinSize Increase" }, - { "ActionMinSizeDecrease", "MinSize Decrease" }, - { "ActionTrackingMode", "Tracking Mode" }, - { "ActionWC_CycleAmmo", "Cycle Consumable" }, - { "ActionWC_RepelMode", "Repel Mode" }, + { "ActionBiologicals", "Target Biologicals On/Off" }, + { "ActionMeteors", "Target Meteors On/Off" }, + { "ActionGrids", "Target Grids On/Off" }, + { "ActionFriendly", "Target Friendly On/Off" }, + { "ActionUnowned", "Target Unowned On/Off" }, + { "ActionFocusTargets", "Focus Fire On/Off" }, + { "ActionFocusSubSystem", "Target SubSystems On/Off" }, + { "ActionMaxSizeIncrease", "Max Target Size Increase" }, + { "ActionMaxSizeDecrease", "Max Target Size Decrease" }, + { "ActionMinSizeIncrease", "Min Target Size Increase" }, + { "ActionMinSizeDecrease", "Min Target Size Decrease" }, + { "ActionTrackingMode", "Cycle Movement Mode" }, + { "ActionWC_CycleAmmo", "Cycle Ammo" }, + { "ActionWC_RepelMode", "Repel Mode On/Off" }, { "ActionWC_Increase_CameraChannel", "Next Camera Channel" }, { "ActionWC_Decrease_CameraChannel", "Previous Camera Channel" }, { "ActionWC_Increase_LeadGroup", "Next Lead Group" }, { "ActionWC_Decrease_LeadGroup", "Previous Lead Group" }, - + { "ActionTargetLargeGrids", "Target Large Grids" }, + { "ActionTargetSmallGrids", "Target Small Grids" }, + { "ActionCycleObjective", "Cycle Objective Mode" }, { "ActionWCAiEnabled", "Enable AI On/Off" }, { "ActionShareFireControl", "Share Control On/Off" }, - { "ActionMask", "Select Mask Type" }, { "SystemStatusFault", "[Fault]" }, { "SystemStatusOffline", "[Offline]" }, @@ -176,13 +169,82 @@ public static class Localization { "WeaponInfoLoS", "LoS" }, { "WeaponTotalEffect", "Damage" }, { "WeaponTotalEffectAvgDps", "AvgDps" }, - { "TerminalOverrideTitle", "Override" }, - { "TerminalOverrideTooltip", "Turns off targeting and tracking so you can forcibly fire the weapon- for practice use only" }, + { "TerminalOverrideTitle", "Test Mode" }, + { "TerminalOverrideTooltip", "When test mode is on guided weapons and turrets\ncan be forced to fire without a target - for practice use only" }, { "TerminalAngularTitle", "Track Angular Motion" }, - { "TerminalAngularTooltip", "Adjust aim to account for angular motion of the target" }, + { "TerminalAngularTooltip", "Adjust aim to account for helical motion of the target\nonly needed against those who spin to dodge" }, + { "TerminalLGTitle", "Large Grid" }, + { "TerminalLGTooltip", "Target large grids" }, + { "TerminalSGTitle", "Small Grid" }, + { "TerminalSGTooltip", "Target small grids" }, + { "TerminalObjectiveTitle", "Objective Mode" }, + { "TerminalObjectiveTooltip", "Select when to cease firing at a block" }, { "WeaponInfoHasTarget", "HasTarget" }, { "WeaponInfoTargetState", "TargetType" }, - + { "WeaponInfoIdlePower", "Idle Power" }, + { "WeaponInfoMWLabel", "MW" }, + { "WeaponInfoStatsHeader", "--- Stats ---" }, + { "WeaponInfoDPSLabel", "DPS" }, + { "WeaponInfoMinRange", "Min Range" }, + { "WeaponInfoMaxRange", "Max Range" }, + { "WeaponInfoROF", "RoF" }, + { "WeaponInfoMeter", "m" }, + { "WeaponInfoTargetLabel", "Target" }, + { "WeaponInfoPerMin", "/min" }, + { "WeaponInfoProjectileLabel", "Projectile" }, + { "WeaponInfoNoneTarget", "None" }, + { "WeaponInfoAmmoType", "Ammo Types (Mag if different)" }, + { "WeaponInfoServerModdedLine1", "Weapon modified by server!" }, + { "WeaponInfoServerModdedLine2", "Report issues to server admins." }, + { "WeaponInfoDrawOverMax", "Draw/Max" }, + { "WeaponInfoPowerCharged", "Power: Charged" }, + { "WeaponInfoPowerChargedIn", "Power: Charged in" }, + { "WeaponInfoSeconds", "s" }, + { "WeaponInfoAmmoLabel", "Ammo" }, + { "WeaponInfoWaitingCharge", "Waiting on charge" }, + { "WeaponInfoLoadedIn", "Loaded in" }, + { "WeaponInfoLoaded", "Loaded" }, + { "WeaponInfoNoammo", "No ammo available" }, + { "WeaponInfoNoTarget", "No Target" }, + { "WeaponInfoHeatPerSecOverMax", "Heat per Sec/Max" }, + { "SubtypeAny", "Any" }, + { "SubtypeOffense", "Offense" }, + { "SubtypeUtility", "Utility" }, + { "SubtypePower", "Power" }, + { "SubtypeProduction", "Production" }, + { "SubtypeThrust", "Thrust" }, + { "SubtypeJumping", "Jumping" }, + { "SubtypeSteering", "Steering" }, + { "ShootAiShoot", "Auto (AI Controlled)" }, + { "ShootMouse", "Mouse Control (Click)" }, + { "ShootKeyToggle", "Key Toggle (Shoot On/Off)" }, + { "ShootKey", "Key Fire (Shoot Once)" }, + { "ObjDefault", "Default" }, + { "ObjDisabled", "Disabled" }, + { "ObjDestroyed", "Destroyed" }, + { "ControlAuto", "Auto (AI Controlled)" }, + { "ControlManual", "Manual (Cursor Following)" }, + { "ControlPainter", "Painter (Mark targets for AI)" }, + { "MoveAny", "Any" }, + { "MoveMoving", "Moving ship" }, + { "MoveMoored", "Stations" }, + { "WeaponInfoTrue", "True" }, + { "WeaponInfoFalse", "False" }, + { "ControlsInactive", "Inactive" }, + { "BombArmed", "Armed" }, + { "BombDisarmed", "Disarmed" }, + { "TrackAngular", "Predict Targets Angular Motion"}, + //new + { "MoveMobile", "Immobile ship" }, + { "MoveShipAny", "Ships" }, + { "WeaponTargTrue", "True" }, + { "WeaponTargFalse", "False" }, + { "WeaponTargRange", "Not in range" }, + { "WeaponTargNeedSelection", "Manually select target" }, + { "WeaponTargTooClose", "Too close" }, + { "WeaponInfoCheckAmmoType", "No selected ammo, alternatives in inventory" }, + { "ActionMaxRangeIncrease", "Increase Max Range" }, + { "ActionMaxRangeDecrease", "Decrease Max Range" }, } }, { @@ -195,21 +257,21 @@ public static class Localization { "Decrease Weapon Damage", "Уменьшить Наносимый урон" }, { "Increase Weapon ROF", "Увеличить Скорострельность" }, { "Decrease Weapon ROF", "Уменьшить Скорострельность" }, - { "Overload Toggle On/Off", "Переключить Перегрузку Вкл/Выкл " }, - { "Overload On", "Переключить Перегрузку Вкл" }, - { "Overload Off", "Переключить Перегрузку Выкл" }, + { "Overload Toggle On/Off", "Переключить Усиление Вкл/Выкл" }, + { "Overload On", "Переключить Усиление Вкл" }, + { "Overload Off", "Переключить Усиление Выкл" }, { "TerminalSwitchOn", "Вкл" }, { "TerminalSwitchOff", "Выкл" }, - { "TerminalReportTargetTitle", "Включить Наведение" }, - { "TerminalReportTargetTooltip", "Включить наводку турелей" }, + { "TerminalReportTargetTitle", "Отображать состояние захвата" }, + { "TerminalReportTargetTooltip", "Отображать на HUD наличие захваченной цели" }, { "TerminalWeaponROFTitle", "Изменить скорострельность" }, { "TerminalWeaponROFTooltip", "Изменить скорострельность" }, - { "TerminalOverloadTitle", "Получаемый урон от перегрузки" }, - { "TerminalOverloadTooltip", "Получаемый урон от перегрузки" }, + { "TerminalOverloadTitle", "Усиление" }, + { "TerminalOverloadTooltip", "Включение усиления увеличит урон энергетического(!) оружия в 2 раза, но потребление энергии и перегрев возрастут в 4 раза, перегрев будет наносить 2% урона cfvjve орудию" }, { "TerminalDetonationTitle", "Время детонации" }, { "TerminalDetonationTooltip", "Время детонации" }, { "TerminalGravityTitle", "Коррекция гравитации" }, - { "TerminalGravityTooltip", "Фактор коррекции гравитации, более низкие значения уменьшают дальность, более высокие значения увеличивают её" }, + { "TerminalGravityTooltip", "Фактор коррекции гравитационного воздействия, более низкие значения уменьшают дальность, более высокие значения увеличивают её" }, { "TerminalStartCountTitle", "Запустить отсчет" }, { "TerminalStartCountTooltip", "Запустить отсчет" }, { "TerminalStopCountTitle", "Остановить отсчет" }, @@ -221,23 +283,27 @@ public static class Localization { "TerminalWeaponRangeTitle", "Радиус прицеливания" }, { "TerminalWeaponRangeTooltip", "Радиус прицеливания" }, { "TerminalNeutralsTitle", "Наводить на нейтральных" }, - { "TerminalNeutralsTooltip", "Стрелять по нейтральным" }, + { "TerminalNeutralsTooltip", "Открывать огонь по нейтральным целям" }, { "TerminalUnownedTitle", "Наводить на цели без владельца" }, - { "TerminalUnownedTooltip", "Стрелять по целям без владельца" }, + { "TerminalUnownedTooltip", "Открывать огонь по целям без владельца" }, + { "TerminalFriendlyTitle", "Наводить на союзников" }, + { "TerminalFriendlyTooltip", "Открывать огонь по союзным целям" }, { "TerminalBiologicalsTitle", "Наводить на живую силу" }, - { "TerminalBiologicalsTooltip", "Огонь по игрокам и NPC" }, + { "TerminalBiologicalsTooltip", "Открывать огонь по игрокам и NPC" }, { "TerminalProjectilesTitle", "Наводить на снаряды" }, { "TerminalProjectilesTooltip", "Огонь по приближающимся снарядам" }, + { "TerminalSupportingPDTitle", "Вспомогательная оборона" }, + { "TerminalSupportingPDTooltip", "Автоматически открывать огонь по снарядам, вне завистимости от наличия захваченной цели" }, { "TerminalMeteorsTitle", "Наводить на метеориты" }, { "TerminalMeteorsTooltip", "Огонь по приближающимся метеоритам" }, { "TerminalGridsTitle", "Наводить на большие/малые блоки" }, - { "TerminalGridsTooltip", "Огонь по большим/малым блокам" }, + { "TerminalGridsTooltip", "Открывать огонь по большим/малым блокам" }, { "TerminalFocusFireTitle", "Фокусировать огонь" }, - { "TerminalFocusFireTooltip", "Сосредоточивать весь огонь на указанной цели" }, + { "TerminalFocusFireTooltip", "Сосредоточивать весь огонь на захваченной цели" }, { "TerminalSubSystemsTitle", "Наводить на подсистемы" }, - { "TerminalSubSystemsTooltip", "Огонь по подсистемам цели" }, + { "TerminalSubSystemsTooltip", "Открывать огонь по выбранным подсистемам цели" }, { "TerminalRepelTitle", "Режим Подавления" }, - { "TerminalRepelTooltip", "Сосредоточить огонь на приближающихся малых объектах" }, + { "TerminalRepelTooltip", "Сосредоточить огонь на приближающихся малых объектах с низким уровнем угрозы (не на снарядах)" }, { "TerminalPickAmmoTitle", "Вид боеприпасов" }, { "TerminalPickAmmoTooltip", "Выберите тип боеприпасов для использования" }, { "TerminalPickSubSystemTitle", "Подсистема для наведения" }, @@ -245,34 +311,51 @@ public static class Localization { "TerminalTrackingModeTitle", "Отслеживать цели" }, { "TerminalTrackingModeTooltip", "Стрелять только по Двигающимся/Всем, кроме неподвижных/Неподвижным" }, { "TerminalControlModesTitle", "Управление прицелом" }, - { "TerminalControlModesTooltip", "Выберите режим управления прицелом для оружия." }, + { "TerminalControlModesTooltip", "Выберите режим управления прицелом для оружия" }, { "TerminalCameraChannelTitle", "Канал оружейной камеры" }, - { "TerminalCameraChannelTooltip", "На камере с таким же каналом, будет проецироваться прицел с опережением" }, + { "TerminalCameraChannelTooltip", "На камере с таким же каналом, будет проецироваться прицел с упреждением" }, { "TerminalBurstShotsTitle", "Размер очереди" }, { "TerminalBurstShotsTooltip", "Кол-во выстрелов в 1 очереди" }, - { "TerminalTargetGroupTitle", "Ведущая оружейная группа" }, - { "TerminalTargetGroupTooltip", "Установите идентичные цифры на камере м орудиях для проекции прицела" }, + { "TerminalBurstDelayTitle", "Задержка перед выстрелом" }, + { "TerminalBurstDelayTooltip", "Количество игровых тиков(60 в секунду), которое должно пройти перед выстрелом" }, + { "TerminalSequenceIdTitle", "Номер орудия в очереди" }, + { "TerminalSequenceIdTooltip", "Назначьте орудию уникальный номер, использующийся в стрельбе группой" }, + { "TerminalWeaponGroupIdTitle", "Номер оружейной группы" }, + { "TerminalWeaponGroupIdTooltip", "Назначьте орудию номер оружейной группы, использующийся в стрельбе группой" }, + { "TerminalShootModeTitle", "Режим огня" }, + { "TerminalShootModeTooltip", "Назначьте режим ведения огня: стрельба одиночными, стрельба очередями, нажатие мыши, переключение" }, + { "TerminalAiEnabledTitle", "Включить ИИ" }, + { "TerminalAiEnabledTooltip", "Разрешить автоматический захват, наведение и огонь по цели" }, + { "TerminalShareFireControlTitle", "Разделить управление" }, + { "TerminalShareFireControlTooltip", "Оружие с управлением прицеливанием ручной/точка будут получать цель от других орудий, если у последних включено разделение управления" }, + { "TerminalTargetGroupTitle", "Оружейная группа упреждения" }, + { "TerminalTargetGroupTooltip", "Установите индентичные цифры на камере и оружейной группе для проекции точки упреждения" }, { "TerminalDecoyPickSubSystemTitle", "Имитация подсистемы" }, { "TerminalDecoyPickSubSystemTooltip", "Выберите, какую подсистему будет имитировать эта приманка" }, { "TerminalCameraCameraChannelTitle", "Канал камеры" }, - { "TerminalCameraCameraChannelTooltip", "Установите индентичные цифры на ведущей группе орудий для проекции прицела" }, + { "TerminalCameraCameraChannelTooltip", "Установите индентичные цифры на камере и оружейной группе для проекции точки упреждения" }, { "TerminalDebugTitle", "Отладка" }, { "TerminalDebugTooltip", "Отладка Вкл/Выкл" }, + { "TerminalAdvancedTitle", "Продвинутые настройки" }, + { "TerminalAdvancedTooltip", "Включить показ продвинутых опций настройки оружия (может быть сложно для начинающих)" }, { "TerminalShootTitle", "Стрелять" }, { "TerminalShootTooltip", "Стрелять Вкл/Выкл" }, { "ActionStateOn", "Вкл" }, { "ActionStateOff", "Выкл" }, - { "ActionWCShootMode", "Огонь по нажатию" }, + { "ActionWCShootMode", "Переключить режим огня" }, + { "ActionWCMouseToggle", "Нажатие мыши" }, { "ActionFire", "Выстрелить один раз" }, + { "ForceReload", "Принудительная перезарядка" }, { "ActionShoot", "Стрелять Вкл/Выкл" }, { "ActionShoot_Off", "Стрелять Выкл" }, { "ActionShoot_On", "Стрелять Вкл" }, - { "ActionSubSystems", "Выбрать Подсистему" }, + { "ActionSubSystems", "Переключить подсистемы" }, { "ActionNextCameraChannel", "Следующий канал" }, { "ActionPreviousCameraChannel", "Предыдущий оружейный канал" }, { "ActionControlModes", "Управление прицелом" }, { "ActionNeutrals", "Наводить на Нейтральных Вкл/Выкл" }, { "ActionProjectiles", "Наводить на Снаряды Вкл/Выкл" }, + { "ActionSupportingPD", "Вспомогательная оборона Вкл/Выкл" }, { "ActionBiologicals", "Наводить на Живую силу Вкл/Выкл" }, { "ActionMeteors", "Наводить на Метеориты Вкл/Выкл" }, { "ActionGrids", "Наводить на Большие/малые блоки Вкл/Выкл" }, @@ -291,6 +374,11 @@ public static class Localization { "ActionWC_Decrease_CameraChannel", "Предыдущий канал оружейной камеры" }, { "ActionWC_Increase_LeadGroup", "Следующая ведущая оружейная группа" }, { "ActionWC_Decrease_LeadGroup", "Предыдущая ведущая оружейная группа" }, + { "ActionTargetLargeGrids", "Наводить на большие структуры" }, + { "ActionTargetSmallGrids", "Наводить на малые структуры" }, + { "ActionCycleObjective", "Переключить задачу" }, + { "ActionWCAiEnabled", "ИИ Вкл/Выкл" }, + { "ActionShareFireControl", "Разделить управление Вкл/Выкл" }, { "ActionMask", "Имитировать подсистему" }, { "SystemStatusFault", "[Повреждено]" }, { "SystemStatusOffline", "[Выкл]" }, @@ -310,7 +398,6 @@ public static class Localization { "WeaponInfoCurrentHeat", "Текущий нагрев" }, { "WeaponInfoCurrentDraw", "Макс. потребление" }, { "WeaponInfoRequiredPower", "Требуемое потребление" }, - { "WeaponInfoDividerLineWeapon", "==== Оружие ====" }, { "WeaponInfoName", "Название" }, { "WeaponInfoBurst", "Очередь" }, { "WeaponInfoDelay", "Задержка" }, @@ -318,9 +405,73 @@ public static class Localization { "WeaponInfoLoS", "Прямая видимость" }, { "WeaponTotalEffect", "Повреждать" }, { "WeaponTotalEffectAvgDps", "Средний урон в секунду" }, - { "TerminalOverrideTitle", "Переопределие" }, - { "TerminalOverrideTooltip", "Разрешить стрельбу орудиям, иначе требующие цель, только для тестирования цели" }, + { "TerminalOverrideTitle", "Усиление" }, + { "TerminalOverrideTooltip", "Разрешить стрельбу орудиям, иначе требующим цель, только для тестирования!" }, + { "TerminalAngularTitle", "Отслеживать угловое движение" }, + { "TerminalAngularTooltip", "Вносить корректировки для учёта углового движения цели" }, + { "TerminalLGTitle", "Большие Структуры" }, + { "TerminalLGTooltip", "Наводить на Большие Структуры" }, + { "TerminalSGTitle", "Малые Структуры" }, + { "TerminalSGTooltip", "Наводить на Малые Структуры" }, + { "TerminalObjectiveTitle", "Выбор задачи" }, + { "TerminalObjectiveTooltip", "Выберите условие, когда прекращается огонь по блоку" }, { "WeaponInfoHasTarget", "Имеет цель" }, + { "WeaponInfoTargetState", "Тип цели" }, + { "WeaponInfoIdlePower", "Пассивное потребление" }, + { "WeaponInfoMWLabel", "МВ" }, + { "WeaponInfoStatsHeader", "-- Параметры --" }, + { "WeaponInfoDPSLabel", "Урон в секунду" }, + { "WeaponInfoMinRange", "Минимальная дистанция" }, + { "WeaponInfoMaxRange", "Максимальная дистанция" }, + { "WeaponInfoROF", "Скорострельность" }, + { "WeaponInfoMeter", "м" }, + { "WeaponInfoTargetLabel", "Цель" }, + { "WeaponInfoPerMin", "/мин" }, + { "WeaponInfoProjectileLabel", "Боеприпас" }, + { "WeaponInfoNoneTarget", "Нет" }, + { "WeaponInfoAmmoType", "Типы боеприпасов(Магазин, если задан)" }, + { "WeaponInfoServerModdedLine1", "Оружие изменено сервером!" }, + { "WeaponInfoServerModdedLine2", "Проинформируйте администрацию о проблемах" }, + { "WeaponInfoDrawOverMax", "Потребление: Текущее/Максимальное" }, + { "WeaponInfoPowerCharged", "Заряд: Готово" }, + { "WeaponInfoPowerChargedIn", "Заряд: Зарядка ещё " }, + { "WeaponInfoSeconds", "c" }, + { "WeaponInfoAmmoLabel", "Боеприпас" }, + { "WeaponInfoWaitingCharge", "Ожидание зарядки" }, + { "WeaponInfoLoadedIn", "Перезарядка ещё " }, + { "WeaponInfoLoaded", "Заряжено" }, + { "WeaponInfoNoammo", "Нет боеприпасов" }, + { "WeaponInfoNoTarget", "Нет цели" }, + { "WeaponInfoHeatPerSecOverMax", "Нагрев: в Сек/Макс" }, + { "SubtypeAny", "Любой" }, + { "SubtypeOffense", "Вооружение" }, + { "SubtypeUtility", "Другое" }, + { "SubtypePower", "Энергия" }, + { "SubtypeProduction", "Производство" }, + { "SubtypeThrust", "Двигатели" }, + { "SubtypeJumping", "Прыжковые двигатели" }, + { "SubtypeSteering", "Гироскопы" }, + { "ShootAiShoot", "ИИ-Выстрел" }, + { "ShootMouse", "Нажатие мыши" }, + { "ShootKeyToggle", "Переключение" }, + { "ShootKey", "Нажатие" }, + { "ObjDefault", "Стандарт" }, + { "ObjDisabled", "Отключено" }, + { "ObjDestroyed", "Уничтожено" }, + { "ControlAuto", "Авто" }, + { "ControlManual", "Ручной" }, + { "ControlPainter", "Точка" }, + { "MoveAny", "Любой" }, + { "MoveMoving", "Движущиеся корабли" }, + { "MoveMoored", "Станции" }, + { "WeaponTargTrue", "Да" },//Contextual to targets + { "WeaponTargFalse", "Нет" },//Contextual to targets, use Правда/Ложь for logic + { "ControlsInactive", "Неактивно" }, + { "BombArmed", "Взведено" }, + { "BombDisarmed", "Предохранитель" }, + { "TrackAngular", "Отслеживать угловое движение"}, + { "MoveMobile", "Неподвижный корабль" }, + { "MoveShipAny", "Любой корабль" }, } }, { @@ -497,4 +648,4 @@ internal static string GetTextWithoutFallback(string text) return I18NDictionary.TryGetValue(text, out value) ? value : text; } } -} \ No newline at end of file +} diff --git a/Data/Scripts/CoreSystems/Support/Log.cs b/Data/Scripts/CoreSystems/Support/Log.cs index bc786c77..8638183c 100644 --- a/Data/Scripts/CoreSystems/Support/Log.cs +++ b/Data/Scripts/CoreSystems/Support/Log.cs @@ -4,6 +4,7 @@ using System.Text; using Sandbox.ModAPI; using VRage.Collections; +using VRage.Utils; namespace CoreSystems.Support { @@ -101,7 +102,7 @@ public static void Init(string name, Session session, bool defaultInstance = tru { var filename = name + ".log"; if (_instances.ContainsKey(name)) return; - RenameFileInLocalStorage(filename, name + $"-{DateTime.Now:MM-dd-yy_HH-mm-ss}.log", typeof(LogInstance)); + RenameFileInLocalStorageLimited(filename, name + $"_1.log", typeof(LogInstance)); if (defaultInstance) _defaultInstance = name; var instance = _logPool.Get(); @@ -135,9 +136,34 @@ public static void Init(string name, Session session, bool defaultInstance = tru catch (Exception e) { MyAPIGateway.Utilities.ShowNotification(e.Message, 5000); + MyLog.Default.Error($"WC failed to initialize log {name} \n {e.Message}"); } } + public static void RenameFileInLocalStorageLimited(string oldName, string newName, Type anyObjectInYourMod) + { + if (!MyAPIGateway.Utilities.FileExistsInLocalStorage(oldName, anyObjectInYourMod)) + return; + + if (MyAPIGateway.Utilities.FileExistsInLocalStorage(newName, anyObjectInYourMod)) + MyAPIGateway.Utilities.DeleteFileInLocalStorage(newName, anyObjectInYourMod); + + using (var read = MyAPIGateway.Utilities.ReadFileInLocalStorage(oldName, anyObjectInYourMod)) + { + var sb = new StringBuilder(newName); + SUtils.ReplaceAll(sb, Path.GetInvalidFileNameChars(), '_'); + + using (var write = MyAPIGateway.Utilities.WriteFileInLocalStorage(sb.ToString(), anyObjectInYourMod)) + { + write.Write(read.ReadToEnd()); + write.Flush(); + write.Dispose(); + } + } + + MyAPIGateway.Utilities.DeleteFileInLocalStorage(oldName, anyObjectInYourMod); + } + public static void RenameFileInLocalStorage(string oldName, string newName, Type anyObjectInYourMod) { if (!MyAPIGateway.Utilities.FileExistsInLocalStorage(oldName, anyObjectInYourMod)) @@ -264,39 +290,6 @@ public static void LineShortDate(string text, string instanceName = null) } } - public static void NetLog(string text, Session session, int logLevel) - { - var set = session.AuthorSettings; - var netEnabled = session.AuthLogging && set[4] >= 0 && logLevel >= set[5]; - if (netEnabled) - NetLogger(session, "[R-LOG] " + text, string.Empty); - } - - public static void Chars(string text, string instanceName = null) - { - try - { - var name = instanceName ?? _defaultInstance; - var instance = _instances[name]; - if (instance.TextWriter != null) { - - if (name == _defaultInstance && !instance.Session.LocalVersion && instance.Paused()) - return; - - instance.TextWriter.Write(text); - instance.TextWriter.Flush(); - - var set = instance.Session.AuthorSettings; - var netEnabled = instance.Session.AuthLogging && name == _defaultInstance && set[0] >= 0 || name == "perf" && set[1] >= 0 || name == "stats" && set[2] >= 0 || name == "net" && set[3] >= 0; - if (netEnabled) - NetLogger(instance.Session, "[R-LOG] " + text, name); - } - } - catch (Exception e) - { - } - } - public static void CleanLine(string text, string instanceName = null) { try @@ -322,31 +315,6 @@ public static void CleanLine(string text, string instanceName = null) } } - public static void ThreadedWrite(string logLine) - { - _threadedLineQueue.Enqueue(new[] { $"Threaded Time: {DateTime.Now:HH-mm-ss-fff} - ", logLine }); - MyAPIGateway.Utilities.InvokeOnGameThread(WriteLog); - } - - private static void WriteLog() { - string[] line; - - var instance = _instances[_defaultInstance]; - if (instance.TextWriter != null) - Init("debugdevelop.log", null); - - instance = _instances[_defaultInstance]; - - while (_threadedLineQueue.TryDequeue(out line)) - { - if (instance.TextWriter != null) - { - instance.TextWriter.WriteLine(line[0] + line[1]); - instance.TextWriter.Flush(); - } - } - } - public static void Close() { try diff --git a/Data/Scripts/CoreSystems/Support/MathFuncs.cs b/Data/Scripts/CoreSystems/Support/MathFuncs.cs index 908fb75c..1cf4cb50 100644 --- a/Data/Scripts/CoreSystems/Support/MathFuncs.cs +++ b/Data/Scripts/CoreSystems/Support/MathFuncs.cs @@ -5,235 +5,6 @@ namespace CoreSystems.Support { - #region MissileGuidanceBase - - internal class ProNavGuidanceInlined - { - private readonly double _updatesPerSecond; - - public Vector3D? LastVelocity; - - public ProNavGuidanceInlined(double updatesPerSecond) - { - _updatesPerSecond = updatesPerSecond; - - } - - public void ClearAcceleration() - { - LastVelocity = null; - } - - public Vector3D Update(Vector3D missilePosition, Vector3D missileVelocity, double missileAcceleration, Vector3D targetPosition, Vector3D targetVelocity, Vector3D? gravity = null, double navConstant = 3, double maxLateralThrustProportion = 1, double navAccelConstant = 0) - { - Vector3D targetAcceleration = Vector3D.Zero; - if (LastVelocity.HasValue) - targetAcceleration = (targetVelocity - LastVelocity.Value) * _updatesPerSecond; - LastVelocity = targetVelocity; - - Vector3D missileToTarget = targetPosition - missilePosition; - Vector3D missileToTargetNorm = Vector3D.Normalize(missileToTarget); - Vector3D relativeVelocity = targetVelocity - missileVelocity; - Vector3D lateralTargetAcceleration = (targetAcceleration - Vector3D.Dot(targetAcceleration, missileToTargetNorm) * missileToTargetNorm); - - Vector3D omega = Vector3D.Cross(missileToTarget, relativeVelocity) / Math.Max(missileToTarget.LengthSquared(), 1); //to combat instability at close range - var lateralAcceleration = navConstant * relativeVelocity.Length() * Vector3D.Cross(omega, missileToTargetNorm) + navAccelConstant * lateralTargetAcceleration; - - - Vector3D pointingVector; - if (Vector3D.IsZero(lateralAcceleration)) - { - pointingVector = missileToTargetNorm * missileAcceleration; - } - else - { - double maxLateralThrust = missileAcceleration * Math.Min(1, Math.Max(0, maxLateralThrustProportion)); - if (lateralAcceleration.LengthSquared() > maxLateralThrust * maxLateralThrust) - { - Vector3D.Normalize(ref lateralAcceleration, out lateralAcceleration); - lateralAcceleration *= maxLateralThrust; - } - - - var diff = missileAcceleration * missileAcceleration - lateralAcceleration.LengthSquared(); - pointingVector = diff < 0 ? Vector3D.Normalize(lateralAcceleration) * missileAcceleration : lateralAcceleration + Math.Sqrt(diff) * missileToTargetNorm; - } - - if (gravity.HasValue && gravity.Value.LengthSquared() > 1e-3) - { - - if (!Vector3D.IsZero(pointingVector)) - { - var directionNorm = Vector3D.IsUnit(ref pointingVector) ? pointingVector : Vector3D.Normalize(pointingVector); - Vector3D gravityCompensationVec; - - if (Vector3D.IsZero(gravity.Value) || Vector3D.IsZero(pointingVector)) - gravityCompensationVec = Vector3D.Zero; - else - gravityCompensationVec = (gravity.Value - gravity.Value.Dot(pointingVector) / pointingVector.LengthSquared() * pointingVector); - - var diffSq = missileAcceleration * missileAcceleration - gravityCompensationVec.LengthSquared(); - pointingVector = diffSq < 0 ? pointingVector - gravity.Value : directionNorm * Math.Sqrt(diffSq) + gravityCompensationVec; - } - - } - - return pointingVector; - } - } - - - internal abstract class MissileGuidanceBase - { - protected double _deltaTime; - protected double _updatesPerSecond; - - Vector3D? _lastVelocity; - - protected MissileGuidanceBase(double updatesPerSecond) - { - _updatesPerSecond = updatesPerSecond; - _deltaTime = 1.0 / _updatesPerSecond; - } - - public void ClearAcceleration() - { - _lastVelocity = null; - } - - public Vector3D Update(Vector3D missilePosition, Vector3D missileVelocity, double missileAcceleration, Vector3D targetPosition, Vector3D targetVelocity, Vector3D? gravity = null) - { - Vector3D targetAcceleration = Vector3D.Zero; - if (_lastVelocity.HasValue) - targetAcceleration = (targetVelocity - _lastVelocity.Value) * _updatesPerSecond; - _lastVelocity = targetVelocity; - - Vector3D pointingVector = GetPointingVector(missilePosition, missileVelocity, missileAcceleration, targetPosition, targetVelocity, targetAcceleration); - - if (gravity.HasValue && gravity.Value.LengthSquared() > 1e-3) - { - pointingVector = GravityCompensation(missileAcceleration, pointingVector, gravity.Value); - } - return pointingVector; - } - - public static Vector3D GravityCompensation(double missileAcceleration, Vector3D desiredDirection, Vector3D gravity) - { - Vector3D directionNorm = MathFuncs.SafeNormalize(desiredDirection); - Vector3D gravityCompensationVec = -(MathFuncs.Rejection(gravity, desiredDirection)); - - double diffSq = missileAcceleration * missileAcceleration - gravityCompensationVec.LengthSquared(); - if (diffSq < 0) // Impossible to hover - { - return desiredDirection - gravity; // We will sink, but at least approach the target. - } - - return directionNorm * Math.Sqrt(diffSq) + gravityCompensationVec; - } - - protected abstract Vector3D GetPointingVector(Vector3D missilePosition, Vector3D missileVelocity, double missileAcceleration, Vector3D targetPosition, Vector3D targetVelocity, Vector3D targetAcceleration); - } - - internal abstract class RelNavGuidance : MissileGuidanceBase - { - public double NavConstant; - public double NavAccelConstant; - - protected RelNavGuidance(double updatesPerSecond, double navConstant, double navAccelConstant = 0) : base(updatesPerSecond) - { - NavConstant = navConstant; - NavAccelConstant = navAccelConstant; - } - - protected abstract Vector3D GetLatax(Vector3D missileToTarget, Vector3D missileToTargetNorm, Vector3D relativeVelocity, Vector3D lateralTargetAcceleration); - - protected override Vector3D GetPointingVector(Vector3D missilePosition, Vector3D missileVelocity, double missileAcceleration, Vector3D targetPosition, Vector3D targetVelocity, Vector3D targetAcceleration) - { - Vector3D missileToTarget = targetPosition - missilePosition; - Vector3D missileToTargetNorm = Vector3D.Normalize(missileToTarget); - Vector3D relativeVelocity = targetVelocity - missileVelocity; - Vector3D lateralTargetAcceleration = (targetAcceleration - Vector3D.Dot(targetAcceleration, missileToTargetNorm) * missileToTargetNorm); - - Vector3D lateralAcceleration = GetLatax(missileToTarget, missileToTargetNorm, relativeVelocity, lateralTargetAcceleration); - - if (Vector3D.IsZero(lateralAcceleration)) - return missileToTargetNorm * missileAcceleration; - - double diff = missileAcceleration * missileAcceleration - lateralAcceleration.LengthSquared(); - if (diff < 0) - return Vector3D.Normalize(lateralAcceleration) * missileAcceleration; //fly parallel to the target - return lateralAcceleration + Math.Sqrt(diff) * missileToTargetNorm; - } - } - - /// - /// Whip's Proportional Navigation Intercept - /// Derived from: https://en.wikipedia.org/wiki/Proportional_navigation - /// And: http://www.moddb.com/members/blahdy/blogs/gamedev-introduction-to-proportional-navigation-part-i - /// And: http://www.dtic.mil/dtic/tr/fulltext/u2/a556639.pdf - /// And: http://nptel.ac.in/courses/101108054/module8/lecture22.pdf - /// - internal class ProNavGuidance : RelNavGuidance - { - public ProNavGuidance(double updatesPerSecond, double navConstant, double navAccelConstant = 0) : base(updatesPerSecond, navConstant, navAccelConstant) { } - - protected override Vector3D GetLatax(Vector3D missileToTarget, Vector3D missileToTargetNorm, Vector3D relativeVelocity, Vector3D lateralTargetAcceleration) - { - Vector3D omega = Vector3D.Cross(missileToTarget, relativeVelocity) / Math.Max(missileToTarget.LengthSquared(), 1); //to combat instability at close range - return NavConstant * relativeVelocity.Length() * Vector3D.Cross(omega, missileToTargetNorm) - + NavAccelConstant * lateralTargetAcceleration; - } - } - - internal class WhipNavGuidance : RelNavGuidance - { - public WhipNavGuidance(double updatesPerSecond, double navConstant, double navAccelConstant = 0) : base(updatesPerSecond, navConstant, navAccelConstant) { } - - protected override Vector3D GetLatax(Vector3D missileToTarget, Vector3D missileToTargetNorm, Vector3D relativeVelocity, Vector3D lateralTargetAcceleration) - { - Vector3D parallelVelocity = relativeVelocity.Dot(missileToTargetNorm) * missileToTargetNorm; //bootleg vector projection - Vector3D normalVelocity = (relativeVelocity - parallelVelocity); - return NavConstant * 0.1 * normalVelocity - + NavAccelConstant * lateralTargetAcceleration; - } - } - - internal class HybridNavGuidance : RelNavGuidance - { - public HybridNavGuidance(double updatesPerSecond, double navConstant, double navAccelConstant = 0) : base(updatesPerSecond, navConstant, navAccelConstant) { } - - protected override Vector3D GetLatax(Vector3D missileToTarget, Vector3D missileToTargetNorm, Vector3D relativeVelocity, Vector3D lateralTargetAcceleration) - { - Vector3D omega = Vector3D.Cross(missileToTarget, relativeVelocity) / Math.Max(missileToTarget.LengthSquared(), 1); //to combat instability at close range - Vector3D parallelVelocity = relativeVelocity.Dot(missileToTargetNorm) * missileToTargetNorm; //bootleg vector projection - Vector3D normalVelocity = (relativeVelocity - parallelVelocity); - return NavConstant * (relativeVelocity.Length() * Vector3D.Cross(omega, missileToTargetNorm) + 0.1 * normalVelocity) - + NavAccelConstant * lateralTargetAcceleration; - } - } - - /// - /// Zero Effort Miss Intercept - /// Derived from: https://doi.org/10.2514/1.26948 - /// - internal class ZeroEffortMissGuidance : RelNavGuidance - { - public ZeroEffortMissGuidance(double updatesPerSecond, double navConstant) : base(updatesPerSecond, navConstant, 0) { } - protected override Vector3D GetLatax(Vector3D missileToTarget, Vector3D missileToTargetNorm, Vector3D relativeVelocity, Vector3D lateralTargetAcceleration) - { - double distToTarget = Vector3D.Dot(missileToTarget, missileToTargetNorm); - double closingSpeed = Vector3D.Dot(relativeVelocity, missileToTargetNorm); - // Equation (8) with sign modification to keep time positive and not NaN - double tau = distToTarget / Math.Max(1, Math.Abs(closingSpeed)); - // Equation (6) - Vector3D z = missileToTarget + relativeVelocity * tau; - // Equation (7) - return NavConstant * z / (tau * tau) - + NavAccelConstant * lateralTargetAcceleration; - } - } - #endregion - internal static class MathFuncs { internal struct Cone @@ -262,67 +33,28 @@ internal static bool TargetSphereInCone(ref BoundingSphereD targetSphere, ref Co return true; } - public static bool IntersectEllipsoidEllipsoid(Ellipsoid ellipsoid1, Quaternion rotation1, Ellipsoid ellipsoid2, Quaternion rotation2, out Vector3 collisionPoint) + internal static Vector3D ShieldHitAngle(MatrixD ellipsoidMatrixInv, MatrixD ellipsoidMatrix, RayD ray) { - collisionPoint = Vector3.Zero; - - // Create transform matrices for the ellipsoids - Matrix transform1 = Matrix.CreateFromTransformScale(rotation1, ellipsoid1.Center, Vector3.One); - Matrix transform2 = Matrix.CreateFromTransformScale(rotation2, ellipsoid2.Center, Vector3.One); - - // Transform the ellipsoid centers and radii into a common space - Matrix transform1Inv = Matrix.Invert(transform1); - Matrix transform2Inv = Matrix.Invert(transform2); - var center1 = Vector3.Transform(ellipsoid2.Center, transform1Inv); - var center2 = Vector3.Transform(ellipsoid1.Center, transform2Inv); - var radii1 = Vector3.TransformNormal(ellipsoid2.Radii, transform1Inv); - var radii2 = Vector3.TransformNormal(ellipsoid1.Radii, transform2Inv); - - //Vector3 center1 = transform1.inverse.MultiplyPoint(ellipsoid2.Center); - //Vector3 center2 = transform2.inverse.MultiplyPoint(ellipsoid1.Center); - //Vector3 radii1 = transform1.inverse.MultiplyVector(ellipsoid2.Radii); - //Vector3 radii2 = transform2.inverse.MultiplyVector(ellipsoid1.Radii); - - // Calculate the distance between the transformed ellipsoid centers - Vector3 centerDistance = center1 - center2; - float distance = centerDistance.Length(); - - // Calculate the sum of the transformed ellipsoid radii - Vector3 radiiSum = radii1 + radii2; - - // Check if the distance between the transformed ellipsoid centers is less than or equal to the sum of the transformed ellipsoid radii in all dimensions - if (distance <= radiiSum.X && distance <= radiiSum.Y && distance <= radiiSum.Z) - { - // The ellipsoids intersect, so find the surface collision points - Vector3 surfacePoint1 = center1 + centerDistance.Normalize() * radii1; - Vector3 surfacePoint2 = center2 - centerDistance.Normalize() * radii2; - - // Calculate the collision distance - float collisionDistance = (radiiSum - centerDistance).Length() / 2; - - // Set the collision point to the midpoint between the surface collision points, minus the collision distance - collisionPoint = (surfacePoint1 + surfacePoint2) / 2 - centerDistance.Normalize() * collisionDistance; - // Transform the collision point back into world space - collisionPoint = Vector3.Transform(collisionPoint, transform1); - //collisionPoint = transform1.MultiplyPoint(collisionPoint); - return true; - } - else - { - return false; - } - } + var dirMat = MatrixD.CreateWorld(ray.Position, ray.Direction, Vector3D.CalculatePerpendicularVector(ray.Direction)); + var ray1 = new RayD(ray.Position + dirMat.Up * 0.05 + dirMat.Right * 0.05, ray.Direction); + var ray2 = new RayD(ray.Position + dirMat.Down * 0.05 + dirMat.Right * 0.05, ray.Direction); + var ray3 = new RayD(ray.Position + dirMat.Left * 0.0707106781186548, ray.Direction); - public struct Ellipsoid - { - public Vector3 Center; - public Vector3 Radii; + var dist1 = IntersectEllipsoid(ellipsoidMatrixInv, ellipsoidMatrix, ray1); + var dist2 = IntersectEllipsoid(ellipsoidMatrixInv, ellipsoidMatrix, ray2); + var dist3 = IntersectEllipsoid(ellipsoidMatrixInv, ellipsoidMatrix, ray3); + if (!dist1.HasValue || !dist2.HasValue || !dist3.HasValue) + return Vector3D.Zero; - public Ellipsoid(Vector3 center, Vector3 radii) - { - Center = center; - Radii = radii; - } + var hitPos1World = ray1.Position + (ray.Direction * dist1.Value); + var hitPos2World = ray2.Position + (ray.Direction * dist2.Value); + var hitPos3World = ray3.Position + (ray.Direction * dist3.Value); + var plane = new PlaneD(hitPos1World, hitPos2World, hitPos3World); + + if (!plane.Normal.IsValid() || plane.Normal.AbsMax() == 1) + return Vector3D.Zero; + + return plane.Normal; } internal static double? IntersectEllipsoid(MatrixD ellipsoidMatrixInv, MatrixD ellipsoidMatrix, RayD ray) @@ -353,11 +85,6 @@ public Ellipsoid(Vector3 center, Vector3 radii) return (double.IsNaN(dist) ? (double?) null : dist); } - public static bool PointInEllipsoid(Vector3D point, MatrixD ellipsoidMatrixInv) - { - return Vector3D.Transform(point, ellipsoidMatrixInv).LengthSquared() <= 1; - } - internal static bool IsDotProductWithinTolerance(ref Vector3D targetDir, ref Vector3D refDir, double tolerance) { double dot = Vector3D.Dot(targetDir, refDir); @@ -365,77 +92,6 @@ internal static bool IsDotProductWithinTolerance(ref Vector3D targetDir, ref Vec return Math.Abs(dot) * dot > num; } - /* - This sausage of a method was made by combining my MissileGuidance class into a single call - because... because Keen won't let us have nice things. - - This is derived using a lateral acceleration (latax) that is normal to the line of sight vector. - This is a much more stable solution than using a latax that is normal to the velocity vector - because I don't need to screw with the dozen or so edge cases you get with that geometry. - - - Whiplash141 the Salty - */ - internal static Vector3D ProNavGuidanceButAllInOneMethod( - double NavConstant, // Nominally: 3-5 - double NavAccelConstant, // Nominally: NavConstant / 2 - ref Vector3D targetPosition, - ref Vector3D targetVelocity, - ref Vector3D targetAcceleration, - ref Vector3D missilePosition, - ref Vector3D missileVelocity, - ref Vector3D gravity, // Plug in Vector3D.Zero if you don't give a shit about gravity - double missileAccelerationMagnitude, // m/s^2 - double updateIntervalInSeconds) - { - Vector3D missileToTarget = targetPosition - missilePosition; - Vector3D missileToTargetNorm = Vector3D.Normalize(missileToTarget); - Vector3D relativeVelocity = targetVelocity - missileVelocity; - Vector3D lateralTargetAcceleration = (targetAcceleration - Vector3D.Dot(targetAcceleration, missileToTargetNorm) * missileToTargetNorm); - Vector3D gravityCompensationTerm = 1.1 * -(gravity - Vector3D.Dot(gravity, missileToTargetNorm) * missileToTargetNorm); - /* - This is where the magic happens. Here we are using the angular rate of change as the "error" - that we are going to slap into an augmented PROPORTIONAL controller. That is where the name - comes from. - */ - Vector3D omega = Vector3D.Cross(missileToTarget, relativeVelocity) / Math.Max(missileToTarget.LengthSquared(), 1); // To combat instability at close range - Vector3D lateralAcceleration = NavConstant * relativeVelocity.Length() * Vector3D.Cross(omega, missileToTargetNorm) - + NavAccelConstant * lateralTargetAcceleration - + gravityCompensationTerm; // Normal to LOS - - if (Vector3D.IsZero(lateralAcceleration)) - return missileToTarget; - - double diff = missileAccelerationMagnitude * missileAccelerationMagnitude - lateralAcceleration.LengthSquared(); - if (diff < 0) - return lateralAcceleration; // Fly parallel to the target if we run out of acceleration budget - return lateralAcceleration + Math.Sqrt(diff) * missileToTargetNorm; - } - - //Relative velocity proportional navigation - //aka: Whip-Nav - internal static Vector3D CalculateMissileIntercept(Vector3D targetPosition, Vector3D targetVelocity, Vector3D missilePos, Vector3D missileVelocity, double missileAcceleration, double compensationFactor = 1, double maxLateralThrustProportion = 0.5) - { - var missileToTarget = Vector3D.Normalize(targetPosition - missilePos); - var relativeVelocity = targetVelocity - missileVelocity; - var parallelVelocity = relativeVelocity.Dot(missileToTarget) * missileToTarget; - var normalVelocity = (relativeVelocity - parallelVelocity); - - var normalMissileAcceleration = normalVelocity * compensationFactor; - - if (Vector3D.IsZero(normalMissileAcceleration)) - return missileToTarget * missileAcceleration; - - double maxLateralThrust = missileAcceleration * Math.Min(1, Math.Max(0, maxLateralThrustProportion)); - if (normalMissileAcceleration.LengthSquared() > maxLateralThrust * maxLateralThrust) - { - Vector3D.Normalize(ref normalMissileAcceleration, out normalMissileAcceleration); - normalMissileAcceleration *= maxLateralThrust; - } - double diff = missileAcceleration * missileAcceleration - normalMissileAcceleration.LengthSquared(); - var maxedDiff = Math.Max(0, diff); - return Math.Sqrt(maxedDiff) * missileToTarget + normalMissileAcceleration; - } - public enum DebugCaller { TrajectoryEstimation, @@ -671,28 +327,6 @@ internal static double AngleBetween(Vector3D a, Vector3D b) //returns radians return Math.Acos(MathHelperD.Clamp(a.Dot(b) / Math.Sqrt(a.LengthSquared() * b.LengthSquared()), -1, 1)); } - internal static long UniqueId(int left, int right) - { - long uniqueId = left; - uniqueId <<= 32; - uniqueId += right; - return uniqueId; - } - - internal static void GetRotationAnglesOld(ref Vector3D targetVector, ref MatrixD matrix, out double yaw, out double pitch) - { - var localTargetVector = Vector3D.TransformNormal(targetVector, MatrixD.Transpose(matrix)); - var flattenedTargetVector = new Vector3D(localTargetVector.X, 0, localTargetVector.Z); - yaw = AngleBetween(Vector3D.Forward, flattenedTargetVector) * -Math.Sign(localTargetVector.X); //right is positive - if (Math.Abs(yaw) < 1E-6 && localTargetVector.Z > 0) //check for straight back case - yaw = Math.PI; - - if (Vector3D.IsZero(flattenedTargetVector)) //check for straight up case - pitch = MathHelper.PiOver2 * Math.Sign(localTargetVector.Y); - else - pitch = AngleBetween(localTargetVector, flattenedTargetVector) * Math.Sign(localTargetVector.Y); //up is positive - } - internal static void GetRotationAngles(ref Vector3D targetVector, ref MatrixD matrix, out double yaw, out double pitch) { yaw = 0; @@ -734,234 +368,6 @@ internal static double Intercept(Vector3D deltaPos, Vector3D deltaVel, double pr return 2.0 * num3 / (Math.Sqrt(d) - num2); } - internal static void WrapAngleAroundPI(ref float angle) - { - angle %= MathHelper.TwoPi; - if (angle > Math.PI) - angle = -MathHelper.TwoPi + angle; - else if (angle < -Math.PI) - angle = MathHelper.TwoPi + angle; - } - - internal static void DotRepairAndReport(double dot, out double newDot) - { - if (dot > 1) - newDot = 1; - else if (dot < -1) - newDot = -1; - else - newDot = dot; - - Log.Line($"dot was invalid: {dot}"); - } - - internal static double CalculateRotorDeviationAngle(Vector3D forwardVector, MatrixD lastOrientation) - { - var flattenedForwardVector = Rejection(forwardVector, lastOrientation.Up); - return AngleBetween(flattenedForwardVector, lastOrientation.Forward) * Math.Sign(flattenedForwardVector.Dot(lastOrientation.Left)); - } - - internal static void GetAzimuthAngle(ref Vector3D targetVector, ref MatrixD matrix, out double azimuth) - { - var localTargetVector = Vector3D.TransformNormal(targetVector, MatrixD.Transpose(matrix)); - var flattenedTargetVector = new Vector3D(localTargetVector.X, 0, localTargetVector.Z); - azimuth = AngleBetween(Vector3D.Forward, flattenedTargetVector) * -Math.Sign(localTargetVector.X); //right is positive - if (Math.Abs(azimuth) < 1E-6 && localTargetVector.Z > 0) //check for straight back case - azimuth = Math.PI; - } - internal static void GetElevationAngle(ref Vector3D targetVector, ref MatrixD matrix, out double pitch) - { - var localTargetVector = Vector3D.TransformNormal(targetVector, MatrixD.Transpose(matrix)); - var flattenedTargetVector = new Vector3D(localTargetVector.X, 0, localTargetVector.Z); - if (Vector3D.IsZero(flattenedTargetVector)) //check for straight up case - pitch = MathHelper.PiOver2 * Math.Sign(localTargetVector.Y); - else - pitch = AngleBetween(localTargetVector, flattenedTargetVector) * Math.Sign(localTargetVector.Y); //up is positive - } - - internal static Vector3D SafeNormalize(Vector3D a) - { - if (Vector3D.IsZero(a)) return Vector3D.Zero; - if (Vector3D.IsUnit(ref a)) return a; - return Vector3D.Normalize(a); - } - - internal static Vector3D Reflection(Vector3D a, Vector3D b, double rejectionFactor = 1) //reflect a over b - { - Vector3D project_a = Projection(a, b); - Vector3D reject_a = a - project_a; - return project_a - reject_a * rejectionFactor; - } - - internal static Vector3D Rejection(Vector3D a, Vector3D b) //reject a on b - { - if (Vector3D.IsZero(a) || Vector3D.IsZero(b)) - return Vector3D.Zero; - return a - a.Dot(b) / b.LengthSquared() * b; - } - - internal static Vector3D Projection(Vector3D a, Vector3D b) - { - if (Vector3D.IsZero(a) || Vector3D.IsZero(b)) - return Vector3D.Zero; - if (Vector3D.IsUnit(ref b)) - return a.Dot(b) * b; - - return a.Dot(b) / b.LengthSquared() * b; - } - - internal static double ScalarProjection(Vector3D a, Vector3D b) - { - if (Vector3D.IsZero(a) || Vector3D.IsZero(b)) return 0; - if (Vector3D.IsUnit(ref b)) - return a.Dot(b); - return a.Dot(b) / b.Length(); - } - - - - public static double CosBetween(Vector3D a, Vector3D b) - { - if (Vector3D.IsZero(a) || Vector3D.IsZero(b)) - return 0; - return MathHelper.Clamp(a.Dot(b) / Math.Sqrt(a.LengthSquared() * b.LengthSquared()), -1, 1); - } - - - public static Vector3D NearestPointOnLine(Vector3D start, Vector3D end, Vector3D pnt) - { - var line = (end - start); - var len = line.Length(); - line.Normalize(); - - var v = pnt - start; - var d = Vector3.Dot(v, line); - MathHelper.Clamp(d, 0f, len); - return start + line * d; - } - - /* - ** Returns the point on the line formed by (point1 + dir1 * x) that is closest to the point - ** on the line formed by line (point2 + dir2 * t) - */ - - public static Vector3D GetClosestPointOnLine1(Vector3D point1, Vector3D dir1, Vector3D point2, Vector3D dir2) - { - Vector3D axis = Vector3D.Cross(dir1, dir2); - if (Vector3D.IsZero(axis)) - return point1; - Vector3D perpDir2 = Vector3D.Cross(dir2, axis); - Vector3D point1To2 = point2 - point1; - return point1 + Vector3D.Dot(point1To2, perpDir2) / Vector3D.Dot(dir1, perpDir2) * dir1; - } - - /* - ** Returns the point on the line1 that is closest to the point on line2 - */ - - public static Vector3D GetClosestPointOnLine2(Vector3D line1Start, Vector3D line1End, Vector3D line2Start, Vector3D line2End) - { - Vector3D dir1 = line1End - line1Start; - Vector3D dir2 = line2End - line2Start; - Vector3D axis = Vector3D.Cross(dir1, dir2); - if (Vector3D.IsZero(axis)) - return line1Start; - Vector3D perpDir2 = Vector3D.Cross(dir2, axis); - Vector3D point1To2 = line2Start - line1Start; - return line1Start + Vector3D.Dot(point1To2, perpDir2) / Vector3D.Dot(dir1, perpDir2) * dir1; - } - - public static Vector3D VectorProjection(Vector3D a, Vector3D b) - { - if (Vector3D.IsZero(b)) - return Vector3D.Zero; - - return a.Dot(b) / b.LengthSquared() * b; - } - - public static bool SameSign(float num1, double num2) - { - if (num1 > 0 && num2 < 0) - return false; - if (num1 < 0 && num2 > 0) - return false; - return true; - } - - public static bool NearlyEqual(double f1, double f2) - { - // Equal if they are within 0.00001 of each other - return Math.Abs(f1 - f2) < 0.00001; - } - - - public static double InverseSqrDist(Vector3D source, Vector3D target, double range) - { - var rangeSq = range * range; - var distSq = (target - source).LengthSquared(); - if (distSq > rangeSq) - return 0.0; - return 1.0 - (distSq / rangeSq); - } - - public static double GetIntersectingSurfaceArea(MatrixD matrix, Vector3D hitPosLocal) - { - var surfaceArea = -1d; - - var boxMax = matrix.Backward + matrix.Right + matrix.Up; - var boxMin = -boxMax; - var box = new BoundingBoxD(boxMin, boxMax); - - var maxWidth = box.Max.LengthSquared(); - var testLine = new LineD(Vector3D.Zero, Vector3D.Normalize(hitPosLocal) * maxWidth); - LineD testIntersection; - box.Intersect(ref testLine, out testIntersection); - - var intersection = testIntersection.To; - - var epsilon = 1e-6; - var projFront = VectorProjection(intersection, matrix.Forward); - if (Math.Abs(projFront.LengthSquared() - matrix.Forward.LengthSquared()) < epsilon) - { - var a = Vector3D.Distance(matrix.Left, matrix.Right); - var b = Vector3D.Distance(matrix.Up, matrix.Down); - surfaceArea = a * b; - } - - var projLeft = VectorProjection(intersection, matrix.Left); - if (Math.Abs(projLeft.LengthSquared() - matrix.Left.LengthSquared()) < epsilon) - { - var a = Vector3D.Distance(matrix.Forward, matrix.Backward); - var b = Vector3D.Distance(matrix.Up, matrix.Down); - surfaceArea = a * b; - } - - var projUp = VectorProjection(intersection, matrix.Up); - if (Math.Abs(projUp.LengthSquared() - matrix.Up.LengthSquared()) < epsilon) - { - var a = Vector3D.Distance(matrix.Forward, matrix.Backward); - var b = Vector3D.Distance(matrix.Left, matrix.Right); - surfaceArea = a * b; - } - return surfaceArea; - } - - public static void FibonacciSeq(int magicNum) - { - var root5 = Math.Sqrt(5); - var phi = (1 + root5) / 2; - - var n = 0; - int Fn; - do - { - Fn = (int)((Math.Pow(phi, n) - Math.Pow(-phi, -n)) / ((2 * phi) - 1)); - //Console.Write("{0} ", Fn); - ++n; - } - while (Fn < magicNum); - } - public static double LargestCubeInSphere(double r) { @@ -974,34 +380,11 @@ public static double LargestCubeInSphere(double r) return a; } - public static double AreaCube(double a) - { - return (a * a * a); - } - - public static double SurfaceCube(double a) - { - return (6 * a * a); - } - public static double VolumeCube(double len) { return Math.Pow(len, 3); } - public static double Percentile(double[] sequence, double excelPercentile) - { - Array.Sort(sequence); - int N = sequence.Length; - double n = (N - 1) * excelPercentile + 1; - // Another method: double n = (N + 1) * excelPercentile; - if (n == 1d) return sequence[0]; - if (n == N) return sequence[N - 1]; - int k = (int)n; - double d = n - k; - return sequence[k - 1] + d * (sequence[k] - sequence[k - 1]); - } - public static double GetMedian(int[] array) { int[] tempArray = array; diff --git a/Data/Scripts/CoreSystems/Support/MiscTypes.cs b/Data/Scripts/CoreSystems/Support/MiscTypes.cs index f0f46fbb..7d3db142 100644 --- a/Data/Scripts/CoreSystems/Support/MiscTypes.cs +++ b/Data/Scripts/CoreSystems/Support/MiscTypes.cs @@ -22,6 +22,7 @@ public class Target internal bool TargetChanged; internal bool ClientDirty; internal bool IsDrone; + internal bool ValidEstimate; internal uint ChangeTick; internal uint ProjectileEndTick; internal long TargetId; diff --git a/Data/Scripts/CoreSystems/Support/Spawn.cs b/Data/Scripts/CoreSystems/Support/Spawn.cs deleted file mode 100644 index cb51d243..00000000 --- a/Data/Scripts/CoreSystems/Support/Spawn.cs +++ /dev/null @@ -1,282 +0,0 @@ -using System; -using System.Collections.Generic; -using Sandbox.Common.ObjectBuilders; -using Sandbox.Definitions; -using Sandbox.Game.Entities; -using Sandbox.Game.EntityComponents; -using Sandbox.ModAPI; -using VRage; -using VRage.Game; -using VRage.Game.Entity; -using VRage.Game.GUI.TextPanel; -using VRage.Game.ModAPI; -using VRage.ModAPI; -using VRage.ObjectBuilders; -using VRageMath; - -namespace CoreSystems.Support -{ - internal class Spawn - { - private static readonly SerializableBlockOrientation EntityOrientation = new SerializableBlockOrientation(Base6Directions.Direction.Forward, Base6Directions.Direction.Up); - - private static readonly MyObjectBuilder_CubeGrid CubeGridBuilder = new MyObjectBuilder_CubeGrid - { - EntityId = 0, - GridSizeEnum = MyCubeSize.Large, - IsStatic = true, - Skeleton = new List(), - LinearVelocity = Vector3.Zero, - AngularVelocity = Vector3.Zero, - ConveyorLines = new List(), - BlockGroups = new List(), - Handbrake = false, - XMirroxPlane = null, - YMirroxPlane = null, - ZMirroxPlane = null, - PersistentFlags = MyPersistentEntityFlags2.InScene, - Name = "ArtificialCubeGrid", - DisplayName = "FieldEffect", - CreatePhysics = false, - DestructibleBlocks = true, - PositionAndOrientation = new MyPositionAndOrientation(Vector3D.Zero, Vector3D.Forward, Vector3D.Up), - - CubeBlocks = new List - { - new MyObjectBuilder_CubeBlock - { - EntityId = 0, - BlockOrientation = EntityOrientation, - SubtypeName = string.Empty, - Name = string.Empty, - Min = Vector3I.Zero, - Owner = 0, - ShareMode = MyOwnershipShareModeEnum.None, - DeformationRatio = 0, - } - } - }; - - public static readonly MyObjectBuilder_Meteor GravityMissile = new MyObjectBuilder_Meteor - { - EntityId = 0, - LinearVelocity = Vector3.One * 10, - AngularVelocity = Vector3.Zero, - PersistentFlags = MyPersistentEntityFlags2.InScene, - Name = "GravityMissile", - PositionAndOrientation = new MyPositionAndOrientation(Vector3D.Zero, Vector3D.Forward, Vector3D.Up) - }; - - public static readonly MyObjectBuilder_FloatingObject FloatingObject = new MyObjectBuilder_FloatingObject - { - EntityId = 0, - PersistentFlags = MyPersistentEntityFlags2.InScene, - Name = "CustomFloater", - PositionAndOrientation = new MyPositionAndOrientation(Vector3D.Zero, Vector3D.Forward, Vector3D.Up) - }; - - public static MyEntity EmptyEntity(string displayName, string model, MyEntity parent, bool parented = false) - { - try - { - var ent = new MyEntity(); - ent.Init(null, model, null, null); - ent.Render.CastShadows = false; - ent.IsPreview = true; - ent.Render.Visible = true; - ent.Save = false; - ent.SyncFlag = false; - ent.NeedsWorldMatrix = false; - ent.Flags |= EntityFlags.IsNotGamePrunningStructureObject; - MyEntities.Add(ent); - return ent; - } - catch (Exception ex) { Log.Line($"Exception in EmptyEntity: {ex}"); return null; } - } - - public static MyEntity SpawnBlock(string subtypeId, string name, bool isVisible = false, bool hasPhysics = false, bool isStatic = false, bool toSave = false, bool destructible = false, long ownerId = 0) - { - try - { - CubeGridBuilder.Name = name; - CubeGridBuilder.CubeBlocks[0].SubtypeName = subtypeId; - CubeGridBuilder.CreatePhysics = hasPhysics; - CubeGridBuilder.IsStatic = isStatic; - CubeGridBuilder.DestructibleBlocks = destructible; - var ent = (MyEntity)MyAPIGateway.Entities.CreateFromObjectBuilder(CubeGridBuilder); - - ent.Flags &= ~EntityFlags.Save; - ent.Render.Visible = isVisible; - MyAPIGateway.Entities.AddEntity(ent); - - return ent; - } - catch (Exception ex) - { - Log.Line("Exception in Spawn"); - Log.Line($"{ex}"); - return null; - } - } - - internal static MyEntity SpawnPrefab(string name, out IMyTextPanel lcd, bool isDisplay = false) - { - try - { - if (string.IsNullOrEmpty(name)) - { - lcd = null; - return null; - } - - PrefabBuilder.CubeBlocks.Clear(); // need no leftovers from previous spawns - - if (isDisplay) - { - PrefabTextPanel.SubtypeName = name; - PrefabTextPanel.FontColor = new Vector4(1, 1, 1, 1); - PrefabTextPanel.BackgroundColor = new Vector4(0,0,0, 0); - PrefabTextPanel.FontSize = DISPLAY_FONT_SIZE; - PrefabBuilder.CubeBlocks.Add(PrefabTextPanel); - var def = MyDefinitionManager.Static.GetCubeBlockDefinition(new MyDefinitionId(typeof(MyObjectBuilder_TextPanel), name)) as MyTextPanelDefinition; - - if (def != null) - def.TextureResolution = 256; - } - else - { - PrefabCubeBlock.SubtypeName = name; - PrefabBuilder.CubeBlocks.Add(PrefabCubeBlock); - } - - MyEntities.RemapObjectBuilder(PrefabBuilder); - var ent = MyEntities.CreateFromObjectBuilder(PrefabBuilder, true); - ent.IsPreview = true; // don't sync on MP - ent.SyncFlag = false; // don't sync on MP - ent.Save = false; // don't save this entity - - MyEntities.Add(ent); - var lcdSlim = ((IMyCubeGrid)ent).GetCubeBlock(Vector3I.Zero); - lcd = lcdSlim.FatBlock as IMyTextPanel; - //lcd.Render.CastShadows = false; - //lcd.Render.Transparency = 0.5f; - //lcd.Render.NeedsResolveCastShadow = false; - //lcd.Render.EnableColorMaskHsv = false; - //lcd.Render.DrawInAllCascades = false; - - //lcd.Render.UpdateRenderObject(false, true); - //lcd.Render.UpdateRenderObject(true, true); - //lcd.Render.RemoveRenderObjects(); - //lcd.Render.AddRenderObjects(); - lcd.SetEmissiveParts("ScreenArea", Color.White, 1f); - lcd.SetEmissiveParts("Edges", Color.Teal, 0.5f); - - lcd.ContentType = ContentType.TEXT_AND_IMAGE; - - return ent; - } - catch (Exception ex) { Log.Line($"Exception in SpawnPrefab: {ex}"); } - - lcd = null; - return null; - } - - internal static MyEntity SpawnCamera(string name, out MyCameraBlock camera) - { - try - { - if (string.IsNullOrEmpty(name)) - { - camera = null; - return null; - } - PrefabCamera.SubtypeName = name; - PrefabBuilder.CubeBlocks.Clear(); // need no leftovers from previous spawns - PrefabBuilder.CubeBlocks.Add(PrefabCamera); - MyEntities.RemapObjectBuilder(PrefabBuilder); - var ent = MyEntities.CreateFromObjectBuilder(PrefabBuilder, false); - ent.Render.CastShadows = false; - ent.Render.Visible = false; - ent.IsPreview = true; - ent.Save = false; - ent.SyncFlag = false; - ent.NeedsWorldMatrix = false; - ent.Flags |= EntityFlags.IsNotGamePrunningStructureObject; - ent.Render.RemoveRenderObjects(); - MyEntities.Add(ent, false); - var cameraSlim = ((IMyCubeGrid)ent).GetCubeBlock(Vector3I.Zero); - var gId = MyResourceDistributorComponent.ElectricityId; - camera = (MyCameraBlock)cameraSlim.FatBlock; - camera.ResourceSink.SetInputFromDistributor(gId, 0, true); - camera.RefreshModels(null, null); - return ent; - } - catch (Exception ex) { Log.Line($"Exception in SpawnPrefab: {ex}"); } - - camera = null; - return null; - } - - private static SerializableVector3 PrefabVector0 = new SerializableVector3(0, 0, 0); - private static SerializableVector3I PrefabVectorI0 = new SerializableVector3I(0, 0, 0); - private static SerializableBlockOrientation PrefabOrientation = new SerializableBlockOrientation(Base6Directions.Direction.Forward, Base6Directions.Direction.Up); - private const float DISPLAY_FONT_SIZE = 1f; - - private static MyObjectBuilder_CubeBlock PrefabCubeBlock = new MyObjectBuilder_CubeBlock - { - EntityId = 1, - SubtypeName = "", - Min = PrefabVectorI0, - BlockOrientation = PrefabOrientation, - DeformationRatio = 0, - ShareMode = MyOwnershipShareModeEnum.None, - }; - - private static MyObjectBuilder_CubeGrid PrefabBuilder = new MyObjectBuilder_CubeGrid - { - EntityId = 0, - GridSizeEnum = MyCubeSize.Small, - IsStatic = true, - Skeleton = new List(), - LinearVelocity = PrefabVector0, - AngularVelocity = PrefabVector0, - ConveyorLines = new List(), - BlockGroups = new List(), - Handbrake = false, - XMirroxPlane = null, - YMirroxPlane = null, - ZMirroxPlane = null, - PersistentFlags = MyPersistentEntityFlags2.InScene, - Name = "SpamCamGrid", - DisplayName = "SpamCamGrid", - CreatePhysics = false, - PositionAndOrientation = new MyPositionAndOrientation(Vector3D.Zero, Vector3D.Forward, Vector3D.Up), - CubeBlocks = new List(), - }; - - private static MyObjectBuilder_TextPanel PrefabTextPanel = new MyObjectBuilder_TextPanel - { - EntityId = 1, - Min = PrefabVectorI0, - BlockOrientation = PrefabOrientation, - ShareMode = MyOwnershipShareModeEnum.None, - DeformationRatio = 0, - ShowOnHUD = false, - //ShowText = ShowTextOnScreenFlag.PUBLIC, // HACK not whitelisted anymore... - FontSize = DISPLAY_FONT_SIZE, - }; - - private static MyObjectBuilder_CameraBlock PrefabCamera = new MyObjectBuilder_CameraBlock - { - EntityId = 1, - Min = PrefabVectorI0, - BlockOrientation = PrefabOrientation, - ShareMode = MyOwnershipShareModeEnum.None, - DeformationRatio = 0, - ShowOnHUD = false, - //IsActive = true, - Name = null, - CustomName = null, - }; - } -} diff --git a/Data/Scripts/CoreSystems/Support/StaticUtils.cs b/Data/Scripts/CoreSystems/Support/StaticUtils.cs index 39e1ad15..81dc3f90 100644 --- a/Data/Scripts/CoreSystems/Support/StaticUtils.cs +++ b/Data/Scripts/CoreSystems/Support/StaticUtils.cs @@ -1,14 +1,10 @@ using System; using System.Collections.Generic; using System.Text; -using CoreSystems.Projectiles; -using Sandbox.Game; using Sandbox.Game.Entities; -using Sandbox.Game.Entities.Cube; using Sandbox.ModAPI; using Sandbox.ModAPI.Interfaces.Terminal; using VRage.Game; -using VRage.Game.Entity; using VRage.Game.ModAPI; using VRageMath; @@ -63,31 +59,6 @@ public static bool ModActivate(IMyModContext context, IMySession session) return validP3; } - public static void GetFourInt16FromLong(long id, out int w, out int x, out int y, out int z) - { - - w = (int)(id >> 48); - - x = (int)((id << 16) >> 48); - y = (int)((id << 32) >> 48); - z = (int)((id << 48) >> 48); - - } - - public static void FourInt16ToLong(int w, int x, int y, int z, out long id) - { - - id = ((long)(w << 16 | x) << 32) | (uint)(y << 16 | z); - - } - - public static double Clamp01(double value) - { - if (value < 0.0) - return 0.0d; - return value > 1.0 ? 1d : value; - } - public static void ReplaceAll(StringBuilder sb, char[] charlist, char replacewith) { for (int i = 0; i < sb.Length; i++) @@ -96,47 +67,11 @@ public static void ReplaceAll(StringBuilder sb, char[] charlist, char replacewit sb[i] = replacewith; } } - - public static double Lerp(double a, double b, double t) => a + (b - a) * Clamp01(t); - - public static double InverseLerp(double a, double b, double value) => a != b ? Clamp01((value - a) / (b - a)) : 0.0f; - public static Vector3 ColorToHSVOffset(Color color) { return MyColorPickerConstants.HSVToHSVOffset(color.ColorToHSV()); } - public static long MakeLong(int left, int right) - { - long res = left; - res <<= 32; - res |= (uint)right; //uint first to prevent loss of signed bit - return res; - } - - static void ShellSort(List list, Vector3D weaponPos) - { - int length = list.Count; - - for (int h = length / 2; h > 0; h /= 2) - { - for (int i = h; i < length; i += 1) - { - var tempValue = list[i]; - double temp; - Vector3D.DistanceSquared(ref list[i].Position, ref weaponPos, out temp); - - int j; - for (j = i; j >= h && Vector3D.DistanceSquared(list[j - h].Position, weaponPos) > temp; j -= h) - { - list[j] = list[j - h]; - } - - list[j] = tempValue; - } - } - } - public static IMyTerminalControlOnOffSwitch RefreshToggle; public static MyCubeBlock RefreshToggleCube; @@ -208,208 +143,6 @@ public static void RefreshTerminalControls(IMyTerminalBlock b) } } - - /* - public static void UpdateTerminal(this MyCubeBlock block) - { - MyOwnershipShareModeEnum shareMode; - long ownerId; - if (block.IDModule != null) - { - ownerId = block.IDModule.Owner; - shareMode = block.IDModule.ShareMode; - } - else - { - var sorter = block as IMyTerminalBlock; - if (sorter != null) - { - sorter.ShowOnHUD = !sorter.ShowOnHUD; - sorter.ShowOnHUD = !sorter.ShowOnHUD; - } - return; - } - block.ChangeOwner(ownerId, shareMode == MyOwnershipShareModeEnum.None ? MyOwnershipShareModeEnum.Faction : MyOwnershipShareModeEnum.None); - block.ChangeOwner(ownerId, shareMode); - } - */ - public static void SphereCloud(int pointLimit, Vector3D[] physicsArray, MyEntity shieldEnt, bool transformAndScale, bool debug, Random rnd = null) - { - if (pointLimit > 10000) pointLimit = 10000; - if (rnd == null) rnd = new Random(0); - - var sPosComp = shieldEnt.PositionComp; - var unscaledPosWorldMatrix = MatrixD.Rescale(MatrixD.CreateTranslation(sPosComp.WorldAABB.Center), sPosComp.WorldVolume.Radius); - var radius = sPosComp.WorldVolume.Radius; - for (int i = 0; i < pointLimit; i++) - { - var value = rnd.Next(0, physicsArray.Length - 1); - var phi = 2 * Math.PI * i / pointLimit; - var x = (float)(radius * Math.Sin(phi) * Math.Cos(value)); - var z = (float)(radius * Math.Sin(phi) * Math.Sin(value)); - var y = (float)(radius * Math.Cos(phi)); - var v = new Vector3D(x, y, z); - - if (transformAndScale) v = Vector3D.Transform(Vector3D.Normalize(v), unscaledPosWorldMatrix); - if (debug) DsDebugDraw.DrawX(v, sPosComp.LocalMatrix, 0.5); - physicsArray[i] = v; - } - } - - public static void UnitSphereCloudQuick(int pointLimit, ref Vector3D[] physicsArray, MyEntity shieldEnt, bool translateAndScale, bool debug, Random rnd = null) - { - if (pointLimit > 10000) pointLimit = 10000; - if (rnd == null) rnd = new Random(0); - - var sPosComp = shieldEnt.PositionComp; - var radius = sPosComp.WorldVolume.Radius; - var center = sPosComp.WorldAABB.Center; - var v = Vector3D.Zero; - - for (int i = 0; i < pointLimit; i++) - { - while (true) - { - v.X = (rnd.NextDouble() * 2) - 1; - v.Y = (rnd.NextDouble() * 2) - 1; - v.Z = (rnd.NextDouble() * 2) - 1; - var len2 = v.LengthSquared(); - if (len2 < .0001) continue; - v *= radius / Math.Sqrt(len2); - break; - } - - if (translateAndScale) physicsArray[i] = v += center; - else physicsArray[i] = v; - if (debug) DsDebugDraw.DrawX(v, sPosComp.LocalMatrix, 0.5); - } - } - - public static void UnitSphereRandomOnly(ref Vector3D[] physicsArray, Random rnd = null) - { - if (rnd == null) rnd = new Random(0); - var v = Vector3D.Zero; - - for (int i = 0; i < physicsArray.Length; i++) - { - v.X = 0; - v.Y = 0; - v.Z = 0; - while ((v.X * v.X) + (v.Y * v.Y) + (v.Z * v.Z) < 0.0001) - { - v.X = (rnd.NextDouble() * 2) - 1; - v.Y = (rnd.NextDouble() * 2) - 1; - v.Z = (rnd.NextDouble() * 2) - 1; - } - v.Normalize(); - physicsArray[i] = v; - } - } - - public static void UnitSphereTranslateScale(int pointLimit, ref Vector3D[] physicsArray, ref Vector3D[] scaledCloudArray, MyEntity shieldEnt, bool debug) - { - var sPosComp = shieldEnt.PositionComp; - var radius = sPosComp.WorldVolume.Radius; - var center = sPosComp.WorldAABB.Center; - - for (int i = 0; i < pointLimit; i++) - { - var v = physicsArray[i]; - scaledCloudArray[i] = v = center + (radius * v); - if (debug) DsDebugDraw.DrawX(v, sPosComp.LocalMatrix, 0.5); - } - } - - public static void UnitSphereTranslateScaleList(int pointLimit, ref Vector3D[] physicsArray, ref List scaledCloudList, MyEntity shieldEnt, bool debug, MyEntity grid, bool rotate = true) - { - var sPosComp = shieldEnt.PositionComp; - var radius = sPosComp.WorldVolume.Radius; - var center = sPosComp.WorldAABB.Center; - var gMatrix = grid.WorldMatrix; - for (int i = 0; i < pointLimit; i++) - { - var v = physicsArray[i]; - if (rotate) Vector3D.Rotate(ref v, ref gMatrix, out v); - v = center + (radius * v); - scaledCloudList.Add(v); - if (debug) DsDebugDraw.DrawX(v, sPosComp.LocalMatrix, 0.5); - } - } - - public static void DetermisticSphereCloud(List physicsArray, int pointsInSextant) - { - physicsArray.Clear(); - int stepsPerCoord = (int)Math.Sqrt(pointsInSextant); - double radPerStep = MathHelperD.PiOver2 / stepsPerCoord; - - for (double az = -MathHelperD.PiOver4; az < MathHelperD.PiOver4; az += radPerStep) - { - for (double el = -MathHelperD.PiOver4; el < MathHelperD.PiOver4; el += radPerStep) - { - Vector3D vec; - Vector3D.CreateFromAzimuthAndElevation(az, el, out vec); - Vector3D vec2 = new Vector3D(vec.Z, vec.X, vec.Y); - Vector3D vec3 = new Vector3D(vec.Y, vec.Z, vec.X); - physicsArray.Add(vec); //first sextant - physicsArray.Add(vec2); //2nd sextant - physicsArray.Add(vec3); //3rd sextant - physicsArray.Add(-vec); //4th sextant - physicsArray.Add(-vec2); //5th sextant - physicsArray.Add(-vec3); //6th sextant - } - } - } - - public static Vector3D? GetLineIntersectionExactAll(MyCubeGrid grid, ref LineD line, out double distance, out IMySlimBlock intersectedBlock) - { - intersectedBlock = null; - distance = 3.40282346638529E+38; - Vector3I? nullable = new Vector3I?(); - Vector3I zero = Vector3I.Zero; - double distanceSquared = double.MaxValue; - if (grid.GetLineIntersectionExactGrid(ref line, ref zero, ref distanceSquared)) - { - distanceSquared = Math.Sqrt(distanceSquared); - nullable = zero; - } - if (!nullable.HasValue) - return new Vector3D?(); - distance = distanceSquared; - intersectedBlock = grid.GetCubeBlock(nullable.Value); - if (intersectedBlock == null) - return new Vector3D?(); - return zero; - } - - public static void CreateVoxelExplosion(Session session, float damage, double radius, Vector3D position, Vector3D direction, MyEntity owner, MyEntity hitEnt, WeaponDefinition.AmmoDef ammoDef, bool forceNoDraw = false) - { - - var sphere = new BoundingSphereD(position, radius); - var eFlags = MyExplosionFlags.AFFECT_VOXELS; - - var explosionInfo = new MyExplosionInfo - { - PlayerDamage = 0.1f, - Damage = damage, - ExplosionType = MyExplosionTypeEnum.MISSILE_EXPLOSION, - ExplosionSphere = sphere, - LifespanMiliseconds = 0, - HitEntity = hitEnt, - OwnerEntity = owner, - Direction = direction, - VoxelExplosionCenter = sphere.Center, - ExplosionFlags = eFlags, - VoxelCutoutScale = 0.3f, - PlaySound = false, - ApplyForceAndDamage = true, - KeepAffectedBlocks = true, - CreateParticleEffect = false, - }; - if (hitEnt?.Physics != null) - explosionInfo.Velocity = hitEnt.Physics.LinearVelocity; - MyExplosions.AddExplosion(ref explosionInfo); - } - public static void GetBlockOrientedBoundingBox(MyCubeBlock block, out MyOrientedBoundingBoxD blockBox) { var quat = Quaternion.CreateFromRotationMatrix(block.PositionComp.WorldMatrixRef); diff --git a/Data/Scripts/CoreSystems/Support/Utils.cs b/Data/Scripts/CoreSystems/Support/Utils.cs index 252fe024..fa864d5d 100644 --- a/Data/Scripts/CoreSystems/Support/Utils.cs +++ b/Data/Scripts/CoreSystems/Support/Utils.cs @@ -1,15 +1,21 @@ using System; -using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using VRage; using VRage.Collections; -using VRage.Library.Threading; using VRageMath; namespace CoreSystems.Support { + internal static class ConcurrentQueueExtensions + { + public static void Clear(this ConcurrentQueue queue) + { + T item; + while (queue.TryDequeue(out item)) { } + } + } public class JerkRunningAverage { @@ -139,54 +145,6 @@ public bool NextBoolean() return (_buffer & 0xF000000000000000) == 0; } - /// - /// Generates a pseudorandom byte. - /// - /// - /// A pseudorandom byte. - /// - - public byte NextByte() - { - if (_bufferMask >= 8) - { - byte _ = (byte)_buffer; - _buffer >>= 8; - _bufferMask >>= 8; - return _; - } - - var tempX = _y; - _x ^= _x << 23; var tempY = _x ^ _y ^ (_x >> 17) ^ (_y >> 26); - - _buffer = tempY + _y; - _x = tempX; - _y = tempY; - - _bufferMask = 0x8000000000000; - return (byte)(_buffer >>= 8); - } - - /// - /// Generates a pseudorandom 16-bit signed integer. - /// - /// - /// A pseudorandom 16-bit signed integer. - /// - - public short NextInt16() - { - var tempX = _y; - _x ^= _x << 23; var tempY = _x ^ _y ^ (_x >> 17) ^ (_y >> 26); - - var _ = (short)(tempY + _y); - - _x = tempX; - _y = tempY; - - return _; - } - /// /// Generates a pseudorandom 16-bit unsigned integer. /// @@ -206,63 +164,6 @@ public ushort NextUInt16() return _; } - /// - /// Generates a pseudorandom 32-bit signed integer. - /// - /// - /// A pseudorandom 32-bit signed integer. - /// - public int NextInt32() - { - var tempX = _y; - _x ^= _x << 23; var tempY = _x ^ _y ^ (_x >> 17) ^ (_y >> 26); - - var _ = (int)(tempY + _y); - - _x = tempX; - _y = tempY; - - return _; - } - - /// - /// Generates a pseudorandom 32-bit unsigned integer. - /// - /// - /// A pseudorandom 32-bit unsigned integer. - /// - public uint NextUInt32() - { - var tempX = _y; - _x ^= _x << 23; var tempY = _x ^ _y ^ (_x >> 17) ^ (_y >> 26); - - var _ = (uint)(tempY + _y); - - _x = tempX; - _y = tempY; - - return _; - } - - /// - /// Generates a pseudorandom 64-bit signed integer. - /// - /// - /// A pseudorandom 64-bit signed integer. - /// - public long NextInt64() - { - var tempX = _y; - _x ^= _x << 23; var tempY = _x ^ _y ^ (_x >> 17) ^ (_y >> 26); - - var _ = (long)(tempY + _y); - - _x = tempX; - _y = tempY; - - return _; - } - /// /// Generates a pseudorandom 64-bit unsigned integer. /// @@ -303,36 +204,6 @@ public double NextDouble() return _; } - /// - /// Generates a pseudorandom decimal between - /// 0 and 1 non-inclusive. - /// - /// - /// A pseudorandom decimal. - /// - public decimal NextDecimal() - { - var tempX = _y; - _x ^= _x << 23; var tempY = _x ^ _y ^ (_x >> 17) ^ (_y >> 26); - - var tempZ = tempY + _y; - - var h = (int)(tempZ & 0x1FFFFFFF); - var m = (int)(tempZ >> 16); - var l = (int)(tempZ >> 32); - - var _ = new decimal(l, m, h, false, 28); - - _x = tempX; - _y = tempY; - - return _; - } - - public ulong Range(ulong aMin, ulong aMax) - { - return aMin + NextUInt64() % (aMax - aMin); - } public int Range(int aMin, int aMax) { var rndInt = (int)NextUInt64(); @@ -376,14 +247,6 @@ public ulong FairRange(ulong aRange) v = NextUInt64(); return v % aRange; } - public ulong FairRange(ulong aMin, ulong aMax) - { - return aMin + FairRange(aMax - aMin); - } - public Vector3D Vector(double radius) - { - return new Vector3D(Range(-radius, radius), Range(-radius, radius), Range(-radius, radius)); - } } public class XorShiftRandom { @@ -416,913 +279,108 @@ public XorShiftRandom(ulong seed) var tempX = Y; X ^= X << 23; var tempY = X ^ Y ^ (X >> 17) ^ (Y >> 26); var newSeed = tempY + Y; X = tempX; Y = tempY; X = newSeed << 3; Y = newSeed >> 3; } + } - /// - /// Reinits existing Random class - /// with the supplied seed. - /// - /// - /// The seed value. - /// - public void Reinit(ulong seed) + internal class RunningAverage + { + private readonly int _size; + private readonly int[] _values; + private int _valuesIndex; + private int _valueCount; + private int _sum; + + internal RunningAverage(int size) { - X = seed << 3; Y = seed >> 3; - Buffer = 0; - BufferMask = 0; + _size = Math.Max(size, 1); + _values = new int[_size]; + } - // - // random isn't very random unless we do the below.... likely because hashes produce incrementing numbers for Int3 conversions. - // + internal int Add(int newValue) + { + // calculate new value to add to sum by subtracting the + // value that is replaced from the new value; + var temp = newValue - _values[_valuesIndex]; + _values[_valuesIndex] = newValue; + _sum += temp; - var temp1 = Y; X ^= X << 23; var temp2 = X ^ Y ^ (X >> 17) ^ (Y >> 26); X = temp1; Y = temp2; + _valuesIndex++; + _valuesIndex %= _size; - var tempX = Y; X ^= X << 23; var tempY = X ^ Y ^ (X >> 17) ^ (Y >> 26); var newSeed = tempY + Y; X = tempX; Y = tempY; + if (_valueCount < _size) + _valueCount++; - X = newSeed << 3; Y = newSeed >> 3; + return _sum / _valueCount; } + } - public MyTuple GetSeedVaues() - { - return new MyTuple(X, Y); - } + public class NetworkReporter + { + public Dictionary> ReportData = new Dictionary>(); + public readonly MyConcurrentPool ReportPool = new MyConcurrentPool(3600, reprot => reprot.Clean()); - public void SyncSeed(ulong x, ulong y) + public NetworkReporter() { - X = x; - Y = y; + foreach (var suit in (PacketType[])Enum.GetValues(typeof(PacketType))) + ReportData.Add(suit, new List()); } - /// - /// Generates a pseudorandom boolean. - /// - /// - /// A pseudorandom boolean. - /// - public bool NextBoolean() + public class Report { - if (BufferMask > 0) + public enum Received { - var _ = (Buffer & BufferMask) == 0; - BufferMask >>= 1; - return _; + None, + Server, + Client } - var tempX = Y; - X ^= X << 23; var tempY = X ^ Y ^ (X >> 17) ^ (Y >> 26); - - Buffer = tempY + Y; - X = tempX; - Y = tempY; - - BufferMask = 0x8000000000000000; - return (Buffer & 0xF000000000000000) == 0; - } - - /// - /// Generates a pseudorandom byte. - /// - /// - /// A pseudorandom byte. - /// + public Received Receiver; + public bool PacketValid; + public int PacketSize; - public byte NextByte() - { - if (BufferMask >= 8) + public void Clean() { - byte _ = (byte)Buffer; - Buffer >>= 8; - BufferMask >>= 8; - return _; + Receiver = Received.None; + PacketValid = false; + PacketSize = 0; } - - var tempX = Y; - X ^= X << 23; var tempY = X ^ Y ^ (X >> 17) ^ (Y >> 26); - - Buffer = tempY + Y; - X = tempX; - Y = tempY; - - BufferMask = 0x8000000000000; - return (byte)(Buffer >>= 8); } + } - /// - /// Generates a pseudorandom 16-bit signed integer. - /// - /// - /// A pseudorandom 16-bit signed integer. - /// + internal class StallReporter + { + private readonly Stopwatch _watch = new Stopwatch(); + internal string Name; + internal double MaxMs; - public short NextInt16() + public void Start(string name, double maxMs) { - var tempX = Y; - X ^= X << 23; var tempY = X ^ Y ^ (X >> 17) ^ (Y >> 26); - - var _ = (short)(tempY + Y); - - X = tempX; - Y = tempY; - - return _; + Name = name; + MaxMs = maxMs; + _watch.Restart(); } - /// - /// Generates a pseudorandom 16-bit unsigned integer. - /// - /// - /// A pseudorandom 16-bit unsigned integer. - /// - public ushort NextUInt16() + public void End() { - var tempX = Y; - X ^= X << 23; var tempY = X ^ Y ^ (X >> 17) ^ (Y >> 26); - - var _ = (ushort)(tempY + Y); - - X = tempX; - Y = tempY; - - return _; + _watch.Stop(); + var ticks = _watch.ElapsedTicks; + var ns = 1000000000.0 * ticks / Stopwatch.Frequency; + var ms = ns / 1000000.0; + if (ms > MaxMs) + { + var message = $"[Warning] {ms} milisecond delay detected in {Name}: "; + Log.LineShortDate(message, "perf"); + } } + } - /// - /// Generates a pseudorandom 32-bit signed integer. - /// - /// - /// A pseudorandom 32-bit signed integer. - /// - public int NextInt32() + internal class DSUtils + { + internal struct Results { - var tempX = Y; - X ^= X << 23; var tempY = X ^ Y ^ (X >> 17) ^ (Y >> 26); - - var _ = (int)(tempY + Y); - - X = tempX; - Y = tempY; - - return _; - } - - /// - /// Generates a pseudorandom 32-bit unsigned integer. - /// - /// - /// A pseudorandom 32-bit unsigned integer. - /// - public uint NextUInt32() - { - var tempX = Y; - X ^= X << 23; var tempY = X ^ Y ^ (X >> 17) ^ (Y >> 26); - - var _ = (uint)(tempY + Y); - - X = tempX; - Y = tempY; - - return _; - } - - /// - /// Generates a pseudorandom 64-bit signed integer. - /// - /// - /// A pseudorandom 64-bit signed integer. - /// - public long NextInt64() - { - var tempX = Y; - X ^= X << 23; var tempY = X ^ Y ^ (X >> 17) ^ (Y >> 26); - - var _ = (long)(tempY + Y); - - X = tempX; - Y = tempY; - - return _; - } - - /// - /// Generates a pseudorandom 64-bit unsigned integer. - /// - /// - /// A pseudorandom 64-bit unsigned integer. - /// - public ulong NextUInt64() - { - var tempX = Y; - X ^= X << 23; var tempY = X ^ Y ^ (X >> 17) ^ (Y >> 26); - - var _ = tempY + Y; - - X = tempX; - Y = tempY; - - return _; - } - - /// - /// Generates a pseudorandom double between - /// 0 and 1 non-inclusive. - /// - /// - /// A pseudorandom double. - /// - public double NextDouble() - { - var tempX = Y; - X ^= X << 23; var tempY = X ^ Y ^ (X >> 17) ^ (Y >> 26); - - var tempZ = tempY + Y; - var _ = DoubleUnit * (0x7FFFFFFF & tempZ); - - X = tempX; - Y = tempY; - - return _; - } - - /// - /// Generates a pseudorandom decimal between - /// 0 and 1 non-inclusive. - /// - /// - /// A pseudorandom decimal. - /// - public decimal NextDecimal() - { - var tempX = Y; - X ^= X << 23; var tempY = X ^ Y ^ (X >> 17) ^ (Y >> 26); - - var tempZ = tempY + Y; - - var h = (int)(tempZ & 0x1FFFFFFF); - var m = (int)(tempZ >> 16); - var l = (int)(tempZ >> 32); - - var _ = new decimal(l, m, h, false, 28); - - X = tempX; - Y = tempY; - - return _; - } - - public ulong Range(ulong aMin, ulong aMax) - { - return aMin + NextUInt64() % (aMax - aMin); - } - public int Range(int aMin, int aMax) - { - var rndInt = (int)NextUInt64(); - var value = aMin + rndInt % (aMax - aMin); - - if (value < aMin || value > aMax) - value *= -1; - - return value; - } - - public double Range(double aMin, double aMax) - { - var value = aMin + NextDouble() * (aMax - aMin); - if (value < aMin || value > aMax) - value *= -1; - - return value; - } - - public float Range(float aMin, float aMax) - { - var value = aMin + NextDouble() * (aMax - aMin); - if (value < aMin || value > aMax) - value *= -1; - - return (float)value; - } - - // corrects bit alignment which might shift the probability slightly to the - // lower numbers based on the choosen range. - public ulong FairRange(ulong aRange) - { - ulong dif = ulong.MaxValue % aRange; - // if aligned or range too big, just pick a number - if (dif == 0 || ulong.MaxValue / (aRange / 4UL) < 2UL) - return NextUInt64() % aRange; - ulong v = NextUInt64(); - // avoid the last incomplete set - while (ulong.MaxValue - v < dif) - v = NextUInt64(); - return v % aRange; - } - public ulong FairRange(ulong aMin, ulong aMax) - { - return aMin + FairRange(aMax - aMin); - } - public Vector3D Vector(double radius) - { - return new Vector3D(Range(-radius, radius), Range(-radius, radius), Range(-radius, radius)); - } - } - - internal class RunningAverage - { - private readonly int _size; - private readonly int[] _values; - private int _valuesIndex; - private int _valueCount; - private int _sum; - - internal RunningAverage(int size) - { - _size = Math.Max(size, 1); - _values = new int[_size]; - } - - internal int Add(int newValue) - { - // calculate new value to add to sum by subtracting the - // value that is replaced from the new value; - var temp = newValue - _values[_valuesIndex]; - _values[_valuesIndex] = newValue; - _sum += temp; - - _valuesIndex++; - _valuesIndex %= _size; - - if (_valueCount < _size) - _valueCount++; - - return _sum / _valueCount; - } - } - - internal static class ConcurrentQueueExtensions - { - public static void Clear(this ConcurrentQueue queue) - { - T item; - while (queue.TryDequeue(out item)) { } - } - } - - class FiniteFifoQueueSet - { - private readonly T1[] _nodes; - private readonly Dictionary _backingDict; - private int _nextSlotToEvict; - - public FiniteFifoQueueSet(int size) - { - _nodes = new T1[size]; - _backingDict = new Dictionary(size + 1); - _nextSlotToEvict = 0; - } - - public void Enqueue(T1 key, T2 value) - { - try - { - _backingDict.Remove(_nodes[_nextSlotToEvict]); - _nodes[_nextSlotToEvict] = key; - _backingDict.Add(key, value); - - _nextSlotToEvict++; - if (_nextSlotToEvict >= _nodes.Length) _nextSlotToEvict = 0; - } - catch (Exception ex) { Log.Line($"Exception in Enqueue: {ex}"); } - } - - public bool Contains(T1 value) - { - return _backingDict.ContainsKey(value); - } - - public bool TryGet(T1 value, out T2 hostileEnt) - { - return _backingDict.TryGetValue(value, out hostileEnt); - } - } - - public class NetworkReporter - { - public Dictionary> ReportData = new Dictionary>(); - public readonly MyConcurrentPool ReportPool = new MyConcurrentPool(3600, reprot => reprot.Clean()); - - public NetworkReporter() - { - foreach (var suit in (PacketType[])Enum.GetValues(typeof(PacketType))) - ReportData.Add(suit, new List()); - } - - public class Report - { - public enum Received - { - None, - Server, - Client - } - - public Received Receiver; - public bool PacketValid; - public int PacketSize; - - public void Clean() - { - Receiver = Received.None; - PacketValid = false; - PacketSize = 0; - } - } - } - - public class DsUniqueListFastRemove - { - private List _list; - private Dictionary _dictionary; - - public DsUniqueListFastRemove(int capacity) - { - _list = new List(capacity); - _dictionary = new Dictionary(capacity); - } - - public DsUniqueListFastRemove() - { - _list = new List(); - _dictionary = new Dictionary(); - } - - /// O(1) - public int Count - { - get - { - return _list.Count; - } - } - - /// O(1) - public T this[int index] - { - get - { - return _list[index]; - } - } - - /// O(1) - public bool Add(T item) - { - if (_dictionary.ContainsKey(item)) - return false; - _list.Add(item); - _dictionary.Add(item, _list.Count - 1); - return true; - } - - /// O(1) - public bool Remove(T item) - { - int oldPos; - if (_dictionary.TryGetValue(item, out oldPos)) - { - - _dictionary.Remove(item); - _list.RemoveAtFast(oldPos); - var count = _list.Count; - if (count > 0) - { - count--; - if (oldPos <= count) - _dictionary[_list[oldPos]] = oldPos; - else - _dictionary[_list[count]] = count; - } - - return true; - } - return false; - } - - public void Clear() - { - _list.Clear(); - _dictionary.Clear(); - } - - /// O(1) - public bool Contains(T item) - { - return _dictionary.ContainsKey(item); - } - - public UniqueListReader Items - { - get - { - return new UniqueListReader(); - } - } - - public List ItemList - { - get - { - return new List(_list); - } - } - - public List.Enumerator GetEnumerator() - { - return _list.GetEnumerator(); - } - } - - public class DsUniqueConcurrentListFastRemove - { - private MyConcurrentList _list = new MyConcurrentList(); - private ConcurrentDictionary _dictionary = new ConcurrentDictionary(); - - /// O(1) - public int Count - { - get - { - return _list.Count; - } - } - - /// O(1) - public T this[int index] - { - get - { - return _list[index]; - } - } - - /// O(1) - public bool Add(T item) - { - if (_dictionary.ContainsKey(item)) - return false; - _list.Add(item); - - return _dictionary.TryAdd(item, _list.Count - 1); - - } - - /// O(1) - public bool Remove(T item) - { - int oldPos; - if (_dictionary.TryGetValue(item, out oldPos)) - { - - _dictionary.Remove(item); - _list.RemoveAtFast(oldPos); - var count = _list.Count; - if (count > 0) - { - count--; - if (oldPos <= count) - _dictionary[_list[oldPos]] = oldPos; - else - _dictionary[_list[count]] = count; - } - - return true; - } - return false; - } - - public void Clear() - { - _list.Clear(); - _dictionary.Clear(); - } - - /// O(1) - public bool Contains(T item) - { - return _dictionary.ContainsKey(item); - } - - public UniqueListReader Items - { - get - { - return new UniqueListReader(); - } - } - - public ListReader ItemList - { - get - { - return new ListReader(new List(_list)); - } - } - - public Object GetEnumerator() - { - return _list.GetEnumerator(); - } - } - - public class DsUniqueList - { - private List _list = new List(); - private HashSet _hashSet = new HashSet(); - - /// O(1) - public int Count - { - get - { - return _list.Count; - } - } - - /// O(1) - public T this[int index] - { - get - { - return _list[index]; - } - } - - /// O(1) - public bool Add(T item) - { - if (!_hashSet.Add(item)) - return false; - _list.Add(item); - return true; - } - - /// O(n) - public bool Insert(int index, T item) - { - if (_hashSet.Add(item)) - { - _list.Insert(index, item); - return true; - } - _list.Remove(item); - _list.Insert(index, item); - return false; - } - - /// O(n) - public bool Remove(T item) - { - if (!_hashSet.Remove(item)) - return false; - _list.Remove(item); - return true; - } - - public void Clear() - { - _list.Clear(); - _hashSet.Clear(); - } - - /// O(1) - public bool Contains(T item) - { - return _hashSet.Contains(item); - } - - public UniqueListReader Items - { - get - { - return new UniqueListReader(); - } - } - - public ListReader ItemList - { - get - { - return new ListReader(_list); - } - } - - public List.Enumerator GetEnumerator() - { - return _list.GetEnumerator(); - } - } - - public class ConcurrentUniqueQueue : IEnumerable - { - private readonly MyConcurrentHashSet _hashSet; - private readonly ConcurrentQueue _queue; - private SpinLockRef _lock = new SpinLockRef(); - - public ConcurrentUniqueQueue() - { - _hashSet = new MyConcurrentHashSet(); - _queue = new ConcurrentQueue(); - } - - - public int Count - { - get - { - return _hashSet.Count; - } - } - - public void Clear() - { - _hashSet.Clear(); - _queue.Clear(); - } - - - public bool Contains(T item) - { - return _hashSet.Contains(item); - } - - - public void Enqueue(T item) - { - if (_hashSet.Add(item)) - { - _queue.Enqueue(item); - } - } - - public T Dequeue() - { - T item; - _queue.TryDequeue(out item); - _hashSet.Remove(item); - return item; - } - - - public T Peek() - { - T result; - _queue.TryPeek(out result); - return result; - } - - - public IEnumerator GetEnumerator() - { - return _queue.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return _queue.GetEnumerator(); - } - } - - public class DsConcurrentUniqueList - { - private List _list = new List(); - private HashSet _hashSet = new HashSet(); - private SpinLockRef _lock = new SpinLockRef(); - - /// O(1) - public int Count - { - get - { - return _list.Count; - } - } - - /// O(1) - public T this[int index] - { - get - { - return _list[index]; - } - } - - /// O(1) - public bool Add(T item) - { - using (_lock.Acquire()) - { - if (!_hashSet.Add(item)) - return false; - _list.Add(item); - return true; - } - } - - /// O(n) - public bool Insert(int index, T item) - { - using (_lock.Acquire()) - { - if (_hashSet.Add(item)) - { - _list.Insert(index, item); - return true; - } - _list.Remove(item); - _list.Insert(index, item); - return false; - } - } - - /// O(n) - public bool Remove(T item) - { - using (_lock.Acquire()) - { - if (!_hashSet.Remove(item)) - return false; - _list.Remove(item); - return true; - } - } - - public void Clear() - { - _list.Clear(); - _hashSet.Clear(); - } - - /// O(1) - public bool Contains(T item) - { - return _hashSet.Contains(item); - } - - public UniqueListReader Items - { - get - { - return new UniqueListReader(); - } - } - - public ListReader ItemList - { - get - { - return new ListReader(_list); - } - } - - public List.Enumerator GetEnumerator() - { - return _list.GetEnumerator(); - } - } - - internal class StallReporter - { - private readonly Stopwatch _watch = new Stopwatch(); - internal string Name; - internal double MaxMs; - - public void Start(string name, double maxMs) - { - Name = name; - MaxMs = maxMs; - _watch.Restart(); - } - - public void End() - { - _watch.Stop(); - var ticks = _watch.ElapsedTicks; - var ns = 1000000000.0 * ticks / Stopwatch.Frequency; - var ms = ns / 1000000.0; - if (ms > MaxMs) - { - var message = $"[Warning] {ms} milisecond delay detected in {Name}: "; - Log.LineShortDate(message, "perf"); - } - } - } - - internal class DSUtils - { - internal struct Results - { - public double Min; - public double Max; - public double Median; - public uint MaxTick; + public double Min; + public double Max; + public double Median; + public uint MaxTick; } internal class Timings @@ -1443,71 +501,4 @@ public void Complete(string name, bool store, bool display = false) } } } - - public class UniqueQueue : IEnumerable - { - private HashSet hashSet; - private Queue queue; - - - public UniqueQueue() - { - hashSet = new HashSet(); - queue = new Queue(); - } - - - public int Count - { - get - { - return hashSet.Count; - } - } - - public void Clear() - { - hashSet.Clear(); - queue.Clear(); - } - - - public bool Contains(T item) - { - return hashSet.Contains(item); - } - - - public void Enqueue(T item) - { - if (hashSet.Add(item)) - { - queue.Enqueue(item); - } - } - - public T Dequeue() - { - T item = queue.Dequeue(); - hashSet.Remove(item); - return item; - } - - - public T Peek() - { - return queue.Peek(); - } - - - public IEnumerator GetEnumerator() - { - return queue.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return queue.GetEnumerator(); - } - } } diff --git a/Data/Scripts/CoreSystems/Support/VersionControl.cs b/Data/Scripts/CoreSystems/Support/VersionControl.cs index cec10a7c..d4b346e1 100644 --- a/Data/Scripts/CoreSystems/Support/VersionControl.cs +++ b/Data/Scripts/CoreSystems/Support/VersionControl.cs @@ -6,8 +6,6 @@ using CoreSystems.Settings; using CoreSystems.Support; using Sandbox.ModAPI; -using VRage.Utils; -using static VRage.Game.MyObjectBuilder_SessionComponentMission; namespace WeaponCore.Data.Scripts.CoreSystems.Support { diff --git a/Data/Scripts/CoreSystems/Ui/Hud/HudDraw.cs b/Data/Scripts/CoreSystems/Ui/Hud/HudDraw.cs index 2d16fb38..1330ca70 100644 --- a/Data/Scripts/CoreSystems/Ui/Hud/HudDraw.cs +++ b/Data/Scripts/CoreSystems/Ui/Hud/HudDraw.cs @@ -1,13 +1,9 @@ using CoreSystems; using CoreSystems.Platform; using CoreSystems.Support; -using System.Runtime.CompilerServices; -using Sandbox.ModAPI; using VRage.Game; using VRage.Utils; using VRageMath; -using WeaponCore.Data.Scripts.CoreSystems.Ui.Targeting; -using static VRage.Game.ObjectBuilders.Definitions.MyObjectBuilder_GameDefinition; namespace WeaponCore.Data.Scripts.CoreSystems.Ui.Hud { @@ -228,10 +224,15 @@ private void BackgroundAdd(Vector2D currWeaponDisplayPos, double bgStartPosX) _textureAddList.Add(backgroundTexture); } - public const string EmptyStr = ""; - public const string NoAmmoStr = ": No Ammo"; - public const string NoTargetStr = ": No Target"; - public const string NoSubSystemStr = ": No Subsystem"; + public const string NoAmmoStr = ": No Ammo"; + public const string NoSubSystemStr = ": No Subsys"; + public const string RotatingStr = ": Rotating"; + public const string NotInRangeStr = ": Too Far"; + public const string NoLOSStr = ": No LOS"; + public const string InsideMinRangeStr = ": Too Close"; + public const string NoTargetSetStr = ": Pick Targ"; + public const string FakeOnTarg = ": Aligned"; + public const string FakeCannotHit = ": Cannot hit"; private void WeaponsToAdd(bool reset, Vector2D currWeaponDisplayPos, double bgStartPosX) { @@ -250,31 +251,43 @@ private void WeaponsToAdd(bool reset, Vector2D currWeaponDisplayPos, double bgSt var notAnyBlock = comp.MasterOverrides.SubSystem != WeaponDefinition.TargetingDef.BlockTypes.Any; var needsTarget = (!weapon.Target.HasTarget || Session.I.Tick - weapon.Target.ChangeTick <= 30) && comp.MasterOverrides.Grids && (comp.DetectOtherSignals && comp.MasterAi.DetectionInfo.OtherInRange || comp.MasterAi.DetectionInfo.PriorityInRange) && report && comp.Data.Repo.Values.Set.ReportTarget && delayNoTarget && comp.MasterAi.DetectionInfo.TargetInRange(weapon); var showReloadIcon = (weapon.Loading || weapon.Reload.WaitForClient || s.Tick - weapon.LastLoadedTick < 60); - - string noTagetReason; - var needNameUpdate = weapon.LastFriendlyNameTick == 0 || s.Tick - weapon.LastFriendlyNameTick > 600; + var displayText = weapon.FriendlyName; + if (weapon.LastFriendlyNameTick == 0 || s.Tick - weapon.LastFriendlyNameTick > 600) + weapon.UpdateAndGetFriendlyName(); if (needsTarget) { + var di = comp.MasterAi.DetectionInfo; + var notManual = comp.MasterOverrides.Control != ProtoWeaponOverrides.ControlModes.Manual; + var inRange = weapon.MaxTargetDistanceSqr > 0 && ((di.OtherRangeSqr == double.MaxValue ? false : di.OtherRangeSqr < weapon.MaxTargetDistanceSqr) || (di.PriorityRangeSqr == double.MaxValue ? false : di.PriorityRangeSqr < weapon.MaxTargetDistanceSqr)); if (weapon.OutOfAmmo && !showReloadIcon) - noTagetReason = needNameUpdate ? weapon.UpdateAndGetFriendlyName(Weapon.FriendlyNames.NoAmmo) : weapon.FriendlyNameNoAmmo; - + displayText += NoAmmoStr; + else if (notManual && (weapon.Target.CurrentState == Target.States.NotSet || weapon.Target.CurrentState == Target.States.Expired)) + displayText += NoTargetSetStr; else if (comp.MasterOverrides.FocusSubSystem && !showReloadIcon && notAnyBlock && weapon.FoundTopMostTarget) - noTagetReason = needNameUpdate ? weapon.UpdateAndGetFriendlyName(Weapon.FriendlyNames.NoSubSystems) : weapon.FriendlyNameNoSubsystem; - - else - noTagetReason = needNameUpdate ? weapon.UpdateAndGetFriendlyName(Weapon.FriendlyNames.NoTarget) : weapon.FriendlyNameNoTarget; + displayText += NoSubSystemStr; + else if (weapon.MinTargetDistanceSqr > 0 && (di.OtherRangeSqr < weapon.MinTargetDistanceSqr || di.PriorityRangeSqr < weapon.MinTargetDistanceSqr)) + displayText += InsideMinRangeStr; + else if (!weapon.Target.HasTarget && (weapon.PauseShoot || (notManual && inRange))) + displayText += NoLOSStr; + else if (notManual && !inRange) + displayText += NotInRangeStr; } - else + else if (weapon.Comp.HasTurret && !weapon.Target.IsAligned && weapon.Target.ValidEstimate) + displayText += RotatingStr; + else if (weapon.Comp.HasTurret && weapon.Target.CurrentState == Target.States.Fake) { - noTagetReason = needNameUpdate ? weapon.UpdateAndGetFriendlyName(Weapon.FriendlyNames.Normal) : weapon.FriendlyName; + if (weapon.Target.IsAligned) + displayText += FakeOnTarg; + else if (!weapon.Target.ValidEstimate) + displayText += FakeCannotHit; } - var textOffset = bgStartPosX - _bgWidth + _reloadWidth + _padding; + var textOffset = bgStartPosX - _bgWidth + _reloadWidth + _padding; var hasHeat = weapon.HeatPerc > 0; var textInfo = _textDrawPool.Count > 0 ? _textDrawPool.Dequeue() : new TextDrawRequest(); - textInfo.Text = noTagetReason; + textInfo.Text = displayText; var color = new Vector4(1, 1, 1, 1); textInfo.Color = color; textInfo.Position.X = textOffset; @@ -289,7 +302,7 @@ private void WeaponsToAdd(bool reset, Vector2D currWeaponDisplayPos, double bgSt textInfo.Text = $"(x{stackedInfo.WeaponStack})"; textInfo.Color = new Vector4(0.5f, 0.5f, 1, 1); - textInfo.Position.X = textOffset + (noTagetReason.Length * ((_textSize * s.AspectRatioInv) * 0.6f) * ShadowSizeScaler); + textInfo.Position.X = textOffset + (displayText.Length * ((_textSize * s.AspectRatioInv) * 0.6f) * ShadowSizeScaler); textInfo.Position.Y = currWeaponDisplayPos.Y; textInfo.FontSize = _sTextSize; diff --git a/Data/Scripts/CoreSystems/Ui/Hud/HudFields.cs b/Data/Scripts/CoreSystems/Ui/Hud/HudFields.cs index f6eab3c0..91d1fa76 100644 --- a/Data/Scripts/CoreSystems/Ui/Hud/HudFields.cs +++ b/Data/Scripts/CoreSystems/Ui/Hud/HudFields.cs @@ -1,6 +1,5 @@ using System.Collections.Concurrent; using System.Collections.Generic; -using CoreSystems; using CoreSystems.Platform; using VRage.Collections; using VRage.Utils; @@ -13,7 +12,7 @@ partial class Hud { private const float MetersInPixel = 0.0002645833f; private const float PaddingConst = 10 * MetersInPixel; - private const float WeaponHudFontSize = 8f; + private const float WeaponHudFontSize = 7f; private const float WeaponHudFontHeight = WeaponHudFontSize * MetersInPixel; private const float ReloadHeightConst = 4f * MetersInPixel; private const float ReloadWidthConst = ReloadHeightConst; diff --git a/Data/Scripts/CoreSystems/Ui/Hud/HudSupport.cs b/Data/Scripts/CoreSystems/Ui/Hud/HudSupport.cs index 4e2ea693..8d64eb11 100644 --- a/Data/Scripts/CoreSystems/Ui/Hud/HudSupport.cs +++ b/Data/Scripts/CoreSystems/Ui/Hud/HudSupport.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using CoreSystems; using CoreSystems.Platform; using CoreSystems.Support; diff --git a/Data/Scripts/CoreSystems/Ui/Hud/HudText.cs b/Data/Scripts/CoreSystems/Ui/Hud/HudText.cs index e4e42ba3..92621353 100644 --- a/Data/Scripts/CoreSystems/Ui/Hud/HudText.cs +++ b/Data/Scripts/CoreSystems/Ui/Hud/HudText.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CoreSystems; -using CoreSystems.Support; using VRage.Game; using VRage.Utils; using VRageMath; diff --git a/Data/Scripts/CoreSystems/Ui/Targeting/TargetUiDraw.cs b/Data/Scripts/CoreSystems/Ui/Targeting/TargetUiDraw.cs index be816035..82be7162 100644 --- a/Data/Scripts/CoreSystems/Ui/Targeting/TargetUiDraw.cs +++ b/Data/Scripts/CoreSystems/Ui/Targeting/TargetUiDraw.cs @@ -551,11 +551,12 @@ private bool CheckBlockWeaponEntityHit(MyEntity ent, ProInfo info) private void CheckHandWeaponEntityHit(ProInfo info) { + if (Session.I.TrackingAi != null && info.Weapon?.Comp?.Ai?.Construct?.RootAi != Session.I.TrackingAi) + return; foreach (var hitEnt in info.HitList) { - if (info.Weapon.Comp.Ai.Construct.RootAi != Session.I.TrackingAi || hitEnt.Entity is MyVoxelBase) + if (hitEnt.Entity is MyVoxelBase) continue; - HandHitIncrease = HandFullPulseSize - HandCircleSize; HandHitMarkerActive = true; return; diff --git a/Data/Scripts/CoreSystems/Ui/Targeting/TargetUiSelect.cs b/Data/Scripts/CoreSystems/Ui/Targeting/TargetUiSelect.cs index 9cdaedb0..3ff7ba0c 100644 --- a/Data/Scripts/CoreSystems/Ui/Targeting/TargetUiSelect.cs +++ b/Data/Scripts/CoreSystems/Ui/Targeting/TargetUiSelect.cs @@ -6,8 +6,6 @@ using VRage.Game.Entity; using VRage.Game.ModAPI; using VRage.ModAPI; -using VRage.Noise.Patterns; -using VRage.Utils; using VRageMath; using CollisionLayers = Sandbox.Engine.Physics.MyPhysics.CollisionLayers; @@ -145,7 +143,7 @@ internal bool SelectTarget(bool manualSelect = true, bool firstStage = false, bo var advanced = s.Settings.ClientConfig.AdvancedMode || s.UiInput.IronLock; MyEntity closestEnt = null; MyEntity rootEntity = null; - if (ai.MyPlanet != null && Session.I.Tick90 && s.UiInput.AltPressed) + if (ai.MyPlanet != null && s.UiInput.AltPressed && Session.I.Tick10) { var rayLine = new LineD(AimPosition, ai.MaxTargetingRange > s.PreFetchMaxDist ? AimPosition + AimDirection * s.PreFetchMaxDist : end); ai.MyPlanet.PrefetchShapeOnRay(ref rayLine); @@ -336,7 +334,7 @@ internal bool ActivateDroneNotice() internal bool ActivateMarks() { var s = Session.I; - var mark = s.TrackingAi.AiType != Ai.AiTypes.Phantom && s.ActiveMarks.Count > 0; + var mark = !s.Settings.Enforcement.ProhibitHUDPainter && s.TrackingAi.AiType != Ai.AiTypes.Phantom && s.ActiveMarks.Count > 0; var showAlert = mark && !(s.HudHandlers.Count > 0 && s.HudUi.RestrictHudHandlers(s.TrackingAi, s.PlayerId, Hud.Hud.HudMode.PainterMarks)); return showAlert; } diff --git a/Data/Scripts/CoreSystems/Ui/UiInput.cs b/Data/Scripts/CoreSystems/Ui/UiInput.cs index 6265fa9e..b5ca548d 100644 --- a/Data/Scripts/CoreSystems/Ui/UiInput.cs +++ b/Data/Scripts/CoreSystems/Ui/UiInput.cs @@ -1,11 +1,9 @@ -using System; -using CoreSystems; +using CoreSystems; using CoreSystems.Platform; using CoreSystems.Support; using Sandbox.ModAPI; using VRage.Input; using VRageMath; -using WeaponCore.Data.Scripts.CoreSystems.Ui.Hud; namespace WeaponCore.Data.Scripts.CoreSystems.Ui { @@ -301,6 +299,8 @@ internal void UpdateInputState() set.ClientConfig.MinimalHud = !set.ClientConfig.MinimalHud; set.ClientConfig.HideReload = false; } + s.ShowLocalNotify($"WC Top Hud: {(set.ClientConfig.MinimalHud ? "Minimal" : "Full")}", 2000, "Red", true); + s.ShowLocalNotify($"WC Right Info Panel: {(set.ClientConfig.HideReload ? "Off" : "On")}", 2000, "Red"); set.VersionControl.UpdateClientCfgFile(); } else if (!set.ClientConfig.AdvancedMode) diff --git a/README.md b/README.md index 8c9236b1..7afa1e16 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,3 @@ Modder documentation is currently in progress, and viewable on the [Wiki](https: Thanks to Ash for server override enhancements and quality of life work on v2. Thanks to CriegwareFare for his work on the block animations, heat mechanic and assisting with weapon reloading hud! Thanks to [NukeGuard](https://github.com/nukeguard) for the awesome GUI/HUD design and textures. Thanks to Derek for general bug fixing and weapon area placement limit feature. Special thanks to the math wizard himself [WhipLash141](https://github.com/Whiplash141) for all of his help with the mind bending math required to pull off the advanced target tracking and smart projectile guidance systems is this mod. - -# Patreon - -## If you appreciate WeaponCore please consider donating: - -[![](https://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Patreon_logo_with_wordmark.svg/512px-Patreon_logo_with_wordmark.svg.png)](https://www.patreon.com/user?u=14228932)