This commit is contained in:
2025-09-22 21:50:05 +08:00
parent 8699c4c63e
commit 268ea3c681
7 changed files with 262 additions and 264 deletions

Binary file not shown.

View File

@@ -1,70 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<ThingDef ParentName="BuildingBase">
<defName>CatastropheMissileSilo</defName>
<label>天灾导弹发射井</label>
<description>一个多功能导弹发射平台。它装备的武器系统既可以作为自动炮塔进行本地防御,也可以在操作员的指引下,将“天灾”级巡航导弹发射到全球任何一个角落。</description>
<thingClass>ArachnaeSwarm.Building_CatastropheMissileSilo</thingClass>
<drawerType>MapMeshAndRealTime</drawerType>
<graphicData>
<texPath>Things/Building/Security/TurretHeavy_Base</texPath>
<graphicClass>Graphic_Single</graphicClass>
<drawSize>(3, 3)</drawSize>
<drawOffset>(0,0,-0.1)</drawOffset>
<damageData>
<rect>(0.2,0.2,0.6,0.6)</rect>
</damageData>
<shadowData>
<volume>(1.5,0.35,1.4)</volume>
<offset>(0,0,-0.05)</offset>
</shadowData>
</graphicData>
<size>(2,2)</size>
<altitudeLayer>Building</altitudeLayer>
<passability>PassThroughOnly</passability>
<pathCost>50</pathCost>
<fillPercent>0.5</fillPercent>
<stealable>false</stealable>
<statBases>
<MaxHitPoints>500</MaxHitPoints>
<WorkToBuild>12000</WorkToBuild>
<Mass>800</Mass>
<Beauty>-20</Beauty>
</statBases>
<tickerType>Normal</tickerType>
<comps>
<li Class="CompProperties_Refuelable">
<fuelLabel>导弹</fuelLabel>
<fuelGizmoLabel>导弹</fuelGizmoLabel>
<outOfFuelMessage>缺少导弹</outOfFuelMessage>
<fuelFilter>
<thingDefs>
<li>ComponentSpacer</li>
</thingDefs>
</fuelFilter>
<fuelCapacity>10</fuelCapacity>
<initialFuelPercent>0</initialFuelPercent>
<autoRefuelPercent>1</autoRefuelPercent>
<showFuelGizmo>true</showFuelGizmo>
<consumeFuelOnlyWhenUsed>true</consumeFuelOnlyWhenUsed>
</li>
<li Class="CompProperties_Forbiddable"/>
<li Class="CompProperties_Breakdownable"/>
<li Class="ArachnaeSwarm.CompProperties_ForceTargetable" />
</comps>
<building>
<turretGunDef>CatastropheMissile_Weapon</turretGunDef>
<turretBurstCooldownTime>5.0</turretBurstCooldownTime>
<buildingTags>
<li>Artillery</li>
</buildingTags>
</building>
<designationCategory>ARA_Buildings</designationCategory>
<constructionSkillPrerequisite>8</constructionSkillPrerequisite>
<researchPrerequisites>
<li>ShipbuildingBasics</li>
</researchPrerequisites>
</ThingDef>
</Defs>

View File

