织座特效

This commit is contained in:
2025-10-04 16:27:24 +08:00
parent 8d7541ac85
commit fa3fb2fde9
3 changed files with 34 additions and 22 deletions

Binary file not shown.

View File

@@ -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>

View File

@@ -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)
{