From 2b352a076f965ec592302b1fe3d3aeab9515efc3 Mon Sep 17 00:00:00 2001 From: Future <1609605489@qq.com> Date: Fri, 25 Nov 2022 01:00:53 +0800 Subject: [PATCH] update --- RW_NodeTree/CompChildNodeProccesser.cs | 3 ++- RW_NodeTree/Patch/Pawn_EquipmentTracker_Patcher.cs | 2 +- RW_NodeTree/Patch/Pawn_TryGetAttackVerb_Patcher.cs | 2 +- RW_NodeTree/Patch/VerbTracker_AllVerbs_Patcher.cs | 3 ++- RW_NodeTree/VerbRegiestInfo.cs | 7 ++++--- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/RW_NodeTree/CompChildNodeProccesser.cs b/RW_NodeTree/CompChildNodeProccesser.cs index 4b804e5..f8d5977 100644 --- a/RW_NodeTree/CompChildNodeProccesser.cs +++ b/RW_NodeTree/CompChildNodeProccesser.cs @@ -99,6 +99,7 @@ public HashSet RegiestedNodeId Log.Error(ex.ToString()); } } + cache.RemoveWhere(x => !x.IsVaildityKeyFormat()); regiestedNodeId.AddRange(cache); } return new HashSet(regiestedNodeId); @@ -533,7 +534,7 @@ public Material GetAndUpdateChildTexture(Rot4 rot, Graphic subGraphic = null) List final = new List(); foreach((Thing, string, List) infos in nodeRenderingInfos) { - final.AddRange(infos.Item3); + if(!infos.Item3.NullOrEmpty()) final.AddRange(infos.Item3); } RenderingTools.RenderToTarget(final, ref cachedRenderTarget, ref texture, default(Vector2Int), Props.TextureSizeFactor, Props.ExceedanceFactor, Props.ExceedanceOffset); diff --git a/RW_NodeTree/Patch/Pawn_EquipmentTracker_Patcher.cs b/RW_NodeTree/Patch/Pawn_EquipmentTracker_Patcher.cs index d23322e..6348a39 100644 --- a/RW_NodeTree/Patch/Pawn_EquipmentTracker_Patcher.cs +++ b/RW_NodeTree/Patch/Pawn_EquipmentTracker_Patcher.cs @@ -106,7 +106,7 @@ IEnumerable forEach(IEnumerable< Gizmo> result) { Log.Error(ex.ToString()); } - foreach (Gizmo gizmo in gizmos) yield return gizmo; + foreach (Gizmo gizmo in gizmos) if(gizmo != null) yield return gizmo; } } } diff --git a/RW_NodeTree/Patch/Pawn_TryGetAttackVerb_Patcher.cs b/RW_NodeTree/Patch/Pawn_TryGetAttackVerb_Patcher.cs index 3aae2fa..9547db2 100644 --- a/RW_NodeTree/Patch/Pawn_TryGetAttackVerb_Patcher.cs +++ b/RW_NodeTree/Patch/Pawn_TryGetAttackVerb_Patcher.cs @@ -29,7 +29,7 @@ public static void PrePawn_TryGetAttackVerb(Pawn __instance) if(job != null && typeof(JobDriver_AttackStatic).IsAssignableFrom(job.def.driverClass) && job.verbToUse?.Caster == __instance) { CompEquippable equippable = __instance.equipment.PrimaryEq; - List verbList = CompChildNodeProccesser.GetOriginalAllVerbs(equippable.verbTracker); + List verbList = CompChildNodeProccesser.GetOriginalAllVerbs(equippable.VerbTracker); if (verbList.Remove(__instance.CurJob.verbToUse)) { verbList.Insert(0, __instance.CurJob.verbToUse); diff --git a/RW_NodeTree/Patch/VerbTracker_AllVerbs_Patcher.cs b/RW_NodeTree/Patch/VerbTracker_AllVerbs_Patcher.cs index d8af0ed..a322902 100644 --- a/RW_NodeTree/Patch/VerbTracker_AllVerbs_Patcher.cs +++ b/RW_NodeTree/Patch/VerbTracker_AllVerbs_Patcher.cs @@ -128,8 +128,9 @@ internal List PostVerbTracker_AllVerbs(Type ownerType, List result) { for (int i = 0; i < result.Count; i++) { - result[i] = GetAfterConvertVerbCorrespondingThing(ownerType, result[i]).Item2; + result[i] = GetAfterConvertVerbCorrespondingThing(ownerType, result[i]).Item2 ?? result[i]; } + result.RemoveAll(x => x == null || x.verbProps == null); return result; } return null; diff --git a/RW_NodeTree/VerbRegiestInfo.cs b/RW_NodeTree/VerbRegiestInfo.cs index 95f39b8..a2d5b12 100644 --- a/RW_NodeTree/VerbRegiestInfo.cs +++ b/RW_NodeTree/VerbRegiestInfo.cs @@ -1,4 +1,5 @@ -using System; +using RW_NodeTree.Tools; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -16,7 +17,7 @@ public VerbToolRegiestInfo(string id, Tool berforConvertTool, Tool afterCobvertT this.afterCobvertTool = afterCobvertTool; } - public bool Vaildity => berforConvertTool != null && afterCobvertTool != null; + public bool Vaildity => berforConvertTool != null && afterCobvertTool != null && (id == null || id.IsVaildityKeyFormat()); public override string ToString() { @@ -35,7 +36,7 @@ public VerbPropertiesRegiestInfo(string id, VerbProperties berforConvertProperti this.berforConvertProperties = berforConvertProperties; this.afterConvertProperties = afterConvertProperties; } - public bool Vaildity => berforConvertProperties != null && afterConvertProperties != null; + public bool Vaildity => berforConvertProperties != null && afterConvertProperties != null && (id == null || id.IsVaildityKeyFormat()); public override string ToString() {