Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion CommunityEntity.UI.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using UnityEngine;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Facepunch.Extend;
using System.IO;
using Rust.Workshop;

#if CLIENT

Expand Down Expand Up @@ -127,6 +128,33 @@ private void CreateComponents( GameObject go, JSON.Object obj )
SetImageFromServer( c, uint.Parse( obj.GetString( "png" ) ) );
}

if ( obj.ContainsKey( "itemid" ) )
{
var itemdef = ItemManager.FindItemDefinition( obj.GetInt( "itemid" ) );
if ( itemdef != null )
{
c.sprite = itemdef.iconSprite;

if ( obj.ContainsKey( "skinid" ) )
{
var requestedSkin = obj.GetInt( "skinid" );
var skin = itemdef.skins.FirstOrDefault( x => x.id == requestedSkin );
if ( skin.id == requestedSkin )
{
c.sprite = skin.invItem.icon;
}
else
{
var workshopSprite = WorkshopIconLoader.Find( (ulong)requestedSkin );
if ( workshopSprite != null )
{
c.sprite = workshopSprite;
}
}
}
}
}

GraphicComponentCreated( c, obj );

break;
Expand Down