织座特效
This commit is contained in:
Binary file not shown.
@@ -552,7 +552,6 @@
|
||||
<rechargeHitPointsIntervalTicks>1</rechargeHitPointsIntervalTicks>
|
||||
<startWithMaxHitPoints>true</startWithMaxHitPoints>
|
||||
<alwaysShowHitpointsGizmo>true</alwaysShowHitpointsGizmo>
|
||||
<drawWithNoSelection>true</drawWithNoSelection>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_Morphable">
|
||||
<!-- 休息速度增益,例如1.0代表200%的速度 -->
|
||||
@@ -572,7 +571,7 @@
|
||||
<li>ARA_InsectJelly</li>
|
||||
</thingDefs>
|
||||
</fuelFilter>
|
||||
<fuelCapacity>2.0</fuelCapacity>
|
||||
<fuelCapacity>5.0</fuelCapacity>
|
||||
<targetFuelLevelConfigurable>false</targetFuelLevelConfigurable>
|
||||
<fuelGizmoLabel>虫蜜</fuelGizmoLabel>
|
||||
<outOfFuelMessage>没有营养</outOfFuelMessage>
|
||||
@@ -687,7 +686,7 @@
|
||||
</thingDefs>
|
||||
</fuelFilter>
|
||||
|
||||
<targetFuelLevelConfigurable>true</targetFuelLevelConfigurable>
|
||||
<targetFuelLevelConfigurable>false</targetFuelLevelConfigurable>
|
||||
<showAllowAutoRefuelToggle>true</showAllowAutoRefuelToggle>
|
||||
<canEjectFuel>true</canEjectFuel>
|
||||
</li>
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace ArachnaeSwarm
|
||||
private CompMorphable compMorphable;
|
||||
private CompRefuelableNutrition compRefuelable;
|
||||
private Effecter researchEffecter;
|
||||
private Mote psyfocusMote; // For the sustained pulse effect
|
||||
|
||||
public float virtualRest; // Public for external access
|
||||
private bool forceSleep;
|
||||
@@ -37,7 +38,7 @@ namespace ArachnaeSwarm
|
||||
|
||||
if (compMorphable?.StoredPawn == null)
|
||||
{
|
||||
StopResearchEffect();
|
||||
StopWorkEffects();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -87,8 +88,14 @@ namespace ArachnaeSwarm
|
||||
{
|
||||
// 使用XML中定义的乘数
|
||||
virtualRest = Mathf.Min(VirtualRestMax, virtualRest + (Need_Rest.BaseRestGainPerTick * ((CompProperties_Morphable)compMorphable.props).restGainMultiplier));
|
||||
|
||||
// --- ADDED: Zzz effect when sleeping ---
|
||||
if (this.IsHashIntervalTick(120)) // Slightly slower than meditation
|
||||
{
|
||||
FleckMaker.ThrowMetaIcon(this.Position, this.Map, FleckDefOf.SleepZ);
|
||||
}
|
||||
}
|
||||
StopResearchEffect();
|
||||
StopWorkEffects();
|
||||
}
|
||||
else // 工作或任意时间 (只要不在休息/娱乐,就下降)
|
||||
{
|
||||
@@ -105,31 +112,41 @@ namespace ArachnaeSwarm
|
||||
researchSpeed *= this.GetStatValue(StatDefOf.ResearchSpeedFactor);
|
||||
Find.ResearchManager.ResearchPerformed(researchSpeed, pawn);
|
||||
pawn.skills.Learn(SkillDefOf.Intellectual, 0.1f, false);
|
||||
StartResearchEffect();
|
||||
|
||||
// --- Directly replicating the logic of Toil.WithEffect() ---
|
||||
if (researchEffecter == null)
|
||||
{
|
||||
researchEffecter = EffecterDefOf.Research.Spawn();
|
||||
}
|
||||
researchEffecter.EffectTick(this, this);
|
||||
|
||||
// Maintain the other effect as well
|
||||
if (psyfocusMote == null || psyfocusMote.Destroyed)
|
||||
{
|
||||
psyfocusMote = MoteMaker.MakeAttachedOverlay(this, ThingDefOf.Mote_PsyfocusPulse, Vector3.zero);
|
||||
}
|
||||
psyfocusMote.Maintain();
|
||||
}
|
||||
else
|
||||
{
|
||||
StopResearchEffect();
|
||||
StopWorkEffects();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void StartResearchEffect()
|
||||
{
|
||||
if (researchEffecter == null)
|
||||
{
|
||||
researchEffecter = EffecterDefOf.Research.Spawn();
|
||||
}
|
||||
researchEffecter.EffectTick(this, TargetInfo.Invalid);
|
||||
}
|
||||
|
||||
private void StopResearchEffect()
|
||||
// We no longer need StartWorkEffects, the logic is now directly in Tick()
|
||||
private void StopWorkEffects()
|
||||
{
|
||||
if (researchEffecter != null)
|
||||
{
|
||||
researchEffecter.Cleanup();
|
||||
researchEffecter = null;
|
||||
}
|
||||
if (psyfocusMote != null && !psyfocusMote.Destroyed)
|
||||
{
|
||||
psyfocusMote.Destroy();
|
||||
}
|
||||
psyfocusMote = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -251,11 +268,7 @@ namespace ArachnaeSwarm
|
||||
|
||||
public override void Destroy(DestroyMode mode)
|
||||
{
|
||||
if (researchEffecter != null)
|
||||
{
|
||||
researchEffecter.Cleanup();
|
||||
researchEffecter = null;
|
||||
}
|
||||
StopWorkEffects();
|
||||
|
||||
if (this.Spawned && compMorphable?.StoredPawn != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user