mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
* Shitspawner Extraordinare * Shitcoder Extraordinare * the code is leaking * ёбушки-воробушки * it will all be over soon * шутки кончились * virtual selfantag * шейдеры это на удивление весело * i'm tired boss * connection terminated * консервная банка * а чё сразу нельзя было? * minus * Removed Herobrine. * мусор * Apply suggestions from code review Co-authored-by: Spatison <137375981+Spatison@users.noreply.github.com> * code review * fix: unshit * shit: unfix * потемнее * переперевод * ok i clean up * жопа Co-authored-by: Spatison <137375981+Spatison@users.noreply.github.com> * scuffed english localization --------- Co-authored-by: Spatison <137375981+Spatison@users.noreply.github.com>
55 lines
1.7 KiB
C#
55 lines
1.7 KiB
C#
using Content.Shared._White.Event;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Shared.Prototypes;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Numerics;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Content.Client._White.Event;
|
|
|
|
public class EventItemDispenserSystem : SharedEventItemDispenserSystem
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<EventItemDispenserComponent, ComponentInit>(OnInit);
|
|
SubscribeLocalEvent<EventItemDispenserComponent, AfterAutoHandleStateEvent>(OnAfterAutoHandleState);
|
|
}
|
|
|
|
private void OnInit(EntityUid uid, EventItemDispenserComponent comp, ComponentInit args)
|
|
{
|
|
UpdateVisuals(uid, comp);
|
|
}
|
|
|
|
private void OnAfterAutoHandleState(EntityUid uid, EventItemDispenserComponent comp, AfterAutoHandleStateEvent args)
|
|
{
|
|
UpdateVisuals(uid, comp);
|
|
}
|
|
|
|
private void UpdateVisuals(EntityUid uid, EventItemDispenserComponent comp)
|
|
{
|
|
var sprite = Comp<SpriteComponent>(uid);
|
|
var icon = _sprite.GetPrototypeIcon(comp.DispensingPrototype).Default;
|
|
sprite.LayerSetTexture(EventItemDispenserVisualLayers.ItemPreview, icon);
|
|
float scale = comp.ItemPreviewScale;
|
|
|
|
if (scale <= 0)
|
|
scale = 32f / Math.Max(15, Math.Max(icon.Width, icon.Height));
|
|
|
|
sprite.LayerSetScale(EventItemDispenserVisualLayers.ItemPreview, new Vector2(scale));
|
|
}
|
|
}
|
|
|
|
enum EventItemDispenserVisualLayers : byte
|
|
{
|
|
Base,
|
|
Lights,
|
|
Arms,
|
|
ItemPreview
|
|
}
|