This commit is contained in:
Oscar
2025-06-26 01:56:08 +03:00
parent 5c9be94aba
commit 8b61aa1d7b
89 changed files with 7072 additions and 333 deletions

View File

@@ -18,12 +18,12 @@ public sealed partial class Dedugan : Component
// Inventory.AddItem( new InventoryItem
// {
// Definition = ResourceLibrary.Get<ClothingItemDefinition>( "Items/cloth_pijama.clitem" )
// Definition = ResourceLibrary.Get<ClothingItemDefinition>( "Items/Cloth/cloth_pijama.clitem" )
// } );
//
// Inventory.AddItem( new InventoryItem
// {
// Definition = ResourceLibrary.Get<ClothingItemDefinition>( "Items/cloth_pijama_bottom.clitem" )
// Definition = ResourceLibrary.Get<ClothingItemDefinition>( "Items/Cloth/cloth_pijama_bottom.clitem" )
// } );
//
// Inventory.AddItem( new InventoryItem

View File

@@ -80,50 +80,25 @@ partial class Dedugan
CancellationTokenSource _cts;
[Rpc.Broadcast]
public void WearWorkshop( List<string> workshopItems )
{
_cts = new CancellationTokenSource();
var token = _cts.Token;
if ( workshopItems != null && workshopItems.Count > 0 )
{
Task.WhenAll( workshopItems.Select( x => InstallWorkshopClothing( x, token ) ) )
.ContinueWith( ( tasks ) =>
{
foreach ( var cloth in tasks.Result )
{
if ( cloth is null )
continue;
CurrentClothing.Add( cloth );
}
} );
}
CurrentClothing.Normalize();
CurrentClothing.Apply( Renderer );
Renderer.PostAnimationUpdate();
}
// public async void AsyncWearWorkshop( List<string> workshopItems )
// [Rpc.Broadcast]
// public void WearWorkshop( List<string> workshopItems )
// {
// _cts = new CancellationTokenSource();
// var token = _cts.Token;
//
// if ( workshopItems != null && workshopItems.Count > 0 )
// {
// var tasks = workshopItems.Select( x => InstallWorkshopClothing( x, token ) );
//
// foreach ( var task in tasks )
// {
// var c = await task;
//
// if ( c is null )
// continue;
//
// CurrentClothing.Add( c );
// }
// Task.WhenAll( workshopItems.Select( x => InstallWorkshopClothing( x, token ) ) )
// .ContinueWith( ( tasks ) =>
// {
// foreach ( var cloth in tasks.Result )
// {
// if ( cloth is null )
// continue;
// Log.Info( cloth.Title );
// CurrentClothing.Add( cloth );
// }
// } );
// }
//
// CurrentClothing.Normalize();
@@ -131,6 +106,37 @@ partial class Dedugan
// Renderer.PostAnimationUpdate();
// }
[Rpc.Broadcast]
public void WearWorkshop( List<string> workshopItems )
{
AsyncWearWorkshop( workshopItems );
}
public async void AsyncWearWorkshop( List<string> workshopItems )
{
_cts = new CancellationTokenSource();
var token = _cts.Token;
if ( workshopItems != null && workshopItems.Count > 0 )
{
var tasks = workshopItems.Select( x => InstallWorkshopClothing( x, token ) );
foreach ( var task in tasks )
{
var c = await task;
if ( c is null )
continue;
CurrentClothing.Add( c );
}
}
CurrentClothing.Normalize();
CurrentClothing.Apply( Renderer );
Renderer.PostAnimationUpdate();
}
[Rpc.Broadcast]
public void StripByName( string name )
{

View File

@@ -27,7 +27,7 @@ public sealed partial class Dedugan : Component, IUseContext, Component.INetwork
[Sync] public int Health { get; set; } = 100;
private RagdollController RagdollController { get; set; }
public Vector3 OverrideGravity { get; set; } = Vector3.Zero;
[Property] public Vector3 OverrideGravity { get; set; } = Vector3.Zero;
private Vector3 _directionToAxis = Vector3.Up;
private Vector3 _up = Vector3.Up;