This commit is contained in:
Oscar
2025-05-28 20:21:58 +03:00
parent 77c1704cd6
commit a6f2e43c49
35 changed files with 1310 additions and 132 deletions

View File

@@ -1,10 +1,20 @@
using Sandbox;
public enum GravityType
{
Down,
Circle
}
public sealed class Teleporter : Component, Component.ITriggerListener
{
[Property] public GameObject ToPosGameObject { get; set; }
[Property] public GameObject Building { get; set; }
// [Property] public bool ResetGravity { get; set; } = false;
// [Property] public bool NormalGravity { get; set; } = true;
[Property] public GravityType gravityType { get; set; } = GravityType.Down;
public void OnTriggerEnter( Collider other )
{
@@ -17,7 +27,16 @@ public sealed class Teleporter : Component, Component.ITriggerListener
Log.Info($"{otherEntity.Name} вошел в зону телепорта");
otherEntity.WorldPosition = ToPosGameObject.WorldPosition;
controller.OverrideGravity = Vector3.Down;
if ( gravityType == GravityType.Circle )
{
controller.OverrideGravity = Vector3.Zero;
}
if ( gravityType == GravityType.Down )
{
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();