diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index de23dbc..456ab82 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/ThingDef_Races/ARA_RaceNodeSwarm.xml b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml index 65aff14..c7db3db 100644 --- a/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml +++ b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml @@ -587,10 +587,10 @@ -
  • - ARA_InsectJelly - 0.01 - 14 +
  • + ARA_InsectJelly + 2 + 14
  • true diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj index 2a93bed..9e8ae6b 100644 --- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj +++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj @@ -84,6 +84,10 @@ + + + + diff --git a/Source/ArachnaeSwarm/Work/CompMilkableArachnae.cs b/Source/ArachnaeSwarm/Work/CompMilkableArachnae.cs new file mode 100644 index 0000000..a2c7c18 --- /dev/null +++ b/Source/ArachnaeSwarm/Work/CompMilkableArachnae.cs @@ -0,0 +1,80 @@ +using RimWorld; +using Verse; +using UnityEngine; + +namespace ArachnaeSwarm +{ + public class CompMilkableArachnae : CompHasGatherableBodyResource + { + protected override int GatherResourcesIntervalDays => Props.milkIntervalDays; + + protected override int ResourceAmount => Props.milkAmount; + + protected override ThingDef ResourceDef => Props.milkDef; + + protected override string SaveKey => "milkFullness"; + + public CompProperties_MilkableArachnae Props => (CompProperties_MilkableArachnae)props; + + protected override bool Active + { + get + { + if (!base.Active) + { + return false; + } + Pawn pawn = parent as Pawn; + if (Props.milkFemaleOnly && pawn != null && pawn.gender != Gender.Female) + { + return false; + } + if (pawn != null && !pawn.ageTracker.CurLifeStage.milkable) + { + return false; + } + if (ModsConfig.AnomalyActive && pawn.IsShambler) + { + return false; + } + return true; + } + } + + public override string CompInspectStringExtra() + { + if (!Active) + { + return null; + } + return "MilkFullness".Translate() + ": " + base.Fullness.ToStringPercent(); + } + + public override void CompTick() + { + base.CompTick(); + + // 检查是否活跃且fullness已满 + if (Active && fullness >= 1.0f) + { + // 检查parent是否是Pawn且在普通地图上 + if (parent is Pawn pawn && pawn.Map != null) + { + // 自动生成资源并掉落到地上 + int num = ResourceAmount; + while (num > 0) + { + int num2 = Mathf.Clamp(num, 1, ResourceDef.stackLimit); + num -= num2; + Thing thing = ThingMaker.MakeThing(ResourceDef); + thing.stackCount = num2; + GenPlace.TryPlaceThing(thing, pawn.Position, pawn.Map, ThingPlaceMode.Near); + } + + // 重置挤奶进度 + fullness = 0f; + } + } + } + } +} \ No newline at end of file diff --git a/Source/ArachnaeSwarm/Work/CompProperties_MilkableArachnae.cs b/Source/ArachnaeSwarm/Work/CompProperties_MilkableArachnae.cs new file mode 100644 index 0000000..b76818d --- /dev/null +++ b/Source/ArachnaeSwarm/Work/CompProperties_MilkableArachnae.cs @@ -0,0 +1,17 @@ +using Verse; + +namespace ArachnaeSwarm +{ + public class CompProperties_MilkableArachnae : CompProperties + { + public int milkIntervalDays; + public int milkAmount = 1; + public ThingDef milkDef; + public bool milkFemaleOnly = true; + + public CompProperties_MilkableArachnae() + { + compClass = typeof(CompMilkableArachnae); // 注意这里是 CompMilkableArachnae + } + } +} \ No newline at end of file