Skip to content

Commit

Permalink
Теперь проще убирать следы (#720)
Browse files Browse the repository at this point in the history
* Теперь проще убирать следы

Signed-off-by: pacable <[email protected]>

* чистобот чистит грязь лучше

Signed-off-by: pacable <[email protected]>

* Revert "добавление возможности выключать следы (#655)"

This reverts commit ae78fa1

Signed-off-by: pacable <[email protected]>

* postfix

Signed-off-by: pacable <[email protected]>

* исправление чистящих гранат по отношению к следам

Signed-off-by: pacable <[email protected]>

---------

Signed-off-by: pacable <[email protected]>
  • Loading branch information
pxc1984 authored Dec 1, 2024
1 parent dc7caa8 commit 343c84c
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 36 deletions.
1 change: 0 additions & 1 deletion Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Content.Shared.CCVar;
using Content.Shared._Sunrise.SunriseCCVars;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
Expand Down
1 change: 0 additions & 1 deletion Content.Client/Options/UI/Tabs/SunriseTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public SunriseTab()
Control.AddOptionDropDown(SunriseCCVars.LobbyParallax, DropDownLobbyParallax, lobbyParallaxes);
Control.AddOptionPercentSlider(SunriseCCVars.LobbyOpacity, LobbyOpacitySlider);
Control.AddOptionCheckBox(SunriseCCVars.DamageOverlay, DamageOverlayCheckBox);
Control.AddOptionCheckBox(SunriseCCVars.ShowFootprints, ShowFootprintsCheckBox);

Control.Initialize();
}
Expand Down
28 changes: 1 addition & 27 deletions Content.Client/_Sunrise/Footprints/FootPrintsVisualizerSystem.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using Content.Shared._Sunrise.Footprints;
using Content.Shared._Sunrise.SunriseCCVars;
using Content.Shared._Sunrise.Footprints;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.Configuration;
using Robust.Shared.Random;

namespace Content.Client._Sunrise.Footprints;
Expand All @@ -14,31 +12,16 @@ public sealed class FootprintVisualizerSystem : VisualizerSystem<FootprintCompon
{
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;

private bool _showFootprints;

/// <inheritdoc/>
public override void Initialize()
{
base.Initialize();

_cfg.OnValueChanged(SunriseCCVars.ShowFootprints, OnShowFootprintsChanged, true);

SubscribeLocalEvent<FootprintComponent, ComponentInit>(OnFootprintInitialized);
SubscribeLocalEvent<FootprintComponent, ComponentShutdown>(OnFootprintShutdown);
}

private void OnShowFootprintsChanged(bool value)
{
_showFootprints = value;
var query = EntityManager.AllEntityQueryEnumerator<FootprintComponent, SpriteComponent>();
while (query.MoveNext(out var uid, out var footprint, out var sprite))
{
UpdateFootprintVisuals(uid, footprint, sprite);
}
}

/// <summary>
/// Initializes the visual appearance of a new footprint
/// </summary>
Expand Down Expand Up @@ -91,15 +74,6 @@ private void UpdateFootprintVisuals(EntityUid uid, FootprintComponent footprint,
|| !TryComp<AppearanceComponent>(uid, out var appearance))
return;

// Hide footprints if disabled in settings
if (!_showFootprints)
{
sprite.Visible = false;
return;
}

sprite.Visible = true;

if (!_appearanceSystem.TryGetData<FootprintVisualType>(
uid,
FootprintVisualParameter.VisualState,
Expand Down
10 changes: 10 additions & 0 deletions Content.Server/Chemistry/TileReactions/CleanDecalsReaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using System.Numerics;
using Content.Shared._Sunrise.Footprints;
using Robust.Server.GameObjects;

namespace Content.Server.Chemistry.TileReactions;

Expand Down Expand Up @@ -54,6 +56,14 @@ public FixedPoint2 TileReact(TileRef tile,
amount += CleanCost;
}

// Sunrise-start
var footprints = lookupSystem.GetEntitiesInRange<FootprintComponent>(new EntityCoordinates(tile.GridUid, tile.X, tile.Y), 0.5f);
foreach (var footprint in footprints)
{
entityManager.QueueDeleteEntity(footprint);
}
// Sunrise-end

return amount;
}
}
10 changes: 10 additions & 0 deletions Content.Server/Chemistry/TileReactions/CleanTileReaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Robust.Shared.Map;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using System.Linq;
using Content.Shared._Sunrise.Footprints;

namespace Content.Server.Chemistry.TileReactions;

Expand Down Expand Up @@ -61,6 +62,15 @@ IEntityManager entityManager
break;
}

var lookupSystem = entityManager.System<EntityLookupSystem>();
// Sunrise-start
var footprints = lookupSystem.GetEntitiesInRange<FootprintComponent>(new EntityCoordinates(tile.GridUid, tile.X, tile.Y), 0.5f);
foreach (var footprint in footprints)
{
entityManager.QueueDeleteEntity(footprint);
}
// Sunrise-end

return (reactVolume / CleanAmountMultiplier - purgeAmount) * CleanAmountMultiplier;
}
}
24 changes: 24 additions & 0 deletions Content.Server/_Sunrise/Cleaning/FoorprintAreaCleaningSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Content.Shared._Sunrise.Footprints;
using Robust.Shared.Physics.Events;

namespace Content.Server._Sunrise.Cleaning;

public sealed class FoorprintAreaCleaningSystem : EntitySystem
{
[Dependency] private readonly EntityManager _entMan = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<FootprintAreaCleanerComponent, StartCollideEvent>(OnCollide);
}

private void OnCollide(EntityUid uid, FootprintAreaCleanerComponent component, StartCollideEvent args)
{
if (!TryComp<FootprintComponent>(args.OtherEntity, out _) || !component.Enabled)
return;

_entMan.QueueDeleteEntity(args.OtherEntity);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Content.Server._Sunrise.Cleaning;

[RegisterComponent]
public sealed partial class FootprintAreaCleanerComponent : Component
{
[DataField]
public bool Enabled = true;
}
6 changes: 0 additions & 6 deletions Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,4 @@ public static readonly CVarDef<bool>

public static readonly CVarDef<bool> MoodDecreasesSpeed =
CVarDef.Create("mood.decreases_speed", true, CVar.SERVER);

/// <summary>
/// Whether to show footprints
/// </summary>
public static readonly CVarDef<bool> ShowFootprints =
CVarDef.Create("game.show_footprints", true, CVar.CLIENTONLY | CVar.ARCHIVE);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ ui-options-lobby-art = Арт лобби
ui-options-lobby-animation = Анимация лобби
ui-options-lobby-parallax = Паралакс лобби
ui-options-damage-overlay = Оверлей урона
ui-options-show-footprints = Отображать следы
ui-options-sunrise-general-audio = Аудио
ui-options-sunrise-general-graphics = Графика
ui-options-sunrise-general-lobby = Лобби
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
parent: BorgChassisSelectable
name: janitor cyborg
components:
- type: FootprintAreaCleaner
- type: BorgSwitchableType
selectedBorgType: janitor

Expand Down

0 comments on commit 343c84c

Please sign in to comment.