补产奶
This commit is contained in:
Binary file not shown.
@@ -587,10 +587,10 @@
|
|||||||
</generalSettings>
|
</generalSettings>
|
||||||
</alienRace>
|
</alienRace>
|
||||||
<comps>
|
<comps>
|
||||||
<li Class="CompProperties_Milkable">
|
<li Class="ArachnaeSwarm.CompProperties_MilkableArachnae">
|
||||||
<milkDef>ARA_InsectJelly</milkDef>
|
<milkDef>ARA_InsectJelly</milkDef>
|
||||||
<milkIntervalDays>0.01</milkIntervalDays>
|
<milkIntervalDays>2</milkIntervalDays>
|
||||||
<milkAmount>14</milkAmount>
|
<milkAmount>14</milkAmount>
|
||||||
</li>
|
</li>
|
||||||
<li Class="ArachnaeSwarm.CompProperties_AutoMechCarrier">
|
<li Class="ArachnaeSwarm.CompProperties_AutoMechCarrier">
|
||||||
<freeProduction>true</freeProduction>
|
<freeProduction>true</freeProduction>
|
||||||
|
|||||||
@@ -84,6 +84,10 @@
|
|||||||
<Compile Include="ARA_HiveMind\CompProperties_AbilityBindDrone.cs" />
|
<Compile Include="ARA_HiveMind\CompProperties_AbilityBindDrone.cs" />
|
||||||
<Compile Include="JobGiver_MaintainBuildings.cs" />
|
<Compile Include="JobGiver_MaintainBuildings.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Work\CompMilkableArachnae.cs" />
|
||||||
|
<Compile Include="Work\CompProperties_MilkableArachnae.cs" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="MainHarmony.cs" />
|
<Compile Include="MainHarmony.cs" />
|
||||||
<Compile Include="ARA_TrainingWork\ThinkNode_ConditionalAnimalShouldDoGrowingWork.cs" />
|
<Compile Include="ARA_TrainingWork\ThinkNode_ConditionalAnimalShouldDoGrowingWork.cs" />
|
||||||
|
|||||||
80
Source/ArachnaeSwarm/Work/CompMilkableArachnae.cs
Normal file
80
Source/ArachnaeSwarm/Work/CompMilkableArachnae.cs
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
17
Source/ArachnaeSwarm/Work/CompProperties_MilkableArachnae.cs
Normal file
17
Source/ArachnaeSwarm/Work/CompProperties_MilkableArachnae.cs
Normal file
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user