Make smoking cool again. (#6046)

This commit is contained in:
Leon Friedrich
2022-01-07 01:45:02 +13:00
committed by GitHub
parent 6af1bfabf3
commit 4921ea6850
3 changed files with 38 additions and 39 deletions

View File

@@ -3,6 +3,7 @@ using System.Linq;
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Clothing.Components;
using Content.Server.Nutrition.Components;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Reagent;
@@ -38,14 +39,22 @@ namespace Content.Server.Nutrition.EntitySystems
InitializeCigars();
}
public void SetSmokableState(EntityUid uid, SmokableState state, SmokableComponent? smokable = null, AppearanceComponent? appearance = null)
public void SetSmokableState(EntityUid uid, SmokableState state, SmokableComponent? smokable = null,
AppearanceComponent? appearance = null, ClothingComponent? clothing = null)
{
if (!Resolve(uid, ref smokable, ref appearance))
if (!Resolve(uid, ref smokable, ref appearance, ref clothing))
return;
smokable.State = state;
appearance.SetData(SmokingVisuals.Smoking, state);
clothing.EquippedPrefix = state switch
{
SmokableState.Lit => smokable.LitPrefix,
SmokableState.Burnt => smokable.BurntPrefix,
_ => smokable.UnlitPrefix
};
if (state == SmokableState.Lit)
_active.Add(uid);
else