暂存
This commit is contained in:
Binary file not shown.
@@ -68,10 +68,12 @@
|
|||||||
|
|
||||||
<!-- 扫射参数 -->
|
<!-- 扫射参数 -->
|
||||||
<enableGroundStrafing>true</enableGroundStrafing>
|
<enableGroundStrafing>true</enableGroundStrafing>
|
||||||
<strafeWidth>3</strafeWidth>
|
<strafeWidth>6</strafeWidth>
|
||||||
<strafeLength>25</strafeLength>
|
<strafeLength>25</strafeLength>
|
||||||
<strafeProjectile>Proj_ARA_HiveCorvette</strafeProjectile>
|
|
||||||
<strafeFireChance>0.23</strafeFireChance>
|
<strafeFireChance>0.23</strafeFireChance>
|
||||||
|
<!-- 新增:控制最终射弹数量 -->
|
||||||
|
<minStrafeProjectiles>4</minStrafeProjectiles>
|
||||||
|
<maxStrafeProjectiles>4</maxStrafeProjectiles>
|
||||||
|
|
||||||
<!-- 只传递信号,不传递具体参数 -->
|
<!-- 只传递信号,不传递具体参数 -->
|
||||||
<enableSectorSurveillance>true</enableSectorSurveillance>
|
<enableSectorSurveillance>true</enableSectorSurveillance>
|
||||||
@@ -125,7 +127,6 @@
|
|||||||
<enableGroundStrafing>true</enableGroundStrafing>
|
<enableGroundStrafing>true</enableGroundStrafing>
|
||||||
<strafeWidth>6</strafeWidth>
|
<strafeWidth>6</strafeWidth>
|
||||||
<strafeLength>15</strafeLength>
|
<strafeLength>15</strafeLength>
|
||||||
<strafeProjectile>Bullet_ARA_RW_Acid_Mortar</strafeProjectile>
|
|
||||||
<strafeFireChance>0.3</strafeFireChance>
|
<strafeFireChance>0.3</strafeFireChance>
|
||||||
|
|
||||||
<!-- 只传递信号,不传递具体参数 -->
|
<!-- 只传递信号,不传递具体参数 -->
|
||||||
|
|||||||
@@ -517,11 +517,11 @@
|
|||||||
<altitudeLayer>MetaOverlays</altitudeLayer>
|
<altitudeLayer>MetaOverlays</altitudeLayer>
|
||||||
<comps>
|
<comps>
|
||||||
<li Class="ArachnaeSwarm.CompProperties_GroundStrafing">
|
<li Class="ArachnaeSwarm.CompProperties_GroundStrafing">
|
||||||
<projectileDef>Proj_ARA_HiveCorvette</projectileDef>
|
<projectileDef>Projectile_CatastropheMissile</projectileDef>
|
||||||
<range>50</range>
|
<range>50</range>
|
||||||
</li>
|
</li>
|
||||||
<li Class="ArachnaeSwarm.CompProperties_SectorSurveillance">
|
<li Class="ArachnaeSwarm.CompProperties_SectorSurveillance">
|
||||||
<projectileDef>Bullet_ARA_HiveCorvette</projectileDef>
|
<projectileDef>Bullet_RW_Missile_AR_Gun</projectileDef>
|
||||||
<sectorAngle>30</sectorAngle> <!-- 扇形角度 -->
|
<sectorAngle>30</sectorAngle> <!-- 扇形角度 -->
|
||||||
<sectorRange>50</sectorRange> <!-- 射程 -->
|
<sectorRange>50</sectorRange> <!-- 射程 -->
|
||||||
<shotCount>3</shotCount> <!-- 发射次数 -->
|
<shotCount>3</shotCount> <!-- 发射次数 -->
|
||||||
@@ -571,7 +571,7 @@
|
|||||||
<altitudeLayer>MetaOverlays</altitudeLayer>
|
<altitudeLayer>MetaOverlays</altitudeLayer>
|
||||||
<comps>
|
<comps>
|
||||||
<li Class="ArachnaeSwarm.CompProperties_GroundStrafing">
|
<li Class="ArachnaeSwarm.CompProperties_GroundStrafing">
|
||||||
<projectileDef>Bullet_ARA_RW_Acid_Mortar</projectileDef>
|
<projectileDef>Proj_ARA_HiveCorvette</projectileDef>
|
||||||
<range>15</range>
|
<range>15</range>
|
||||||
</li>
|
</li>
|
||||||
<li Class="ArachnaeSwarm.CompProperties_SectorSurveillance">
|
<li Class="ArachnaeSwarm.CompProperties_SectorSurveillance">
|
||||||
|
|||||||
@@ -392,16 +392,37 @@ namespace ArachnaeSwarm
|
|||||||
private List<IntVec3> PreprocessStrafingTargets(List<IntVec3> potentialTargets, float fireChance)
|
private List<IntVec3> PreprocessStrafingTargets(List<IntVec3> potentialTargets, float fireChance)
|
||||||
{
|
{
|
||||||
List<IntVec3> confirmedTargets = new List<IntVec3>();
|
List<IntVec3> confirmedTargets = new List<IntVec3>();
|
||||||
|
List<IntVec3> missedCells = new List<IntVec3>();
|
||||||
foreach (IntVec3 cell in potentialTargets)
|
foreach (IntVec3 cell in potentialTargets)
|
||||||
{
|
{
|
||||||
// 使用概率决定这个单元格是否会被射击
|
|
||||||
if (Rand.Value <= fireChance)
|
if (Rand.Value <= fireChance)
|
||||||
{
|
{
|
||||||
confirmedTargets.Add(cell);
|
confirmedTargets.Add(cell);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
missedCells.Add(cell);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Message($"Strafing Preprocess: {confirmedTargets.Count}/{potentialTargets.Count} cells confirmed ({fireChance:P0} chance)");
|
// 应用最小和最大射弹数限制
|
||||||
|
if (Props.maxStrafeProjectiles > -1 && confirmedTargets.Count > Props.maxStrafeProjectiles)
|
||||||
|
{
|
||||||
|
// 如果超出最大值,随机丢弃一些目标
|
||||||
|
confirmedTargets = confirmedTargets.InRandomOrder().Take(Props.maxStrafeProjectiles).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Props.minStrafeProjectiles > -1 && confirmedTargets.Count < Props.minStrafeProjectiles)
|
||||||
|
{
|
||||||
|
// 如果不足最小值,从之前未选中的格子里补充
|
||||||
|
int needed = Props.minStrafeProjectiles - confirmedTargets.Count;
|
||||||
|
if (needed > 0 && missedCells.Count > 0)
|
||||||
|
{
|
||||||
|
confirmedTargets.AddRange(missedCells.InRandomOrder().Take(Mathf.Min(needed, missedCells.Count)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.Message($"Strafing Preprocess: {confirmedTargets.Count}/{potentialTargets.Count} cells confirmed after min/max adjustment.");
|
||||||
return confirmedTargets;
|
return confirmedTargets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ namespace ArachnaeSwarm
|
|||||||
public int strafeWidth = 3; // 扫射宽度(用于预览)
|
public int strafeWidth = 3; // 扫射宽度(用于预览)
|
||||||
public int strafeLength = 15; // 扫射长度
|
public int strafeLength = 15; // 扫射长度
|
||||||
public float strafeFireChance = 0.7f; // 扫射发射概率
|
public float strafeFireChance = 0.7f; // 扫射发射概率
|
||||||
|
public int minStrafeProjectiles = -1; // 新增:最小射弹数
|
||||||
|
public int maxStrafeProjectiles = -1; // 新增:最大射弹数
|
||||||
public ThingDef strafeProjectile; // 抛射体定义
|
public ThingDef strafeProjectile; // 抛射体定义
|
||||||
|
|
||||||
// 地面扫射可视化
|
// 地面扫射可视化
|
||||||
|
|||||||
Reference in New Issue
Block a user