1
This commit is contained in:
@@ -42,7 +42,7 @@ namespace WulaFallenEmpire
|
||||
|
||||
GenSpawn.Spawn(pawn, parent.Position, parent.Map, WipeMode.Vanish);
|
||||
|
||||
if (Props.initDrafted && pawn.drafter!=null)
|
||||
if (Props.initDrafted && pawn.Faction.IsPlayer && pawn.drafter!=null)
|
||||
pawn.drafter.Drafted = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,21 +135,6 @@ namespace WulaFallenEmpire
|
||||
|
||||
// 生成新的Pawn
|
||||
GenSpawn.Spawn(newPawn, position, map);
|
||||
|
||||
// 为新Pawn添加AutonomousCat组件(如果还没有)
|
||||
EnsureAutonomousCatComponent(newPawn);
|
||||
|
||||
// 显示消息
|
||||
Messages.Message(
|
||||
"Wula_TransformComplete".Translate(originalPawn.LabelShort, newPawn.LabelShort),
|
||||
MessageTypeDefOf.PositiveEvent
|
||||
);
|
||||
|
||||
// 记录日志
|
||||
if (Prefs.DevMode)
|
||||
{
|
||||
Log.Message($"[CompGather] Transformation complete: {originalPawn.LabelShort} -> {newPawn.LabelShort}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -157,34 +142,6 @@ namespace WulaFallenEmpire
|
||||
}
|
||||
}
|
||||
|
||||
// 确保新Pawn有AutonomousCat组件
|
||||
private void EnsureAutonomousCatComponent(Pawn newPawn)
|
||||
{
|
||||
// 检查是否已经有AutonomousCat组件
|
||||
if (newPawn.TryGetComp<Comp_AutonomousCat>() != null)
|
||||
return;
|
||||
|
||||
// 检查Pawn的定义中是否有AutonomousCat组件
|
||||
var compProps = newPawn.def.comps?.Find(c => c.compClass == typeof(Comp_AutonomousCat)) as CompProperties_AutonomousCat;
|
||||
if (compProps == null)
|
||||
{
|
||||
// 如果没有,添加一个默认的AutonomousCat组件
|
||||
newPawn.AllComps.Add(new Comp_AutonomousCat()
|
||||
{
|
||||
parent = newPawn,
|
||||
props = new CompProperties_AutonomousCat()
|
||||
{
|
||||
autoDraftOnGather = true
|
||||
}
|
||||
});
|
||||
|
||||
if (Prefs.DevMode)
|
||||
{
|
||||
Log.Message($"[CompGather] Added AutonomousCat component to {newPawn.LabelShort}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Gizmo显示
|
||||
public override IEnumerable<Gizmo> CompGetGizmosExtra()
|
||||
{
|
||||
@@ -210,7 +167,7 @@ namespace WulaFallenEmpire
|
||||
cachedGizmo = new Command_Action();
|
||||
cachedGizmo.defaultLabel = "Wula_GatherCats".Translate();
|
||||
cachedGizmo.defaultDesc = "Wula_GatherCatsDesc".Translate();
|
||||
cachedGizmo.icon = ContentFinder<Texture2D>.Get("UI/Gizmos/GatherCats", false) ?? BaseContent.BadTex;
|
||||
cachedGizmo.icon = ContentFinder<Texture2D>.Get("Wula/UI/Commands/Wula_GatherCats", false) ?? BaseContent.BadTex;
|
||||
cachedGizmo.action = StartGathering;
|
||||
|
||||
// 添加冷却时间显示
|
||||
@@ -255,10 +212,7 @@ namespace WulaFallenEmpire
|
||||
|
||||
// 查找并命令范围内的 Autonomous Cats
|
||||
GatherAutonomousCats();
|
||||
|
||||
// 显示消息
|
||||
Messages.Message("Wula_GatheringStarted".Translate(), MessageTypeDefOf.PositiveEvent);
|
||||
|
||||
|
||||
// 刷新Gizmo状态
|
||||
cachedGizmo.disabledReason = GetDisabledReason();
|
||||
}
|
||||
@@ -295,15 +249,6 @@ namespace WulaFallenEmpire
|
||||
{
|
||||
CommandCatToGather(cat);
|
||||
}
|
||||
|
||||
// 报告召集数量
|
||||
if (autonomousCats.Count > 0)
|
||||
{
|
||||
Messages.Message(
|
||||
"Wula_CatsGathered".Translate(autonomousCats.Count),
|
||||
MessageTypeDefOf.NeutralEvent
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 命令单个 Autonomous Cat
|
||||
@@ -340,12 +285,6 @@ namespace WulaFallenEmpire
|
||||
|
||||
cat.jobs.StartJob(job, JobCondition.InterruptForced);
|
||||
}
|
||||
|
||||
// 记录日志
|
||||
if (Prefs.DevMode)
|
||||
{
|
||||
Log.Message($"[CompGather] Cat {cat.LabelShort} commanded to gather at {parent.Position}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -83,12 +83,6 @@ namespace WulaFallenEmpire
|
||||
{
|
||||
CreateGatherJob(pawn, target);
|
||||
}
|
||||
|
||||
// 记录日志
|
||||
if (Prefs.DevMode)
|
||||
{
|
||||
Log.Message($"[CompAutonomousCat] {pawn.LabelShort} responding to gather call from {target?.LabelShort ?? "unknown"}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -152,18 +146,6 @@ namespace WulaFallenEmpire
|
||||
// 清除当前任务并开始新任务
|
||||
pawn.jobs.StopAll();
|
||||
pawn.jobs.StartJob(job, JobCondition.InterruptForced);
|
||||
|
||||
// 显示消息
|
||||
Messages.Message(
|
||||
"Wula_TransformStarted".Translate(pawn.LabelShort, targetPawnKind.label),
|
||||
MessageTypeDefOf.NeutralEvent
|
||||
);
|
||||
|
||||
// 记录日志
|
||||
if (Prefs.DevMode)
|
||||
{
|
||||
Log.Message($"[CompAutonomousCat] {pawn.LabelShort} starting transformation to {targetPawnKind.label}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -314,12 +296,6 @@ namespace WulaFallenEmpire
|
||||
|
||||
if (cachedTransformGizmo != null)
|
||||
{
|
||||
// 如果已有待处理的转化,显示不同图标或状态
|
||||
if (pendingTransformTarget != null)
|
||||
{
|
||||
cachedTransformGizmo.disabledReason = "Wula_TransformPending".Translate(pendingTransformTarget.label);
|
||||
}
|
||||
|
||||
yield return cachedTransformGizmo;
|
||||
}
|
||||
}
|
||||
@@ -333,7 +309,7 @@ namespace WulaFallenEmpire
|
||||
cachedTransformGizmo = new Command_Action();
|
||||
cachedTransformGizmo.defaultLabel = "Wula_Transform".Translate();
|
||||
cachedTransformGizmo.defaultDesc = "Wula_TransformDesc".Translate();
|
||||
cachedTransformGizmo.icon = ContentFinder<Texture2D>.Get("UI/Gizmos/Transform", false) ?? BaseContent.BadTex;
|
||||
cachedTransformGizmo.icon = ContentFinder<Texture2D>.Get("Wula/UI/Commands/WULA_ConvertMechanoids", false) ?? BaseContent.BadTex;
|
||||
cachedTransformGizmo.action = () => ShowTransformMenu();
|
||||
|
||||
// 设置热键
|
||||
@@ -359,13 +335,6 @@ namespace WulaFallenEmpire
|
||||
));
|
||||
}
|
||||
|
||||
// 添加取消选项
|
||||
options.Add(new FloatMenuOption(
|
||||
"Cancel".Translate(),
|
||||
null,
|
||||
MenuOptionPriority.Default
|
||||
));
|
||||
|
||||
Find.WindowStack.Add(new FloatMenu(options));
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@ namespace WulaFallenEmpire
|
||||
public override bool TryMakePreToilReservations(bool errorOnFailed)
|
||||
{
|
||||
// 预留目标建筑
|
||||
if (!pawn.Reserve(job.targetA, job, 1, -1, null, errorOnFailed))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//if (!pawn.Reserve(job.targetA, job, 1, -1, null, errorOnFailed))
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ namespace WulaFallenEmpire
|
||||
// 确保可以转化
|
||||
if (!gatherComp.CanTransformPawn(pawn))
|
||||
{
|
||||
Messages.Message("Wula_CannotTransformHere".Translate(), MessageTypeDefOf.RejectInput);
|
||||
ReadyForNextToil();
|
||||
return;
|
||||
}
|
||||
@@ -113,7 +112,6 @@ namespace WulaFallenEmpire
|
||||
var targetPawnKind = PawnComp?.PendingTransformTarget;
|
||||
if (targetPawnKind == null)
|
||||
{
|
||||
Messages.Message("Wula_NoTransformTarget".Translate(), MessageTypeDefOf.RejectInput);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user