zc
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -59,6 +59,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
@@ -87,6 +88,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
@@ -115,6 +117,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
@@ -143,6 +146,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
@@ -171,6 +175,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
@@ -298,6 +303,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
@@ -344,6 +350,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
@@ -390,6 +397,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
@@ -437,6 +445,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
@@ -486,6 +495,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
@@ -535,6 +545,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
@@ -582,6 +593,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_ApparelInterceptor">
|
||||
@@ -659,6 +671,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
@@ -708,6 +721,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
@@ -137,6 +138,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
</comps>
|
||||
@@ -212,6 +214,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_Cleave">
|
||||
@@ -321,6 +324,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_CustomUniqueWeapon" MayRequire="Ludeon.RimWorld.Odyssey">
|
||||
@@ -414,6 +418,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_CustomUniqueWeapon" MayRequire="Ludeon.RimWorld.Odyssey">
|
||||
@@ -507,6 +512,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_CustomUniqueWeapon" MayRequire="Ludeon.RimWorld.Odyssey">
|
||||
@@ -627,6 +633,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_GiveHediffOnShot">
|
||||
@@ -741,6 +748,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_CustomUniqueWeapon" MayRequire="Ludeon.RimWorld.Odyssey">
|
||||
@@ -839,6 +847,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_CustomUniqueWeapon" MayRequire="Ludeon.RimWorld.Odyssey">
|
||||
@@ -950,6 +959,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_CustomUniqueWeapon" MayRequire="Ludeon.RimWorld.Odyssey">
|
||||
@@ -1095,6 +1105,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_CustomUniqueWeapon" MayRequire="Ludeon.RimWorld.Odyssey">
|
||||
@@ -1209,6 +1220,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_CustomUniqueWeapon" MayRequire="Ludeon.RimWorld.Odyssey">
|
||||
@@ -1338,6 +1350,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_CustomUniqueWeapon" MayRequire="Ludeon.RimWorld.Odyssey">
|
||||
@@ -1469,6 +1482,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_CustomUniqueWeapon" MayRequire="Ludeon.RimWorld.Odyssey">
|
||||
@@ -1622,6 +1636,7 @@
|
||||
<li Class="ArachnaeSwarm.CompProperties_ExtraIncubationInfo">
|
||||
<cocoonDefs>
|
||||
<li>ARA_Equipment_Ootheca</li>
|
||||
<li>ARA_BioforgeIncubator_Thing</li>
|
||||
</cocoonDefs>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_CustomUniqueWeapon" MayRequire="Ludeon.RimWorld.Odyssey">
|
||||
|
||||
@@ -179,52 +179,70 @@ namespace ArachnaeSwarm
|
||||
}
|
||||
|
||||
// === 幼虫激活逻辑 ===
|
||||
// 每次只呼叫一只幼虫,避免预留冲突
|
||||
private void CallLarvae()
|
||||
{
|
||||
int neededLarvae = WaitingForLarvaCount - assignedLarvae.Count;
|
||||
if (neededLarvae <= 0)
|
||||
if (assignedLarvae.Count > 0)
|
||||
{
|
||||
Messages.Message("已有幼虫正在工作中,请等待完成", MessageTypeDefOf.RejectInput);
|
||||
return;
|
||||
}
|
||||
|
||||
if (WaitingForLarvaCount <= 0)
|
||||
{
|
||||
Messages.Message("没有需要激活的订单", MessageTypeDefOf.RejectInput);
|
||||
return;
|
||||
}
|
||||
|
||||
int called = 0;
|
||||
var availableLarvae = FindAvailableLarvae(neededLarvae);
|
||||
foreach (var larva in availableLarvae)
|
||||
{
|
||||
var job = JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("ARA_OperateIncubator"), parent);
|
||||
if (larva.jobs.TryTakeOrderedJob(job, JobTag.Misc))
|
||||
{
|
||||
assignedLarvae.Add(larva);
|
||||
called++;
|
||||
}
|
||||
}
|
||||
|
||||
if (called > 0)
|
||||
Messages.Message($"已呼叫 {called} 只幼虫", MessageTypeDefOf.PositiveEvent);
|
||||
else
|
||||
Messages.Message("未找到可用的幼虫!", MessageTypeDefOf.RejectInput);
|
||||
CallOneLarva(true);
|
||||
}
|
||||
|
||||
private List<Pawn> FindAvailableLarvae(int maxCount)
|
||||
private bool CallOneLarva(bool showMessage)
|
||||
{
|
||||
var result = new List<Pawn>();
|
||||
float searchRadius = 50f;
|
||||
if (parent.Map == null) return result;
|
||||
var larva = FindOneLarva();
|
||||
if (larva == null)
|
||||
{
|
||||
if (showMessage)
|
||||
Messages.Message("未找到可用的幼虫!", MessageTypeDefOf.RejectInput);
|
||||
return false;
|
||||
}
|
||||
|
||||
var job = JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("ARA_OperateIncubator"), parent);
|
||||
if (larva.jobs.TryTakeOrderedJob(job, JobTag.Misc))
|
||||
{
|
||||
assignedLarvae.Add(larva);
|
||||
if (showMessage)
|
||||
Messages.Message("已呼叫幼虫", MessageTypeDefOf.PositiveEvent);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (showMessage)
|
||||
Messages.Message("幼虫无法接受任务", MessageTypeDefOf.RejectInput);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private Pawn FindOneLarva()
|
||||
{
|
||||
if (parent.Map == null) return null;
|
||||
|
||||
foreach (var pawn in parent.Map.mapPawns.AllPawnsSpawned)
|
||||
{
|
||||
if (result.Count >= maxCount) break;
|
||||
if (pawn.def.defName == "ArachnaeBase_Race_Larva" &&
|
||||
!pawn.Downed && !pawn.Dead &&
|
||||
pawn.Faction == parent.Faction &&
|
||||
!assignedLarvae.Contains(pawn) &&
|
||||
parent.Position.DistanceTo(pawn.Position) <= searchRadius)
|
||||
{
|
||||
result.Add(pawn);
|
||||
}
|
||||
if (pawn.def.defName != "ArachnaeBase_Race_Larva") continue;
|
||||
if (pawn.Downed || pawn.Dead) continue;
|
||||
if (pawn.Faction != parent.Faction) continue;
|
||||
if (assignedLarvae.Contains(pawn)) continue;
|
||||
|
||||
bool isBusy = pawn.CurJobDef != null &&
|
||||
pawn.CurJobDef != JobDefOf.Wait_Wander &&
|
||||
pawn.CurJobDef != JobDefOf.GotoWander &&
|
||||
pawn.CurJobDef.defName != "Wait";
|
||||
if (isBusy) continue;
|
||||
|
||||
return pawn;
|
||||
}
|
||||
return result;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void NotifyLarvaArrived(Pawn larva) { }
|
||||
@@ -240,6 +258,12 @@ namespace ArachnaeSwarm
|
||||
waitingOrder.qualityProgress = 0f;
|
||||
}
|
||||
assignedLarvae.Remove(larva);
|
||||
|
||||
// 自动呼叫下一只幼虫
|
||||
if (WaitingForLarvaCount > 0 && assignedLarvae.Count == 0)
|
||||
{
|
||||
CallOneLarva(false);
|
||||
}
|
||||
}
|
||||
|
||||
// === Tick 逻辑 ===
|
||||
@@ -247,7 +271,12 @@ namespace ArachnaeSwarm
|
||||
{
|
||||
base.CompTick();
|
||||
|
||||
assignedLarvae.RemoveAll(l => l == null || l.Dead || l.Destroyed);
|
||||
// 清理无效的幼虫
|
||||
assignedLarvae.RemoveAll(l =>
|
||||
l == null || l.Dead || l.Destroyed ||
|
||||
l.CurJobDef == null ||
|
||||
l.CurJobDef.defName != "ARA_OperateIncubator" ||
|
||||
l.CurJob?.targetA.Thing != parent);
|
||||
|
||||
bool hasFuel = (FuelComp?.Fuel ?? 10f) > 0.01f;
|
||||
|
||||
@@ -388,17 +417,27 @@ namespace ArachnaeSwarm
|
||||
};
|
||||
}
|
||||
|
||||
int needed = WaitingForLarvaCount - assignedLarvae.Count;
|
||||
if (needed > 0)
|
||||
// 呼叫幼虫按钮
|
||||
if (WaitingForLarvaCount > 0 && assignedLarvae.Count == 0)
|
||||
{
|
||||
yield return new Command_Action
|
||||
{
|
||||
defaultLabel = $"呼叫幼虫 ({needed})",
|
||||
defaultDesc = $"呼叫 {needed} 只幼虫来激活等待中的订单",
|
||||
defaultLabel = "呼叫幼虫",
|
||||
defaultDesc = $"呼叫一只幼虫来激活下一个订单(还有{WaitingForLarvaCount}个等待中)",
|
||||
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_CallLarva", false),
|
||||
action = CallLarvae
|
||||
};
|
||||
}
|
||||
else if (WaitingForLarvaCount > 0 && assignedLarvae.Count > 0)
|
||||
{
|
||||
yield return new Command_Action
|
||||
{
|
||||
defaultLabel = "幼虫工作中",
|
||||
defaultDesc = $"一只幼虫正在操作孵化器(还有{WaitingForLarvaCount}个订单等待)",
|
||||
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_CallLarva", false),
|
||||
Disabled = true
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowOrderMenuPublic() => ShowOrderMenu();
|
||||
|
||||
@@ -183,47 +183,59 @@ namespace ArachnaeSwarm
|
||||
}
|
||||
|
||||
// === 幼虫激活逻辑 ===
|
||||
// 每次只呼叫一只幼虫,避免预留冲突
|
||||
private void CallLarvae()
|
||||
{
|
||||
int neededLarvae = WaitingForLarvaCount - assignedLarvae.Count;
|
||||
if (neededLarvae <= 0)
|
||||
// 检查是否已有幼虫在工作/路上
|
||||
if (assignedLarvae.Count > 0)
|
||||
{
|
||||
Messages.Message("已有幼虫正在工作中,请等待完成", MessageTypeDefOf.RejectInput);
|
||||
return;
|
||||
}
|
||||
|
||||
if (WaitingForLarvaCount <= 0)
|
||||
{
|
||||
Messages.Message("没有需要激活的订单", MessageTypeDefOf.RejectInput);
|
||||
return;
|
||||
}
|
||||
|
||||
int called = 0;
|
||||
int found = 0;
|
||||
var availableLarvae = FindAvailableLarvae(neededLarvae * 2);
|
||||
found = availableLarvae.Count;
|
||||
|
||||
foreach (var larva in availableLarvae)
|
||||
{
|
||||
if (called >= neededLarvae) break;
|
||||
|
||||
var job = JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("ARA_OperateIncubator"), parent);
|
||||
if (larva.jobs.TryTakeOrderedJob(job, JobTag.Misc))
|
||||
{
|
||||
assignedLarvae.Add(larva);
|
||||
called++;
|
||||
}
|
||||
}
|
||||
|
||||
if (called > 0)
|
||||
Messages.Message($"已呼叫 {called} 只幼虫 (找到{found}只)", MessageTypeDefOf.PositiveEvent);
|
||||
else
|
||||
Messages.Message($"未找到可用的幼虫! (需要{neededLarvae}只,找到{found}只)", MessageTypeDefOf.RejectInput);
|
||||
// 只呼叫一只幼虫
|
||||
CallOneLarva(true);
|
||||
}
|
||||
|
||||
private List<Pawn> FindAvailableLarvae(int maxCount)
|
||||
// 呼叫单只幼虫
|
||||
private bool CallOneLarva(bool showMessage)
|
||||
{
|
||||
var result = new List<Pawn>();
|
||||
if (parent.Map == null) return result;
|
||||
var larva = FindOneLarva();
|
||||
if (larva == null)
|
||||
{
|
||||
if (showMessage)
|
||||
Messages.Message("未找到可用的幼虫!", MessageTypeDefOf.RejectInput);
|
||||
return false;
|
||||
}
|
||||
|
||||
var job = JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("ARA_OperateIncubator"), parent);
|
||||
if (larva.jobs.TryTakeOrderedJob(job, JobTag.Misc))
|
||||
{
|
||||
assignedLarvae.Add(larva);
|
||||
if (showMessage)
|
||||
Messages.Message("已呼叫幼虫", MessageTypeDefOf.PositiveEvent);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (showMessage)
|
||||
Messages.Message("幼虫无法接受任务", MessageTypeDefOf.RejectInput);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private Pawn FindOneLarva()
|
||||
{
|
||||
if (parent.Map == null) return null;
|
||||
|
||||
foreach (var pawn in parent.Map.mapPawns.AllPawnsSpawned)
|
||||
{
|
||||
if (result.Count >= maxCount) break;
|
||||
|
||||
if (pawn.def.defName != "ArachnaeBase_Race_Larva") continue;
|
||||
if (pawn.Downed || pawn.Dead) continue;
|
||||
if (pawn.Faction != parent.Faction) continue;
|
||||
@@ -235,9 +247,9 @@ namespace ArachnaeSwarm
|
||||
pawn.CurJobDef.defName != "Wait";
|
||||
if (isBusy) continue;
|
||||
|
||||
result.Add(pawn);
|
||||
return pawn;
|
||||
}
|
||||
return result;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void NotifyLarvaArrived(Pawn larva) { }
|
||||
@@ -254,6 +266,12 @@ namespace ArachnaeSwarm
|
||||
waitingOrder.qualityProgress = 0f;
|
||||
}
|
||||
assignedLarvae.Remove(larva);
|
||||
|
||||
// 自动呼叫下一只幼虫(如果还有等待订单)
|
||||
if (WaitingForLarvaCount > 0 && assignedLarvae.Count == 0)
|
||||
{
|
||||
CallOneLarva(false);
|
||||
}
|
||||
}
|
||||
|
||||
// === Tick 逻辑 ===
|
||||
@@ -261,7 +279,12 @@ namespace ArachnaeSwarm
|
||||
{
|
||||
base.CompTick();
|
||||
|
||||
assignedLarvae.RemoveAll(l => l == null || l.Dead || l.Destroyed);
|
||||
// 清理无效的幼虫:死亡、销毁、或不再执行来孵化器的任务
|
||||
assignedLarvae.RemoveAll(l =>
|
||||
l == null || l.Dead || l.Destroyed ||
|
||||
l.CurJobDef == null ||
|
||||
l.CurJobDef.defName != "ARA_OperateIncubator" ||
|
||||
l.CurJob?.targetA.Thing != parent);
|
||||
|
||||
bool hasFuel = (FuelComp?.Fuel ?? 10f) > 0.01f;
|
||||
|
||||
@@ -393,17 +416,28 @@ namespace ArachnaeSwarm
|
||||
};
|
||||
}
|
||||
|
||||
int needed = WaitingForLarvaCount - assignedLarvae.Count;
|
||||
if (needed > 0)
|
||||
// 呼叫幼虫按钮:只有没有幼虫在工作且有等待订单时显示
|
||||
if (WaitingForLarvaCount > 0 && assignedLarvae.Count == 0)
|
||||
{
|
||||
yield return new Command_Action
|
||||
{
|
||||
defaultLabel = $"呼叫幼虫 ({needed})",
|
||||
defaultDesc = $"呼叫 {needed} 只幼虫来激活等待中的订单",
|
||||
defaultLabel = $"呼叫幼虫",
|
||||
defaultDesc = $"呼叫一只幼虫来激活下一个订单(还有{WaitingForLarvaCount}个等待中)",
|
||||
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_CallLarva", false),
|
||||
action = CallLarvae
|
||||
};
|
||||
}
|
||||
else if (WaitingForLarvaCount > 0 && assignedLarvae.Count > 0)
|
||||
{
|
||||
// 显示幼虫正在工作的状态
|
||||
yield return new Command_Action
|
||||
{
|
||||
defaultLabel = "幼虫工作中",
|
||||
defaultDesc = $"一只幼虫正在操作孵化器(还有{WaitingForLarvaCount}个订单等待)",
|
||||
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_CallLarva", false),
|
||||
Disabled = true
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowOrderMenuPublic() => ShowOrderMenu();
|
||||
|
||||
Reference in New Issue
Block a user