diff --git a/UncomplicatedCustomItems/API/Serializable/SerializableThing.cs b/UncomplicatedCustomItems/API/Serializable/SerializableThing.cs index e4c5c4c..728eb2e 100644 --- a/UncomplicatedCustomItems/API/Serializable/SerializableThing.cs +++ b/UncomplicatedCustomItems/API/Serializable/SerializableThing.cs @@ -24,7 +24,7 @@ public abstract class SerializableThing public Vector3 Scale { get; set; } [Description("Spawn properties")] - public ItemSpawnPoint SpawnPoint { get; set; } + public ItemSpawnPoint[] SpawnPoint { get; set; } public abstract CustomThing Create(Player player); } diff --git a/UncomplicatedCustomItems/Config.cs b/UncomplicatedCustomItems/Config.cs index 303addf..7d1c252 100644 --- a/UncomplicatedCustomItems/Config.cs +++ b/UncomplicatedCustomItems/Config.cs @@ -26,10 +26,13 @@ public class Config : IConfig Id = 0, Model = ItemType.KeycardFacilityManager, Scale = Vector3.one, - SpawnPoint = new ItemSpawnPoint() + SpawnPoint = new[] { - Position = Vector3.zero, - Location = Exiled.API.Enums.SpawnLocationType.InsideLczWc + new ItemSpawnPoint() + { + Position = Vector3.zero, + Location = Exiled.API.Enums.SpawnLocationType.InsideLczWc + }, }, Info = new KeycardInfo() { @@ -55,13 +58,15 @@ public class Config : IConfig BodyProtection = 99, HeadProtection = 99 }, - SpawnPoint = new ItemSpawnPoint() - { - Location = Exiled.API.Enums.SpawnLocationType.Inside914, - Chance = 100, - Position = Vector3.one, - Name = "Chipi chapa" - } + SpawnPoint = new[] { + new ItemSpawnPoint() + { + Location = Exiled.API.Enums.SpawnLocationType.Inside914, + Chance = 100, + Position = Vector3.one, + Name = "Chipi chapa" + } + }, } } }; diff --git a/UncomplicatedCustomItems/Events/Internal/Player.cs b/UncomplicatedCustomItems/Events/Internal/Player.cs index 2ff0aa4..9047f66 100644 --- a/UncomplicatedCustomItems/Events/Internal/Player.cs +++ b/UncomplicatedCustomItems/Events/Internal/Player.cs @@ -1,4 +1,5 @@ using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Player; using UncomplicatedCustomItems.API.Extensions; using UncomplicatedCustomItems.API.Features; diff --git a/UncomplicatedCustomItems/Events/Internal/Server.cs b/UncomplicatedCustomItems/Events/Internal/Server.cs index 0ecbf0b..e6009ba 100644 --- a/UncomplicatedCustomItems/Events/Internal/Server.cs +++ b/UncomplicatedCustomItems/Events/Internal/Server.cs @@ -36,21 +36,22 @@ private static void SpawnCustomItemsList(IEnumerable customTh { foreach (var customItem in customThings) { - if (customItem.SpawnPoint is null || customItem.SpawnPoint.Chance == 0) + foreach (var spawnPoint in customItem.SpawnPoint) { - continue; - } + if (customItem.SpawnPoint is null || spawnPoint.Chance == 0) + { + continue; + } - var spawnPoint = customItem.SpawnPoint; + var chance = UnityEngine.Random.Range(0, 100); - var chance = UnityEngine.Random.Range(0, 100); + if (spawnPoint.Chance != 100 && spawnPoint.Chance > chance) + { + continue; + } - if (spawnPoint.Chance != 100 && spawnPoint.Chance > chance) - { - continue; - } - - customItem.Create(null).Spawn(spawnPoint.Location.GetPosition() + spawnPoint.Position); + customItem.Create(null).Spawn(spawnPoint.Location.GetPosition() + spawnPoint.Position); + } } } }