* adds an overdose metabolism with sensible default settings * adds the compoenents for the run fast part of meth * not sure what I changed here but I trust my past self to not fuck up for once * adds basic meth recipe * correctly names comething * I really should've checked my spelling before making this pr Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * adds suggestion from the maintaner, who managed to get to this pr suprisingly fast * Revert "adds suggestion from the maintaner, who managed to get to this pr suprisingly fast" This reverts commit 9b0f07402e35ed5890b3af805691b690671b950c. * tweak * tweak * git's gitting on my nerves * some small tweaks * don't need these anymore * makes some stuff required * changes the meth recipe to arbitary bullshit to get the yaml thingy to leave me alone goddamnit * extremely minor change * removes overdose, because however it's gonna be done, it's definitely not my way * i should really double check every key I press * hm * sigh, I should be more thorough with looking at error messages. * beenus * gay sex is gay * this one goes out to bingo * reviews * not sure why status lifetime description wasn't being commited * Update MovespeedModifierMetabolism.cs Co-authored-by: mirrorcult <notzombiedude@gmail.com> * adds VV to component variables * rebalances meth, and makes the completely unrealistic recipe properly work now * meth effects should go away now or something do you think I test these changes before pushing?? * ah yes, orginization * adds proper recipe and prequisite chemicals * fixes linter hopefully * Update chemicals.yml * a * starts working on prediction * thing * predmiction?? * changes thing * does it properly * uses timespan instead of timer * uses dif timers and adds a system * updates robust and tweaks a small thing * Fixes * "Fix" prediction * starts changing the timer to timespans to avoid icky on timer end * okay fixes the check thing but now meth is broken and I don't know why * fixes predicition (partially) * Delete ContentNetIDs.cs whoops * some changes advised by sloth * certified scalycode fix right here * moves resettimer to the metabolism to make it less oop stinky * moves resettimer to the metabolism to make it less oop stinky * gamin * when the is * updates mth colour to be accurate because I forgot * abc hard ok * everything should be up to date now * makes MovespeedModifierMetabolism ECS and cleans up some other stuff * does a fixy wixy * fix thing * Revert "Merge branch 'master' of https://github.com/space-wizards/space-station-14 into meth" This reverts commit 62886561098be02f9adb6352f4e858a8269d5bd5, reversing changes made to ca34fffb5b7a40f19aec7b9e4bc37bdeab914bc1. * Revert "Revert "Merge branch 'master' of https://github.com/space-wizards/space-station-14 into meth"" This reverts commit 4f550da19656abfd0be05f818fc6b7100252d5b8. * fix hopefully * updates metabolism to works with mirror's fancy new system * updates yaml + tweaks * bruh * yaml moment * :yaml moment * Revert " :yaml moment" This reverts commit 8cb51573c64db76d989de22acdbb9c50b2c6d052. * 99th commit yay, also I need to not do this * removes something that I don't need * makes system work with this and gets rid of unnesescary check * make the update only work on active components * oops * Cleanup * alphabetise this shit * Touchup * Woops stupid alloc by me * Nerf nyoom for now Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: mirrorcult <notzombiedude@gmail.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
78 lines
2.7 KiB
C#
78 lines
2.7 KiB
C#
using Content.Shared.Chemistry.Components;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Timing;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Content.Shared.Movement.Components;
|
|
using static Content.Shared.Chemistry.Components.MovespeedModifierMetabolismComponent;
|
|
|
|
namespace Content.Shared.Chemistry
|
|
{
|
|
public class MetabolismMovespeedModifierSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
|
|
private readonly List<MovespeedModifierMetabolismComponent> _components = new();
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<MovespeedModifierMetabolismComponent, ComponentHandleState>(OnMovespeedHandleState);
|
|
SubscribeLocalEvent<MovespeedModifierMetabolismComponent, ComponentStartup>(AddComponent);
|
|
}
|
|
|
|
private void OnMovespeedHandleState(EntityUid uid, MovespeedModifierMetabolismComponent component, ComponentHandleState args)
|
|
{
|
|
if (args.Current is not MovespeedModifierMetabolismComponentState cast)
|
|
return;
|
|
|
|
if (ComponentManager.TryGetComponent<MovementSpeedModifierComponent>(uid, out var modifier) &&
|
|
(!component.WalkSpeedModifier.Equals(cast.WalkSpeedModifier) ||
|
|
!component.SprintSpeedModifier.Equals(cast.SprintSpeedModifier)))
|
|
{
|
|
modifier.RefreshMovementSpeedModifiers();
|
|
}
|
|
|
|
component.WalkSpeedModifier = cast.WalkSpeedModifier;
|
|
component.SprintSpeedModifier = cast.SprintSpeedModifier;
|
|
component.ModifierTimer = cast.ModifierTimer;
|
|
|
|
}
|
|
private void AddComponent(EntityUid uid, MovespeedModifierMetabolismComponent component, ComponentStartup args)
|
|
{
|
|
_components.Add(component);
|
|
}
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
var currentTime = _gameTiming.CurTime;
|
|
|
|
for (var i = _components.Count - 1; i >= 0; i--)
|
|
{
|
|
var component = _components[i];
|
|
|
|
if (component.Deleted)
|
|
{
|
|
_components.RemoveAt(i);
|
|
continue;
|
|
}
|
|
|
|
if (component.ModifierTimer > currentTime) continue;
|
|
|
|
_components.RemoveAt(i);
|
|
ComponentManager.RemoveComponent<MovespeedModifierMetabolismComponent>(component.Owner.Uid);
|
|
|
|
if (component.Owner.TryGetComponent(out MovementSpeedModifierComponent? modifier))
|
|
{
|
|
modifier.RefreshMovementSpeedModifiers();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|