暂存
This commit is contained in:
@@ -65,7 +65,8 @@ namespace ArachnaeSwarm
|
||||
}
|
||||
|
||||
// 3. 准备抱脸虫和Hediff
|
||||
Pawn originalCaster = caster.SplitOff(1) as Pawn;
|
||||
Pawn originalCaster = PawnGenerator.GeneratePawn(caster.kindDef, caster.Faction);
|
||||
PawnDataUtility.TransferSoul(caster, originalCaster); // 确保克隆体有完全一致的数据
|
||||
Hediff_Possession hediff = (Hediff_Possession)HediffMaker.MakeHediff(HediffDef.Named("ARA_Possession"), targetPawn);
|
||||
hediff.originalHostData = originalHostData; // 将宿主数据存入Hediff
|
||||
|
||||
@@ -76,6 +77,12 @@ namespace ArachnaeSwarm
|
||||
|
||||
// 5. 灵魂转移,此时 targetPawn 的技能被 caster 的技能覆盖
|
||||
PawnDataUtility.TransferSoul(caster, targetPawn);
|
||||
|
||||
// 夺舍成功后,原始的抱脸虫应该消失
|
||||
if (!caster.Destroyed)
|
||||
{
|
||||
caster.Destroy(DestroyMode.Vanish);
|
||||
}
|
||||
|
||||
// 6. 技能合并:在灵魂转移后,直接在最终的身体 (targetPawn) 上进行合并
|
||||
if (targetPawn.skills != null)
|
||||
|
||||
@@ -129,6 +129,9 @@
|
||||
<Compile Include="ARA_TrainingWork\JobClean\ThinkNode_ConditionalAnimalShouldDoCleaningWork.cs" />
|
||||
<Compile Include="ARA_TrainingWork\JobClean\WorkGiver_ArachnaeClean.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="HediffComp_Temperature.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- 自定义清理任务,删除obj文件夹中的临时文件 -->
|
||||
<Target Name="CleanDebugFiles" AfterTargets="Build">
|
||||
|
||||
53
Source/ArachnaeSwarm/HediffComp_Temperature.cs
Normal file
53
Source/ArachnaeSwarm/HediffComp_Temperature.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using RimWorld;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
public class HediffComp_Temperature : HediffComp
|
||||
{
|
||||
public HediffCompProperties_Temperature Props => (HediffCompProperties_Temperature)props;
|
||||
|
||||
public override void CompPostTick(ref float severityAdjustment)
|
||||
{
|
||||
if (!parent.pawn.IsHashIntervalTick(360)) // 每 60 ticks 检查一次
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float ambientTemperature = parent.pawn.AmbientTemperature;
|
||||
float minComfortable = Props.minComfortableTemperature;
|
||||
float maxComfortable = Props.maxComfortableTemperature;
|
||||
|
||||
if (ambientTemperature >= minComfortable && ambientTemperature <= maxComfortable)
|
||||
{
|
||||
// 在舒适温度范围内
|
||||
if (Props.severityChangeIn != 0f)
|
||||
{
|
||||
severityAdjustment += Props.severityChangeIn;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 在舒适温度范围外
|
||||
if (Props.severityChangeOut != 0f)
|
||||
{
|
||||
severityAdjustment += Props.severityChangeOut;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HediffCompProperties_Temperature : HediffCompProperties
|
||||
{
|
||||
public float minComfortableTemperature = 16f;
|
||||
public float maxComfortableTemperature = 26f;
|
||||
public float severityChangeIn = 0f;
|
||||
public float severityChangeOut = 0f;
|
||||
|
||||
public HediffCompProperties_Temperature()
|
||||
{
|
||||
compClass = typeof(HediffComp_Temperature);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user