* The only commit that matters * I had to stop playing with my cat to push this change * Yaml removal * Proper drunk status effect and remove shitcode * Review changes * whoops * Whoops x2 * Update master fix merge conflicts * Fix merge conflicts * Dunk Component kill * MORE RELAYS * Holy fucking breaking changes * Ough * 46 file diff * Fix bad commits * Erm what the test fail? * Fix those last two * Merge conflicts * Me when I fix the merge conflicts --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using Content.Shared.Speech.EntitySystems;
|
|
using Content.Shared.StatusEffectNew;
|
|
using Content.Shared.Traits.Assorted;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Shared.Drunk;
|
|
|
|
public abstract class SharedDrunkSystem : EntitySystem
|
|
{
|
|
public static EntProtoId Drunk = "StatusEffectDrunk";
|
|
public static EntProtoId Woozy = "StatusEffectWoozy";
|
|
|
|
/* I have no clue why this magic number was chosen, I copied it from slur system and needed it for the overlay
|
|
If you have a more intelligent magic number be my guest to completely explode this value.
|
|
There were no comments as to why this value was chosen three years ago. */
|
|
public static float MagicNumber = 1100f;
|
|
|
|
[Dependency] protected readonly StatusEffectsSystem Status = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<LightweightDrunkComponent, DrunkEvent>(OnLightweightDrinking);
|
|
}
|
|
|
|
public void TryApplyDrunkenness(EntityUid uid, TimeSpan boozePower)
|
|
{
|
|
var ev = new DrunkEvent(boozePower);
|
|
RaiseLocalEvent(uid, ref ev);
|
|
|
|
Status.TryAddStatusEffectDuration(uid, Drunk, ev.Duration);
|
|
}
|
|
|
|
public void TryRemoveDrunkenness(EntityUid uid)
|
|
{
|
|
Status.TryRemoveStatusEffect(uid, Drunk);
|
|
}
|
|
|
|
public void TryRemoveDrunkennessTime(EntityUid uid, TimeSpan boozePower)
|
|
{
|
|
Status.TryAddTime(uid, Drunk, - boozePower);
|
|
}
|
|
|
|
private void OnLightweightDrinking(Entity<LightweightDrunkComponent> entity, ref DrunkEvent args)
|
|
{
|
|
args.Duration *= entity.Comp.BoozeStrengthMultiplier;
|
|
}
|
|
|
|
[ByRefEvent]
|
|
public record struct DrunkEvent(TimeSpan Duration);
|
|
}
|