各种更新
This commit is contained in:
Binary file not shown.
@@ -3,16 +3,28 @@
|
||||
"WorkspaceRootPath": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\abilities\\ara_givehediffwithskillduration\\compabilityeffect_givehediffwithskillduration.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_givehediffwithskillduration\\compabilityeffect_givehediffwithskillduration.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\\abilities\\ara_showtemperaturerange\\compabilityeffect_abilityshowtemperaturerange.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_showtemperaturerange\\compabilityeffect_abilityshowtemperaturerange.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\\abilities\\ara_givehediffwithskillduration\\compproperties_givehediffwithskillduration.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_givehediffwithskillduration\\compproperties_givehediffwithskillduration.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\\ara_hediffdefof.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:ara_hediffdefof.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\\abilities\\ara_terrainrestriction\\compabilityeffect_terrainrestriction .cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_terrainrestriction\\compabilityeffect_terrainrestriction .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\\mainharmony.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:mainharmony.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\\supercarryextension.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:supercarryextension.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\\floatmenuoptionprovider_supercarry.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:floatmenuoptionprovider_supercarry.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\\jobdriver_supercarry.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:jobdriver_supercarry.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
@@ -22,7 +34,7 @@
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 2,
|
||||
"SelectedChildIndex": 1,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
@@ -30,42 +42,76 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "CompProperties_GiveHediffWithSkillDuration.cs",
|
||||
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_GiveHediffWithSkillDuration\\CompProperties_GiveHediffWithSkillDuration.cs",
|
||||
"RelativeDocumentMoniker": "Abilities\\ARA_GiveHediffWithSkillDuration\\CompProperties_GiveHediffWithSkillDuration.cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_GiveHediffWithSkillDuration\\CompProperties_GiveHediffWithSkillDuration.cs*",
|
||||
"RelativeToolTip": "Abilities\\ARA_GiveHediffWithSkillDuration\\CompProperties_GiveHediffWithSkillDuration.cs*",
|
||||
"ViewState": "AgIAAAEAAAAAAAAAAAAiwC4AAAAFAAAAAAAAAA==",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "CompAbilityEffect_AbilityShowTemperatureRange.cs",
|
||||
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_ShowTemperatureRange\\CompAbilityEffect_AbilityShowTemperatureRange.cs",
|
||||
"RelativeDocumentMoniker": "Abilities\\ARA_ShowTemperatureRange\\CompAbilityEffect_AbilityShowTemperatureRange.cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_ShowTemperatureRange\\CompAbilityEffect_AbilityShowTemperatureRange.cs",
|
||||
"RelativeToolTip": "Abilities\\ARA_ShowTemperatureRange\\CompAbilityEffect_AbilityShowTemperatureRange.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAkAAAA9AAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-09-26T06:01:20.721Z",
|
||||
"WhenOpened": "2025-09-27T08:23:51.83Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "CompAbilityEffect_GiveHediffWithSkillDuration.cs",
|
||||
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_GiveHediffWithSkillDuration\\CompAbilityEffect_GiveHediffWithSkillDuration.cs",
|
||||
"RelativeDocumentMoniker": "Abilities\\ARA_GiveHediffWithSkillDuration\\CompAbilityEffect_GiveHediffWithSkillDuration.cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_GiveHediffWithSkillDuration\\CompAbilityEffect_GiveHediffWithSkillDuration.cs*",
|
||||
"RelativeToolTip": "Abilities\\ARA_GiveHediffWithSkillDuration\\CompAbilityEffect_GiveHediffWithSkillDuration.cs*",
|
||||
"ViewState": "AgIAACYAAAAAAAAAAAAqwEgAAAAnAAAAAAAAAA==",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "ARA_HediffDefOf.cs",
|
||||
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ARA_HediffDefOf.cs",
|
||||
"RelativeDocumentMoniker": "ARA_HediffDefOf.cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ARA_HediffDefOf.cs",
|
||||
"RelativeToolTip": "ARA_HediffDefOf.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAA4AAAAJAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-09-26T06:00:59.354Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2025-09-27T03:14:05.334Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "CompAbilityEffect_TerrainRestriction .cs",
|
||||
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_TerrainRestriction\\CompAbilityEffect_TerrainRestriction .cs",
|
||||
"RelativeDocumentMoniker": "Abilities\\ARA_TerrainRestriction\\CompAbilityEffect_TerrainRestriction .cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_TerrainRestriction\\CompAbilityEffect_TerrainRestriction .cs",
|
||||
"RelativeToolTip": "Abilities\\ARA_TerrainRestriction\\CompAbilityEffect_TerrainRestriction .cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAEsAAAAAAAAAAAAAAA==",
|
||||
"Title": "MainHarmony.cs",
|
||||
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\MainHarmony.cs",
|
||||
"RelativeDocumentMoniker": "MainHarmony.cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\MainHarmony.cs",
|
||||
"RelativeToolTip": "MainHarmony.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-09-26T03:32:39.017Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2025-09-27T03:13:34.632Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"Title": "SuperCarryExtension.cs",
|
||||
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\SuperCarryExtension.cs",
|
||||
"RelativeDocumentMoniker": "SuperCarryExtension.cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\SuperCarryExtension.cs",
|
||||
"RelativeToolTip": "SuperCarryExtension.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-09-27T03:13:32.751Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 4,
|
||||
"Title": "FloatMenuOptionProvider_SuperCarry.cs",
|
||||
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\FloatMenuOptionProvider_SuperCarry.cs",
|
||||
"RelativeDocumentMoniker": "FloatMenuOptionProvider_SuperCarry.cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\FloatMenuOptionProvider_SuperCarry.cs",
|
||||
"RelativeToolTip": "FloatMenuOptionProvider_SuperCarry.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-09-27T03:13:31.262Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 5,
|
||||
"Title": "JobDriver_SuperCarry.cs",
|
||||
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\JobDriver_SuperCarry.cs",
|
||||
"RelativeDocumentMoniker": "JobDriver_SuperCarry.cs",
|
||||
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\JobDriver_SuperCarry.cs",
|
||||
"RelativeToolTip": "JobDriver_SuperCarry.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-09-27T03:13:30.358Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
public class CompAbilityEffect_ShowSpawnablePawns : CompAbilityEffect
|
||||
{
|
||||
public new CompProperties_AbilityShowSpawnablePawns Props => (CompProperties_AbilityShowSpawnablePawns)props;
|
||||
|
||||
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
|
||||
{
|
||||
// 这个组件只用于显示信息,不执行实际效果
|
||||
}
|
||||
|
||||
public override bool Valid(LocalTargetInfo target, bool throwMessages = false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// 重写工具提示方法,显示可生成的pawn列表
|
||||
public override string ExtraTooltipPart()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
// 获取建筑定义的spawn comp
|
||||
var spawnComp = GetSpawnCompFromBuilding();
|
||||
if (spawnComp == null || spawnComp.spawnablePawns == null || spawnComp.spawnablePawns.Count == 0)
|
||||
{
|
||||
return null; // 没有可显示的内容
|
||||
}
|
||||
|
||||
stringBuilder.AppendLine(Props.customLabel + ":");
|
||||
stringBuilder.AppendLine();
|
||||
|
||||
// 显示每个可生成的pawn
|
||||
foreach (var spawnEntry in spawnComp.spawnablePawns)
|
||||
{
|
||||
if (spawnEntry.pawnKind != null)
|
||||
{
|
||||
string entryText = $" • {spawnEntry.pawnKind.LabelCap}";
|
||||
|
||||
// 如果有延迟,显示延迟信息
|
||||
if (spawnEntry.delayTicks > 0)
|
||||
{
|
||||
entryText += $" ({spawnEntry.delayTicks.ToStringTicksToPeriod()})";
|
||||
}
|
||||
|
||||
// 如果有科技需求,显示科技信息
|
||||
if (Props.showResearchRequirements && spawnEntry.requiredResearch != null)
|
||||
{
|
||||
bool researched = spawnEntry.requiredResearch.IsFinished;
|
||||
string researchStatus = researched ? "✓" : "✗";
|
||||
entryText += $" [{researchStatus}{spawnEntry.requiredResearch.LabelCap}]";
|
||||
}
|
||||
|
||||
stringBuilder.AppendLine(entryText);
|
||||
}
|
||||
}
|
||||
|
||||
return stringBuilder.ToString().TrimEndNewlines();
|
||||
}
|
||||
|
||||
// 从建筑定义获取spawn comp
|
||||
private CompProperties_SpawnPawnFromList GetSpawnCompFromBuilding()
|
||||
{
|
||||
if (Props.spawnBuildingDef == null)
|
||||
{
|
||||
Log.Error("CompProperties_AbilityShowSpawnablePawns: spawnBuildingDef is null");
|
||||
return null;
|
||||
}
|
||||
|
||||
// 查找建筑的spawn comp
|
||||
foreach (var comp in Props.spawnBuildingDef.comps)
|
||||
{
|
||||
if (comp is CompProperties_SpawnPawnFromList spawnComp)
|
||||
{
|
||||
return spawnComp;
|
||||
}
|
||||
}
|
||||
|
||||
Log.Warning($"CompProperties_AbilityShowSpawnablePawns: No spawn comp found on building {Props.spawnBuildingDef.defName}");
|
||||
return null;
|
||||
}
|
||||
|
||||
// 获取所有可生成的pawn种类(用于其他用途)
|
||||
public List<PawnKindDef> GetSpawnablePawnKinds()
|
||||
{
|
||||
var spawnComp = GetSpawnCompFromBuilding();
|
||||
var result = new List<PawnKindDef>();
|
||||
|
||||
if (spawnComp?.spawnablePawns != null)
|
||||
{
|
||||
foreach (var entry in spawnComp.spawnablePawns)
|
||||
{
|
||||
if (entry.pawnKind != null && (entry.requiredResearch == null || entry.requiredResearch.IsFinished))
|
||||
{
|
||||
result.Add(entry.pawnKind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// 检查特定pawn种类是否可生成
|
||||
public bool CanSpawnPawnKind(PawnKindDef pawnKind)
|
||||
{
|
||||
var spawnComp = GetSpawnCompFromBuilding();
|
||||
if (spawnComp?.spawnablePawns != null)
|
||||
{
|
||||
foreach (var entry in spawnComp.spawnablePawns)
|
||||
{
|
||||
if (entry.pawnKind == pawnKind &&
|
||||
(entry.requiredResearch == null || entry.requiredResearch.IsFinished))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
public class CompProperties_AbilityShowSpawnablePawns : CompProperties_AbilityEffect
|
||||
{
|
||||
public ThingDef spawnBuildingDef; // 指向的建筑定义
|
||||
public string customLabel = "可生成单位"; // 自定义标签
|
||||
public bool showResearchRequirements = true; // 是否显示科技需求
|
||||
|
||||
public CompProperties_AbilityShowSpawnablePawns()
|
||||
{
|
||||
this.compClass = typeof(CompAbilityEffect_ShowSpawnablePawns);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
public class CompAbilityEffect_ShowTemperatureRange : CompAbilityEffect
|
||||
{
|
||||
public new CompProperties_AbilityShowTemperatureRange Props => (CompProperties_AbilityShowTemperatureRange)props;
|
||||
|
||||
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
|
||||
{
|
||||
// This component is only for displaying information, no actual effect
|
||||
}
|
||||
|
||||
public override bool Valid(LocalTargetInfo target, bool throwMessages = false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Override tooltip method to display temperature range information
|
||||
public override string ExtraTooltipPart()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
// Get the temperature control component from the building
|
||||
var tempCompProps = GetTemperatureCompFromBuilding();
|
||||
if (tempCompProps == null)
|
||||
{
|
||||
return null; // No content to display
|
||||
}
|
||||
|
||||
stringBuilder.AppendLine(Props.customLabel.Translate() + ":");
|
||||
stringBuilder.AppendLine();
|
||||
|
||||
// Display temperature range
|
||||
stringBuilder.AppendLine(" " + "AbilityCheckSafeTemperatureRange".Translate(tempCompProps.minSafeTemperature, tempCompProps.maxSafeTemperature));
|
||||
|
||||
// Display current temperature (if enabled)
|
||||
if (Props.showCurrentTemperature && parent.pawn != null && parent.pawn.Map != null)
|
||||
{
|
||||
float currentTemp = GenTemperature.GetTemperatureForCell(parent.pawn.Position, parent.pawn.Map);
|
||||
string tempStatus = GetTemperatureStatus(currentTemp, tempCompProps.minSafeTemperature, tempCompProps.maxSafeTemperature);
|
||||
stringBuilder.AppendLine();
|
||||
stringBuilder.AppendLine("AbilityCheckCurrentTemperature".Translate(currentTemp.ToString("F1"), tempStatus));
|
||||
}
|
||||
return stringBuilder.ToString().TrimEndNewlines();
|
||||
}
|
||||
|
||||
// Get temperature status description
|
||||
private string GetTemperatureStatus(float currentTemp, float minSafe, float maxSafe)
|
||||
{
|
||||
if (currentTemp < minSafe)
|
||||
return "AbilityCheckTemperatureTooLow".Translate();
|
||||
else if (currentTemp > maxSafe)
|
||||
return "AbilityCheckTemperatureTooHigh".Translate();
|
||||
else
|
||||
return "AbilityCheckTemperatureSafe".Translate();
|
||||
}
|
||||
|
||||
// Get temperature control component from building definition
|
||||
private CompProperties_TemperatureRuinableDamage GetTemperatureCompFromBuilding()
|
||||
{
|
||||
if (Props.temperatureCheckBuilding == null)
|
||||
{
|
||||
Log.Error("CompProperties_AbilityShowTemperatureRange: temperatureCheckBuilding is null");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Find the temperature control component of the building
|
||||
foreach (var comp in Props.temperatureCheckBuilding.comps)
|
||||
{
|
||||
if (comp is CompProperties_TemperatureRuinableDamage tempComp)
|
||||
{
|
||||
return tempComp;
|
||||
}
|
||||
}
|
||||
|
||||
Log.Warning($"CompProperties_AbilityShowTemperatureRange: No temperature comp found on building {Props.temperatureCheckBuilding.defName}");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get temperature range (for other uses)
|
||||
public (float min, float max) GetTemperatureRange()
|
||||
{
|
||||
var tempComp = GetTemperatureCompFromBuilding();
|
||||
if (tempComp != null)
|
||||
{
|
||||
return (tempComp.minSafeTemperature, tempComp.maxSafeTemperature);
|
||||
}
|
||||
return (0f, 100f); // Default value
|
||||
}
|
||||
|
||||
// Check if current temperature is within safe range
|
||||
public bool IsTemperatureSafe()
|
||||
{
|
||||
if (parent.pawn == null || parent.pawn.Map == null)
|
||||
return true;
|
||||
|
||||
var tempComp = GetTemperatureCompFromBuilding();
|
||||
if (tempComp == null)
|
||||
return true;
|
||||
|
||||
float currentTemp = GenTemperature.GetTemperatureForCell(parent.pawn.Position, parent.pawn.Map);
|
||||
return currentTemp >= tempComp.minSafeTemperature && currentTemp <= tempComp.maxSafeTemperature;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
public class CompProperties_AbilityShowTemperatureRange : CompProperties_AbilityEffect
|
||||
{
|
||||
public ThingDef temperatureCheckBuilding; // 要检查的建筑定义
|
||||
public string customLabel = "AbilityCheckSafeTemperatureRangeLabel"; // 自定义标签
|
||||
public bool showCurrentTemperature = true; // 是否显示当前温度
|
||||
|
||||
public CompProperties_AbilityShowTemperatureRange()
|
||||
{
|
||||
this.compClass = typeof(CompAbilityEffect_ShowTemperatureRange);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,6 +91,10 @@
|
||||
<Compile Include="Abilities\ARA_QueenAbility\CompAbilityEffect_ResearchPrereq.cs" />
|
||||
<Compile Include="Abilities\ARA_QueenAbility\CompAbilityEffect_SprayLiquidMulti.cs" />
|
||||
<Compile Include="Abilities\ARA_QueenAbility\CompProperties_AbilitySprayLiquidMulti.cs" />
|
||||
<Compile Include="Abilities\ARA_ShowSpawnablePawnsList\CompAbilityEffect_AbilityShowSpawnablePawns.cs" />
|
||||
<Compile Include="Abilities\ARA_ShowSpawnablePawnsList\CompProperties_AbilityShowSpawnablePawns.cs" />
|
||||
<Compile Include="Abilities\ARA_ShowTemperatureRange\CompAbilityEffect_AbilityShowTemperatureRange.cs" />
|
||||
<Compile Include="Abilities\ARA_ShowTemperatureRange\CompProperties_AbilityShowTemperatureRange.cs" />
|
||||
<Compile Include="Abilities\ARA_TerrainRestriction\CompAbilityEffect_TerrainRestriction .cs" />
|
||||
<Compile Include="Abilities\ARA_TerrainRestriction\CompProperties_TerrainRestriction.cs" />
|
||||
<Compile Include="Abilities\CompAbilityEffect_DRM_Deaddustpop.cs" />
|
||||
@@ -101,7 +105,7 @@
|
||||
<Compile Include="Abilities\TrackingCharge\CompProperties_TrackingCharge.cs" />
|
||||
<Compile Include="Abilities\TrackingCharge\PawnFlyer_TrackingCharge.cs" />
|
||||
<Compile Include="Abilities\TrackingCharge\Verb_CastAbilityTrackingCharge.cs" />
|
||||
<Compile Include="Hediffs\ARA_HediffDefOf.cs" />
|
||||
<Compile Include="ARA_HediffDefOf.cs" />
|
||||
<Compile Include="Building_Comps\ARA_BuildingTerrainSpawn\CompDelayedTerrainSpawn.cs" />
|
||||
<Compile Include="Building_Comps\ARA_BuildingTerrainSpawn\CompProperties_DelayedTerrainSpawn.cs" />
|
||||
<Compile Include="Building_Comps\ARA_CompInteractiveProducer\CompInteractiveProducer.cs" />
|
||||
|
||||
Reference in New Issue
Block a user