This commit is contained in:
Tourswen
2026-02-28 00:03:51 +08:00
parent 5d2f824140
commit 60cde0317d
11 changed files with 32 additions and 105 deletions

View File

@@ -344,6 +344,20 @@
<basePowerConsumption>-2000</basePowerConsumption>
<transmitsPower>true</transmitsPower>
</li>
<li Class="CompProperties_Shuttle" />
<li Class="CompProperties_Transporter">
<massCapacity>2000</massCapacity>
<max1PerGroup>true</max1PerGroup>
<canChangeAssignedThingsAfterStarting>true</canChangeAssignedThingsAfterStarting>
<showOverallStats>false</showOverallStats>
<pawnLoadedSound>Shuttle_PawnLoaded</pawnLoadedSound>
<pawnExitSound>Shuttle_PawnExit</pawnExitSound>
</li>
<li Class="CompProperties_AmbientSound">
<sound>ShuttleIdle_Ambience</sound>
</li>
</comps>
<modExtensions>
<li Class="WulaFallenEmpire.PocketMapProperties">

View File

@@ -427,8 +427,6 @@
<building>
<destroySound>BuildingDestroyed_Metal_Small</destroySound>
<turretBurstCooldownTime>3.5</turretBurstCooldownTime>
<claimable>false</claimable>
<ai_combatDangerous>true</ai_combatDangerous>
<turretGunDef>WULA_Cat_Bunker_TurretGun</turretGunDef>
<claimable>false</claimable>
</building>

View File

@@ -322,7 +322,7 @@
<AreaDamageEnabled>区域伤害:已启用</AreaDamageEnabled>
<AreaDamageDisabled>区域伤害:已禁用</AreaDamageDisabled>
<WULA_SwitchWeapon>更换武器</WULA_SwitchWeapon>
<WULA_SwitchWeapon>重置武器</WULA_SwitchWeapon>
<WULA_SwitchWeapon_Desc>扔掉当前武器,并装备该单位的初始武器</WULA_SwitchWeapon_Desc>
<WULA_WeaponSwitched>{0} 更换了武器为 {1}</WULA_WeaponSwitched>
<WULA_NoWeaponAvailable>{0} 没有可用的武器类型</WULA_NoWeaponAvailable>

View File

@@ -265,4 +265,13 @@
<Wula_FocusFireDesc>命令该单位所有的炮塔攻击指定目标。如果目标不处于某个炮塔的攻击范围或者无法攻击到目标,则其依然会自行索敌。</Wula_FocusFireDesc>
<Wula_ClearFocus>清除目标</Wula_ClearFocus>
<Wula_ClearFocusDesc>清除指定的集中攻击目标,各炮塔将自行索敌。</Wula_ClearFocusDesc>
<Wula_Transform>更换装备</Wula_Transform>
<Wula_TransformDesc>更换乌拉猫猫的装备,使其可以承担不同的工作。\n\n更换装备的预制件装载在乌拉猫猫地堡中下达更换指令后乌拉猫猫会去寻找最近的地堡进行装备更换。</Wula_TransformDesc>
<Wula_NoGatherBuilding>没有可以抵达的乌拉猫猫地堡</Wula_NoGatherBuilding>
<Wula_NoSpawnSpace>没有可用位置</Wula_NoSpawnSpace>
<Wula_GatherCats>猫猫集合!</Wula_GatherCats>
<Wula_GatherCatsDesc>使地堡发出号召,让地图上所有的乌拉猫猫自动进入征召状态并聚集到该地堡附近。</Wula_GatherCatsDesc>
<Wula_GatherCooldown>集合能力冷却中</Wula_GatherCooldown>
<Wula_BuildingBroken>地堡被停用,无法进行集结征召</Wula_BuildingBroken>
</LanguageData>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

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

View File

@@ -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)
{

View File

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

View File

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