This commit is contained in:
Tourswen
2025-11-26 02:39:35 +08:00
7 changed files with 107 additions and 18 deletions

View File

@@ -56,7 +56,7 @@
<defName>WULA_Colony_License_LV1_Technology</defName> <defName>WULA_Colony_License_LV1_Technology</defName>
<label>乌拉帝国殖民地许可等级1</label> <label>乌拉帝国殖民地许可等级1</label>
<description>乌拉帝国的第一阶殖民地许可,代表此殖民地正式被乌拉帝国承认为其下辖殖民地之一。许可不会为殖民地带来什么好处,但是提升许可是继续研究乌拉帝国科技的重要条件。</description> <description>乌拉帝国的第一阶殖民地许可,代表此殖民地正式被乌拉帝国承认为其下辖殖民地之一。许可不会为殖民地带来什么好处,但是提升许可是继续研究乌拉帝国科技的重要条件。</description>
<baseCost>10000</baseCost> <baseCost>1000</baseCost>
<researchViewX>0.00</researchViewX> <researchViewX>0.00</researchViewX>
<researchViewY>3.20</researchViewY> <researchViewY>3.20</researchViewY>
<techprintCount>1</techprintCount> <techprintCount>1</techprintCount>
@@ -118,7 +118,7 @@
<defName>WULA_Colony_License_LV2_Technology</defName> <defName>WULA_Colony_License_LV2_Technology</defName>
<label>乌拉帝国殖民地许可等级2</label> <label>乌拉帝国殖民地许可等级2</label>
<description>乌拉帝国的第二阶殖民地许可,代表此殖民地已经被乌拉帝国赋予更多特权,许可不会为殖民地带来什么好处,但是提升许可是继续研究乌拉帝国科技的重要条件。\n\n要获得许可你需要建造&lt;color=#6BB7B7>&lt;i>乌拉帝国作业通讯台&lt;/i>&lt;/color>,指派一名殖民者联系乌拉帝国行星封锁机关的长官,并开启审查流程任务,任务完成后将给予此许可。</description> <description>乌拉帝国的第二阶殖民地许可,代表此殖民地已经被乌拉帝国赋予更多特权,许可不会为殖民地带来什么好处,但是提升许可是继续研究乌拉帝国科技的重要条件。\n\n要获得许可你需要建造&lt;color=#6BB7B7>&lt;i>乌拉帝国作业通讯台&lt;/i>&lt;/color>,指派一名殖民者联系乌拉帝国行星封锁机关的长官,并开启审查流程任务,任务完成后将给予此许可。</description>
<baseCost>15000</baseCost> <baseCost>1500</baseCost>
<researchViewX>4.00</researchViewX> <researchViewX>4.00</researchViewX>
<researchViewY>3.20</researchViewY> <researchViewY>3.20</researchViewY>
<techprintCount>1</techprintCount> <techprintCount>1</techprintCount>
@@ -180,7 +180,7 @@
<defName>WULA_Colony_License_LV3_Technology</defName> <defName>WULA_Colony_License_LV3_Technology</defName>
<label>乌拉帝国殖民地许可等级3</label> <label>乌拉帝国殖民地许可等级3</label>
<description>乌拉帝国的第一阶殖民地许可,代表此殖民地已经被乌拉帝国赋予更多特权,许可不会为殖民地带来什么好处,但是提升许可是继续研究乌拉帝国科技的重要条件。</description> <description>乌拉帝国的第一阶殖民地许可,代表此殖民地已经被乌拉帝国赋予更多特权,许可不会为殖民地带来什么好处,但是提升许可是继续研究乌拉帝国科技的重要条件。</description>
<baseCost>20000</baseCost> <baseCost>2000</baseCost>
<researchViewX>8.00</researchViewX> <researchViewX>8.00</researchViewX>
<researchViewY>3.20</researchViewY> <researchViewY>3.20</researchViewY>
<techprintCount>1</techprintCount> <techprintCount>1</techprintCount>

View File

@@ -137,6 +137,10 @@
<def>StartingResearch</def> <def>StartingResearch</def>
<project>WULA_Colony_License_LV1_Technology</project> <project>WULA_Colony_License_LV1_Technology</project>
</li> </li>
<li Class="ScenPart_StartingResearch">
<def>StartingResearch</def>
<project>WULA_Structure_Technology</project>
</li>
<li Class="ScenPart_StartingResearch"> <li Class="ScenPart_StartingResearch">
<def>StartingResearch</def> <def>StartingResearch</def>
<project>BasicMechtech</project> <project>BasicMechtech</project>

