upd
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user