diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index 30181a2..7ac79d4 100644 Binary files a/1.6/1.6/Assemblies/ArachnaeSwarm.dll and b/1.6/1.6/Assemblies/ArachnaeSwarm.dll differ diff --git a/1.6/1.6/Defs/ThingDefs_Buildings/ThingDef_Building_CatastropheMissileSilo.xml b/1.6/1.6/Defs/ThingDefs_Buildings/ThingDef_Building_CatastropheMissileSilo.xml deleted file mode 100644 index 0919108..0000000 --- a/1.6/1.6/Defs/ThingDefs_Buildings/ThingDef_Building_CatastropheMissileSilo.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - CatastropheMissileSilo - - 一个多功能导弹发射平台。它装备的武器系统既可以作为自动炮塔进行本地防御,也可以在操作员的指引下,将“天灾”级巡航导弹发射到全球任何一个角落。 - ArachnaeSwarm.Building_CatastropheMissileSilo - MapMeshAndRealTime - - Things/Building/Security/TurretHeavy_Base - Graphic_Single - (3, 3) - (0,0,-0.1) - - (0.2,0.2,0.6,0.6) - - - (1.5,0.35,1.4) - (0,0,-0.05) - - - (2,2) - Building - PassThroughOnly - 50 - 0.5 - false - - 500 - 12000 - 800 - -20 - - Normal - -
  • - 导弹 - 导弹 - 缺少导弹 - - -
  • ComponentSpacer
  • - - - 10 - 0 - 1 - true - true - -
  • -
  • -
  • - - - CatastropheMissile_Weapon - 5.0 - -
  • Artillery
  • - - - ARA_Buildings - 8 - -
  • ShipbuildingBasics
  • -
    -
    - -
    \ No newline at end of file diff --git a/1.6/1.6/Defs/ThingDefs_Misc/ThingDef_Projectile_CatastropheMissile.xml b/1.6/1.6/Defs/ThingDefs_Misc/ThingDef_Projectile_CatastropheMissile.xml deleted file mode 100644 index da4a71f..0000000 --- a/1.6/1.6/Defs/ThingDefs_Misc/ThingDef_Projectile_CatastropheMissile.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - Projectile_CatastropheMissile - - ArachnaeSwarm.Projectile_CruiseMissile - - Graphic_Single_AgeSecs - Things/Projectile/FleshmassSpitterProjectileSheet - (3,3) - MoteGlow - - - True - 1 - ARA_AcidBurn - 200 - 80 - 15 - true - Filth_SpentAcid - 4 - Shell_AcidSpitImpact - 60 - false - 5.9 - MortarBomb_Explode - - -
  • - ARA_AcidBurn - 150 - 5.9 - MortarBomb_Explode - true - 8 - 2.9 - 50 - 15 - ARA_AcidBurn - Mortar_Explode - 0.05 - 5 - 20 - 0.1 - 0.2 - 0.5 -
  • -
    - -
  • - Shell_AcidSpitStream -
  • -
  • - Shell_AcidSpitLaunched -
  • -
    -
    - - - Projectile_CatastropheMissile_Fake - - ArachnaeSwarm.Projectile_CruiseMissile - - Graphic_Single_AgeSecs - Things/Projectile/FleshmassSpitterProjectileSheet - (3,3) - MoteGlow - - - True - 1 - ARA_AcidBurn - 0 - 50 - 15 - true - - -
  • - true - false -
  • -
    - -
  • - Shell_AcidSpitStream -
  • -
  • - Shell_AcidSpitLaunched -
  • -
    -
    - - - CatastropheMissile_Weapon - - 天灾导弹的发射系统。 - Spacer - - Things/Building/Security/TurretMortar_Top - Graphic_Single - - - 5.0 - 50 - - -
  • - ArachnaeSwarm.Verb_LaunchCatastropheMissile - true - Projectile_CatastropheMissile - 3.0 - 1 - true - false - 29.9 - 1 - 500 - Shot_Autocannon - 16 - - true - -
  • -
    -
    - -
    \ No newline at end of file diff --git a/1.6/1.6/Defs/Thing_building/ARA_ThingDef_Building_CatastropheMissileSilo.xml b/1.6/1.6/Defs/Thing_building/ARA_ThingDef_Building_CatastropheMissileSilo.xml new file mode 100644 index 0000000..cd30468 --- /dev/null +++ b/1.6/1.6/Defs/Thing_building/ARA_ThingDef_Building_CatastropheMissileSilo.xml @@ -0,0 +1,244 @@ + + + + + CatastropheMissileSilo + + 一个多功能导弹发射平台。它装备的武器系统既可以作为自动炮塔进行本地防御,也可以在操作员的指引下,将“天灾”级巡航导弹发射到全球任何一个角落。 + ArachnaeSwarm.Building_CatastropheMissileSilo + MapMeshAndRealTime + + Things/Building/Security/TurretHeavy_Base + Graphic_Single + (3, 3) + (0,0,-0.1) + + (0.2,0.2,0.6,0.6) + + + (1.5,0.35,1.4) + (0,0,-0.05) + + + (2,2) + Building + PassThroughOnly + 50 + 0.5 + false + + 500 + 12000 + 800 + -20 + + Normal + +
  • + 导弹 + 导弹 + 缺少导弹 + + +
  • ComponentSpacer
  • + + + 10 + 0 + 1 + true + true + +
  • +
  • +
  • + + + CatastropheMissile_Weapon + 5.0 + +
  • Artillery
  • + + + ARA_Buildings + 8 + +
  • ShipbuildingBasics
  • +
    +
    + + + Projectile_CatastropheMissile + + ArachnaeSwarm.Projectile_CruiseMissile + + Graphic_Single_AgeSecs + Things/Projectile/FleshmassSpitterProjectileSheet + (3,3) + MoteGlow + + + True + 1 + ARA_AcidBurn + 150 + 80 + true + Filth_SpentAcid + 4 + ARA_Shell_AcidSpitImpact + 60 + false + 10.9 + MortarBomb_Explode + + +
  • + ARA_AcidBurn + 150 + 10.9 + MortarBomb_Explode + true + 8 + 2.9 + 50 + 15 + ARA_AcidBurn + MortarBomb_Explode + 0.01 + 1 + 5 + 0.05 + 0.05 + 1.5 +
  • +
    + +
  • + Shell_AcidSpitStream +
  • +
  • + Shell_AcidSpitLaunched +
  • +
    +
    + + + ARA_Shell_AcidSpitImpact + +
  • + SubEffecter_SprayerChance + Fleck_AcidSpitImpact + 1 + 5 + 1 + 2 + 8 + OnSource +
  • +
  • + SubEffecter_SprayerTriggered + Fleck_AcidSpitLaunchedMist + 20 + 3~6 + OnSource + false + 0~100 + 1 + -1~1 + 0 +
  • +
  • + SubEffecter_SprayerTriggered + Fleck_AcidSpitLaunchedGlobFast + 6~10 + OnSource + false + .7 + .7 + true + true + 0~100 + 2.5 + 20~45 + 0~360 +
  • +
    +
    + + + Projectile_CatastropheMissile_Fake + + ArachnaeSwarm.Projectile_CruiseMissile + + Graphic_Single_AgeSecs + Things/Projectile/FleshmassSpitterProjectileSheet + (3,3) + MoteGlow + + + True + 1 + ARA_AcidBurn + 0 + 80 + true + + +
  • + true + false + 0.01 + 1 + 5 + 0.05 + 0.05 + 1.5 +
  • +
    + +
  • + Shell_AcidSpitStream +
  • +
  • + Shell_AcidSpitLaunched +
  • +
    +
    + + + CatastropheMissile_Weapon + + 天灾导弹的发射系统。 + Spacer + + Things/Building/Security/TurretMortar_Top + Graphic_Single + + + 5.0 + 50 + + +
  • + Verb_Shoot + true + Projectile_CatastropheMissile + 1 + 3.0 + 1 + true + false + 10.9 + 1 + 500 + Shot_Autocannon + 16 + + true + +
  • +
    +
    + +
    \ No newline at end of file diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj index 4e1f258..541d774 100644 --- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj +++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj @@ -209,7 +209,6 @@ - diff --git a/Source/ArachnaeSwarm/Buildings/Building_CatastropheMissileSilo.cs b/Source/ArachnaeSwarm/Buildings/Building_CatastropheMissileSilo.cs index 0902cad..332f412 100644 --- a/Source/ArachnaeSwarm/Buildings/Building_CatastropheMissileSilo.cs +++ b/Source/ArachnaeSwarm/Buildings/Building_CatastropheMissileSilo.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; -using System.Reflection; using UnityEngine; using Verse; using Verse.AI; @@ -15,18 +14,12 @@ namespace ArachnaeSwarm [StaticConstructorOnStartup] public class Building_CatastropheMissileSilo : Building_TurretGun { - // Reflection to access the private 'holdFire' field in the base class, as there is no public accessor. - private static readonly FieldInfo holdFireField = - typeof(Building_TurretGun).GetField("holdFire", BindingFlags.NonPublic | BindingFlags.Instance); - public GlobalTargetInfo longTarget; public static readonly Texture2D FireMissionTex = ContentFinder.Get("UI/Commands/Attack", true); public override void SpawnSetup(Map map, bool respawningAfterLoad) { base.SpawnSetup(map, respawningAfterLoad); - // This is the definitive fix for the default target issue on spawn. - // It runs only once when the building is first created, not on game load. if (!respawningAfterLoad) { this.longTarget = GlobalTargetInfo.Invalid; @@ -41,49 +34,36 @@ namespace ArachnaeSwarm protected override void Tick() { - // Always run base.Tick() first. This handles all local targeting, aiming, warmup, - // cooldowns, and calling the Verb for local shots. This is the key to fixing the bug. + // Base tick handles all local targeting, cooldowns, and fuel consumption via XML. base.Tick(); - // --- Mutual Exclusivity: Prioritize Local Target --- - // If a local target is set (either by player or automatically), clear the remote target. + // If a local target is active, prevent remote targeting. if (this.forcedTarget.IsValid && this.longTarget.IsValid) { this.longTarget = GlobalTargetInfo.Invalid; } - - // --- Debug Logging (every 120 ticks, approx 2 seconds) --- - if (Find.TickManager.TicksGame % 120 == 0) - { - bool isHoldingFireForLog = (bool)holdFireField.GetValue(this); - string reason; - CanFireGlobal(out reason); // To get the reason string - Log.Message($"[Silo Debug] Tick: {Find.TickManager.TicksGame}\n" + - $"- Cooldown: {this.burstCooldownTicksLeft}\n" + - $"- Active (Power): {base.Active}\n" + - $"- HoldFire: {isHoldingFireForLog}\n" + - $"- CanFireGlobal (Fuel?): {CanFireGlobal(out reason)} (Reason: {reason})\n" + - $"- Local Target: {this.forcedTarget.ToString()}\n" + - $"- Remote Target: {this.longTarget.ToString()}"); - } - // --- Remote Firing Logic --- - bool isHoldingFire = (bool)holdFireField.GetValue(this); - if (this.longTarget.IsValid && !isHoldingFire && this.burstCooldownTicksLeft <= 0 && base.Active && CanFireGlobal(out _)) + // If a remote target is set and the turret is ready, fire. + // The base.Tick() cooldown handling prevents this from running if a local shot was just fired. + if (this.longTarget.IsValid && this.burstCooldownTicksLeft <= 0 && base.Active && CanFireGlobal(out _)) { - if (!this.forcedTarget.IsValid) - { - this.FireMission(this.longTarget); - } + this.FireMission(this.longTarget); } } public override string GetInspectString() { StringBuilder sb = new StringBuilder(base.GetInspectString()); + + if (burstCooldownTicksLeft > 0) + { + if (sb.Length > 0) sb.AppendLine(); + sb.Append("Cooldown".Translate() + ": " + this.burstCooldownTicksLeft.ToStringTicksToPeriod()); + } + if (this.longTarget.IsValid) { - sb.AppendLine(); + if (sb.Length > 0) sb.AppendLine(); sb.Append("RemoteTargetSet".Translate(this.longTarget.Label)); } return sb.ToString(); @@ -91,13 +71,11 @@ namespace ArachnaeSwarm public override IEnumerable GetGizmos() { - // Yield base gizmos first, which includes "Set forced target" and other standard buttons. foreach (var g in base.GetGizmos()) { yield return g; } - // Then add our custom "Global Strike" gizmo Command_Action fireGlobal = new Command_Action { defaultLabel = "CommandFireGlobal".Translate(), @@ -110,14 +88,12 @@ namespace ArachnaeSwarm { fireGlobal.Disable(reason); } - // Global Strike button is disabled if a forced target is already set, to ensure mutual exclusivity. if (this.forcedTarget.IsValid) { fireGlobal.Disable("LocalTargetForced".Translate()); } yield return fireGlobal; - // Add a specific button to clear the remote target if (this.longTarget.IsValid) { Command_Action clearRemote = new Command_Action @@ -147,7 +123,6 @@ namespace ArachnaeSwarm missile.Projectile = DefDatabase.GetNamed("Projectile_CatastropheMissile"); Find.WorldObjects.Add(missile); - // Rimatomics style: dummy projectile flies off-map in the direction the turret is facing. Vector3 shellDirection = Vector3.forward.RotatedBy(this.top.CurRotation); IntVec3 outcell = (this.DrawPos + shellDirection * 500f).ToIntVec3(); @@ -161,14 +136,13 @@ namespace ArachnaeSwarm } SoundDef.Named("RocketLaunch").PlayOneShot(new TargetInfo(this.Position, this.Map)); - // Manually reset cooldown. this.BurstComplete(); } private bool CanFireGlobal(out string reason) { var refuelableComp = this.TryGetComp(); - if (refuelableComp != null && !this.refuelableComp.HasFuel) + if (refuelableComp != null && !refuelableComp.HasFuel) { reason = "NoFuel".Translate().CapitalizeFirst(); return false; @@ -214,12 +188,11 @@ namespace ArachnaeSwarm Find.Targeter.BeginTargeting(new TargetingParameters { canTargetLocations = true, - canTargetPawns = true, // Allow targeting pawns - canTargetBuildings = true // Allow targeting buildings + canTargetPawns = true, + canTargetBuildings = true }, (LocalTargetInfo localTarget) => { - // Convert LocalTargetInfo to GlobalTargetInfo, handling Thing targets. if (localTarget.HasThing) { this.longTarget = new GlobalTargetInfo(localTarget.Thing); @@ -228,7 +201,7 @@ namespace ArachnaeSwarm { this.longTarget = new GlobalTargetInfo(localTarget.Cell, mapParent.Map); } - this.forcedTarget = LocalTargetInfo.Invalid; // Clear local target when setting remote + this.forcedTarget = LocalTargetInfo.Invalid; }, null, onFinished, FireMissionTex, true); diff --git a/Source/ArachnaeSwarm/Verbs/Verb_LaunchCatastropheMissile.cs b/Source/ArachnaeSwarm/Verbs/Verb_LaunchCatastropheMissile.cs deleted file mode 100644 index c451d9e..0000000 --- a/Source/ArachnaeSwarm/Verbs/Verb_LaunchCatastropheMissile.cs +++ /dev/null @@ -1,18 +0,0 @@ -using RimWorld; -using RimWorld.Planet; -using UnityEngine; -using Verse; -using Verse.AI; -using Verse.Sound; - -namespace ArachnaeSwarm -{ - public class Verb_LaunchCatastropheMissile : Verb_Shoot - { - // This verb is now only for local defense. The global launch is handled by the Building. - protected override bool TryCastShot() - { - return base.TryCastShot(); - } - } -} \ No newline at end of file