@@ -1,130 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<ThingDef ParentName="BaseBullet">
<defName>Projectile_CatastropheMissile</defName>
<label>“天灾”巡航导弹</label>
<thingClass>ArachnaeSwarm.Projectile_CruiseMissile</thingClass>
<graphicData>
<graphicClass>Graphic_Single_AgeSecs</graphicClass>
<texPath>Things/Projectile/FleshmassSpitterProjectileSheet</texPath>
<drawSize>(3,3)</drawSize>
<shaderType>MoteGlow</shaderType>
</graphicData>
<projectile>
<useGraphicClass>True</useGraphicClass>
<shadowSize>1</shadowSize>
<damageDef>ARA_AcidBurn</damageDef>
<damageAmountBase>200</damageAmountBase>
<speed>80</speed>
<spinRate>15</spinRate>
<flyOverhead>true</flyOverhead>
<filth>Filth_SpentAcid</filth>
<filthCount>4</filthCount>
<explosionEffect>Shell_AcidSpitImpact</explosionEffect>
<explosionEffectLifetimeTicks>60</explosionEffectLifetimeTicks>
<doExplosionVFX>false</doExplosionVFX>
<explosionRadius>5.9</explosionRadius>
<soundExplode>MortarBomb_Explode</soundExplode>
</projectile>
<modExtensions>
<li Class="ArachnaeSwarm.CruiseMissileProperties">
<customDamageDef>ARA_AcidBurn</customDamageDef>
<customDamageAmount>150</customDamageAmount>
<customExplosionRadius>5.9</customExplosionRadius>
<customSoundExplode>MortarBomb_Explode</customSoundExplode>
<useSubExplosions>true</useSubExplosions>
<subExplosionCount>8</subExplosionCount>
<subExplosionRadius>2.9</subExplosionRadius>
<subExplosionDamage>50</subExplosionDamage>
<subExplosionSpread>15</subExplosionSpread>
<subDamageDef>ARA_AcidBurn</subDamageDef>
<subSoundExplode>Mortar_Explode</subSoundExplode>
<bezierArcHeightFactor>0.05</bezierArcHeightFactor>
<bezierMinArcHeight>5</bezierMinArcHeight>
<bezierMaxArcHeight>20</bezierMaxArcHeight>
<bezierHorizontalOffsetFactor>0.1</bezierHorizontalOffsetFactor>
<bezierSideOffsetFactor>0.2</bezierSideOffsetFactor>
<bezierRandomOffsetScale>0.5</bezierRandomOffsetScale>
</li>
</modExtensions>
<comps>
<li Class="CompProperties_ProjectileEffecter">
<effecterDef>Shell_AcidSpitStream</effecterDef>
</li>
<li Class="CompProperties_ProjectileEffecter">
<effecterDef>Shell_AcidSpitLaunched</effecterDef>
</li>
</comps>
</ThingDef>
<ThingDef ParentName="BaseBullet">
<defName>Projectile_CatastropheMissile_Fake</defName>
<label>“天灾”巡航导弹</label>
<thingClass>ArachnaeSwarm.Projectile_CruiseMissile</thingClass>
<graphicData>
<graphicClass>Graphic_Single_AgeSecs</graphicClass>
<texPath>Things/Projectile/FleshmassSpitterProjectileSheet</texPath>
<drawSize>(3,3)</drawSize>
<shaderType>MoteGlow</shaderType>
</graphicData>
<projectile>
<useGraphicClass>True</useGraphicClass>
<shadowSize>1</shadowSize>
<damageDef>ARA_AcidBurn</damageDef>
<damageAmountBase>0</damageAmountBase>
<speed>50</speed>
<spinRate>15</spinRate>
<flyOverhead>true</flyOverhead>
</projectile>
<modExtensions>
<li Class="ArachnaeSwarm.CruiseMissileProperties">
<isDummy>true</isDummy>
<useSubExplosions>false</useSubExplosions>
</li>
</modExtensions>
<comps>
<li Class="CompProperties_ProjectileEffecter">
<effecterDef>Shell_AcidSpitStream</effecterDef>
</li>
<li Class="CompProperties_ProjectileEffecter">
<effecterDef>Shell_AcidSpitLaunched</effecterDef>
</li>
</comps>
</ThingDef>
<ThingDef ParentName="BaseWeapon">
<defName>CatastropheMissile_Weapon</defName>
<label>天灾导弹武器系统</label>
<description>天灾导弹的发射系统。</description>
<techLevel>Spacer</techLevel>
<graphicData>
<texPath>Things/Building/Security/TurretMortar_Top</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<statBases>
<RangedWeapon_Cooldown>5.0</RangedWeapon_Cooldown>
<Mass>50</Mass>
</statBases>
<verbs>
<li>
<verbClass>ArachnaeSwarm.Verb_LaunchCatastropheMissile</verbClass>
<hasStandardCommand>true</hasStandardCommand>
<defaultProjectile>Projectile_CatastropheMissile</defaultProjectile> <!-- Placeholder local projectile -->
<warmupTime>3.0</warmupTime>
<forcedMissRadius>1</forcedMissRadius>
<isMortar>true</isMortar>
<requireLineOfSight>false</requireLineOfSight>
<minRange>29.9</minRange>
<burstShotCount>1</burstShotCount>
<range>500</range>
<soundCast>Shot_Autocannon</soundCast>
<muzzleFlashScale>16</muzzleFlashScale>
<targetParams>
<canTargetLocations>true</canTargetLocations>
</targetParams>
</li>
</verbs>
</ThingDef>
</Defs>

