EVERYTHING

This commit is contained in:
niko
2026-06-01 17:19:55 +02:00
parent d063b81359
commit b62bac090b
1081 changed files with 1716544 additions and 0 deletions
@@ -0,0 +1,34 @@
using System;
using BlockSpace.Voxels;
using UnityEngine;
[DisallowMultipleComponent]
public sealed class SetGroupMaterialBehavior : NodeBehavior
{
public override void OnRun(string inputPortName)
{
if (!base.IsAuthoritative || !string.Equals(inputPortName, "Set", StringComparison.Ordinal) || !TryGetInputGroup("Group", out var group) || group == null || group.voxels == null)
{
return;
}
VoxelMaterial material = Mathf.RoundToInt((float)GetInputNumber("Material")) switch
{
1 => VoxelMaterial.Unlit,
2 => VoxelMaterial.Transparent,
3 => VoxelMaterial.Invisible,
_ => VoxelMaterial.Lit,
};
for (int i = 0; i < group.voxels.Length; i++)
{
byte voxel = group.voxels[i];
if (!PackedVoxel.IsAir(voxel))
{
byte colorIndex = PackedVoxel.GetColorIndex(voxel);
group.voxels[i] = PackedVoxel.Create(colorIndex, material);
}
}
group.MarkDirty(mesh: true, collider: true);
VoxelGroupManager.Instance?.BroadcastGroupModify(group);
TriggerOutput("Done");
}
}