View File

@@ -100,5 +100,18 @@
<WULA_AutonomousMech>自主机械体</WULA_AutonomousMech> <WULA_AutonomousMech>自主机械体</WULA_AutonomousMech>
<WULA_WorkMode_AutoFight>自动战斗</WULA_WorkMode_AutoFight> <WULA_WorkMode_AutoFight>自动战斗</WULA_WorkMode_AutoFight>
<WULA_WorkMode_AutoFight_Desc>切换到自动战斗模式 - 机械将自动寻找并攻击敌人</WULA_WorkMode_AutoFight_Desc> <WULA_WorkMode_AutoFight_Desc>切换到自动战斗模式 - 机械将自动寻找并攻击敌人</WULA_WorkMode_AutoFight_Desc>
<!-- CompSkyfallerCaller -->
<WULA_ToggleAutoCallSkyfaller>切换自动召唤</WULA_ToggleAutoCallSkyfaller>
<WULA_ToggleAutoCallSkyfallerDesc>启用或禁用所有信标的自动空投功能。启用后,信标在建造完成后会立即自动呼叫空投。</WULA_ToggleAutoCallSkyfallerDesc>
<WULA_AutoCallEnabled>自动空投已启用。</WULA_AutoCallEnabled>
<WULA_AutoCallDisabled>自动空投已禁用。</WULA_AutoCallDisabled>
<!-- ITab_GlobalBills -->
<WULA_Equipment>装备</WULA_Equipment>
<WULA_Weapon>武器</WULA_Weapon>
<WULA_Mechanoid>机械体</WULA_Mechanoid>
<WULA_SelectCategoryFirst>请先选择一个分类</WULA_SelectCategoryFirst>
<WULA_GatheringMaterials>正在收集材料</WULA_GatheringMaterials>
<WULA_Paused>已暂停</WULA_Paused>
</LanguageData> </LanguageData>

View File

