diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index c7b2d922..243528b9 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/ThingDefs_Buildings/Buildings_GlobalStorageSender.xml b/1.6/1.6/Defs/ThingDefs_Buildings/Buildings_GlobalStorageSender.xml new file mode 100644 index 00000000..d1b6a879 --- /dev/null +++ b/1.6/1.6/Defs/ThingDefs_Buildings/Buildings_GlobalStorageSender.xml @@ -0,0 +1,57 @@ + + + + + WULA_GlobalStorageSenderPod + + 一个一次性的物资输送装置,可以将装载的货物直接发射到全局存储网络中,而无需选择目标地点。发射后即告销毁。 + + Things/Special/DropPod + Graphic_Single + (2,2) + + (1,1) + false + Normal + BuildingOnTop + PassThroughOnly + false + Misc12 + 0.5 + WULA_Buildings + 2201 + Medium + + 250 + 1600 + 0.5 + + + 60 + 1 + + +
  • + 300 + 0.8 + true +
  • +
  • + DropPodLeaving + false +
  • +
    + +
  • ITab_ContentsTransporter
  • +
    + +
  • PlaceWorker_NotUnderRoof
  • +
    + +
  • TransportPod
  • +
    + 6 + 0.65 +
    + +
    \ No newline at end of file diff --git a/1.6/1.6/Languages/SimpChinese/DefInjected/ThingDef/Buildings_GlobalStorageSender.xml b/1.6/1.6/Languages/SimpChinese/DefInjected/ThingDef/Buildings_GlobalStorageSender.xml new file mode 100644 index 00000000..2a15ba9e --- /dev/null +++ b/1.6/1.6/Languages/SimpChinese/DefInjected/ThingDef/Buildings_GlobalStorageSender.xml @@ -0,0 +1,7 @@ + + + + 全局存储输送舱 + 一个一次性的物资输送装置,可以将装载的货物直接发射到全局存储网络中,而无需选择目标地点。发射后即告销毁。 + + \ No newline at end of file diff --git a/1.6/1.6/Languages/SimpChinese/Keyed/GlobalStorageSender.xml b/1.6/1.6/Languages/SimpChinese/Keyed/GlobalStorageSender.xml new file mode 100644 index 00000000..9bc72f67 --- /dev/null +++ b/1.6/1.6/Languages/SimpChinese/Keyed/GlobalStorageSender.xml @@ -0,0 +1,9 @@ + + + + 发射到全局存储 + 将此输送舱中的所有物品直接发送到全局存储网络中。此操作将消耗燃料并销毁输送舱。 + 已将 {0} 发送到全局存储。 + 输送舱是空的,没有什么可以发送的。 + + \ No newline at end of file diff --git a/Source/WulaFallenEmpire/3516260226.code-workspace b/Source/WulaFallenEmpire/3516260226.code-workspace index dd29657e..9604a404 100644 --- a/Source/WulaFallenEmpire/3516260226.code-workspace +++ b/Source/WulaFallenEmpire/3516260226.code-workspace @@ -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": {} diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/CompLaunchable_ToGlobalStorage.cs b/Source/WulaFallenEmpire/GlobalWorkTable/CompLaunchable_ToGlobalStorage.cs new file mode 100644 index 00000000..eb7d1717 --- /dev/null +++ b/Source/WulaFallenEmpire/GlobalWorkTable/CompLaunchable_ToGlobalStorage.cs @@ -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 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.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(); + 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); + } + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/CompProperties_Launchable_ToGlobalStorage.cs b/Source/WulaFallenEmpire/GlobalWorkTable/CompProperties_Launchable_ToGlobalStorage.cs new file mode 100644 index 00000000..fe5c84be --- /dev/null +++ b/Source/WulaFallenEmpire/GlobalWorkTable/CompProperties_Launchable_ToGlobalStorage.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj index 6a4fde54..438b303e 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj +++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj @@ -113,6 +113,8 @@ + +