Skip to content

Commit

Permalink
new implicit transfer method
Browse files Browse the repository at this point in the history
  • Loading branch information
Cn-mjt44 committed Feb 27, 2024
1 parent bffda7c commit a966ca0
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions RW_NodeTree/CompChildNodeProccesser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,14 @@ public static bool CheckVerbDatasVaildityAndAdapt(Type ownerType, Thing thing, r
public void ResetRenderedTexture()
{
for (int i = 0; i < nodeRenderingInfos.Length; i++) nodeRenderingInfos[i] = null;
if (parent.Spawned && parent.def.drawerType >= DrawerType.MapMeshOnly) parent.DirtyMapMesh(parent.Map);
try
{
if (parent.Spawned && parent.def.drawerType >= DrawerType.MapMeshOnly) parent.DirtyMapMesh(parent.Map);
}
catch (Exception ex)
{
Log.Warning(ex.ToString());
}
ParentProccesser?.ResetRenderedTexture();
}

Expand Down Expand Up @@ -743,7 +750,27 @@ public static implicit operator Thing(CompChildNodeProccesser node)

public static implicit operator CompChildNodeProccesser(Thing thing)
{
return thing?.TryGetComp<CompChildNodeProccesser>();
List<ThingComp> comps = (thing as ThingWithComps)?.AllComps;
if (comps != null && comps.Count > 0)
{
CompChildNodeProccesser result = comps[0] as CompChildNodeProccesser;
if (result == null)
{
int i = 1;
for (; i < comps.Count; i++)
{
result = comps[i] as CompChildNodeProccesser;
if (result != null) break;
}
if (result != null)
{
comps.RemoveAt(i);
comps.Insert(0, result);
}
}
return result;
}
return null;
}
#endregion

Expand Down

0 comments on commit a966ca0

Please sign in to comment.