Команды разработки: necrofill (засыпать ямы), necrosmooth (край насыпи скатом)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
AlexCube
2026-10-18 18:26:42 +03:00
co-authored by Claude Opus 5.5
parent dfa7508bda
commit eaa6b3bbb3
3 changed files with 102 additions and 0 deletions
+102
View File
@@ -152,6 +152,90 @@ namespace NecromancerTome
", очередь " + q + ", выход" + Stacks(ws.Output));
break;
}
case "necrofill":
{
// necrofill x0 z0 x1 z1 y [блок] [соседей] - засыпать ямы рельефа на уровне y: пустую клетку, у которой рядом по
// уровню не меньше двух клеток земли, - землёй с полной плотностью; повторять, пока засыпается.
// Ровную землю рядом не поднимает (у неё на этом уровне соседи - воздух). 18.10: ямы в test8.
int x0 = int.Parse(_params[0]), z0 = int.Parse(_params[1]), x1 = int.Parse(_params[2]), z1 = int.Parse(_params[3]);
int fy = int.Parse(_params[4]);
Block fb = Block.GetBlockByName(_params.Count > 5 ? _params[5] : "terrForestGround", true);
int total = 0;
for (int pass = 0; pass < 20; pass++)
{
List<Vector3i> fill = new List<Vector3i>();
for (int x = Mathf.Min(x0, x1); x <= Mathf.Max(x0, x1); x++)
{
for (int z = Mathf.Min(z0, z1); z <= Mathf.Max(z0, z1); z++)
{
Vector3i c = new Vector3i(x, fy, z);
if (!w.GetBlock(c).isair || w.GetBlock(c - Vector3i.up).isair)
{
continue;
}
int n = 0;
foreach (Vector3i d in new[] { Vector3i.forward, Vector3i.back, Vector3i.left, Vector3i.right })
{
BlockValue nb = w.GetBlock(c + d);
if (!nb.isair && nb.Block != null && nb.Block.shape.IsTerrain())
{
n++;
}
}
if (n >= (_params.Count > 6 ? int.Parse(_params[6]) : 2)) // седьмой параметр - сколько соседей-земли нужно (широкие ямы - 1)
{
fill.Add(c);
}
}
}
if (fill.Count == 0)
{
break;
}
foreach (Vector3i c in fill)
{
w.SetBlockRPC(c, fb.ToBlockValue(), MarchingCubes.DensityTerrain);
}
total += fill.Count;
}
Out("necrofill: засыпано клеток " + total);
break;
}
case "necrosmooth":
{
// necrosmooth x0 z0 x1 z1 y [плотность] - край насыпи скатом: клеткам земли на уровне y, у которых сбоку воздух,
// - неполная плотность (по умолчанию -30; полная земля -128), игра рисует их наклоном.
int x0 = int.Parse(_params[0]), z0 = int.Parse(_params[1]), x1 = int.Parse(_params[2]), z1 = int.Parse(_params[3]);
int sy = int.Parse(_params[4]);
sbyte dens = (sbyte)(_params.Count > 5 ? int.Parse(_params[5]) : -30);
List<(Vector3i, BlockValue)> edge = new List<(Vector3i, BlockValue)>();
for (int x = Mathf.Min(x0, x1); x <= Mathf.Max(x0, x1); x++)
{
for (int z = Mathf.Min(z0, z1); z <= Mathf.Max(z0, z1); z++)
{
Vector3i c = new Vector3i(x, sy, z);
BlockValue bv = w.GetBlock(c);
if (bv.isair || bv.Block == null || !bv.Block.shape.IsTerrain() || !w.GetBlock(c + Vector3i.up).isair)
{
continue;
}
foreach (Vector3i d in new[] { Vector3i.forward, Vector3i.back, Vector3i.left, Vector3i.right })
{
if (w.GetBlock(c + d).isair)
{
edge.Add((c, bv));
break;
}
}
}
}
foreach ((Vector3i c, BlockValue bv) in edge)
{
w.SetBlockRPC(c, bv, dens);
}
Out("necrosmooth: краевых клеток " + edge.Count);
break;
}
case "necrogod": God(pl, _params.Count == 0 || _params[0] != "off"); break;
case "necroclick":
// necroclick 0|1 [x y z] - по блоку под прицелом или по указанной клетке (луч не всегда попадает в низкий череп).
@@ -513,4 +597,22 @@ namespace NecromancerTome
public override bool AllowedInMainMenu => false;
public override void Execute(List<string> _params, CommandSenderInfo _senderInfo) => NecroDev.Run("necrostation", _params);
}
[Preserve]
public class ConsoleCmdNecroFill : ConsoleCmdAbstract
{
public override string[] getCommands() => new[] { "necrofill" };
public override string getDescription() => "NecromancerTome (разработка): засыпать ямы x0 z0 x1 z1 y [блок]";
public override bool AllowedInMainMenu => false;
public override void Execute(List<string> _params, CommandSenderInfo _senderInfo) => NecroDev.Run("necrofill", _params);
}
[Preserve]
public class ConsoleCmdNecroSmooth : ConsoleCmdAbstract
{
public override string[] getCommands() => new[] { "necrosmooth" };
public override string getDescription() => "NecromancerTome (разработка): край насыпи скатом x0 z0 x1 z1 y [плотность]";
public override bool AllowedInMainMenu => false;
public override void Execute(List<string> _params, CommandSenderInfo _senderInfo) => NecroDev.Run("necrosmooth", _params);
}
}