diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index 25d3265..29adbd5 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/AbilityDefs/ARA_Abilities.xml b/1.6/1.6/Defs/AbilityDefs/ARA_Abilities.xml index 5e62cc4..d4d9ad7 100644 --- a/1.6/1.6/Defs/AbilityDefs/ARA_Abilities.xml +++ b/1.6/1.6/Defs/AbilityDefs/ARA_Abilities.xml @@ -30,6 +30,10 @@ 4 食物不足 +
  • + ARA_Ovary + 卵巢受损或缺失,无法生育 +
  • @@ -64,12 +68,12 @@ 32 3 - -
  • +
  • Food 0.5 食物不足
  • + diff --git a/1.6/1.6/Defs/Thing_building/ARA_InteractiveEggSac.xml b/1.6/1.6/Defs/Thing_building/ARA_InteractiveEggSac.xml index 47be407..a4c4ae6 100644 --- a/1.6/1.6/Defs/Thing_building/ARA_InteractiveEggSac.xml +++ b/1.6/1.6/Defs/Thing_building/ARA_InteractiveEggSac.xml @@ -33,11 +33,7 @@ true false - - Things/Building/Natural/Hive - Graphic_Random - 1.6 - +
  • 6 @@ -54,10 +50,16 @@ 300 true + + Things/Building/Natural/Hive + Graphic_Random + 1.6 +
  • CocoonDestroyed
  • +
    diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj index 08e78d2..115002f 100644 --- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj +++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj @@ -76,6 +76,7 @@ + diff --git a/Source/ArachnaeSwarm/Building_Incubator.cs b/Source/ArachnaeSwarm/Building_Incubator.cs index ba4158f..cb2e948 100644 --- a/Source/ArachnaeSwarm/Building_Incubator.cs +++ b/Source/ArachnaeSwarm/Building_Incubator.cs @@ -7,25 +7,13 @@ namespace ArachnaeSwarm { public CompSpawnPawnFromList SpawnComp => GetComp(); - public GraphicData hatchingGraphicData; - private Graphic hatchingGraphic; - - public override void SpawnSetup(Map map, bool respawningAfterLoad) - { - base.SpawnSetup(map, respawningAfterLoad); - if (hatchingGraphicData != null) - { - hatchingGraphic = hatchingGraphicData.Graphic; - } - } - public override Graphic Graphic { get { - if (SpawnComp != null && SpawnComp.IsHatching && hatchingGraphic != null) + if (SpawnComp != null && SpawnComp.IsHatching && SpawnComp.Props.hatchingGraphicData != null) { - return hatchingGraphic; + return SpawnComp.Props.hatchingGraphicData.Graphic; } return base.Graphic; } diff --git a/Source/ArachnaeSwarm/CompAbilityEffect_BodyPartCheck.cs b/Source/ArachnaeSwarm/CompAbilityEffect_BodyPartCheck.cs new file mode 100644 index 0000000..91ab139 --- /dev/null +++ b/Source/ArachnaeSwarm/CompAbilityEffect_BodyPartCheck.cs @@ -0,0 +1,49 @@ +using System.Linq; +using RimWorld; +using Verse; + +namespace ArachnaeSwarm +{ + public class CompProperties_AbilityBodyPartCheck : CompProperties_AbilityEffect + { + public BodyPartDef requiredPart; + public float minimumHealth = 0.8f; + public string failMessage = "Missing or damaged body part."; + + public CompProperties_AbilityBodyPartCheck() + { + compClass = typeof(CompAbilityEffect_BodyPartCheck); + } + } + + public class CompAbilityEffect_BodyPartCheck : CompAbilityEffect + { + public new CompProperties_AbilityBodyPartCheck Props => (CompProperties_AbilityBodyPartCheck)props; + + public override bool GizmoDisabled(out string reason) + { + Pawn caster = parent.pawn; + if (caster != null && caster.health != null && caster.health.hediffSet != null) + { + var part = caster.health.hediffSet.GetNotMissingParts() + .FirstOrDefault(p => p.def == Props.requiredPart); + + if (part == null) + { + reason = Props.failMessage; + return true; + } + + float partHealth = caster.health.hediffSet.GetPartHealth(part) / part.def.GetMaxHealth(caster); + if (partHealth < Props.minimumHealth) + { + reason = Props.failMessage; + return true; + } + } + + reason = null; + return false; + } + } +} \ No newline at end of file diff --git a/Source/ArachnaeSwarm/CompProperties_SpawnPawnFromList.cs b/Source/ArachnaeSwarm/CompProperties_SpawnPawnFromList.cs index efef87f..c69bf18 100644 --- a/Source/ArachnaeSwarm/CompProperties_SpawnPawnFromList.cs +++ b/Source/ArachnaeSwarm/CompProperties_SpawnPawnFromList.cs @@ -13,6 +13,7 @@ namespace ArachnaeSwarm public bool destroyOnSpawn = false; public IntRange spawnCount = new IntRange(1, 1); public Type lordJob; + public GraphicData hatchingGraphicData; public CompProperties_SpawnPawnFromList() {