Allow AutoNetworkedField to work with inherited datafields (#6090)

* allow AutoNetworkedField to work for inherited datafields

* fix

* test fix

* typo

* Update Robust.UnitTesting/Shared/GameState/AutoNetworkingTest.cs

---------

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
This commit is contained in:
slarticodefast
2025-07-23 01:15:12 +02:00
committed by GitHub
parent 0bf4123b8d
commit fee67b648c
3 changed files with 242 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
using static Microsoft.CodeAnalysis.SymbolDisplayFormat;
using static Microsoft.CodeAnalysis.SymbolDisplayMiscellaneousOptions;
using Robust.Roslyn.Shared;
// Yes dude I know this source generator isn't incremental, I'll fix it eventually.
#pragma warning disable RS1035
@@ -48,7 +49,7 @@ namespace Robust.Shared.CompNetworkGenerator
var componentName = classSymbol.Name;
var stateName = $"{componentName}_AutoState";
var members = classSymbol.GetMembers();
var members = TypeSymbolHelper.GetAllMembersIncludingInherited(classSymbol);
var fields = new List<(ITypeSymbol Type, string FieldName)>();
var fieldAttr = comp.GetTypeByMetadataName(MemberAttributeName);
@@ -715,7 +716,7 @@ public partial class {componentName}{deltaInterface}
if (relevantAttribute == null)
{
foreach (var mem in typeSymbol.GetMembers())
foreach (var mem in TypeSymbolHelper.GetAllMembersIncludingInherited(typeSymbol))
{
var attribute = mem.GetAttributes().FirstOrDefault(a =>
a.AttributeClass != null &&