修复追猎问题,科技更新
This commit is contained in:
Binary file not shown.
@@ -5,22 +5,6 @@
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\pawn_comps\\ara_fighter_invisible\\compfighterinvisible.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:pawn_comps\\ara_fighter_invisible\\compfighterinvisible.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\pawn_comps\\ara_fighter_invisible\\compproperties_fighterinvisible.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:pawn_comps\\ara_fighter_invisible\\compproperties_fighterinvisible.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\thing_comps\\ara_ingestionoutcomedoer_givehediff\\ingestionoutcomedoer_givehediffbyrace.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:thing_comps\\ara_ingestionoutcomedoer_givehediff\\ingestionoutcomedoer_givehediffbyrace.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\thing_comps\\ara_customuniqueweapon\\compcustomuniqueweapon.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:thing_comps\\ara_customuniqueweapon\\compcustomuniqueweapon.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\thing_comps\\optoxicgas.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:thing_comps\\optoxicgas.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
@@ -30,24 +14,12 @@
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 2,
|
||||
"SelectedChildIndex": 1,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "CompProperties_FighterInvisible.cs",
|
||||
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Pawn_Comps\\ARA_Fighter_Invisible\\CompProperties_FighterInvisible.cs",
|
||||
"RelativeDocumentMoniker": "Pawn_Comps\\ARA_Fighter_Invisible\\CompProperties_FighterInvisible.cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Pawn_Comps\\ARA_Fighter_Invisible\\CompProperties_FighterInvisible.cs",
|
||||
"RelativeToolTip": "Pawn_Comps\\ARA_Fighter_Invisible\\CompProperties_FighterInvisible.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAABwAAAAJAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-09-22T17:58:46.022Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
@@ -56,46 +28,10 @@
|
||||
"RelativeDocumentMoniker": "Pawn_Comps\\ARA_Fighter_Invisible\\CompFighterInvisible.cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Pawn_Comps\\ARA_Fighter_Invisible\\CompFighterInvisible.cs",
|
||||
"RelativeToolTip": "Pawn_Comps\\ARA_Fighter_Invisible\\CompFighterInvisible.cs",
|
||||
"ViewState": "AgIAABAAAAAAAAAAAAAAwBsAAAAAAAAAAAAAAA==",
|
||||
"ViewState": "AgIAABQAAAAAAAAAAAAQwCcAAAAdAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-09-22T17:58:44.038Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "IngestionOutcomeDoer_GiveHediffByRace.cs",
|
||||
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Thing_Comps\\ARA_IngestionOutcomeDoer_GiveHediff\\IngestionOutcomeDoer_GiveHediffByRace.cs",
|
||||
"RelativeDocumentMoniker": "Thing_Comps\\ARA_IngestionOutcomeDoer_GiveHediff\\IngestionOutcomeDoer_GiveHediffByRace.cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Thing_Comps\\ARA_IngestionOutcomeDoer_GiveHediff\\IngestionOutcomeDoer_GiveHediffByRace.cs",
|
||||
"RelativeToolTip": "Thing_Comps\\ARA_IngestionOutcomeDoer_GiveHediff\\IngestionOutcomeDoer_GiveHediffByRace.cs",
|
||||
"ViewState": "AgIAAAcAAAAAAAAAAAAAABYAAAApAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-09-22T09:03:36.873Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"Title": "CompCustomUniqueWeapon.cs",
|
||||
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Thing_Comps\\ARA_CustomUniqueWeapon\\CompCustomUniqueWeapon.cs",
|
||||
"RelativeDocumentMoniker": "Thing_Comps\\ARA_CustomUniqueWeapon\\CompCustomUniqueWeapon.cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Thing_Comps\\ARA_CustomUniqueWeapon\\CompCustomUniqueWeapon.cs",
|
||||
"RelativeToolTip": "Thing_Comps\\ARA_CustomUniqueWeapon\\CompCustomUniqueWeapon.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-09-22T09:03:28.529Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 4,
|
||||
"Title": "OPToxicGas.cs",
|
||||
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Thing_Comps\\OPToxicGas.cs",
|
||||
"RelativeDocumentMoniker": "Thing_Comps\\OPToxicGas.cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Thing_Comps\\OPToxicGas.cs",
|
||||
"RelativeToolTip": "Thing_Comps\\OPToxicGas.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAALsAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-09-22T09:02:29.07Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -10,53 +10,37 @@ namespace ArachnaeSwarm
|
||||
public class CompFighterInvisible : ThingComp
|
||||
{
|
||||
public CompProperties_FighterInvisible Props => (CompProperties_FighterInvisible)props;
|
||||
|
||||
[Unsaved(false)]
|
||||
private HediffComp_Invisibility invisibility;
|
||||
|
||||
private int lastDetectedTick = -99999;
|
||||
|
||||
private Pawn Sightstealer => (Pawn)parent;
|
||||
|
||||
public HediffDef GetTargetInvisibilityDef()
|
||||
{
|
||||
return Props.InvisibilityDef;
|
||||
}
|
||||
|
||||
//检测是否拥有定义的InvisibilityDef
|
||||
private HediffComp_Invisibility Invisibility => invisibility ?? (invisibility = Sightstealer.health.hediffSet.GetFirstHediffOfDef(GetTargetInvisibilityDef())?.TryGetComp<HediffComp_Invisibility>());
|
||||
|
||||
//用于在存档储存lastDetectedTick
|
||||
// 添加一个属性来检查是否有效
|
||||
private bool IsValid => Sightstealer?.health?.hediffSet != null &&
|
||||
GetTargetInvisibilityDef() != null &&
|
||||
!Sightstealer.IsShambler &&
|
||||
Sightstealer.Spawned;
|
||||
private HediffComp_Invisibility Invisibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid) return null;
|
||||
return invisibility ?? (invisibility = Sightstealer.health.hediffSet
|
||||
.GetFirstHediffOfDef(GetTargetInvisibilityDef())
|
||||
?.TryGetComp<HediffComp_Invisibility>());
|
||||
}
|
||||
}
|
||||
public override void PostExposeData()
|
||||
{
|
||||
Scribe_Values.Look(ref lastDetectedTick, "lastDetectedTick", 0);
|
||||
}
|
||||
|
||||
public override void CompTick()
|
||||
{
|
||||
//如果没有定义的InvisibilityDef,则返回false
|
||||
if (Sightstealer?.health?.hediffSet == null || GetTargetInvisibilityDef() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (Invisibility == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//蹒跚怪不会隐身
|
||||
if (Sightstealer.IsShambler)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (Invisibility == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!Sightstealer.Spawned)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//进行隐身检查,如果超过定义的隐身恢复时间则切换为隐身
|
||||
// 使用统一的有效性检查
|
||||
if (!IsValid || Invisibility == null) return;
|
||||
if (Sightstealer.IsHashIntervalTick(7))
|
||||
{
|
||||
if (Find.TickManager.TicksGame > lastDetectedTick + Props.stealthCooldownTicks)
|
||||
@@ -65,15 +49,15 @@ namespace ArachnaeSwarm
|
||||
}
|
||||
}
|
||||
}
|
||||
//在使用verb的时候,会强制显现
|
||||
public override void Notify_UsedVerb(Pawn pawn, Verb verb)
|
||||
{
|
||||
base.Notify_UsedVerb(pawn, verb);
|
||||
if (!Sightstealer.IsShambler)
|
||||
{
|
||||
Invisibility.BecomeVisible();
|
||||
lastDetectedTick = Find.TickManager.TicksGame;
|
||||
}
|
||||
|
||||
// 统一的 null 检查
|
||||
if (Invisibility == null) return;
|
||||
|
||||
Invisibility.BecomeVisible();
|
||||
lastDetectedTick = Find.TickManager.TicksGame;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user