Meth (#4186)
* 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>
This commit is contained in:
69
Content.Server/Chemistry/ReagentEffects/MovespeedModifier.cs
Normal file
69
Content.Server/Chemistry/ReagentEffects/MovespeedModifier.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using System;
|
||||
using Content.Shared.Chemistry.Solution;
|
||||
|
||||
namespace Content.Server.Chemistry.ReagentEffects
|
||||
{
|
||||
/// <summary>
|
||||
/// Default metabolism for stimulants and tranqs. Attempts to find a MovementSpeedModifier on the target,
|
||||
/// adding one if not there and to change the movespeed
|
||||
/// </summary>
|
||||
public class MovespeedModifier : ReagentEffect
|
||||
{
|
||||
/// <summary>
|
||||
/// How much the entities' walk speed is multiplied by.
|
||||
/// </summary>
|
||||
[DataField("walkSpeedModifier")]
|
||||
public float WalkSpeedModifier { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// How much the entities' run speed is multiplied by.
|
||||
/// </summary>
|
||||
[DataField("sprintSpeedModifier")]
|
||||
public float SprintSpeedModifier { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// How long the modifier applies (in seconds) when metabolized.
|
||||
/// </summary>
|
||||
[DataField("statusLifetime")]
|
||||
public float StatusLifetime = 2f;
|
||||
|
||||
/// <summary>
|
||||
/// Remove reagent at set rate, changes the movespeed modifiers and adds a MovespeedModifierMetabolismComponent if not already there.
|
||||
/// </summary>
|
||||
public override void Metabolize(IEntity solutionEntity, Solution.ReagentQuantity amount)
|
||||
{
|
||||
if (!solutionEntity.TryGetComponent(out MovementSpeedModifierComponent? movement)) return;
|
||||
|
||||
solutionEntity.EnsureComponent(out MovespeedModifierMetabolismComponent status);
|
||||
|
||||
// Only refresh movement if we need to.
|
||||
var modified = !status.WalkSpeedModifier.Equals(WalkSpeedModifier) ||
|
||||
!status.SprintSpeedModifier.Equals(SprintSpeedModifier);
|
||||
|
||||
status.WalkSpeedModifier = WalkSpeedModifier;
|
||||
status.SprintSpeedModifier = SprintSpeedModifier;
|
||||
|
||||
IncreaseTimer(status, StatusLifetime * amount.Quantity.Float());
|
||||
|
||||
if (modified)
|
||||
movement.RefreshMovementSpeedModifiers();
|
||||
|
||||
}
|
||||
public void IncreaseTimer(MovespeedModifierMetabolismComponent status, float time)
|
||||
{
|
||||
var gameTiming = IoCManager.Resolve<IGameTiming>();
|
||||
|
||||
var offsetTime = Math.Max(status.ModifierTimer.TotalSeconds, gameTiming.CurTime.TotalSeconds);
|
||||
|
||||
status.ModifierTimer = TimeSpan.FromSeconds(offsetTime + time);
|
||||
status.Dirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using Content.Shared.Movement.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Shared.Chemistry.Components
|
||||
{
|
||||
//TODO: refactor movement modifier component because this is a pretty poor solution
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent]
|
||||
public sealed class MovespeedModifierMetabolismComponent : Component, IMoveSpeedModifier
|
||||
{
|
||||
[ViewVariables]
|
||||
public override string Name => "MovespeedModifierMetabolism";
|
||||
|
||||
[ViewVariables]
|
||||
public float WalkSpeedModifier { get; set; }
|
||||
|
||||
[ViewVariables]
|
||||
public float SprintSpeedModifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When the current modifier is expected to end.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public TimeSpan ModifierTimer { get; set; } = TimeSpan.Zero;
|
||||
|
||||
public override ComponentState GetComponentState(ICommonSession player)
|
||||
{
|
||||
return new MovespeedModifierMetabolismComponentState(WalkSpeedModifier, SprintSpeedModifier, ModifierTimer);
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class MovespeedModifierMetabolismComponentState : ComponentState
|
||||
{
|
||||
public float WalkSpeedModifier { get; }
|
||||
public float SprintSpeedModifier { get; }
|
||||
public TimeSpan ModifierTimer { get; }
|
||||
|
||||
public MovespeedModifierMetabolismComponentState(float walkSpeedModifier, float sprintSpeedModifier, TimeSpan modifierTimer)
|
||||
{
|
||||
WalkSpeedModifier = walkSpeedModifier;
|
||||
SprintSpeedModifier = sprintSpeedModifier;
|
||||
ModifierTimer = modifierTimer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,11 +121,6 @@
|
||||
# You're technically 'immune to poison' without a heart, but.. uhh, you'll have bigger problems on your hands.
|
||||
- type: Metabolizer
|
||||
metabolisms:
|
||||
Dylovene:
|
||||
effects:
|
||||
- !type:HealthChange
|
||||
damageClass: Toxin
|
||||
healthChange: -1
|
||||
Arithrazine:
|
||||
effects:
|
||||
- !type:HealthChange
|
||||
@@ -154,26 +149,39 @@
|
||||
- !type:HealthChange
|
||||
damageClass: Airloss
|
||||
healthChange: -3
|
||||
Kelotane:
|
||||
Dylovene:
|
||||
effects:
|
||||
- !type:HealthChange
|
||||
damageClass: Burn
|
||||
healthChange: -1
|
||||
Synaptizine:
|
||||
- !type:HealthChange
|
||||
damageClass: Toxin
|
||||
healthChange: -1
|
||||
Ephedrine:
|
||||
effects:
|
||||
- !type:HealthChange
|
||||
damageClass: Toxin
|
||||
healthChange: 0.5
|
||||
- !type:MovespeedModifier
|
||||
walkSpeedModifier: 1.2
|
||||
sprintSpeedModifier: 1.2
|
||||
HeartbreakerToxin:
|
||||
effects:
|
||||
- !type:HealthChange
|
||||
damageClass: Airloss
|
||||
healthChange: 4
|
||||
Kelotane:
|
||||
effects:
|
||||
- !type:HealthChange
|
||||
damageClass: Burn
|
||||
healthChange: -1
|
||||
Lexorin:
|
||||
effects:
|
||||
- !type:HealthChange
|
||||
damageClass: Airloss
|
||||
healthChange: 7
|
||||
Meth:
|
||||
effects:
|
||||
- !type:HealthChange
|
||||
healthChange: 2.5
|
||||
damageClass: Toxin
|
||||
- !type:MovespeedModifier
|
||||
walkSpeedModifier: 1.3
|
||||
sprintSpeedModifier: 1.3
|
||||
Omnizine:
|
||||
effects:
|
||||
- !type:HealthChange
|
||||
@@ -188,6 +196,11 @@
|
||||
- !type:HealthChange
|
||||
healthChange: -2
|
||||
damageClass: Brute
|
||||
Synaptizine:
|
||||
effects:
|
||||
- !type:HealthChange
|
||||
damageClass: Toxin
|
||||
healthChange: 0.5
|
||||
|
||||
- type: entity
|
||||
id: OrganHumanStomach
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
- Fluorine
|
||||
- Glucose
|
||||
- Hydrogen
|
||||
- Iodine
|
||||
- Iron
|
||||
- Lithium
|
||||
- Mercury
|
||||
@@ -25,3 +26,4 @@
|
||||
- SulfuricAcid
|
||||
- Uranium
|
||||
- Water
|
||||
|
||||
|
||||
@@ -222,6 +222,33 @@
|
||||
- !type:AdjustWater
|
||||
amount: 1
|
||||
|
||||
- type: reagent
|
||||
id: Meth
|
||||
name: meth
|
||||
desc: Methamphetamine, more commonly know as meth, is a potent stimulant, with dangerous side-effects if too much is consumed.
|
||||
physicalDesc: translucent
|
||||
color: "#FAFAFA"
|
||||
boilingPoint: 212.0 #Meth vape when?
|
||||
meltingPoint: 170.0
|
||||
|
||||
- type: reagent
|
||||
id: Iodine
|
||||
name: iodine
|
||||
desc: Commonly added to table salt as a nutrient. On its own it tastes far less pleasing.
|
||||
physicalDesc: Dark Brown
|
||||
color: "#BC8A00"
|
||||
boilingPoint: 184.3
|
||||
meltingPoint: 113.7
|
||||
|
||||
- type: reagent
|
||||
id: Ephedrine
|
||||
name: ephedrine
|
||||
desc: Increases stun resistance and movement speed, giving you hand cramps. Overdose deals toxin damage and inhibits breathing
|
||||
physicalDesc: Bone white
|
||||
color: "#D2FFFA"
|
||||
boilingPoint: 255.0
|
||||
meltingPoint: 36.0
|
||||
|
||||
- type: reagent
|
||||
id: Oil
|
||||
name: oil
|
||||
|
||||
@@ -226,3 +226,31 @@
|
||||
amount: 1
|
||||
products:
|
||||
Fluorosurfactant: 5
|
||||
|
||||
- type: reaction
|
||||
id: Meth
|
||||
reactants:
|
||||
Ephedrine:
|
||||
amount: 1
|
||||
Carbon:
|
||||
amount: 1
|
||||
Iodine:
|
||||
amount: 1
|
||||
Phosphorus:
|
||||
amount: 1
|
||||
products:
|
||||
Meth: 4 #I kinda remember having to heat this up, and if you heated it up too much, it went boom, I can't remember the specific values tho.
|
||||
|
||||
- type: reaction
|
||||
id: Ephedrine
|
||||
reactants:
|
||||
Oil:
|
||||
amount: 1
|
||||
Hydrogen:
|
||||
amount: 1
|
||||
Sugar:
|
||||
amount: 1
|
||||
Diethylamine:
|
||||
amount: 1
|
||||
products:
|
||||
Ephedrine: 4
|
||||
|
||||
Reference in New Issue
Block a user