diff --git a/Features/Objects/TeleportObject.cs b/Features/Objects/TeleportObject.cs index 309f149..df9bddc 100644 --- a/Features/Objects/TeleportObject.cs +++ b/Features/Objects/TeleportObject.cs @@ -42,7 +42,13 @@ public void OnTriggerEnter(Collider other) if (NextTimeUse > DateTime.Now) return; - TeleportObject? target = GetRandomTarget(); + if (UnityEngine.Random.Range(0, 100) >= Base.Chance) + return; + + if (!Base.AllowedRoles.Contains(player.Role.ToString())) + return; + + TeleportObject? target = GetRandomTarget(); if (target == null) return; diff --git a/Features/Serializable/SerializableTeleport.cs b/Features/Serializable/SerializableTeleport.cs index 00dc294..0ee4338 100644 --- a/Features/Serializable/SerializableTeleport.cs +++ b/Features/Serializable/SerializableTeleport.cs @@ -13,23 +13,59 @@ public class SerializableTeleport : SerializableObject, IIndicatorDefinition { public List Targets { get; set; } = []; - public float Cooldown { get; set; } = 5f; - - public override GameObject? SpawnOrUpdateObject(Room? room = null, GameObject? instance = null) + public int Chance { get; set; } = 100; + + public List AllowedRoles { get; set; } = new List() + { + "Scp0492", + "Scp049", + "Scp096", + "Scp106", + "Scp173", + "Scp939", + "Scp3114", + "ClassD", + "Scientist", + "FacilityGuard", + "NtfPrivate", + "NtfSergeant", + "NtfSpecialist", + "NtfCaptain", + "ChaosConscript", + "ChaosRifleman", + "ChaosRepressor", + "ChaosMarauder", + "Tutorial", + }; + + public float Cooldown { get; set; } = 5f; + + public override GameObject? SpawnOrUpdateObject(Room? room = null, GameObject? instance = null) { GameObject gameObject = instance ?? new GameObject("Teleport"); Vector3 position = room.GetAbsolutePosition(Position); Quaternion rotation = room.GetAbsoluteRotation(Rotation); _prevIndex = Index; gameObject.transform.SetLocalPositionAndRotation(position, rotation); - - if (instance == null) - { - gameObject.AddComponent().isTrigger = true; - gameObject.AddComponent(); - } - - return gameObject; + BoxCollider collider; + + if (instance == null) + { + collider = gameObject.AddComponent(); + collider.isTrigger = true; + gameObject.AddComponent(); + } + else + { + collider = gameObject.GetComponent(); + } + + if (collider != null) + { + collider.size = Scale; + } + + return gameObject; } public GameObject SpawnOrUpdateIndicator(Room room, GameObject? instance = null)