diff --git a/Config/blocks.xml b/Config/blocks.xml index 854fe05..43d5bc8 100644 --- a/Config/blocks.xml +++ b/Config/blocks.xml @@ -621,7 +621,8 @@ - + + @@ -632,7 +633,8 @@ - + + diff --git a/HarmonySrc/CinerariumZone.cs b/HarmonySrc/CinerariumZone.cs index 08083b6..7bfc71b 100644 --- a/HarmonySrc/CinerariumZone.cs +++ b/HarmonySrc/CinerariumZone.cs @@ -173,6 +173,7 @@ namespace NecromancerTome ZoneLacking = false; ZonePressedBy = _player != null ? _player.entityId : -1; _queue.Clear(); + _lootDone.Clear(); Audio.Manager.BroadcastPlay(World.blockToTransformPos(ToWorldPos()), "button4"); Debug.Log("[NecromancerTome] Cinerarium: " + (IsLooter ? "лутер" : "ремонтник") + " " + ToWorldPos() + " запущен, зона " + ZoneSideNow); } @@ -495,6 +496,8 @@ namespace NecromancerTome // ------------------------------------------------------------------ static readonly List _ents = new List(); + /// Цели, уже обысканные за этот проход (пустой мешок, нечего взять) - второй раз не трогать. + readonly HashSet _lootDone = new HashSet(); /// Цель лутера в зоне: предмет на земле, потом мешок с зомби, потом красный труп. Ничего - проход окончен. void LootPick(World _world, CinerariumGenieMotion _motion) @@ -515,7 +518,7 @@ namespace NecromancerTome foreach (Entity e in _ents) { int rank = LootRank(e); - if (rank < bestRank && !LockManager.Instance.IsLockedServer(e, 0)) + if (rank < bestRank && !_lootDone.Contains(e.entityId) && !LockManager.Instance.IsLockedServer(e, 0)) { best = e; bestRank = rank; @@ -628,6 +631,10 @@ namespace NecromancerTome bag.SetSlot(i, s.count > 0 ? s : ItemStack.Empty.Clone()); } ZoneLacking = left; // не всё влезло - ящик полон, кнопка мигает + if (!left) + { + _lootDone.Add(e.entityId); // опустошён (или был пуст) - больше не цель; пустой убирает игра + } Debug.Log("[NecromancerTome] Cinerarium: лутер " + ToWorldPos() + " обыскал " + e.GetType().Name + " " + e.entityId + (left ? " - не всё влезло" : "")); } diff --git a/HarmonySrc/DecorColliderTagPatch.cs b/HarmonySrc/DecorColliderTagPatch.cs index 2dffa22..9a5b473 100644 --- a/HarmonySrc/DecorColliderTagPatch.cs +++ b/HarmonySrc/DecorColliderTagPatch.cs @@ -20,7 +20,7 @@ namespace NecromancerTome static bool Ours(string _name) { - return _name == "necroBookMindPrefab" || _name == "necroKnifeDecorPrefab" || _name == "necroMortarPrefab" || _name.StartsWith("necroBloodRose") || _name.StartsWith("necroPoster") || _name == "necroBookDoorPrefab" || _name.StartsWith("necroSkullDecor") || _name == "necroCinerariumPrefab" || _name == "necroCinerariumWorkerPrefab" || _name.StartsWith("necroCinerariumLogist"); + return _name == "necroBookMindPrefab" || _name == "necroKnifeDecorPrefab" || _name == "necroMortarPrefab" || _name.StartsWith("necroBloodRose") || _name.StartsWith("necroPoster") || _name == "necroBookDoorPrefab" || _name.StartsWith("necroSkullDecor") || _name == "necroCinerariumPrefab" || _name == "necroCinerariumWorkerPrefab" || _name.StartsWith("necroCinerariumLogist") || _name == "necroCinerariumRepairPrefab" || _name == "necroCinerariumLootPrefab"; } public static void Postfix(Transform __result) diff --git a/HarmonySrc/NecroDevCommands.cs b/HarmonySrc/NecroDevCommands.cs index 3eb3cb9..5f1c736 100644 --- a/HarmonySrc/NecroDevCommands.cs +++ b/HarmonySrc/NecroDevCommands.cs @@ -69,6 +69,11 @@ namespace NecromancerTome // necrobag x y z - мешок с зомби (EntityLootContainer со списком cntDropBag), нетронутый Entity bag = EntityFactory.CreateEntity(EntityClass.FromString("DroppedLootContainer"), P(_params, 0).ToVector3() + new Vector3(0.5f, 0.3f, 0.5f)); bag.lootList = "cntDropBag"; + LootContainer lc = LootContainer.GetLootContainer(bag.lootList, false); + if (lc != null) + { + bag.bag = new Bag(lc.size, XUiC_ItemStack.StackLocationTypes.LootContainer, bag); + } w.SpawnEntityInWorld(bag); Out("necrobag: " + bag.entityId); break; @@ -83,6 +88,31 @@ namespace NecromancerTome Out("necrocorpse: " + z.entityId + " " + cls); break; } + case "necroclear": + { + // necroclear x0 z0 x1 z1 [y0 y1] - убрать только растения (трава, кусты) в прямоугольнике; землю и постройки + // не трогает (18.10: «necroplace air» по ровной высоте срезал рельеф - яма в test8). + int x0 = int.Parse(_params[0]), z0 = int.Parse(_params[1]), x1 = int.Parse(_params[2]), z1 = int.Parse(_params[3]); + int y0 = _params.Count > 5 ? int.Parse(_params[4]) : 1, y1 = _params.Count > 5 ? int.Parse(_params[5]) : 250; + int n = 0; + 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++) + { + for (int y = y0; y <= y1; y++) + { + BlockValue cb = w.GetBlock(x, y, z); + if (!cb.isair && cb.Block != null && cb.Block.IsPlant()) + { + w.SetBlockRPC(new Vector3i(x, y, z), BlockValue.Air); + n++; + } + } + } + } + Out("necroclear: растений убрано " + n); + break; + } case "necrogod": God(pl, _params.Count == 0 || _params[0] != "off"); break; case "necroclick": // necroclick 0|1 [x y z] - по блоку под прицелом или по указанной клетке (луч не всегда попадает в низкий череп). @@ -425,4 +455,13 @@ namespace NecromancerTome public override bool AllowedInMainMenu => false; public override void Execute(List _params, CommandSenderInfo _senderInfo) => NecroDev.Run("necrocorpse", _params); } + + [Preserve] + public class ConsoleCmdNecroClear : ConsoleCmdAbstract + { + public override string[] getCommands() => new[] { "necroclear" }; + public override string getDescription() => "NecromancerTome (разработка): убрать растения x0 z0 x1 z1 [y0 y1]"; + public override bool AllowedInMainMenu => false; + public override void Execute(List _params, CommandSenderInfo _senderInfo) => NecroDev.Run("necroclear", _params); + } } diff --git a/NecromancerHarmony.dll b/NecromancerHarmony.dll index 0dd7ea2..938f26d 100644 Binary files a/NecromancerHarmony.dll and b/NecromancerHarmony.dll differ diff --git a/NecromancerHarmony.pdb b/NecromancerHarmony.pdb index 65bbb5a..a5ff9f9 100644 Binary files a/NecromancerHarmony.pdb and b/NecromancerHarmony.pdb differ diff --git a/Resources/necrocinerarium b/Resources/necrocinerarium index ef3cccd..12edee1 100644 Binary files a/Resources/necrocinerarium and b/Resources/necrocinerarium differ