Skip to content

Commit

Permalink
rizzler
Browse files Browse the repository at this point in the history
  • Loading branch information
Fansana committed Dec 15, 2024
1 parent f7ff7dd commit 33f8509
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Content.Server/FootPrint/FootPrintsSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Linq;
using Content.Server.Atmos.Components;
using Content.Shared.Inventory;
using Content.Shared.Mobs;
Expand All @@ -21,6 +22,7 @@ public sealed class FootPrintsSystem : EntitySystem
[Dependency] private readonly SharedSolutionContainerSystem _solution = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;

private EntityQuery<TransformComponent> _transformQuery;
private EntityQuery<MobThresholdsComponent> _mobThresholdQuery;
Expand All @@ -47,10 +49,10 @@ private void OnStartupComponent(EntityUid uid, FootPrintsComponent component, Co

private void OnMove(EntityUid uid, FootPrintsComponent component, ref MoveEvent args)
{
if (component.PrintsColor.A <= 0f)
if (component.PrintsColor.A <= .2f) // avoid creating footsteps that are invisible
component.DNAs.Clear();

if (component.PrintsColor.A <= 0f
if (component.PrintsColor.A <= .2f
|| !_transformQuery.TryComp(uid, out var transform)
|| !_mobThresholdQuery.TryComp(uid, out var mobThreshHolds)
|| !_map.TryFindGridAt(_transform.GetMapCoordinates((uid, transform)), out var gridUid, out _))
Expand All @@ -64,6 +66,10 @@ private void OnMove(EntityUid uid, FootPrintsComponent component, ref MoveEvent
if (!(distance > stepSize))
return;

var entities = _lookup.GetEntitiesIntersecting(uid, LookupFlags.All);
foreach (var entityUid in entities.Where(entityUid => HasComp<PuddleFootPrintsComponent>(entityUid)))
return; //are we on a puddle? we exit, ideally we would exchange liquid and DNA with the puddle but meh, too lazy to do that now.

component.RightStep = !component.RightStep;

var entity = Spawn(component.StepProtoId, CalcCoords(gridUid, component, transform, dragging));
Expand Down

0 comments on commit 33f8509

Please sign in to comment.