Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Features/Objects/TeleportObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
58 changes: 47 additions & 11 deletions Features/Serializable/SerializableTeleport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,59 @@ public class SerializableTeleport : SerializableObject, IIndicatorDefinition
{
public List<string> 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<string> AllowedRoles { get; set; } = new List<string>()
{
"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<BoxCollider>().isTrigger = true;
gameObject.AddComponent<TeleportObject>();
}

return gameObject;
BoxCollider collider;

if (instance == null)
{
collider = gameObject.AddComponent<BoxCollider>();
collider.isTrigger = true;
gameObject.AddComponent<TeleportObject>();
}
else
{
collider = gameObject.GetComponent<BoxCollider>();
}

if (collider != null)
{
collider.size = Scale;
}

return gameObject;
}

public GameObject SpawnOrUpdateIndicator(Room room, GameObject? instance = null)
Expand Down