This commit is contained in:
Oscar
2025-05-25 19:14:50 +03:00
parent df4b259d17
commit 4d212f2ff8
27 changed files with 735 additions and 142 deletions

View File

@@ -0,0 +1,28 @@
using Sandbox;
public sealed class NormalGravityTrigger : Component, Component.ITriggerListener
{
[Property] public bool TriggerOnEnter { get; set; } = false;
public void OnTriggerEnter(Collider other)
{
if ( !TriggerOnEnter ) return;
var otherEntity = other.GameObject;
if (otherEntity.Components.TryGet<Dedugan>(out var controller))
{
controller.OverrideGravity = WorldRotation.Down;
}
}
public void OnTriggerExit(Collider other)
{
var otherEntity = other.GameObject;
if (otherEntity.Components.TryGet<Dedugan>(out var controller))
{
controller.OverrideGravity = Vector3.Zero;
}
}
}

View File

@@ -4,6 +4,7 @@
public sealed class Teleporter : Component, Component.ITriggerListener
{
[Property] public GameObject ToPosGameObject { get; set; }
[Property] public GameObject Building { get; set; }
public void OnTriggerEnter( Collider other )
{
@@ -18,8 +19,13 @@ public sealed class Teleporter : Component, Component.ITriggerListener
otherEntity.WorldPosition = ToPosGameObject.WorldPosition;
controller.OverrideGravity = Vector3.Down;
controller.EyeAngles = new Angles( 0, 180, 0 ).ToRotation();
controller.Renderer.LocalRotation = new Angles( 0, 180, 0 ).ToRotation();
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;
}
}
}
}

View File

@@ -1,26 +0,0 @@
using Sandbox;
public sealed class NormalGravityTrigger : Component, Component.ITriggerListener
{
// public void OnTriggerEnter(Collider other)
// {
// var otherEntity = other.GameObject;
//
// if (otherEntity.Components.TryGet<Dedugan>(out var controller))
// {
// Log.Info($"{otherEntity.Name} вошел в зону нормальной гравитации");
//
// controller.OverrideGravity = Vector3.Down;
// }
// }
public void OnTriggerExit(Collider other)
{
var otherEntity = other.GameObject;
if (otherEntity.Components.TryGet<Dedugan>(out var controller))
{
controller.OverrideGravity = Vector3.Zero;
}
}
}

View File

@@ -14,7 +14,6 @@ public sealed class RagdollController : Component
bodyPhysics.Enabled = value;
bodyPhysics.MotionEnabled = value;
bodyRenderer.UseAnimGraph = !value;
bodyPhysics.
if ( !value )
{

View File

@@ -0,0 +1,13 @@
using Sandbox;
public sealed class MusicPlayerInteractions : SimpleInteractions.SimpleInteraction
{
[Property] public MyMusicPlayer MusicPlayer { get; set; }
[Rpc.Broadcast]
protected override void OnInteract()
{
// Log.Info($"{Rpc.Caller.DisplayName} interacted with {this.GameObject.Name}!");
MusicPlayer.Next();
}
}

View File

@@ -1,6 +1,6 @@
 namespace Sandbox;
public sealed class MusicPlayer : Component
public sealed class MyMusicPlayer : Component
{
[Property] private List<SoundEvent> _sounds;
[Property] private List<SoundPointComponent> _speakers;

View File

@@ -1,9 +0,0 @@
using Sandbox;
public sealed class Test : Component
{
protected override void OnUpdate()
{
}
}

View File

@@ -1,6 +0,0 @@
namespace Sandbox;
public class VectorExtension
{
}

View File

@@ -1,15 +0,0 @@
using System;
using Sandbox;
using Sandbox.UI;
namespace Sandbox;
public sealed class ButtonComponent : Component, IInteractable
{
[Property] public Action OnClick { get; set; }
public void OnUse()
{
OnClick?.Invoke();
}
}