Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Фикс телепортирующихся трупов #466

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Content.Server/ADT/EntityEffects/Effects/RandomTeleport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override void Effect(EntityEffectBaseArgs ev)
var statusSys = args.EntityManager.EntitySysManager.GetEntitySystem<StatusEffectsSystem>();
var shadekin = args.EntityManager.EntitySysManager.GetEntitySystem<ShadekinSystem>();

shadekin.TeleportRandomly(args.TargetEntity, 2f);
shadekin.TeleportRandomlyNoComp(args.TargetEntity, 2f);
}
}
}
9 changes: 7 additions & 2 deletions Content.Server/ADT/Shadekin/ShadekinSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Robust.Shared.Prototypes;
using Content.Shared.Movement.Pulling.Systems;
using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Mobs.Systems;
using Content.Server.Cuffs;
using Content.Shared.Cuffs.Components;

Expand All @@ -39,6 +40,7 @@ public sealed partial class ShadekinSystem : EntitySystem
[Dependency] private readonly AlertsSystem _alert = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly PullingSystem _pulling = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly CuffableSystem _cuffable = default!;

public override void Initialize()
Expand All @@ -64,6 +66,9 @@ public override void Update(float frameTime)
continue;
if (comp.Blackeye)
continue;
if (_mobState.IsIncapacitated(uid))
continue;

_alert.ShowAlert(uid, _proto.Index<AlertPrototype>("ShadekinPower"), (short) Math.Clamp(Math.Round(comp.PowerLevel / 50f), 0, 4));
comp.NextSecond = _timing.CurTime + TimeSpan.FromSeconds(1);

Expand All @@ -78,7 +83,7 @@ public override void Update(float frameTime)
if (comp.PowerLevel < comp.PowerLevelMin)
comp.MinPowerAccumulator += 1f;
else
comp.MinPowerAccumulator = 0f;
comp.MinPowerAccumulator = Math.Clamp(comp.MinPowerAccumulator - 1f, 0f, comp.MinPowerRoof);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а почему не ноль то?


if (comp.MinPowerAccumulator >= comp.MinPowerRoof)
BlackEye(uid);
Expand Down Expand Up @@ -186,7 +191,7 @@ public void TeleportRandomly(EntityUid uid, ShadekinComponent? comp)
}
}

public void TeleportRandomly(EntityUid uid, float range = 5f)
public void TeleportRandomlyNoComp(EntityUid uid, float range = 5f)
{
var coordsValid = false;
EntityCoordinates coords = Transform(uid).Coordinates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public sealed partial class ShadekinComponent : Component
/// Teleport randomly if MaxedPowerAccumulator is greater
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public float MaxedPowerRoof = 45f;
public float MaxedPowerRoof = 60f;

/// <summary>
/// Accumulator that indicates how long shadekin were with min energy level
Expand Down
Loading