暂存
This commit is contained in:
Binary file not shown.
@@ -30,6 +30,10 @@
|
||||
<needCost>4</needCost>
|
||||
<failMessage>食物不足</failMessage>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_AbilityBodyPartCheck">
|
||||
<requiredPart>ARA_Ovary</requiredPart>
|
||||
<failMessage>卵巢受损或缺失,无法生育</failMessage>
|
||||
</li>
|
||||
</comps>
|
||||
</AbilityDef>
|
||||
|
||||
@@ -64,12 +68,12 @@
|
||||
<shotCount>32</shotCount> <!-- 总共发射5次 -->
|
||||
<ticksBetweenShots>3</ticksBetweenShots> <!-- 每次发射间隔12 Ticks (0.2秒) -->
|
||||
</li>
|
||||
</comps>
|
||||
<li Class="ArachnaeSwarm.CompProperties_AbilityNeedCost">
|
||||
<li Class="ArachnaeSwarm.CompProperties_AbilityNeedCost">
|
||||
<needDef>Food</needDef>
|
||||
<needCost>0.5</needCost>
|
||||
<failMessage>食物不足</failMessage>
|
||||
</li>
|
||||
</comps>
|
||||
</AbilityDef>
|
||||
|
||||
<ThingDef>
|
||||
|
||||
@@ -33,11 +33,7 @@
|
||||
<isTargetable>true</isTargetable>
|
||||
<expandHomeArea>false</expandHomeArea>
|
||||
</building>
|
||||
<hatchingGraphicData>
|
||||
<texPath>Things/Building/Natural/Hive</texPath>
|
||||
<graphicClass>Graphic_Random</graphicClass>
|
||||
<drawSize>1.6</drawSize>
|
||||
</hatchingGraphicData>
|
||||
|
||||
<comps>
|
||||
<li Class="CompProperties_Glower">
|
||||
<glowRadius>6</glowRadius>
|
||||
@@ -54,10 +50,16 @@
|
||||
</whitelist>
|
||||
<delay>300</delay> <!-- 5 seconds -->
|
||||
<destroyOnSpawn>true</destroyOnSpawn>
|
||||
<hatchingGraphicData>
|
||||
<texPath>Things/Building/Natural/Hive</texPath>
|
||||
<graphicClass>Graphic_Random</graphicClass>
|
||||
<drawSize>1.6</drawSize>
|
||||
</hatchingGraphicData>
|
||||
</li>
|
||||
<li Class="CompProperties_SpawnEffecterOnDestroy">
|
||||
<effect>CocoonDestroyed</effect>
|
||||
</li>
|
||||
|
||||
</comps>
|
||||
</ThingDef>
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
<Compile Include="Building_Incubator.cs" />
|
||||
<Compile Include="Hediffs\Hediff_CurseFlame.cs" />
|
||||
<Compile Include="CompAbilityEffect_NeedCost.cs" />
|
||||
<Compile Include="CompAbilityEffect_BodyPartCheck.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@@ -7,25 +7,13 @@ namespace ArachnaeSwarm
|
||||
{
|
||||
public CompSpawnPawnFromList SpawnComp => GetComp<CompSpawnPawnFromList>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
49
Source/ArachnaeSwarm/CompAbilityEffect_BodyPartCheck.cs
Normal file
49
Source/ArachnaeSwarm/CompAbilityEffect_BodyPartCheck.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user