* 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:
metalgearsloth
2022-06-24 17:44:30 +10:00
committed by GitHub
parent 271d34f005
commit 2b6c352aff
107 changed files with 1197 additions and 206 deletions

View File

@@ -0,0 +1,44 @@
using Content.Client.Interactable;
using Content.Client.Movement.Components;
using Content.Shared.Climbing;
using Content.Shared.DragDrop;
using Robust.Shared.GameStates;
namespace Content.Client.Movement.Systems;
public sealed class ClimbSystem : SharedClimbSystem
{
[Dependency] private readonly InteractionSystem _interactionSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ClimbingComponent, ComponentHandleState>(OnClimbingState);
}
private static void OnClimbingState(EntityUid uid, ClimbingComponent component, ref ComponentHandleState args)
{
if (args.Current is not SharedClimbingComponent.ClimbModeComponentState climbModeState)
return;
component.IsClimbing = climbModeState.Climbing;
component.OwnerIsTransitioning = climbModeState.IsTransitioning;
}
protected override void OnCanDragDropOn(EntityUid uid, SharedClimbableComponent component, CanDragDropOnEvent args)
{
base.OnCanDragDropOn(uid, component, args);
if (!args.CanDrop)
return;
var user = args.User;
var target = args.Target;
var dragged = args.Dragged;
bool Ignored(EntityUid entity) => entity == target || entity == user || entity == dragged;
args.CanDrop = _interactionSystem.InRangeUnobstructed(user, target, component.Range, predicate: Ignored)
&& _interactionSystem.InRangeUnobstructed(user, dragged, component.Range, predicate: Ignored);
args.Handled = true;
}
}

View File

@@ -0,0 +1,80 @@
using Content.Client.Clothing;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems;
using Content.Shared.Weapons.Ranged.Systems;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
using Robust.Shared.Timing;
namespace Content.Client.Movement.Systems;
public sealed class JetpackSystem : SharedJetpackSystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<JetpackComponent, AppearanceChangeEvent>(OnJetpackAppearance);
}
protected override bool CanEnable(JetpackComponent component)
{
// No predicted atmos so you'd have to do a lot of funny to get this working.
return false;
}
private void OnJetpackAppearance(EntityUid uid, JetpackComponent component, ref AppearanceChangeEvent args)
{
args.Component.TryGetData(JetpackVisuals.Enabled, out bool enabled);
var state = "icon" + (enabled ? "-on" : "");
args.Sprite?.LayerSetState(0, state);
if (TryComp<ClothingComponent>(uid, out var clothing))
clothing.EquippedPrefix = enabled ? "on" : null;
}
public override void Update(float frameTime)
{
base.Update(frameTime);
if (!_timing.IsFirstTimePredicted) return;
foreach (var comp in EntityQuery<ActiveJetpackComponent>())
{
comp.Accumulator += frameTime;
if (comp.Accumulator < comp.EffectCooldown) continue;
comp.Accumulator -= comp.EffectCooldown;
CreateParticles(comp.Owner);
}
}
private void CreateParticles(EntityUid uid)
{
var uidXform = Transform(uid);
var coordinates = uidXform.Coordinates;
var gridUid = coordinates.GetGridUid(EntityManager);
if (_mapManager.TryGetGrid(gridUid, out var grid))
{
coordinates = new EntityCoordinates(grid.GridEntityId, grid.WorldToLocal(coordinates.ToMapPos(EntityManager)));
}
else if (uidXform.MapUid != null)
{
coordinates = new EntityCoordinates(uidXform.MapUid.Value, uidXform.WorldPosition);
}
else
{
return;
}
var ent = Spawn("JetpackEffect", coordinates);
var xform = Transform(ent);
xform.Coordinates = coordinates;
}
}