```
feat(GlobalWorkTable): 添加全局存储发射组件和相关属性 新增两个编译项用于支持全局工作台的物品投送功能,包括可发射至全局存储的组件及其属性配置。同时更新了项目工作区引用路径,移除了旧版依赖并引入新版资源库及模组框架。 ```
This commit is contained in:
@@ -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": {}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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" />
|
||||
|
||||
Reference in New Issue
Block a user