diff --git a/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/Assemblies/WulaFallenEmpire.dll index 8df64fec..870094b2 100644 Binary files a/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/Defs/JobDefs/WULA_JobDefs.xml b/1.6/Defs/JobDefs/WULA_JobDefs.xml index 79f5e481..6d567805 100644 --- a/1.6/Defs/JobDefs/WULA_JobDefs.xml +++ b/1.6/Defs/JobDefs/WULA_JobDefs.xml @@ -1,13 +1,6 @@ - - WULA_LoadComponentsToMaintenancePod - WulaFallenEmpire.JobDriver_HaulToMaintenancePod - 正在为维护舱补充修复组件。 - true - - WULA_EnterMaintenancePod WulaFallenEmpire.JobDriver_EnterMaintenancePod diff --git a/1.6/Defs/Misc/FactionExists_Example.xml b/1.6/Defs/Misc/FactionExists_Example.xml new file mode 100644 index 00000000..902e348d --- /dev/null +++ b/1.6/Defs/Misc/FactionExists_Example.xml @@ -0,0 +1,45 @@ + + + + + + MyCustomEvent_RequiresMechanoids + + 一个只有在机械族存在时才会发生的特殊事件。 + + + + + +
  • + + Mechanoid +
  • + + + +
    + + + +
    + +
    \ No newline at end of file diff --git a/1.6/Defs/ThingDefs_Buildings/WULA_Buildings_Maintenance.xml b/1.6/Defs/ThingDefs_Buildings/WULA_Buildings_Maintenance.xml index de7b47e2..78967690 100644 --- a/1.6/Defs/ThingDefs_Buildings/WULA_Buildings_Maintenance.xml +++ b/1.6/Defs/ThingDefs_Buildings/WULA_Buildings_Maintenance.xml @@ -56,16 +56,26 @@ 50
  • +
  • + 50.0 + + +
  • ComponentIndustrial
  • + + + 零部件 + true + true + true +
  • 60000 250 5 WULA_Maintenance_Neglect - ComponentIndustrial 5 0 0.75 - 5 0.01 BiosculpterPod_Enter BiosculpterPod_Exit diff --git a/1.6/Defs/WorkGiverDefs/WULA_WorkGivers.xml b/1.6/Defs/WorkGiverDefs/WULA_WorkGivers.xml deleted file mode 100644 index 11950601..00000000 --- a/1.6/Defs/WorkGiverDefs/WULA_WorkGivers.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - WULA_HaulToMaintenancePod - - WulaFallenEmpire.WorkGiver_HaulToMaintenancePod - Hauling - 20 - haul - hauling - -
  • Manipulation
  • - - - -
    \ No newline at end of file diff --git a/Source/WulaFallenEmpire/CompMaintenancePod.cs b/Source/WulaFallenEmpire/CompMaintenancePod.cs index 350206c7..9dcefd2b 100644 --- a/Source/WulaFallenEmpire/CompMaintenancePod.cs +++ b/Source/WulaFallenEmpire/CompMaintenancePod.cs @@ -20,11 +20,9 @@ namespace WulaFallenEmpire public float powerConsumptionRunning = 250f; public float powerConsumptionIdle = 50f; public HediffDef hediffToRemove; - public ThingDef componentDef; public float componentCostPerSeverity = 1f; // How many components per 1.0 severity public int baseComponentCost = 0; // A flat cost in addition to severity cost public float minSeverityToMaintain = 0.75f; // The hediff severity required to trigger maintenance - public int capacity = 50; public float hediffSeverityAfterCycle = 0.01f; public CompProperties_MaintenancePod() @@ -34,13 +32,12 @@ namespace WulaFallenEmpire } [StaticConstructorOnStartup] - public class CompMaintenancePod : ThingComp, IThingHolder, IStoreSettingsParent + public class CompMaintenancePod : ThingComp, IThingHolder { // ===================== Fields ===================== private ThingOwner innerContainer; private CompPowerTrader powerComp; - private StorageSettings allowedComponentSettings; - public float storedComponents = 0f; + private CompRefuelable refuelableComp; private int ticksRemaining; private MaintenancePodState state = MaintenancePodState.Idle; @@ -60,8 +57,6 @@ namespace WulaFallenEmpire return Props.baseComponentCost + (int)(hediff.Severity * Props.componentCostPerSeverity); } - public bool CanAcceptComponents(int count) => storedComponents + count <= Props.capacity; - // ===================== Setup ===================== public CompMaintenancePod() { @@ -72,28 +67,21 @@ namespace WulaFallenEmpire public override void Initialize(CompProperties props) { base.Initialize(props); - allowedComponentSettings = new StorageSettings(this); - if (Props.componentDef != null) - { - allowedComponentSettings.filter = new ThingFilter(); - allowedComponentSettings.filter.SetAllow(Props.componentDef, true); - } } public override void PostSpawnSetup(bool respawningAfterLoad) { base.PostSpawnSetup(respawningAfterLoad); powerComp = parent.TryGetComp(); + refuelableComp = parent.TryGetComp(); } public override void PostExposeData() { base.PostExposeData(); Scribe_Values.Look(ref state, "state", MaintenancePodState.Idle); - Scribe_Values.Look(ref storedComponents, "storedComponents", 0f); Scribe_Values.Look(ref ticksRemaining, "ticksRemaining", 0); Scribe_Deep.Look(ref innerContainer, "innerContainer", this); - Scribe_Deep.Look(ref allowedComponentSettings, "allowedComponentSettings", this); } // ===================== IThingHolder Implementation ===================== @@ -107,12 +95,6 @@ namespace WulaFallenEmpire return innerContainer; } - // ===================== IStoreSettingsParent Implementation ===================== - public StorageSettings GetStoreSettings() => allowedComponentSettings; - public StorageSettings GetParentStoreSettings() => null; // No parent settings - public void Notify_SettingsChanged() { } - public bool StorageTabVisible => false; // We show it in the inspect string - // ===================== Core Logic ===================== public override void CompTick() { @@ -142,13 +124,13 @@ namespace WulaFallenEmpire public void StartCycle(Pawn pawn) { float required = RequiredComponents(pawn); - if (storedComponents < required) + if (refuelableComp.Fuel < required) { Log.Error($"[WulaFallenEmpire] Tried to start maintenance cycle for {pawn.LabelShort} without enough components. This should have been checked earlier."); return; } - storedComponents -= required; + refuelableComp.ConsumeFuel(required); state = MaintenancePodState.Running; ticksRemaining = Props.durationTicks; @@ -197,13 +179,6 @@ namespace WulaFallenEmpire } - public void AddComponents(Thing components) - { - int count = components.stackCount; - storedComponents += count; - components.Destroy(); - } - // ===================== UI & Gizmos ===================== public override string CompInspectStringExtra() { @@ -215,8 +190,6 @@ namespace WulaFallenEmpire sb.AppendLine("Contains".Translate() + ": " + Occupant.NameShortColored.Resolve()); sb.AppendLine("TimeLeft".Translate() + ": " + ticksRemaining.ToStringTicksToPeriod()); } - - sb.AppendLine("WULA_MaintenancePod_StoredComponents".Translate() + ": " + storedComponents.ToString("F0") + " / " + Props.capacity.ToString("F0")); if (!PowerOn) { @@ -244,10 +217,10 @@ namespace WulaFallenEmpire if (Props.hediffToRemove != null && p.health.hediffSet.HasHediff(Props.hediffToRemove)) { float required = RequiredComponents(p); - if (storedComponents >= required) - { - options.Add(new FloatMenuOption(p.LabelShort, () => - { + if (refuelableComp.Fuel >= required) + { + options.Add(new FloatMenuOption(p.LabelShort, () => + { Job job = JobMaker.MakeJob(JobDefOf_WULA.WULA_EnterMaintenancePod, parent); p.jobs.TryTakeOrderedJob(job, JobTag.Misc); })); diff --git a/Source/WulaFallenEmpire/EventSystem/Condition.cs b/Source/WulaFallenEmpire/EventSystem/Condition.cs index 064877f6..76734592 100644 --- a/Source/WulaFallenEmpire/EventSystem/Condition.cs +++ b/Source/WulaFallenEmpire/EventSystem/Condition.cs @@ -151,7 +151,8 @@ namespace WulaFallenEmpire return met; } } -public class Condition_FactionExists : Condition + + public class Condition_FactionExists : Condition { public FactionDef factionDef; diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj index 6fc2e370..c40b15bc 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj +++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj @@ -100,7 +100,6 @@ - @@ -136,7 +135,6 @@ -