[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IEntitySystemManager _sysMan = default!;
+ [Dependency] private readonly IGameTiming _timing = default!;
public override OverlaySpace Space => OverlaySpace.WorldSpace;
public override bool RequestScreenTexture => true;
protected override void FrameUpdate(FrameEventArgs args)
{
+
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
if (playerEntity == null)
if (!statusSys.TryGetTime(playerEntity.Value, SharedDrunkSystem.DrunkKey, out var time, status))
return;
- var timeLeft = (float) (time.Value.Item2 - time.Value.Item1).TotalSeconds;
- CurrentBoozePower += (timeLeft - CurrentBoozePower) * args.DeltaSeconds / 16f;
+ var curTime = _timing.CurTime;
+ var timeLeft = (float) (time.Value.Item2 - curTime).TotalSeconds;
+
+
+ CurrentBoozePower += 8f * (0.5f*timeLeft - CurrentBoozePower) * args.DeltaSeconds / (timeLeft+1);
}
protected override bool BeforeDraw(in OverlayDrawArgs args)
/// <param name="boozePower"></param>
private float BoozePowerToVisual(float boozePower)
{
- return Math.Clamp((boozePower - VisualThreshold) / PowerDivisor, 0.0f, 1.0f);
+ // Clamp booze power when it's low, to prevent really jittery effects
+ if (boozePower < 50f)
+ {
+ return 0;
+ }
+ else
+ {
+ return Math.Clamp((boozePower - VisualThreshold) / PowerDivisor, 0.0f, 1.0f);
+ }
}
}
if (reagents >= meta.MaxReagentsProcessable)
return;
- reagents += 1;
// loop over all our groups and see which ones apply
if (meta.MetabolismGroups == null)
continue;
var entry = proto.Metabolisms[group.Id];
+ var rate = entry.MetabolismRate * group.MetabolismRateModifier;
- // we don't remove reagent for every group, just whichever had the biggest rate
- if (entry.MetabolismRate > mostToRemove)
- mostToRemove = entry.MetabolismRate;
+ // Remove $rate, as long as there's enough reagent there to actually remove that much
+ mostToRemove = FixedPoint2.Clamp(rate, 0, quantity);
- mostToRemove *= group.MetabolismRateModifier;
-
- mostToRemove = FixedPoint2.Clamp(mostToRemove, 0, quantity);
-
- float scale = (float) mostToRemove / (float) entry.MetabolismRate;
+ float scale = (float) mostToRemove / (float) rate;
// if it's possible for them to be dead, and they are,
// then we shouldn't process any effects, but should probably
if (mostToRemove > FixedPoint2.Zero)
{
_solutionContainerSystem.RemoveReagent(solutionEntityUid.Value, solution, reagent, mostToRemove);
+
+ // We have processed a reagant, so count it towards the cap
+ reagents += 1;
}
}
}
using Content.Shared.Speech.EntitySystems;
using Content.Shared.StatusEffect;
using Robust.Shared.Random;
+using Robust.Shared.Timing;
namespace Content.Server.Speech.EntitySystems;
{
[Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!;
[Dependency] private readonly IRobustRandom _random = default!;
+ [Dependency] private readonly IGameTiming _timing = default!;
+
+
[ValidatePrototypeId<StatusEffectPrototype>]
private const string SlurKey = "SlurredSpeech";
if (!_statusEffectsSystem.TryGetTime(uid, SharedDrunkSystem.DrunkKey, out var time))
return 0;
- var timeLeft = (float) (time.Value.Item2 - time.Value.Item1).TotalSeconds;
- return Math.Clamp(timeLeft / 200, 0f, 1f);
+ var curTime = _timing.CurTime;
+ var timeLeft = (float) (time.Value.Item2 - curTime).TotalSeconds;
+ return Math.Clamp((timeLeft - 80) / 1100, 0f, 1f);
}
private void OnAccent(EntityUid uid, SlurredAccentComponent component, AccentGetEvent args)
boilingPoint: 78.2
meltingPoint: -114.1
metabolisms:
- Poison:
+ Alcohol:
effects:
- !type:HealthChange
conditions:
- !type:ReagentThreshold
- min: 5
+ min: 15
- !type:OrganType
type: Dwarf
shouldHave: false
- !type:HealthChange
conditions:
- !type:ReagentThreshold
- min: 5
+ min: 15
- !type:OrganType
type: Dwarf
damage:
- !type:HealthChange
conditions:
- !type:ReagentThreshold
- min: 5
+ min: 15
- !type:OrganType
type: Dwarf
damage:
conditions:
- !type:ReagentThreshold
reagent: Ethanol
- min: 3
+ min: 12
# dwarves immune to vomiting from alcohol
- !type:OrganType
type: Dwarf
shouldHave: false
- Alcohol:
- effects:
- !type:Drunk
- boozePower: 20
+ boozePower: 2
- type: reagent
id: Gin
-- type: reagent
+- type: reagent
id: BaseDrink
group: Drinks
abstract: true
factor: 2
- !type:AdjustReagent
reagent: Ethanol
- amount: 0.05
+ amount: 0.06
reactiveEffects:
Flammable:
methods: [ Touch ]