@@ -9,6 +9,9 @@ namespace WulaFallenEmpire
public bool destroyBuilding = true; public bool destroyBuilding = true;
public int delayTicks = 0; public int delayTicks = 0;
public bool canAutoCall = true; // 默认启用自动召唤
public int autoCallDelayTicks = 600; // 默认10秒
// 新增:是否需要 FlyOver 作为前提条件 // 新增:是否需要 FlyOver 作为前提条件
public bool requireFlyOver = false; // 默认不需要 FlyOver public bool requireFlyOver = false; // 默认不需要 FlyOver

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using RimWorld; using RimWorld;
using RimWorld.Planet;
using UnityEngine; using UnityEngine;
using Verse; using Verse;
using Verse.AI; using Verse.AI;
@@ -11,6 +12,19 @@ namespace WulaFallenEmpire
{ {
private CompProperties_SkyfallerCaller Props => (CompProperties_SkyfallerCaller)props; private CompProperties_SkyfallerCaller Props => (CompProperties_SkyfallerCaller)props;
private WulaSkyfallerWorldComponent _worldComponent;
private WulaSkyfallerWorldComponent WorldComp
{
get
{
if (_worldComponent == null)
{
_worldComponent = Find.World.GetComponent<WulaSkyfallerWorldComponent>();
}
return _worldComponent;
}
}
private bool used = false; private bool used = false;
private int callTick = -1; private int callTick = -1;
private bool calling = false; private bool calling = false;
@@ -138,6 +152,15 @@ namespace WulaFallenEmpire
} }
} }
public override void PostSpawnSetup(bool respawningAfterLoad)
{
base.PostSpawnSetup(respawningAfterLoad);
if (!respawningAfterLoad && Props.canAutoCall && WorldComp.AutoCallSkyfaller && CanCallSkyfaller)
{
CallSkyfaller(true);
}
}
public override void PostExposeData() public override void PostExposeData()
{ {
base.PostExposeData(); base.PostExposeData();
@@ -156,7 +179,7 @@ namespace WulaFallenEmpire
} }
} }
public void CallSkyfaller() public void CallSkyfaller(bool isAutoCall = false)
{ {
if (!CanCallSkyfaller) if (!CanCallSkyfaller)
{ {
@@ -183,15 +206,16 @@ namespace WulaFallenEmpire
calling = true; calling = true;
used = true; used = true;
callTick = Find.TickManager.TicksGame + Props.delayTicks; int delay = isAutoCall ? Props.autoCallDelayTicks : Props.delayTicks;
callTick = Find.TickManager.TicksGame + delay;
if (Props.delayTicks <= 0) if (delay <= 0)
{ {
ExecuteSkyfallerCall(); ExecuteSkyfallerCall();
} }
else else
{ {
Messages.Message("WULA_SkyfallerIncoming".Translate(Props.delayTicks.ToStringTicksToPeriod()), parent, MessageTypeDefOf.ThreatBig); Messages.Message("WULA_SkyfallerIncoming".Translate(delay.ToStringTicksToPeriod()), parent, MessageTypeDefOf.ThreatBig);
} }
} }
@@ -253,19 +277,42 @@ namespace WulaFallenEmpire
foreach (var gizmo in base.CompGetGizmosExtra()) foreach (var gizmo in base.CompGetGizmosExtra())
yield return gizmo; yield return gizmo;
if (!CanCall) if (CanCall)
yield break;
Command_Action callCommand = new Command_Action
{ {
defaultLabel = "WULA_CallSkyfaller".Translate(), Command_Action callCommand = new Command_Action
defaultDesc = GetCallDescription(), {
icon = ContentFinder<Texture2D>.Get("Wula/UI/Commands/WULA_DropBuilding"), defaultLabel = "WULA_CallSkyfaller".Translate(),
action = CallSkyfaller, defaultDesc = GetCallDescription(),
disabledReason = GetDisabledReason() icon = ContentFinder<Texture2D>.Get("Wula/UI/Commands/WULA_DropBuilding"),
}; action = () => CallSkyfaller(false),
disabledReason = GetDisabledReason()
};
yield return callCommand;
}
yield return callCommand; if (Props.canAutoCall)
{
Command_Toggle toggleAutoCall = new Command_Toggle
{
defaultLabel = "WULA_ToggleAutoCallSkyfaller".Translate(),
defaultDesc = "WULA_ToggleAutoCallSkyfallerDesc".Translate(),
icon = ContentFinder<Texture2D>.Get("Wula/UI/Commands/WULA_DropBuilding"),
isActive = () => WorldComp.AutoCallSkyfaller,
toggleAction = () =>
{
WorldComp.AutoCallSkyfaller = !WorldComp.AutoCallSkyfaller;
if (WorldComp.AutoCallSkyfaller)
{
Messages.Message("WULA_AutoCallEnabled".Translate(), MessageTypeDefOf.PositiveEvent);
}
else
{
Messages.Message("WULA_AutoCallDisabled".Translate(), MessageTypeDefOf.NegativeEvent);
}
}
};
yield return toggleAutoCall;
}
} }
private string GetCallDescription() private string GetCallDescription()

View File

@@ -0,0 +1,21 @@
using RimWorld.Planet;
using Verse;
namespace WulaFallenEmpire
{
public class WulaSkyfallerWorldComponent : WorldComponent
{
// 默认为 true即自动召唤
public bool AutoCallSkyfaller = true;
public WulaSkyfallerWorldComponent(World world) : base(world)
{
}
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref AutoCallSkyfaller, "AutoCallSkyfaller", true);
}
}
}

View File

@@ -116,6 +116,7 @@
<Compile Include="BuildingComp\WULA_Shuttle\PocketSpaceThingHolder.cs" /> <Compile Include="BuildingComp\WULA_Shuttle\PocketSpaceThingHolder.cs" />
<Compile Include="BuildingComp\WULA_SkyfallerCaller\CompProperties_SkyfallerCaller.cs" /> <Compile Include="BuildingComp\WULA_SkyfallerCaller\CompProperties_SkyfallerCaller.cs" />
<Compile Include="BuildingComp\WULA_SkyfallerCaller\CompSkyfallerCaller.cs" /> <Compile Include="BuildingComp\WULA_SkyfallerCaller\CompSkyfallerCaller.cs" />
<Compile Include="BuildingComp\WULA_SkyfallerCaller\WulaSkyfallerWorldComponent.cs" />
<Compile Include="BuildingComp\WULA_StorageTurret\CompProperties_StorageTurret.cs" /> <Compile Include="BuildingComp\WULA_StorageTurret\CompProperties_StorageTurret.cs" />
<Compile Include="BuildingComp\WULA_StorageTurret\CompStorageTurret.cs" /> <Compile Include="BuildingComp\WULA_StorageTurret\CompStorageTurret.cs" />
<Compile Include="EventSystem\CompOpenCustomUI.cs" /> <Compile Include="EventSystem\CompOpenCustomUI.cs" />