diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index 9f619a5..0ea2887 100644 Binary files a/1.6/1.6/Assemblies/ArachnaeSwarm.dll and b/1.6/1.6/Assemblies/ArachnaeSwarm.dll differ diff --git a/1.6/1.6/Defs/Thing_Misc/ARA_PowerArmor_Defs.xml b/1.6/1.6/Defs/Thing_Misc/ARA_PowerArmor_Defs.xml index 5643946..cbf1f62 100644 --- a/1.6/1.6/Defs/Thing_Misc/ARA_PowerArmor_Defs.xml +++ b/1.6/1.6/Defs/Thing_Misc/ARA_PowerArmor_Defs.xml @@ -59,6 +59,7 @@ ARA_Cocoon_Cloth_1Stage ArachnaeSwarm.ARA_PowerArmor + Normal
  • 500 @@ -119,7 +120,8 @@ 1 0.5 true - true + false + false
  • diff --git a/1.6/1.6/Defs/Thing_Misc/Weapons/ARA_Weapon.xml b/1.6/1.6/Defs/Thing_Misc/Weapons/ARA_Weapon.xml index 0d1d63d..e9ba9b0 100644 --- a/1.6/1.6/Defs/Thing_Misc/Weapons/ARA_Weapon.xml +++ b/1.6/1.6/Defs/Thing_Misc/Weapons/ARA_Weapon.xml @@ -1152,7 +1152,7 @@ 1 3.5 true - SpitterSpitLands + ThumpCannon_Impact Filth_SpentAcid 4 Shell_AcidSpitImpact diff --git a/1.6/1.6/Defs/Thing_building/ARA_SwarmTurret.xml b/1.6/1.6/Defs/Thing_building/ARA_SwarmTurret.xml index 39d3c6e..7912722 100644 --- a/1.6/1.6/Defs/Thing_building/ARA_SwarmTurret.xml +++ b/1.6/1.6/Defs/Thing_building/ARA_SwarmTurret.xml @@ -397,10 +397,10 @@ Graphic_Single - 0.35 - 0.5 - 0.85 - 1 + 0.60 + 0.70 + 0.65 + 0.55 2.2 diff --git a/1.6/Defs/Thing_Misc/ARA_PowerArmor_Defs.xml b/1.6/Defs/Thing_Misc/ARA_PowerArmor_Defs.xml deleted file mode 100644 index cac9984..0000000 --- a/1.6/Defs/Thing_Misc/ARA_PowerArmor_Defs.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - Building - - Graphic_Multi - (3,3) - - Building - PassThroughOnly - 70 - true - 0.5 - false - (2,2) - Misc - true - true - Never - MapMeshAndRealTime - - 250 - 2000 - 50 - 0.5 - - - - - - ArachnaeSwarm.ARA_PowerArmor - - 2 - - - 250 - 30 - 0 - 0.85 - 0.80 - 0.90 - 40 - 20 - - - -0.5 - - - -
  • Torso
  • -
  • Neck
  • -
  • Shoulders
  • -
  • Arms
  • -
  • Legs
  • -
    - -
  • Shell
  • -
  • Middle
  • -
    - false -
    -
    - - - - - - ARA_Apparel_SpiderOne - - A prototype power armor with an arachnid design. - - Things/Pawn/Humanlike/Apparel/SpiderArmor/SpiderArmor - - -
  • - ARA_Building_SpiderOne - 625 - ARA_PowerArmor_NoFuel - 0.5 -
  • -
    - -
  • - 10.0 - - -
  • Meat_Human
  • - - -
  • FoodMeals
  • -
  • FoodRaw
  • -
    - - 1 - 0.5 - true - true - -
    -
    - - - ARA_Building_SpiderOne - - A stationary housing for the Spider-I Power Armor. - - Things/Building/PowerArmorStation - - -
  • - ARA_Apparel_SpiderOne -
  • -
  • - 10.0 - - -
  • Meat_Human
  • - - -
  • FoodMeals
  • -
  • FoodRaw
  • -
    - - 1 - 0.5 - true - -
    -
    - -
    \ No newline at end of file diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj index c5701ac..1d82a4d 100644 --- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj +++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj @@ -271,7 +271,6 @@ - diff --git a/Source/ArachnaeSwarm/PowerArmor/ARA_PowerArmor.cs b/Source/ArachnaeSwarm/PowerArmor/ARA_PowerArmor.cs index f30f95b..64a542e 100644 --- a/Source/ArachnaeSwarm/PowerArmor/ARA_PowerArmor.cs +++ b/Source/ArachnaeSwarm/PowerArmor/ARA_PowerArmor.cs @@ -56,28 +56,23 @@ namespace ArachnaeSwarm #region Ticker protected override void Tick() { - base.Tick(); // Call Apparel's Tick - - if (this.Wearer == null) return; // Only tick if worn + base.Tick(); + if (this.Wearer == null) return; var fuelComp = this.GetComp(); if (fuelComp != null) { - // Explicitly call the component's Tick method to ensure fuel consumption logic is executed. - // This is needed because Apparel's base Tick does not automatically call component Ticks. - // First, update consumption rate and hediffs - if (this.Wearer.IsHashIntervalTick(60)) // Check every second + // Set the consumption rate on every tick. This value is then used by CompRefuelableNutrition's CompTick. + // We use the value from our PowerArmorExtension, ensuring it's always active. + fuelComp.currentConsumptionRate = Ext?.fuelConsumptionRate ?? 0f; + + // We must explicitly call the component's Tick, as Apparel's base Tick does not. + // This will trigger the consumption logic inside CompRefuelableNutrition. + fuelComp.CompTick(); + + // Handle hediff for empty fuel, checked frequently for responsiveness. + if (this.Wearer.IsHashIntervalTick(60)) { - if (this.Wearer.pather != null && this.Wearer.pather.MovingNow) - { - fuelComp.currentConsumptionRate = Ext?.fuelConsumptionRate ?? 0.5f; - } - else - { - fuelComp.currentConsumptionRate = 0f; - } - - // Handle hediff for empty fuel var hediffDef = Ext?.hediffOnEmptyFuel; if (hediffDef != null) { @@ -98,10 +93,8 @@ namespace ArachnaeSwarm } } } - // Then, explicitly call the component's Tick method to ensure fuel consumption logic is executed with the UPDATED rate. - fuelComp.CompTick(); } - } // Correctly close the Tick method + } #endregion #region Data @@ -125,11 +118,15 @@ namespace ArachnaeSwarm // Yield our custom structure points gizmo. yield return new Gizmo_StructurePanel(this); - // Yield our custom fuel panel gizmo. + // Yield the default gizmos from the CompRefuelable component. + // This will provide the standard RimWorld fuel gizmo. var fuelComp = this.GetComp(); if (fuelComp != null) { - yield return new Gizmo_FuelPanel(fuelComp); + foreach (var gizmo in fuelComp.CompGetGizmosExtra()) + { + yield return gizmo; + } } } #endregion @@ -183,9 +180,12 @@ namespace ArachnaeSwarm GenPlace.TryPlaceThing(building, pawn.Position, pawn.Map, ThingPlaceMode.Near); Log.Message($"[PA_Debug] Notify_Unequipped: After spawning building (ID: {building.thingIDNumber}) - HitPoints: {building.HitPoints}, StackCount: {building.stackCount}"); - // Destroy the apparel to prevent duplication - this.Destroy(DestroyMode.Vanish); - Log.Message($"[PA_Debug] Notify_Unequipped: Apparel {this.Label} (ID: {this.thingIDNumber}) destroyed."); + // To prevent the game from spawning a duplicate item, we must destroy the apparel. + // However, using DestroyMode.Vanish or Kill can cause "Spawning destroyed thing" errors + // if called directly within Notify_Unequipped. + // DestroyMode.QuestLogic is the correct way: it marks the thing as destroyed + // but defers the actual cleanup until the end of the current tick, avoiding race conditions. + this.Destroy(DestroyMode.QuestLogic); } #endregion diff --git a/Source/ArachnaeSwarm/PowerArmor/Gizmo_FuelPanel.cs b/Source/ArachnaeSwarm/PowerArmor/Gizmo_FuelPanel.cs deleted file mode 100644 index ef84748..0000000 --- a/Source/ArachnaeSwarm/PowerArmor/Gizmo_FuelPanel.cs +++ /dev/null @@ -1,55 +0,0 @@ -using UnityEngine; -using Verse; -using RimWorld; // For SolidColorMaterials - -namespace ArachnaeSwarm -{ - [StaticConstructorOnStartup] - public class Gizmo_FuelPanel : Gizmo - { - private static readonly Texture2D FullBarTex = SolidColorMaterials.NewSolidColorTexture(new Color(0.9f, 0.7f, 0.2f)); // Orange for fuel - private static readonly Texture2D EmptyBarTex = SolidColorMaterials.NewSolidColorTexture(new Color(0.1f, 0.1f, 0.1f)); - - private CompRefuelableNutrition fuelComp; - - public Gizmo_FuelPanel(CompRefuelableNutrition fuelComp) - { - this.fuelComp = fuelComp; - this.Order = -90f; // Slightly higher order than structure panel - } - - public override float GetWidth(float maxWidth) - { - return 140f; - } - - public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth, GizmoRenderParms parms) - { - Rect overRect = new Rect(topLeft.x, topLeft.y, GetWidth(maxWidth), 75f); - Find.WindowStack.ImmediateWindow(984989, overRect, WindowLayer.GameUI, delegate - { - Rect rect = overRect.AtZero().ContractedBy(6f); - - // Draw label - Rect labelRect = rect; - labelRect.height = overRect.height / 2f; - Text.Font = GameFont.Tiny; - Widgets.Label(labelRect, "Fuel".Translate()); // Use "Fuel" or custom text - - // Draw bar - Rect barRect = rect; - barRect.yMin = overRect.height / 2f; - float fillPercent = fuelComp.FuelPercentOfMax; - - Widgets.FillableBar(barRect, fillPercent, FullBarTex, EmptyBarTex, false); - - // Draw text on bar - Text.Font = GameFont.Small; - Text.Anchor = TextAnchor.MiddleCenter; - Widgets.Label(barRect, $"{fuelComp.Fuel:F0} / {fuelComp.Props.fuelCapacity:F0}"); - Text.Anchor = TextAnchor.UpperLeft; - }); - return new GizmoResult(GizmoState.Clear); - } - } -} \ No newline at end of file diff --git a/Source/ArachnaeSwarm/PowerArmor/Gizmo_StructurePanel.cs b/Source/ArachnaeSwarm/PowerArmor/Gizmo_StructurePanel.cs index fc5f566..69770bb 100644 --- a/Source/ArachnaeSwarm/PowerArmor/Gizmo_StructurePanel.cs +++ b/Source/ArachnaeSwarm/PowerArmor/Gizmo_StructurePanel.cs @@ -6,9 +6,8 @@ namespace ArachnaeSwarm [StaticConstructorOnStartup] public class Gizmo_StructurePanel : Gizmo { - private static readonly Texture2D FullBarTex = SolidColorMaterials.NewSolidColorTexture(new Color(0.2f, 0.8f, 0.2f)); - private static readonly Texture2D EmptyBarTex = SolidColorMaterials.NewSolidColorTexture(new Color(0.1f, 0.1f, 0.1f)); - private static readonly Texture2D UnderflowBarTex = SolidColorMaterials.NewSolidColorTexture(new Color(0.9f, 0.1f, 0.1f)); + private static readonly Texture2D FullBarTex = SolidColorMaterials.NewSolidColorTexture(new Color(0.2f, 0.2f, 0.24f)); + private static readonly Texture2D EmptyBarTex = SolidColorMaterials.NewSolidColorTexture(Color.clear); private IStructurePoints armor; @@ -41,6 +40,7 @@ namespace ArachnaeSwarm barRect.yMin = overRect.height / 2f; float fillPercent = armor.StructurePointsPercent; + // Use the colors from the Exosuit example Widgets.FillableBar(barRect, fillPercent, FullBarTex, EmptyBarTex, false); // Draw text on bar diff --git a/Source/ArachnaeSwarm/PowerArmor/JobDriver_EnterPowerArmor.cs b/Source/ArachnaeSwarm/PowerArmor/JobDriver_EnterPowerArmor.cs index 383fe59..35ff07c 100644 --- a/Source/ArachnaeSwarm/PowerArmor/JobDriver_EnterPowerArmor.cs +++ b/Source/ArachnaeSwarm/PowerArmor/JobDriver_EnterPowerArmor.cs @@ -50,8 +50,8 @@ namespace ArachnaeSwarm apparelFuelComp.ReceiveFuel(buildingFuelComp.Fuel); } - // Wear the apparel - actor.apparel.Wear(apparel, true, true); + // Wear the apparel, ensuring it's not locked. + actor.apparel.Wear(apparel, false, true); // Despawn the building building.DeSpawn();