Jetpacks (#9023)
* Movement acceleration * tweaks * Weightless refactor coz fuck it * CCVars * weightless movement tweaks * Some cleanup while I'm here * dorkpacks * thanks fork * fixes * zoomies * toggles * hmm * yamls * b * so true * Effects refactor * namespace * review
This commit is contained in:
@@ -145,6 +145,10 @@ namespace Content.Server.Atmos.Components
|
||||
if (internals == null) return;
|
||||
IsConnected = internals.TryConnectTank(Owner);
|
||||
EntitySystem.Get<SharedActionsSystem>().SetToggled(ToggleAction, IsConnected);
|
||||
|
||||
// Couldn't toggle!
|
||||
if (!IsConnected) return;
|
||||
|
||||
_connectStream?.Stop();
|
||||
|
||||
if (_connectSound != null)
|
||||
@@ -158,6 +162,7 @@ namespace Content.Server.Atmos.Components
|
||||
if (!IsConnected) return;
|
||||
IsConnected = false;
|
||||
EntitySystem.Get<SharedActionsSystem>().SetToggled(ToggleAction, false);
|
||||
|
||||
GetInternalsComponent(owner)?.DisconnectTank();
|
||||
_disconnectStream?.Stop();
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using Content.Server.Kitchen.Components;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Movement.EntitySystems;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server.Body.Systems
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Movement.EntitySystems;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server.Chemistry.ReagentEffects
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.UserInterface;
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Shared.Destructible;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -18,6 +18,7 @@ using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Throwing;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -11,7 +11,7 @@ using Content.Shared.Examine;
|
||||
using Content.Shared.Follower;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Movement.EntitySystems;
|
||||
using Content.Shared.Movement.Events;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
|
||||
@@ -16,6 +16,7 @@ using Content.Shared.Doors.Systems;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Spawners.Components;
|
||||
using Content.Shared.Storage;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
@@ -14,6 +14,7 @@ using Content.Shared.DragDrop;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
48
Content.Server/Movement/Systems/JetpackSystem.cs
Normal file
48
Content.Server/Movement/Systems/JetpackSystem.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Movement.Components;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Robust.Shared.Collections;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Server.Movement.Systems;
|
||||
|
||||
public sealed class JetpackSystem : SharedJetpackSystem
|
||||
{
|
||||
private const float UpdateCooldown = 0.5f;
|
||||
|
||||
protected override bool CanEnable(JetpackComponent component)
|
||||
{
|
||||
return TryComp<GasTankComponent>(component.Owner, out var gasTank) && !(gasTank.Air.Pressure < component.VolumeUsage);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
var toDisable = new ValueList<JetpackComponent>();
|
||||
|
||||
foreach (var (active, comp, gasTank) in EntityQuery<ActiveJetpackComponent, JetpackComponent, GasTankComponent>())
|
||||
{
|
||||
active.Accumulator += frameTime;
|
||||
if (active.Accumulator < UpdateCooldown) continue;
|
||||
|
||||
active.Accumulator -= UpdateCooldown;
|
||||
|
||||
if (gasTank.Air.Pressure < comp.VolumeUsage)
|
||||
{
|
||||
toDisable.Add(comp);
|
||||
continue;
|
||||
}
|
||||
|
||||
gasTank.RemoveAirVolume(comp.VolumeUsage);
|
||||
gasTank.UpdateUserInterface();
|
||||
}
|
||||
|
||||
foreach (var comp in toDisable)
|
||||
{
|
||||
SetEnabled(comp, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.EntitySystems;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Server.Nutrition.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Content.Shared.Movement.EntitySystems;
|
||||
using Robust.Shared.Random;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Movement.Components;
|
||||
@@ -8,6 +7,7 @@ using Content.Shared.Alert;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Movement.Systems;
|
||||
|
||||
namespace Content.Server.Nutrition.EntitySystems
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Shuttles.Systems;
|
||||
using Content.Shared.Vehicle.Components;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Shuttles.Components;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
@@ -2,12 +2,12 @@ using Content.Shared.Movement;
|
||||
using Content.Server.DoAfter;
|
||||
using Robust.Shared.Containers;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Movement.EntitySystems;
|
||||
using Robust.Shared.Player;
|
||||
using Content.Shared.Storage;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Movement.Events;
|
||||
|
||||
namespace Content.Server.Resist;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Server.Lock;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Containers;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Movement.Events;
|
||||
|
||||
namespace Content.Server.Resist;
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace Content.Server.Spawners.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Put this component on something you would like to despawn after a certain amount of time
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class TimedDespawnComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// How long the entity will exist before despawning
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("lifetime")]
|
||||
public float Lifetime = 5f;
|
||||
}
|
||||
@@ -1,19 +1,11 @@
|
||||
using Content.Server.Spawners.Components;
|
||||
using Content.Shared.Spawners.EntitySystems;
|
||||
|
||||
namespace Content.Server.Spawners.EntitySystems;
|
||||
|
||||
public sealed class TimedDespawnSystem : EntitySystem
|
||||
public sealed class TimedDespawnSystem : SharedTimedDespawnSystem
|
||||
{
|
||||
public override void Update(float frameTime)
|
||||
protected override bool CanDelete(EntityUid uid)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
foreach (var entity in EntityQuery<TimedDespawnComponent>())
|
||||
{
|
||||
entity.Lifetime -= frameTime;
|
||||
|
||||
if (entity.Lifetime <= 0)
|
||||
EntityManager.QueueDeleteEntity(entity.Owner);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ using Content.Server.Popups;
|
||||
using Content.Shared.Destructible;
|
||||
using static Content.Shared.Storage.SharedStorageComponent;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Movement.Events;
|
||||
|
||||
namespace Content.Server.Storage.EntitySystems
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user