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,43 @@
using Editor;
[Icon( "touch_app" )]
[Title( "SimpleInteraction" )]
[Description( "A simple interaction component so you can interact with objects" )]
public partial class SimpleInteractionTemplate : ComponentTemplate
{
public override void Create( string componentName, string path )
{
var content = $$"""
using Sandbox;
public sealed class {{componentName}} : SimpleInteractions.SimpleInteraction
{
protected override void OnStart()
{
base.OnStart();
// Put your initialization code here if you have any
}
protected override void OnUpdate()
{
base.OnUpdate();
// Put your update code here if you have any
}
[Rpc.Broadcast]
protected override void OnInteract()
{
Log.Info($"{Rpc.Caller.DisplayName} interacted with {this.GameObject.Name}!");
}
}
""";
var directory = System.IO.Path.GetDirectoryName( path );
System.IO.File.WriteAllText( System.IO.Path.Combine( directory, componentName + Suffix ), content );
}
}