Better jetpack emitter (#36093)
* Better jetpack emitter Still need particles this just tilts me whenever I see it. * Update Resources/Prototypes/Entities/Objects/Tools/jetpacks.yml Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -49,13 +49,17 @@ public sealed class JetpackSystem : SharedJetpackSystem
|
|||||||
|
|
||||||
// TODO: Please don't copy-paste this I beg
|
// TODO: Please don't copy-paste this I beg
|
||||||
// make a generic particle emitter system / actual particles instead.
|
// make a generic particle emitter system / actual particles instead.
|
||||||
var query = EntityQueryEnumerator<ActiveJetpackComponent>();
|
var query = EntityQueryEnumerator<ActiveJetpackComponent, TransformComponent>();
|
||||||
|
|
||||||
while (query.MoveNext(out var uid, out var comp))
|
while (query.MoveNext(out var uid, out var comp, out var xform))
|
||||||
{
|
{
|
||||||
if (_timing.CurTime < comp.TargetTime)
|
if (_transform.InRange(xform.Coordinates, comp.LastCoordinates, comp.MaxDistance))
|
||||||
continue;
|
{
|
||||||
|
if (_timing.CurTime < comp.TargetTime)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
comp.LastCoordinates = _transform.GetMoverCoordinates(xform.Coordinates);
|
||||||
comp.TargetTime = _timing.CurTime + TimeSpan.FromSeconds(comp.EffectCooldown);
|
comp.TargetTime = _timing.CurTime + TimeSpan.FromSeconds(comp.EffectCooldown);
|
||||||
|
|
||||||
CreateParticles(uid);
|
CreateParticles(uid);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
namespace Content.Shared.Movement.Components;
|
namespace Content.Shared.Movement.Components;
|
||||||
|
|
||||||
@@ -9,5 +10,10 @@ namespace Content.Shared.Movement.Components;
|
|||||||
public sealed partial class ActiveJetpackComponent : Component
|
public sealed partial class ActiveJetpackComponent : Component
|
||||||
{
|
{
|
||||||
public float EffectCooldown = 0.3f;
|
public float EffectCooldown = 0.3f;
|
||||||
|
|
||||||
|
public float MaxDistance = 0.7f;
|
||||||
|
|
||||||
|
public EntityCoordinates LastCoordinates;
|
||||||
|
|
||||||
public TimeSpan TargetTime = TimeSpan.Zero;
|
public TimeSpan TargetTime = TimeSpan.Zero;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user