View File

@@ -0,0 +1,244 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<ThingDef ParentName="BuildingBase">
<defName>CatastropheMissileSilo</defName>
<label>天灾导弹发射井</label>
<description>一个多功能导弹发射平台。它装备的武器系统既可以作为自动炮塔进行本地防御,也可以在操作员的指引下,将“天灾”级巡航导弹发射到全球任何一个角落。</description>
<thingClass>ArachnaeSwarm.Building_CatastropheMissileSilo</thingClass>
<drawerType>MapMeshAndRealTime</drawerType>
<graphicData>
<texPath>Things/Building/Security/TurretHeavy_Base</texPath>
<graphicClass>Graphic_Single</graphicClass>
<drawSize>(3, 3)</drawSize>
<drawOffset>(0,0,-0.1)</drawOffset>
<damageData>
<rect>(0.2,0.2,0.6,0.6)</rect>
</damageData>
<shadowData>
<volume>(1.5,0.35,1.4)</volume>
<offset>(0,0,-0.05)</offset>
</shadowData>
</graphicData>
<size>(2,2)</size>
<altitudeLayer>Building</altitudeLayer>
<passability>PassThroughOnly</passability>
<pathCost>50</pathCost>
<fillPercent>0.5</fillPercent>
<stealable>false</stealable>
<statBases>
<MaxHitPoints>500</MaxHitPoints>
<WorkToBuild>12000</WorkToBuild>
<Mass>800</Mass>
<Beauty>-20</Beauty>
</statBases>
<tickerType>Normal</tickerType>
<comps>
<li Class="CompProperties_Refuelable">
<fuelLabel>导弹</fuelLabel>
<fuelGizmoLabel>导弹</fuelGizmoLabel>
<outOfFuelMessage>缺少导弹</outOfFuelMessage>
<fuelFilter>
<thingDefs>
<li>ComponentSpacer</li>
</thingDefs>
</fuelFilter>
<fuelCapacity>10</fuelCapacity>
<initialFuelPercent>0</initialFuelPercent>
<autoRefuelPercent>1</autoRefuelPercent>
<showFuelGizmo>true</showFuelGizmo>
<consumeFuelOnlyWhenUsed>true</consumeFuelOnlyWhenUsed>
</li>
<li Class="CompProperties_Forbiddable"/>
<li Class="CompProperties_Breakdownable"/>
<li Class="ArachnaeSwarm.CompProperties_ForceTargetable" />
</comps>
<building>
<turretGunDef>CatastropheMissile_Weapon</turretGunDef>
<turretBurstCooldownTime>5.0</turretBurstCooldownTime>
<buildingTags>
<li>Artillery</li>
</buildingTags>
</building>
<designationCategory>ARA_Buildings</designationCategory>
<constructionSkillPrerequisite>8</constructionSkillPrerequisite>
<researchPrerequisites>
<li>ShipbuildingBasics</li>
</researchPrerequisites>
</ThingDef>
<ThingDef ParentName="BaseBullet">
<defName>Projectile_CatastropheMissile</defName>
<label>“天灾”巡航导弹</label>
<thingClass>ArachnaeSwarm.Projectile_CruiseMissile</thingClass>
<graphicData>
<graphicClass>Graphic_Single_AgeSecs</graphicClass>
<texPath>Things/Projectile/FleshmassSpitterProjectileSheet</texPath>
<drawSize>(3,3)</drawSize>
<shaderType>MoteGlow</shaderType>
</graphicData>
<projectile>
<useGraphicClass>True</useGraphicClass>
<shadowSize>1</shadowSize>
<damageDef>ARA_AcidBurn</damageDef>
<damageAmountBase>150</damageAmountBase>
<speed>80</speed>
<flyOverhead>true</flyOverhead>
<filth>Filth_SpentAcid</filth>
<filthCount>4</filthCount>
<explosionEffect>ARA_Shell_AcidSpitImpact</explosionEffect>
<explosionEffectLifetimeTicks>60</explosionEffectLifetimeTicks>
<doExplosionVFX>false</doExplosionVFX>
<explosionRadius>10.9</explosionRadius>
<soundExplode>MortarBomb_Explode</soundExplode>
</projectile>
<modExtensions>
<li Class="ArachnaeSwarm.CruiseMissileProperties">
<customDamageDef>ARA_AcidBurn</customDamageDef>
<customDamageAmount>150</customDamageAmount>
<customExplosionRadius>10.9</customExplosionRadius>
<customSoundExplode>MortarBomb_Explode</customSoundExplode>
<useSubExplosions>true</useSubExplosions>
<subExplosionCount>8</subExplosionCount>
<subExplosionRadius>2.9</subExplosionRadius>
<subExplosionDamage>50</subExplosionDamage>
<subExplosionSpread>15</subExplosionSpread>
<subDamageDef>ARA_AcidBurn</subDamageDef>
<subSoundExplode>MortarBomb_Explode</subSoundExplode>
<bezierArcHeightFactor>0.01</bezierArcHeightFactor>
<bezierMinArcHeight>1</bezierMinArcHeight>
<bezierMaxArcHeight>5</bezierMaxArcHeight>
<bezierHorizontalOffsetFactor>0.05</bezierHorizontalOffsetFactor>
<bezierSideOffsetFactor>0.05</bezierSideOffsetFactor>
<bezierRandomOffsetScale>1.5</bezierRandomOffsetScale>
</li>
</modExtensions>
<comps>
<li Class="CompProperties_ProjectileEffecter">
<effecterDef>Shell_AcidSpitStream</effecterDef>
</li>
<li Class="CompProperties_ProjectileEffecter">
<effecterDef>Shell_AcidSpitLaunched</effecterDef>
</li>
</comps>
</ThingDef>
<EffecterDef>
<defName>ARA_Shell_AcidSpitImpact</defName>
<children>
<li>
<subEffecterClass>SubEffecter_SprayerChance</subEffecterClass>
<fleckDef>Fleck_AcidSpitImpact</fleckDef>
<burstCount>1</burstCount>
<scale>5</scale>
<chancePerTick>1</chancePerTick>
<chancePeriodTicks>2</chancePeriodTicks>
<lifespanMaxTicks>8</lifespanMaxTicks>
<spawnLocType>OnSource</spawnLocType>
</li>
<li>
<subEffecterClass>SubEffecter_SprayerTriggered</subEffecterClass>
<fleckDef>Fleck_AcidSpitLaunchedMist</fleckDef>
<scale>20</scale>
<burstCount>3~6</burstCount>
<spawnLocType>OnSource</spawnLocType>
<absoluteAngle>false</absoluteAngle>
<angle>0~100</angle>
<positionRadius>1</positionRadius>
<speed>-1~1</speed>
<rotation>0</rotation>
</li>
<li>
<subEffecterClass>SubEffecter_SprayerTriggered</subEffecterClass>
<fleckDef>Fleck_AcidSpitLaunchedGlobFast</fleckDef>
<burstCount>6~10</burstCount>
<spawnLocType>OnSource</spawnLocType>
<absoluteAngle>false</absoluteAngle>
<positionRadius>.7</positionRadius>
<positionRadiusMin>.7</positionRadiusMin>
<fleckUsesAngleForVelocity>true</fleckUsesAngleForVelocity>
<rotateTowardsTargetCenter>true</rotateTowardsTargetCenter>
<angle>0~100</angle>
<scale>2.5</scale>
<speed>20~45</speed>
<rotation>0~360</rotation>
</li>
</children>
</EffecterDef>
<ThingDef ParentName="BaseBullet">
<defName>Projectile_CatastropheMissile_Fake</defName>
<label>“天灾”巡航导弹</label>
<thingClass>ArachnaeSwarm.Projectile_CruiseMissile</thingClass>
<graphicData>
<graphicClass>Graphic_Single_AgeSecs</graphicClass>
<texPath>Things/Projectile/FleshmassSpitterProjectileSheet</texPath>
<drawSize>(3,3)</drawSize>
<shaderType>MoteGlow</shaderType>
</graphicData>
<projectile>
<useGraphicClass>True</useGraphicClass>
<shadowSize>1</shadowSize>
<damageDef>ARA_AcidBurn</damageDef>
<damageAmountBase>0</damageAmountBase>
<speed>80</speed>
<flyOverhead>true</flyOverhead>
</projectile>
<modExtensions>
<li Class="ArachnaeSwarm.CruiseMissileProperties">
<isDummy>true</isDummy>
<useSubExplosions>false</useSubExplosions>
<bezierArcHeightFactor>0.01</bezierArcHeightFactor>
<bezierMinArcHeight>1</bezierMinArcHeight>
<bezierMaxArcHeight>5</bezierMaxArcHeight>
<bezierHorizontalOffsetFactor>0.05</bezierHorizontalOffsetFactor>
<bezierSideOffsetFactor>0.05</bezierSideOffsetFactor>
<bezierRandomOffsetScale>1.5</bezierRandomOffsetScale>
</li>
</modExtensions>
<comps>
<li Class="CompProperties_ProjectileEffecter">
<effecterDef>Shell_AcidSpitStream</effecterDef>
</li>
<li Class="CompProperties_ProjectileEffecter">
<effecterDef>Shell_AcidSpitLaunched</effecterDef>
</li>
</comps>
</ThingDef>
<ThingDef ParentName="BaseWeapon">
<defName>CatastropheMissile_Weapon</defName>
<label>天灾导弹武器系统</label>
<description>天灾导弹的发射系统。</description>
<techLevel>Spacer</techLevel>
<graphicData>
<texPath>Things/Building/Security/TurretMortar_Top</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<statBases>
<RangedWeapon_Cooldown>5.0</RangedWeapon_Cooldown>
<Mass>50</Mass>
</statBases>
<verbs>
<li>
<verbClass>Verb_Shoot</verbClass>
<hasStandardCommand>true</hasStandardCommand>
<defaultProjectile>Projectile_CatastropheMissile</defaultProjectile>
<consumeFuelPerShot>1</consumeFuelPerShot>
<warmupTime>3.0</warmupTime>
<forcedMissRadius>1</forcedMissRadius>
<isMortar>true</isMortar>
<requireLineOfSight>false</requireLineOfSight>
<minRange>10.9</minRange>
<burstShotCount>1</burstShotCount>
<range>500</range>
<soundCast>Shot_Autocannon</soundCast>
<muzzleFlashScale>16</muzzleFlashScale>
<targetParams>
<canTargetLocations>true</canTargetLocations>
</targetParams>
</li>
</verbs>
</ThingDef>
</Defs>

View File

@@ -209,7 +209,6 @@
<Compile Include="ARAFoodDispenserProperties.cs" />
<Compile Include="Patch_DispenserFoodSearch.cs" />
<Compile Include="Buildings\Building_CatastropheMissileSilo.cs" />
<Compile Include="Verbs\Verb_LaunchCatastropheMissile.cs" />
<Compile Include="World\WorldObject_CatastropheMissile.cs" />
<Compile Include="HarmonyPatches\Patch_ForceTargetable.cs" />
<Compile Include="Comps\CompForceTargetable.cs" />

View File

@@ -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<Texture2D>.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<Gizmo> 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<ThingDef>.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<CompRefuelable>();
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);

View File

@@ -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();
}
}
}