Skip to content

Commit

Permalink
Implement sync of zoning grid flags (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaenganxt committed Aug 19, 2023
1 parent 4a481f6 commit 4895ec6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/basegame/Commands/Data/Net/NodeCreateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,11 @@ public class NodeCreateCommand : CommandBase
/// </summary>
[ProtoMember(12)]
public ushort RelocateBuildingId { get; set; }

/// <summary>
/// The zone grid flags (left/right/both zoning).
/// </summary>
[ProtoMember(13)]
public NetSegment.Flags2 ZoneGridFlags { get; set; }
}
}
5 changes: 5 additions & 0 deletions src/basegame/Commands/Handler/Net/NodeCreateHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ protected override void Handle(NodeCreateCommand command)

FastList<NetTool.NodePosition> nodeBuffer = new FastList<NetTool.NodePosition>();

NetSegment.Flags2 oldZoneGridFlags = NetTool.m_zoneGridFlags;
NetTool.m_zoneGridFlags = command.ZoneGridFlags;

NetTool.CreateNode(prefab, command.StartPoint, command.MiddlePoint, command.EndPoint, nodeBuffer,
command.MaxSegments, false, command.TestEnds, false, command.AutoFix, false,
command.Invert, command.SwitchDir, command.RelocateBuildingId, out ushort _,
out ushort _, out ushort _, out int _, out int _);

NetTool.m_zoneGridFlags = oldZoneGridFlags;

ArrayHandler.StopApplying();
IgnoreHelper.Instance.EndIgnore();
}
Expand Down
3 changes: 2 additions & 1 deletion src/basegame/Injections/NetHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public class ToolCreateNode
AutoFix = autoFix,
Invert = invert,
SwitchDir = switchDir,
RelocateBuildingId = relocateBuildingID
RelocateBuildingId = relocateBuildingID,
ZoneGridFlags = NetTool.m_zoneGridFlags
});
}

Expand Down

0 comments on commit 4895ec6

Please sign in to comment.