feat(GlobalWorkTable): 添加全局存储发射组件和相关属性

新增两个编译项用于支持全局工作台的物品投送功能,包括可发射至全局存储的组件及其属性配置。同时更新了项目工作区引用路径,移除了旧版依赖并引入新版资源库及模组框架。
```
This commit is contained in:
2025-11-04 14:45:08 +08:00
parent 7620add8e5
commit ffb2689ac6
8 changed files with 173 additions and 4 deletions

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<ThingDef ParentName="BuildingBase">
<defName>WULA_GlobalStorageSenderPod</defName>
<label>全局存储输送舱</label>
<description>一个一次性的物资输送装置,可以将装载的货物直接发射到全局存储网络中,而无需选择目标地点。发射后即告销毁。</description>
<graphicData>
<texPath>Things/Special/DropPod</texPath>
<graphicClass>Graphic_Single</graphicClass>
<drawSize>(2,2)</drawSize>
</graphicData>
<size>(1,1)</size>
<rotatable>false</rotatable>
<tickerType>Normal</tickerType>
<altitudeLayer>BuildingOnTop</altitudeLayer>
<passability>PassThroughOnly</passability>
<castEdgeShadows>false</castEdgeShadows>
<designationHotKey>Misc12</designationHotKey>
<fillPercent>0.5</fillPercent>
<designationCategory>WULA_Buildings</designationCategory>
<uiOrder>2201</uiOrder> <!-- Slightly after the original -->
<terrainAffordanceNeeded>Medium</terrainAffordanceNeeded>
<statBases>
<MaxHitPoints>250</MaxHitPoints>
<WorkToBuild>1600</WorkToBuild>
<Flammability>0.5</Flammability>
</statBases>
<costList>
<Steel>60</Steel>
<ComponentIndustrial>1</ComponentIndustrial>
</costList>
<comps>
<li Class="CompProperties_Transporter">
<massCapacity>300</massCapacity>
<restEffectiveness>0.8</restEffectiveness>
<canChangeAssignedThingsAfterStarting>true</canChangeAssignedThingsAfterStarting>
</li>
<li Class="WulaFallenEmpire.CompProperties_Launchable_ToGlobalStorage">
<skyfallerLeaving>DropPodLeaving</skyfallerLeaving>
<requiresFuelingPort>false</requiresFuelingPort>
</li>
</comps>
<inspectorTabs>
<li>ITab_ContentsTransporter</li>
</inspectorTabs>
<placeWorkers>
<li>PlaceWorker_NotUnderRoof</li>
</placeWorkers>
<researchPrerequisites>
<li>TransportPod</li>
</researchPrerequisites>
<constructionSkillPrerequisite>6</constructionSkillPrerequisite>
<uiIconScale>0.65</uiIconScale>
</ThingDef>
</Defs>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<LanguageData>
<WULA_GlobalStorageSenderPod.label>全局存储输送舱</WULA_GlobalStorageSenderPod.label>
<WULA_GlobalStorageSenderPod.description>一个一次性的物资输送装置,可以将装载的货物直接发射到全局存储网络中,而无需选择目标地点。发射后即告销毁。</WULA_GlobalStorageSenderPod.description>
</LanguageData>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<LanguageData>
<WULA_LaunchToGlobalStorage>发射到全局存储</WULA_LaunchToGlobalStorage>
<WULA_LaunchToGlobalStorageDesc>将此输送舱中的所有物品直接发送到全局存储网络中。此操作将消耗燃料并销毁输送舱。</WULA_LaunchToGlobalStorageDesc>
<WULA_ItemsSentToGlobalStorage>已将 {0} 发送到全局存储。</WULA_ItemsSentToGlobalStorage>
<WULA_NoItemsToSendToGlobalStorage>输送舱是空的,没有什么可以发送的。</WULA_NoItemsToSendToGlobalStorage>
</LanguageData>

View File

@@ -17,14 +17,16 @@
"path": "../../../../../../../../Users/Kalo/Downloads/AlienRaces/Source/AlienRace/AlienRace"
},
{
"name": "3256974620",
"path": "../../../../../../workshop/content/294100/3256974620"
"path": "../../../../../../workshop/content/294100/3565275325/Source/SRALib/SRALib"
},
{
"path": "../../../../../../workshop/content/294100/3256974620/1.6/Assemblies/Milira"
"path": "../../../../../../workshop/content/294100/3575567766"
},
{
"path": "../../../../../../workshop/content/294100/3240244292"
"path": "../../../../../../../../Users/Kalo/Downloads/MechsuitFramework-main"
},
{
"path": "../../../../../../workshop/content/294100/3226701491/1.6/Assemblies/BM_PowerArmor"
}
],
"settings": {}

View File

@@ -0,0 +1,76 @@
using RimWorld;
using System.Collections.Generic;
using UnityEngine;
using Verse;
using Verse.Sound;
namespace WulaFallenEmpire
{
public class CompLaunchable_ToGlobalStorage : CompLaunchable_TransportPod
{
public new CompProperties_Launchable_ToGlobalStorage Props => (CompProperties_Launchable_ToGlobalStorage)this.props;
public override IEnumerable<Gizmo> CompGetGizmosExtra()
{
// 移除原有的发射按钮,替换为我们自己的
foreach (Gizmo gizmo in base.CompGetGizmosExtra())
{
if (gizmo is Command_Action launchCommand && (launchCommand.defaultDesc == "CommandLaunchGroupDesc".Translate() || launchCommand.defaultDesc == "CommandLaunchSingleDesc".Translate()))
{
continue; // 跳过原版的发射按钮
}
yield return gizmo;
}
if (this.Transporter.LoadingInProgressOrReadyToLaunch)
{
Command_Action command = new Command_Action();
command.defaultLabel = "WULA_LaunchToGlobalStorage".Translate();
command.defaultDesc = "WULA_LaunchToGlobalStorageDesc".Translate();
command.icon = ContentFinder<Texture2D>.Get("UI/Commands/LaunchShip");
command.action = delegate
{
this.TryLaunch();
};
yield return command;
}
}
public void TryLaunch()
{
if (!this.parent.Spawned)
{
Log.Error("Tried to launch " + this.parent + " but it's not spawned.");
return;
}
var globalStorage = Find.World.GetComponent<GlobalStorageWorldComponent>();
if (globalStorage == null)
{
Log.Error("Could not find GlobalStorageWorldComponent.");
return;
}
CompTransporter transporter = this.Transporter;
if (transporter == null || !transporter.innerContainer.Any)
{
Messages.Message("WULA_NoItemsToSendToGlobalStorage".Translate(), this.parent, MessageTypeDefOf.RejectInput);
return;
}
// 1. 将物品转移到全局存储
foreach (Thing item in transporter.innerContainer)
{
globalStorage.AddToInputStorage(item.def, item.stackCount);
}
Messages.Message("WULA_ItemsSentToGlobalStorage".Translate(transporter.innerContainer.ContentsString), this.parent, MessageTypeDefOf.PositiveEvent);
// 2. 清空容器,防止物品掉落
transporter.innerContainer.ClearAndDestroyContents();
// 3. 调用基类的发射方法,让它处理动画和销毁
// 我们给一个无效的目标和空的到达动作,让它飞出地图后就消失
base.TryLaunch(this.parent.Map.Tile, null);
}
}
}

View File

@@ -0,0 +1,16 @@
using RimWorld;
using Verse;
namespace WulaFallenEmpire
{
public class CompProperties_Launchable_ToGlobalStorage : CompProperties_Launchable_TransportPod
{
public float fuelNeededToLaunch = 25f;
public SoundDef launchSound;
public CompProperties_Launchable_ToGlobalStorage()
{
this.compClass = typeof(CompLaunchable_ToGlobalStorage);
}
}
}

View File

@@ -113,6 +113,8 @@
<Compile Include="GlobalWorkTable\GlobalStorageWorldComponent.cs" />
<Compile Include="GlobalWorkTable\GlobalWorkTableAirdropExtension.cs" />
<Compile Include="GlobalWorkTable\ITab_GlobalBills.cs" />
<Compile Include="GlobalWorkTable\CompLaunchable_ToGlobalStorage.cs" />
<Compile Include="GlobalWorkTable\CompProperties_Launchable_ToGlobalStorage.cs" />
<Compile Include="HediffComp\HediffCompProperties_NanoRepair.cs" />
<Compile Include="HediffComp\WULA_HediffDamgeShield\DRMDamageShield.cs" />
<Compile Include="HediffComp\WULA_HediffDamgeShield\Hediff_DamageShield.cs" />