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
index cd30468..11a2416 100644
--- 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
@@ -8,13 +8,10 @@
ArachnaeSwarm.Building_CatastropheMissileSilo
MapMeshAndRealTime
- Things/Building/Security/TurretHeavy_Base
+ ArachnaeSwarm/Building/ARA_CatastropheMissileSilo_Base
Graphic_Single
- (3, 3)
+ (2.5,2.5)
(0,0,-0.1)
-
- (0.2,0.2,0.6,0.6)
-
(1.5,0.35,1.4)
(0,0,-0.05)
@@ -40,7 +37,7 @@
缺少导弹
- ComponentSpacer
+ ARA_CatastropheMissile_Shell
10
@@ -55,7 +52,7 @@
CatastropheMissile_Weapon
- 5.0
+ 15.0
Artillery
@@ -67,7 +64,31 @@
-
+
+ ARA_CatastropheMissile_Shell
+
+ 阿拉克涅虫族使用的天灾导弹.
+ 2
+
+ Things/Item/Resource/Shell/Shell_Toxic
+ Graphic_StackCount
+
+
+
+ 150
+ ARA_AcidBurn
+ 10.9
+ ARA_Filth_SpentAcid
+ 1
+ 2
+ 30~60
+ MortarBomb_Explode
+ ARA_Shell_AcidSpitImpact
+
+
+
+
+
Projectile_CatastropheMissile
ArachnaeSwarm.Projectile_CruiseMissile
@@ -84,8 +105,8 @@
150
80
true
- Filth_SpentAcid
- 4
+ ARA_Filth_SpentAcid
+ 2
ARA_Shell_AcidSpitImpact
60
false
@@ -123,6 +144,39 @@
+
+ ARA_Filth_SpentAcid
+
+ Normal
+
+ -30
+ -5
+
+
+ Things/Filth/Acid
+ Graphic_Random
+ 2.5
+ (1,1,1,0.5)
+
+
+ true
+ 1~3
+ true
+ 70
+ true
+ 1
+ Interact_CleanFilth_Fluid
+
+ ArachnaeSwarm.Filth_Toxic
+
+
+ ARA_AcidCoverd
+ 0.1
+ 240
+
+
+
+
ARA_Shell_AcidSpitImpact
@@ -206,17 +260,17 @@
-
+
CatastropheMissile_Weapon
天灾导弹的发射系统。
- Spacer
- Things/Building/Security/TurretMortar_Top
+ ArachnaeSwarm/Building/ARA_CatastropheMissileSilo_Tower
Graphic_Single
+ (5,5)
- 5.0
+ 15.0
50
diff --git a/Content/Textures/ArachnaeSwarm/Building/ARA_CatastropheMissileSilo_Base.png b/Content/Textures/ArachnaeSwarm/Building/ARA_CatastropheMissileSilo_Base.png
new file mode 100644
index 0000000..ad80a2a
Binary files /dev/null and b/Content/Textures/ArachnaeSwarm/Building/ARA_CatastropheMissileSilo_Base.png differ
diff --git a/Content/Textures/ArachnaeSwarm/Building/ARA_CatastropheMissileSilo_Tower.png b/Content/Textures/ArachnaeSwarm/Building/ARA_CatastropheMissileSilo_Tower.png
new file mode 100644
index 0000000..87ca973
Binary files /dev/null and b/Content/Textures/ArachnaeSwarm/Building/ARA_CatastropheMissileSilo_Tower.png differ
diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj
index 54c6891..dbb9672 100644
--- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj
+++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj
@@ -182,6 +182,7 @@
+
diff --git a/Source/ArachnaeSwarm/Thing_Comps/ARA_IngestionOutcomeDoer_GiveHediff/IngestionOutcomeDoer_GiveHediffByRace.cs b/Source/ArachnaeSwarm/Thing_Comps/ARA_IngestionOutcomeDoer_GiveHediff/IngestionOutcomeDoer_GiveHediffByRace.cs
index f460f00..9e3de3b 100644
--- a/Source/ArachnaeSwarm/Thing_Comps/ARA_IngestionOutcomeDoer_GiveHediff/IngestionOutcomeDoer_GiveHediffByRace.cs
+++ b/Source/ArachnaeSwarm/Thing_Comps/ARA_IngestionOutcomeDoer_GiveHediff/IngestionOutcomeDoer_GiveHediffByRace.cs
@@ -24,14 +24,13 @@ namespace ArachnaeSwarm
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested, int ingestedCount)
{
- // 如果列表是空的或null,则默认对所有的pawn进行操作
- if (!targetRaces.Contains(pawn.def))
+ // 如果 targetRaces 列表有内容,并且当前pawn的种族不在列表中,则不执行任何操作。
+ if (!targetRaces.NullOrEmpty() && !targetRaces.Contains(pawn.def))
{
return;
}
- else if (targetRaces.NullOrEmpty())
- {
- }
+
+ // 如果列表为空,或者pawn的种族在列表中,则继续执行后续代码
Hediff hediff = HediffMaker.MakeHediff(hediffDef, pawn);
float effect = ((!(severity > 0f)) ? hediffDef.initialSeverity : severity);
AddictionUtility.ModifyChemicalEffectForToleranceAndBodySize(pawn, toleranceChemical, ref effect, multiplyByGeneToleranceFactors, divideByBodySize);
diff --git a/Source/ArachnaeSwarm/Thing_Comps/Filth_Toxic.cs b/Source/ArachnaeSwarm/Thing_Comps/Filth_Toxic.cs
new file mode 100644
index 0000000..f25346f
--- /dev/null
+++ b/Source/ArachnaeSwarm/Thing_Comps/Filth_Toxic.cs
@@ -0,0 +1,74 @@
+using RimWorld;
+using System.Collections.Generic;
+using UnityEngine;
+using Verse;
+
+namespace ArachnaeSwarm
+{
+ public class Filth_Toxic : Filth
+ {
+ protected override void Tick()
+ {
+ base.Tick();
+ // 检查是否到了自动消失的时间
+ if (base.DisappearAfterTicks > 0 && Find.TickManager.TicksGame >= base.DisappearAfterTicks)
+ {
+ this.Destroy(DestroyMode.Vanish);
+ return;
+ }
+
+ // 周期性施加毒气效果
+ if (!base.Destroyed && Find.TickManager.TicksGame % OPToxicDefGetValue.OPToxicGetSevUpVal(this.def) == 0)
+ {
+ Map map = base.Map;
+ IntVec3 position = base.Position;
+ List thingList = position.GetThingList(map);
+ if (thingList.Count > 0)
+ {
+ for (int i = 0; i < thingList.Count; i++)
+ {
+ if (thingList[i] is Pawn pawn && !pawn.RaceProps.IsMechanoid && thingList[i].Position == position)
+ {
+ this.DoOPToxicGas(this, pawn);
+ }
+ }
+ }
+ }
+ }
+
+ public void DoOPToxicGas(Thing filth, Thing targ)
+ {
+ Pawn pawn = targ as Pawn;
+ if (pawn != null && pawn.health.capacities.CapableOf(PawnCapacityDefOf.Breathing))
+ {
+ HediffDef hediffDef = DefDatabase.GetNamedSilentFail(OPToxicDefGetValue.OPToxicGetHediff(filth.def));
+ if (hediffDef != null)
+ {
+ Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(hediffDef, false);
+
+ float toxicResistance = pawn.GetStatValue(StatDefOf.ToxicResistance, true, -1);
+ float severityPerTick = OPToxicDefGetValue.OPToxicGetSev(filth.def);
+
+ if (severityPerTick < 0.01f)
+ {
+ severityPerTick = 0.01f;
+ }
+
+ // 考虑污渍厚度对严重性的影响
+ float severityToAdd = Rand.Range(0.01f, severityPerTick) * (1f - toxicResistance) * this.thickness;
+
+ if (hediff != null && severityToAdd > 0f)
+ {
+ hediff.Severity += severityToAdd;
+ }
+ else
+ {
+ Hediff newHediff = HediffMaker.MakeHediff(hediffDef, pawn, null);
+ newHediff.Severity = severityToAdd;
+ pawn.health.AddHediff(newHediff, null, null, null);
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Source/ArachnaeSwarm/Verbs/Projectiles/Projectile_CruiseMissile.cs b/Source/ArachnaeSwarm/Verbs/Projectiles/Projectile_CruiseMissile.cs
index 5ef3aa4..b5ee691 100644
--- a/Source/ArachnaeSwarm/Verbs/Projectiles/Projectile_CruiseMissile.cs
+++ b/Source/ArachnaeSwarm/Verbs/Projectiles/Projectile_CruiseMissile.cs
@@ -37,14 +37,18 @@ namespace ArachnaeSwarm
private CruiseMissileProperties settings;
private bool flag2;
private Vector3 Randdd;
- private Vector3 position2;
public Vector3 ExPos;
public bool isDummy = false;
+
+ private Vector3 exactPositionInt; // 用于存储我们自己计算的位置
+ public override Vector3 ExactPosition => exactPositionInt; // 重写属性,让游戏获取我们计算的位置
+ public override Quaternion ExactRotation => Quaternion.LookRotation(destination - origin); // 弹头始终朝向目标
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref isDummy, "isDummy", false);
+ Scribe_Values.Look(ref exactPositionInt, "exactPositionInt");
}
public override void SpawnSetup(Map map, bool respawningAfterLoad)
@@ -52,6 +56,8 @@ namespace ArachnaeSwarm
base.SpawnSetup(map, respawningAfterLoad);
settings = def.GetModExtension() ?? new CruiseMissileProperties();
this.isDummy = settings.isDummy;
+ // 初始化我们自己的位置
+ exactPositionInt = origin;
}
private void RandFactor()
@@ -166,15 +172,16 @@ namespace ArachnaeSwarm
);
}
- protected override void DrawAt(Vector3 position, bool flip = false)
- {
- position2 = BPos(DistanceCoveredFraction - 0.01f);
- ExPos = position = BPos(DistanceCoveredFraction);
- base.DrawAt(position, flip);
- }
+ // 不再需要重写DrawAt,因为ExactPosition现在是正确的
+ // protected override void DrawAt(Vector3 position, bool flip = false)
+ // { ... }
protected override void Tick()
{
+ // 首先调用base.Tick(),让它处理组件更新(比如拖尾特效)和ticksToImpact
+ base.Tick();
+
+ // 更新目标位置
if (intendedTarget.Thing is Pawn pawn && pawn.Spawned && !pawn.Destroyed)
{
if ((pawn.Dead || pawn.Downed) && DistanceCoveredFraction < 0.6f)
@@ -183,7 +190,30 @@ namespace ArachnaeSwarm
}
destination = pawn.DrawPos;
}
- base.Tick();
+
+ // 如果base.Tick()已经处理了撞击,我们就不再继续
+ if (this.Destroyed)
+ {
+ return;
+ }
+
+ // 用我们自己的曲线位置覆盖掉base.Tick()计算的直线位置
+ Vector3 newPos = BPos(this.DistanceCoveredFraction);
+
+ // 增加边界检查
+ if (!newPos.InBounds(base.Map))
+ {
+ this.Destroy();
+ return;
+ }
+ exactPositionInt = newPos;
+
+ // 检查是否到达终点
+ if (this.DistanceCoveredFraction >= 1f)
+ {
+ Impact(null);
+ return;
+ }
}
private void FindNextTarget(Vector3 center)
diff --git a/非公开资源/Content/Textures/Building/ARA_CatastropheMissileSilo_Base.psd b/非公开资源/Content/Textures/Building/ARA_CatastropheMissileSilo_Base.psd
new file mode 100644
index 0000000..3a7bfdf
Binary files /dev/null and b/非公开资源/Content/Textures/Building/ARA_CatastropheMissileSilo_Base.psd differ