removed Structural instance and SJKScript was changed to be using an nuget package.

This commit is contained in:
2026-04-19 00:46:18 -04:00
parent 5906f248f4
commit e7ef3896b0
21 changed files with 132 additions and 1060 deletions

View File

@@ -19,12 +19,12 @@ public interface IBeltItem : IDisposable
public class TestItem() : IBeltItem
{
public float Temp {get;set;}
public int Width {get;set;}
public float Temp { get; set; }
public int Width { get; set; }
public int Height {get;set;}
public int Height { get; set; }
public Node3D CreateItemVisual() => new MeshInstance3D(){Mesh = new BoxMesh(){Size = new(.1f,.1f,.1f)}};
public Node3D CreateItemVisual() => new MeshInstance3D() { Mesh = new BoxMesh() { Size = new(.1f, .1f, .1f) } };
bool _disposed;
public event IBeltItem.ItemRemoved Disposed;
@@ -83,7 +83,7 @@ public interface IBeltPort
yield return (Profile.LocalOffset.Right * i) + Profile.LocalOffset.Origin;
}
}
LaneSpan LaneSpan => new LaneSpan(0,(ushort)Profile.Width);
LaneSpan LaneSpan => new(0, (ushort)Profile.Width);
}
public sealed class ConveyorPort : IBeltPort
{
@@ -150,20 +150,10 @@ public sealed class ConveyorPort : IBeltPort
public interface IBeltSlotProfile
{
Vector3I Position { get; }
// Direction Direction { get; }
int Width { get; }
PortAccess Access { get; }
// bool CanAcceptItem(IBeltItem beltItem, LaneSpan laneSpan, float beltT = 0);
// /// <summary>
// ///Tries to insert an belt item offset by laneSpan,
// /// </summary>
// /// <param name="beltItem"></param>
// /// <param name="laneSpan"></param>
// /// <param name="beltT"></param>
// /// <returns></returns>
// bool TryInsertItem(IBeltItem beltItem, LaneSpan laneSpan, float beltT = 0);
}
public record LaneId(int Index);
// public record LaneId(int Index);
[Flags]
public enum PortAccess : byte
{
@@ -181,16 +171,16 @@ public enum TransferMode : byte//Need Better Name
Pull = 2,
PushPull = Push | Pull
}
public static class SlotExtesion
public static class SlotExtension
{
public static LaneSpan MapLaneSpanToFacingPort(this IBeltPort self, IBeltPort other) => MapSlotToFacingSlot(self.Profile.LocalOffset, self.Profile.Width, other.Profile.LocalOffset, other.Profile.Width);
public static LaneSpan MapSlotToFacingSlot(
GridTransform3D fromTx,
int fromWidth,
GridTransform3D toTx,
int toWidth)
{
public static LaneSpan MapSlotToFacingSlot(
GridTransform3D fromTx,
int fromWidth,
GridTransform3D toTx,
int toWidth)
{
ushort minLane = ushort.MaxValue;
ushort maxLane = ushort.MinValue;
@@ -215,19 +205,19 @@ public static LaneSpan MapSlotToFacingSlot(
bool onFacePlane = toLocal.Z == 0; // directly entering target face
if (!inWidth || !onFacePlane)
continue;
continue;
minLane = (ushort)Math.Min(minLane, laneIndex);
maxLane = (ushort)Math.Max(maxLane, laneIndex);
}
if (minLane > maxLane)
if (minLane > maxLane)
return LaneSpan.Zero;
return new LaneSpan(minLane, (ushort)(maxLane + 1));
}
}
// Map a sub-span from 'from' port into the 'to' port space
// Map a sub-span from 'from' port into the 'to' port space
public static LaneSpan MapLaneSpan(this IBeltPort from, IBeltPort to, LaneSpan incoming)
{
ushort minLane = ushort.MaxValue;
@@ -264,5 +254,5 @@ public static LaneSpan MapSlotToFacingSlot(
return LaneSpan.Zero;
return new LaneSpan(minLane, (ushort)(maxLane + 1));
}
}
}