Redid inserrt logic and grid registry, added an test oven, and changed .vscode settings to try and get better debugging.
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
using ChickenGameTest;
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class ConveyorBeltStraight : Node3D
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class ConveyorBeltStraight : Node3D, IProvide<IVoxelGridRegistry>
|
||||
{
|
||||
[Export] public Vector3I VoxelPos { get; set; } = default;
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
[Export] public int Width { get; set; } = default;
|
||||
public IVoxelGridRegistry Value() => Grid;
|
||||
[Dependency] protected IVoxelGridRegistry Grid => this.DependOn<IVoxelGridRegistry>();
|
||||
private VoxelGuid _guid = default;
|
||||
public GridTransform3D VoxelTransform
|
||||
{
|
||||
get => GridTransform3D.FromGodot(Transform);
|
||||
set => Transform = value.ToGodot();
|
||||
get => GridTransform3D.FromGodot(GlobalTransform);
|
||||
set => GlobalTransform = value.ToGodot();
|
||||
}
|
||||
public override void _Ready()
|
||||
{
|
||||
@@ -48,4 +53,15 @@ public partial class ConveyorBeltStraight : Node3D
|
||||
LaneSpan.One)
|
||||
];
|
||||
}
|
||||
public void OnResolved()
|
||||
{
|
||||
_guid = Grid.Register(this, VoxelTransform.Origin);
|
||||
this.Provide();
|
||||
|
||||
}
|
||||
public override void _ExitTree()
|
||||
{
|
||||
Grid.UnRegister(_guid);
|
||||
base._ExitTree();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user