diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll
index c6967967..09147844 100644
Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ
diff --git a/1.6/1.6/Defs/ResearchProjectDefs/WULA_ResearchProjects_Remake.xml b/1.6/1.6/Defs/ResearchProjectDefs/WULA_ResearchProjects_Remake.xml
index eb0f5ff3..a85d1c91 100644
--- a/1.6/1.6/Defs/ResearchProjectDefs/WULA_ResearchProjects_Remake.xml
+++ b/1.6/1.6/Defs/ResearchProjectDefs/WULA_ResearchProjects_Remake.xml
@@ -422,6 +422,20 @@
WULA_Colony_License_LV2_Technology
+
+ Wula_Mech_Mobile_Shield_Teleporter_Technology
+ 10.00
+ 5.60
+
+ 允许殖民地使用MSm-8"放射盾"内置的传送器,机械乌拉在其覆盖范围内,处于征召状态下进行常规移动时,会以瞬间传送代替步行。
+ 800
+
+ Wula_Mech_Mobile_Shield_Technology
+
+
+ WULA_Colony_License_LV3_Technology
+
+
WULA_Mech_Mobile_Factory_Technology
9.00
diff --git a/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Mech_Buildings.xml b/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Mech_Buildings.xml
index 79627ca5..714db802 100644
--- a/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Mech_Buildings.xml
+++ b/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Mech_Buildings.xml
@@ -43,7 +43,7 @@
1
- 1
+ 0
1
0
@@ -155,7 +155,7 @@
1
- 1
+ 0
1
0
@@ -230,7 +230,7 @@
清理出一块场地并准备好资源,使得乌拉帝国母舰可以向此处投放大型战争机械。建造好的信标可以收起或移至他处。\n\n放射盾是乌拉帝国的中型战争机械,常被用于镇压异族聚居地的暴动。它形状非常奇怪,根本分不出头在哪,但是不要因此小瞧这个机械体——它能释放强大的立场盾,在很大一片区域内反射大量炮火,并且机体放射出来的辐射会严重地杀伤进入反射盾范围内的敌人。在相关许可开放后,它甚至可以支持机械乌拉使用其内置的相位场进行区域传送。
Wula/Things/WULA_Mobile_Shield/WULA_Mobile_Shield_Incoming
- 1.33
+ 1
(0, -0.1)
MinifiedThing
Normal
@@ -267,7 +267,7 @@
1
- 1
+ 0
1
0
@@ -372,7 +372,7 @@
1
- 1
+ 0
1
0
diff --git a/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Misc_Buildings.xml b/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Misc_Buildings.xml
index 59ef4a03..fd2ffafc 100644
--- a/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Misc_Buildings.xml
+++ b/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Misc_Buildings.xml
@@ -701,7 +701,7 @@
5000
true
- WULA_Buildings
+
Normal
true
true
diff --git a/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Turret_Buildings.xml b/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Turret_Buildings.xml
index 13a679a5..e719d0e3 100644
--- a/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Turret_Buildings.xml
+++ b/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Turret_Buildings.xml
@@ -147,7 +147,7 @@
Light
500
- 1
+ 0
20
0
@@ -291,7 +291,7 @@
1
- 1
+ 0
1
0
@@ -567,7 +567,7 @@
1
- 1
+ 0
1
0
@@ -856,7 +856,7 @@
1
- 1
+ 0
1
0
diff --git a/1.6/1.6/Defs/ThingDefs_Misc/Apperals/WULA_Apparel.xml b/1.6/1.6/Defs/ThingDefs_Misc/Apperals/WULA_Apparel.xml
index 998851e3..7e9914af 100644
--- a/1.6/1.6/Defs/ThingDefs_Misc/Apperals/WULA_Apparel.xml
+++ b/1.6/1.6/Defs/ThingDefs_Misc/Apperals/WULA_Apparel.xml
@@ -528,7 +528,7 @@
300
- 100
+ 10
500
@@ -558,9 +558,10 @@
1
3
- 250
+ 0
- 8
+ 100
+ 8
@@ -623,9 +624,10 @@
Wula/Apparel/WULA_Assault_Troop_Helmet
- 50
+ 0
- 1
+ 30
+ 1
diff --git a/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml b/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml
index 2915ac59..cbae5b03 100644
--- a/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml
+++ b/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml
@@ -1446,8 +1446,8 @@
15
30
- Wula_Dark_Matter_Beam
- 15
+ Flame
+ 8
false
false
false
@@ -1456,12 +1456,12 @@
false
false
热辐射
- MSm-8"放射盾"可以打开外壳,蒸发胆敢靠近其的敌军——这同时会使得它伤害附近所有的散落物品。
+ MSm-8"放射盾"可以打开外壳,蒸发胆敢进入反射立场内的敌军——这同时会使得它伤害附近所有的散落物品。
Wula/UI/Commands/Wula_Psi_Titan_AreaDamage
- 20
+ 15
60
@@ -1472,6 +1472,9 @@
Skip_Entry
Skip_Exit
Psycast_Skip_Entry
+
+ true
+ Wula_Mech_Mobile_Shield_Teleporter_Technology
diff --git a/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/Misc_Gameplay.xml b/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/Misc_Gameplay.xml
index 389f13bf..dfe810f0 100644
--- a/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/Misc_Gameplay.xml
+++ b/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/Misc_Gameplay.xml
@@ -343,4 +343,12 @@
目标距离过近(最小距离:{0}格)
没有视线到目标
无法拉取该目标
+
+
+ 传送器已启用
+ 传送器已禁用
+ 启用传送器
+ 启用区域传送功能,允许机械乌拉在其覆盖范围内以传送代替常规移动。
+ 禁用传送器
+ 禁用区域传送功能,在其附近的机械乌拉使用常规移动而非传送。
\ No newline at end of file
diff --git a/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/WULA_Keyed.xml b/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/WULA_Keyed.xml
index 166c7bc0..9d2888b9 100644
--- a/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/WULA_Keyed.xml
+++ b/1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/WULA_Keyed.xml
@@ -116,7 +116,7 @@
所需材料:
- 轨道信标范围内材料不足
+ -乌拉轨道输送信标-范围内材料不足。你需要建造乌拉轨道输送信标,并在其信号范围内放置足够的材料,建造时这些材料会被自动提交给帝国舰队。
取消呼叫
diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_MechanoidRecycler/JobDriver_RecycleMechanoid.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_MechanoidRecycler/JobDriver_RecycleMechanoid.cs
index 3d76ba65..9bc46b06 100644
--- a/Source/WulaFallenEmpire/BuildingComp/WULA_MechanoidRecycler/JobDriver_RecycleMechanoid.cs
+++ b/Source/WulaFallenEmpire/BuildingComp/WULA_MechanoidRecycler/JobDriver_RecycleMechanoid.cs
@@ -13,12 +13,93 @@ namespace WulaFallenEmpire
{
return pawn.Reserve(job.targetA, job, 1, -1, null, errorOnFailed);
}
-
+
+ ///
+ /// 更换武器逻辑
+ ///
+ private void SwitchWeapon()
+ {
+ if (pawn == null || pawn.Destroyed || !pawn.Spawned)
+ return;
+
+ try
+ {
+ // 1. 扔掉当前武器
+ ThingWithComps currentWeapon = pawn.equipment?.Primary;
+ if (currentWeapon != null)
+ {
+ // 将武器扔在地上
+ pawn.equipment.TryDropEquipment(currentWeapon, out ThingWithComps droppedWeapon, pawn.Position, true);
+ }
+
+ // 2. 从PawnKind允许的武器中生成新武器
+ ThingDef newWeaponDef = GetRandomWeaponFromPawnKind();
+ if (newWeaponDef != null)
+ {
+ // 生成新武器
+ Thing newWeapon = ThingMaker.MakeThing(newWeaponDef);
+ if (newWeapon is ThingWithComps newWeaponWithComps)
+ {
+ // 使用 AddEquipment 方法装备新武器
+ pawn.equipment.AddEquipment(newWeaponWithComps);
+
+ if (Prefs.DevMode)
+ {
+ Log.Message($"[CompAutonomousMech] {pawn.LabelCap} equipped new weapon: {newWeaponDef.LabelCap}");
+ }
+ }
+ }
+ }
+ catch (System.Exception ex)
+ {
+ Log.Error($"[CompAutonomousMech] Error switching weapon for {pawn?.LabelCap}: {ex}");
+ }
+ }
+
+ ///
+ /// 从PawnKind允许的武器中随机获取一个武器定义
+ ///
+ private ThingDef GetRandomWeaponFromPawnKind()
+ {
+ if (pawn.kindDef?.weaponTags == null || pawn.kindDef.weaponTags.Count == 0)
+ return null;
+
+ // 收集所有匹配的武器
+ List availableWeapons = new List();
+
+ foreach (string weaponTag in pawn.kindDef.weaponTags)
+ {
+ foreach (ThingDef thingDef in DefDatabase.AllDefs)
+ {
+ if (thingDef.IsWeapon && thingDef.weaponTags != null && thingDef.weaponTags.Contains(weaponTag))
+ {
+ availableWeapons.Add(thingDef);
+ }
+ }
+ }
+
+ if (availableWeapons.Count == 0)
+ return null;
+
+ // 随机选择一个武器
+ return availableWeapons.RandomElement();
+ }
+
protected override IEnumerable MakeNewToils()
{
+ // 关键修改:在任务开始时立即更换武器
+ yield return new Toil
+ {
+ initAction = () =>
+ {
+ SwitchWeapon();
+ },
+ defaultCompleteMode = ToilCompleteMode.Instant
+ };
+
// 前往回收器
yield return Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell);
-
+
// 进入回收器
yield return new Toil
{
diff --git a/Source/WulaFallenEmpire/ThingComp/WULA_AreaTeleporter/CompProperties_AreaTeleporter.cs b/Source/WulaFallenEmpire/ThingComp/WULA_AreaTeleporter/CompProperties_AreaTeleporter.cs
index 53152430..253f2bcc 100644
--- a/Source/WulaFallenEmpire/ThingComp/WULA_AreaTeleporter/CompProperties_AreaTeleporter.cs
+++ b/Source/WulaFallenEmpire/ThingComp/WULA_AreaTeleporter/CompProperties_AreaTeleporter.cs
@@ -23,10 +23,10 @@ namespace WulaFallenEmpire
public bool affectPrisoners = false;
public bool affectSlaves = false;
- // 传送设置 - 移除冷却时间
- public int checkIntervalTicks = 30; // 检查间隔
- public int stunTicks = 30; // 传送后眩晕时间
- public int maxPositionAdjustRadius = 5; // 最大位置调整半径
+ // 传送设置
+ public int checkIntervalTicks = 30;
+ public int stunTicks = 30;
+ public int maxPositionAdjustRadius = 5;
// 效果设置
public EffecterDef entryEffecter;
@@ -39,6 +39,14 @@ namespace WulaFallenEmpire
public ClamorDef destClamorType;
public float destClamorRadius = 2f;
+ // 新增:科技需求
+ public ResearchProjectDef requiredResearch;
+ public bool requireResearchToUse = false;
+
+ // 新增:开关控制
+ public bool canBeToggled = true;
+ public bool defaultEnabled = true;
+
public CompProperties_AreaTeleporter()
{
compClass = typeof(ThingComp_AreaTeleporter);
diff --git a/Source/WulaFallenEmpire/ThingComp/WULA_AreaTeleporter/ThingComp_AreaTeleporter.cs b/Source/WulaFallenEmpire/ThingComp/WULA_AreaTeleporter/ThingComp_AreaTeleporter.cs
index dc82d436..06ffdfbd 100644
--- a/Source/WulaFallenEmpire/ThingComp/WULA_AreaTeleporter/ThingComp_AreaTeleporter.cs
+++ b/Source/WulaFallenEmpire/ThingComp/WULA_AreaTeleporter/ThingComp_AreaTeleporter.cs
@@ -25,15 +25,27 @@ namespace WulaFallenEmpire
// 硬编码的工作排除表
private static readonly HashSet ExcludedJobs = new HashSet
{
- JobDefOf.GotoWander // 排除闲逛工作
+ JobDefOf.GotoWander
};
+ // 新增:开关状态
+ private bool enabled = true;
+
+ // 新增:初始化时设置默认状态
public override void Initialize(CompProperties props)
{
base.Initialize(props);
+ enabled = Props.defaultEnabled;
RegisterToNetwork();
}
+ // 新增:保存和加载开关状态
+ public override void PostExposeData()
+ {
+ base.PostExposeData();
+ Scribe_Values.Look(ref enabled, "teleporterEnabled", Props.defaultEnabled);
+ }
+
public override void PostSpawnSetup(bool respawningAfterLoad)
{
base.PostSpawnSetup(respawningAfterLoad);
@@ -52,12 +64,46 @@ namespace WulaFallenEmpire
UnregisterFromNetwork();
}
+ ///
+ /// 检查是否满足科技需求
+ ///
+ public bool HasRequiredResearch
+ {
+ get
+ {
+ // 如果没有设置科技需求,或者不要求科技,则返回true
+ if (Props.requiredResearch == null || !Props.requireResearchToUse)
+ return true;
+
+ // 检查科技是否已完成
+ return Props.requiredResearch.IsFinished;
+ }
+ }
+
+ ///
+ /// 检查是否应该显示传送器功能
+ ///
+ public bool ShouldDisplayFunctionality
+ {
+ get
+ {
+ // 如果拥有者是玩家,检查科技需求
+ if (parent.Faction == Faction.OfPlayer)
+ {
+ return HasRequiredResearch;
+ }
+
+ // 非玩家派系总是显示
+ return true;
+ }
+ }
+
///
/// 注册到网络
///
private void RegisterToNetwork()
{
- if (parent?.Map == null) return;
+ if (parent?.Map == null || !enabled || !ShouldDisplayFunctionality) return;
var map = parent.Map;
if (!teleporterNetworks.ContainsKey(map))
@@ -105,11 +151,12 @@ namespace WulaFallenEmpire
///
private bool IsPositionInNetworkRange(IntVec3 position)
{
- if (parent?.Map == null) return false;
+ if (parent?.Map == null || !enabled || !ShouldDisplayFunctionality) return false;
foreach (var teleporter in GetNetworkTeleporters())
{
if (teleporter.parent?.Spawned == true &&
+ teleporter.enabled && teleporter.ShouldDisplayFunctionality &&
position.DistanceTo(teleporter.parent.Position) <= teleporter.Props.teleportRadius)
{
return true;
@@ -123,7 +170,7 @@ namespace WulaFallenEmpire
///
private IntVec3 FindSafePositionInNetwork(IntVec3 preferredPosition, Pawn pawn)
{
- if (parent?.Map == null) return IntVec3.Invalid;
+ if (parent?.Map == null || !enabled || !ShouldDisplayFunctionality) return IntVec3.Invalid;
var map = parent.Map;
@@ -146,7 +193,8 @@ namespace WulaFallenEmpire
// 在整个网络范围内搜索安全位置
foreach (var teleporter in GetNetworkTeleporters())
{
- if (teleporter.parent?.Spawned != true) continue;
+ if (teleporter.parent?.Spawned != true || !teleporter.enabled || !teleporter.ShouldDisplayFunctionality)
+ continue;
var teleporterPos = teleporter.parent.Position;
var searchRadius = teleporter.Props.teleportRadius;
@@ -171,7 +219,7 @@ namespace WulaFallenEmpire
{
base.CompTick();
- if (parent == null || !parent.Spawned || parent.Map == null)
+ if (parent == null || !parent.Spawned || parent.Map == null || !enabled || !ShouldDisplayFunctionality)
return;
// 使用间隔检查优化性能
@@ -499,11 +547,61 @@ namespace WulaFallenEmpire
effecters.Clear();
}
+ // 新增:切换开关状态
+ private void ToggleEnabled()
+ {
+ bool oldEnabled = enabled;
+ enabled = !enabled;
+
+ if (oldEnabled != enabled)
+ {
+ if (enabled)
+ {
+ RegisterToNetwork();
+ Messages.Message("WULA_TeleporterEnabled".Translate(parent.Label), parent, MessageTypeDefOf.PositiveEvent);
+ }
+ else
+ {
+ UnregisterFromNetwork();
+ Messages.Message("WULA_TeleporterDisabled".Translate(parent.Label), parent, MessageTypeDefOf.NegativeEvent);
+ }
+
+ // 清理效果
+ CleanupAllEffects();
+ }
+ }
+
+ // 新增:获取Gizmos
+ public override IEnumerable CompGetGizmosExtra()
+ {
+ foreach (var gizmo in base.CompGetGizmosExtra())
+ {
+ yield return gizmo;
+ }
+
+ // 只有满足科技需求时才显示开关按钮
+ if (ShouldDisplayFunctionality && Props.canBeToggled)
+ {
+ yield return new Command_Toggle
+ {
+ defaultLabel = enabled ? "WULA_TeleporterDisable".Translate() : "WULA_TeleporterEnable".Translate(),
+ defaultDesc = enabled ? "WULA_TeleporterDisableDesc".Translate() : "WULA_TeleporterEnableDesc".Translate(),
+ icon = ContentFinder.Get("UI/Commands/Teleport"),
+ isActive = () => enabled,
+ toggleAction = ToggleEnabled
+ };
+ }
+ }
+
// 调试方法:显示传送范围
public override void PostDraw()
{
base.PostDraw();
+ // 只有满足科技需求且启用时才绘制范围
+ if (!ShouldDisplayFunctionality || !enabled)
+ return;
+
if (Find.Selector.IsSelected(parent))
{
try
@@ -514,7 +612,7 @@ namespace WulaFallenEmpire
// 绘制网络范围(所有传送器的范围)
foreach (var teleporter in GetNetworkTeleporters())
{
- if (teleporter != this && teleporter.parent.Spawned)
+ if (teleporter != this && teleporter.parent.Spawned && teleporter.enabled && teleporter.ShouldDisplayFunctionality)
{
GenDraw.DrawRadiusRing(teleporter.parent.Position, teleporter.Props.teleportRadius, new Color(0.3f, 0.7f, 1, 0.3f));
}
diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj
index d7a47803..962491da 100644
--- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj
+++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj
@@ -374,9 +374,7 @@
-
-
-
+