using Sandbox; public sealed class Teleporter : Component, Component.ITriggerListener { [Property] public GameObject ToPosGameObject { get; set; } [Property] public GameObject Building { get; set; } public void OnTriggerEnter( Collider other ) { var otherEntity = other.GameObject; Log.Info($"{otherEntity.Name} Телепорт"); if (otherEntity.Components.TryGet(out var controller)) { Log.Info($"{otherEntity.Name} вошел в зону телепорта"); otherEntity.WorldPosition = ToPosGameObject.WorldPosition; controller.OverrideGravity = Vector3.Down; controller.EyeAngles = new Angles( 0, ToPosGameObject.WorldRotation.Yaw(), 0 ).ToRotation(); controller.Renderer.LocalRotation = new Angles( 0, ToPosGameObject.WorldRotation.Yaw(), 0 ).ToRotation(); if ( Building != null ) { Building.Enabled = !Building.Enabled; } } } }