乌拉自己找吃的
This commit is contained in:
Binary file not shown.
@@ -2,12 +2,16 @@
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\building_wula_darkenergy_engine.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|solutionrelative:building_wula_darkenergy_engine.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|c:\\steam\\steamapps\\common\\rimworld\\mods\\3516260226\\source\\wulafallenempire\\ingestpatch.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|solutionrelative:ingestpatch.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|c:\\steam\\steamapps\\common\\rimworld\\mods\\3516260226\\source\\wulafallenempire\\hediffcomp_regeneratebackstory.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"AbsoluteMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\hediffcomp_regeneratebackstory.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|solutionrelative:hediffcomp_regeneratebackstory.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
@@ -17,10 +21,6 @@
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\wulafallenempiremod.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|solutionrelative:wulafallenempiremod.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\building_wula_darkenergy_engine.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{F5AE8C3B-0221-4C16-A128-9A62D521A8FF}|WulaFallenEmpire.csproj|solutionrelative:building_wula_darkenergy_engine.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
@@ -30,21 +30,8 @@
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 0,
|
||||
"SelectedChildIndex": 6,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "IngestPatch.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\IngestPatch.cs",
|
||||
"RelativeDocumentMoniker": "IngestPatch.cs",
|
||||
"ToolTip": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\IngestPatch.cs",
|
||||
"RelativeToolTip": "IngestPatch.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAADwvwoAAAAFAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-07-20T17:09:27.916Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
|
||||
@@ -52,6 +39,19 @@
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "IngestPatch.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\IngestPatch.cs",
|
||||
"RelativeDocumentMoniker": "IngestPatch.cs",
|
||||
"ToolTip": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\IngestPatch.cs",
|
||||
"RelativeToolTip": "IngestPatch.cs",
|
||||
"ViewState": "AQIAACEAAAAAAAAAAAAowEwAAAAAAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-07-20T17:09:27.916Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "HediffComp_RegenerateBackstory.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\HediffComp_RegenerateBackstory.cs",
|
||||
"RelativeDocumentMoniker": "HediffComp_RegenerateBackstory.cs",
|
||||
@@ -59,12 +59,11 @@
|
||||
"RelativeToolTip": "HediffComp_RegenerateBackstory.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAHIAAAABAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-07-18T11:23:19.064Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2025-07-18T11:23:19.064Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"DocumentIndex": 4,
|
||||
"Title": "WulaFallenEmpireMod.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\WulaFallenEmpireMod.cs",
|
||||
"RelativeDocumentMoniker": "WulaFallenEmpireMod.cs",
|
||||
@@ -80,7 +79,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"DocumentIndex": 3,
|
||||
"Title": "MechanitorPatch.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\MechanitorPatch.cs",
|
||||
"RelativeDocumentMoniker": "MechanitorPatch.cs",
|
||||
@@ -92,7 +91,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 4,
|
||||
"DocumentIndex": 0,
|
||||
"Title": "Building_Wula_DarkEnergy_Engine.cs",
|
||||
"DocumentMoniker": "C:\\Steam\\steamapps\\common\\RimWorld\\Mods\\3516260226\\Source\\WulaFallenEmpire\\Building_Wula_DarkEnergy_Engine.cs",
|
||||
"RelativeDocumentMoniker": "Building_Wula_DarkEnergy_Engine.cs",
|
||||
@@ -100,7 +99,8 @@
|
||||
"RelativeToolTip": "Building_Wula_DarkEnergy_Engine.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-07-14T12:24:18.86Z"
|
||||
"WhenOpened": "2025-07-14T12:24:18.86Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
{
|
||||
"name": "Data",
|
||||
"path": "../../../../Data"
|
||||
},
|
||||
{
|
||||
"path": "../../../3256974620"
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
|
||||
@@ -8,10 +8,11 @@ namespace WulaFallenEmpire
|
||||
public int durationTicks = 600; // 默认10秒
|
||||
public HediffDef hediffDef;
|
||||
public bool requireDowned = true; // 是否需要倒地才能使用
|
||||
public SoundDef soundCast;
|
||||
|
||||
public CompProperties_AbilityEmergencyEnergyRestore()
|
||||
{
|
||||
compClass = typeof(CompAbilityEffect_EmergencyEnergyRestore);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,13 +79,7 @@ namespace WulaFallenEmpire
|
||||
[HarmonyPostfix]
|
||||
public static void Command_Ability_GizmoDisabled_Postfix(Command_Ability __instance, ref bool __result)
|
||||
{
|
||||
// 使用反射获取ability字段
|
||||
var abilityField = typeof(Command_Ability).GetField("ability", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
if (abilityField == null) return;
|
||||
|
||||
Ability ability = (Ability)abilityField.GetValue(__instance);
|
||||
if (ability == null) return;
|
||||
|
||||
var ability = (Ability)typeof(Command_Ability).GetField("ability", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
|
||||
if (ability.def.defName == "WULA_EmergencyEnergyRestore")
|
||||
{
|
||||
Log.Message($"[EmergencyAbilityPatches] Command_Ability_GizmoDisabled_Postfix for {ability.pawn?.LabelShort}, initial result: {__result}");
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using Verse;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
public class JobGiverDefExtension_WulaGetEnergy : DefModExtension
|
||||
{
|
||||
public float minEnergyLevelPercentage = 0.3f;
|
||||
public float emergencyThreshold = 0.1f;
|
||||
public float normalPriority = 5f;
|
||||
public float emergencyPriority = 9.5f;
|
||||
}
|
||||
}
|
||||
98
Source/WulaFallenEmpire/JobGiver_WulaGetEnergy.cs
Normal file
98
Source/WulaFallenEmpire/JobGiver_WulaGetEnergy.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
using System.Linq; // For FirstOrDefault
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
public class JobGiver_WulaGetEnergy : ThinkNode_JobGiver
|
||||
{
|
||||
public float minEnergyLevelPercentage = 0.3f;
|
||||
public float emergencyThreshold = 0.1f;
|
||||
public float normalPriority = 5f;
|
||||
public float emergencyPriority = 9.5f;
|
||||
|
||||
public override ThinkNode DeepCopy(bool resolve = true)
|
||||
{
|
||||
JobGiver_WulaGetEnergy obj = (JobGiver_WulaGetEnergy)base.DeepCopy(resolve);
|
||||
obj.minEnergyLevelPercentage = minEnergyLevelPercentage;
|
||||
obj.emergencyThreshold = emergencyThreshold;
|
||||
obj.normalPriority = normalPriority;
|
||||
obj.emergencyPriority = emergencyPriority;
|
||||
return obj;
|
||||
}
|
||||
|
||||
public override float GetPriority(Pawn pawn)
|
||||
{
|
||||
Need_WulaEnergy energyNeed = pawn.needs.TryGetNeed<Need_WulaEnergy>();
|
||||
if (energyNeed == null)
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
// 如果能量充足,则不需要寻找能量核心
|
||||
if (energyNeed.CurLevelPercentage > minEnergyLevelPercentage)
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
// 如果能量非常低,给予高优先级
|
||||
if (energyNeed.CurLevelPercentage < emergencyThreshold)
|
||||
{
|
||||
return emergencyPriority;
|
||||
}
|
||||
|
||||
// 否则,给予中等优先级
|
||||
return normalPriority;
|
||||
}
|
||||
|
||||
protected override Job TryGiveJob(Pawn pawn)
|
||||
{
|
||||
Need_WulaEnergy energyNeed = pawn.needs.TryGetNeed<Need_WulaEnergy>();
|
||||
if (energyNeed == null || energyNeed.CurLevelPercentage > minEnergyLevelPercentage)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// 寻找最佳能量核心
|
||||
Thing bestEnergySource = GenClosest.ClosestThingReachable(
|
||||
pawn.Position,
|
||||
pawn.Map,
|
||||
ThingRequest.ForGroup(ThingRequestGroup.HaulableEver), // 扫描所有可搬运的物品
|
||||
PathEndMode.ClosestTouch,
|
||||
TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false),
|
||||
9999f,
|
||||
(Thing t) =>
|
||||
{
|
||||
// 检查物品是否是能量核心
|
||||
ThingDefExtension_EnergySource energySourceExt = t.def.GetModExtension<ThingDefExtension_EnergySource>();
|
||||
if (energySourceExt == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// 检查物品是否可摄取
|
||||
if (!t.IngestibleNow)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// 检查物品是否被禁止或无法预留
|
||||
if (t.IsForbidden(pawn) || !pawn.CanReserve(t, 1, -1, null, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
if (bestEnergySource != null)
|
||||
{
|
||||
// 创建摄取能量核心的Job
|
||||
Job job = JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("WULA_IngestWulaEnergy"), bestEnergySource);
|
||||
job.count = 1; // 每次摄取一个
|
||||
return job;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,5 +10,7 @@ namespace WulaFallenEmpire
|
||||
public float maxLevel = 1.0f;
|
||||
// 运送能量的阈值
|
||||
public float deliverEnergyThreshold = 0.5f;
|
||||
// 自动摄取能量的阈值
|
||||
public float autoIngestThreshold = 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace WulaFallenEmpire
|
||||
public bool applyDamageToExplosionCellsNeighbors = true;
|
||||
public float chanceToStartFire = 0f;
|
||||
public bool damageFalloff = true;
|
||||
public float screenShakeFactor = 0f; // 新增:屏幕震动因子
|
||||
|
||||
public VerbPropertiesExplosiveBeam()
|
||||
{
|
||||
@@ -46,4 +47,4 @@ namespace WulaFallenEmpire
|
||||
verbClass = typeof(Verb_ShootBeamExplosive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,8 @@ namespace WulaFallenEmpire
|
||||
doVisualEffects: true,
|
||||
propagationSpeed: 0.6f,
|
||||
excludeRadius: 0f,
|
||||
doSoundEffects: false // 我们手动处理音效
|
||||
doSoundEffects: false, // 我们手动处理音效
|
||||
screenShakeFactor: explosiveProps.screenShakeFactor // 新增:屏幕震动因子
|
||||
);
|
||||
|
||||
// 生成额外的视觉效果
|
||||
@@ -89,4 +90,4 @@ namespace WulaFallenEmpire
|
||||
Scribe_Values.Look(ref explosionShotCounter, "explosionShotCounter", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,8 @@
|
||||
<Compile Include="CompWulaShieldBelt.cs" />
|
||||
<Compile Include="WulaShieldBeltPatches.cs" />
|
||||
<Compile Include="EmergencyAbilityPatches.cs" />
|
||||
<Compile Include="JobGiver_WulaGetEnergy.cs" />
|
||||
<Compile Include="JobGiverDefExtension_WulaGetEnergy.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user