Skip to content

Commit

Permalink
Done Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus committed Nov 8, 2024
1 parent fc9a283 commit 5fd4468
Show file tree
Hide file tree
Showing 41 changed files with 90 additions and 108 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Content.Shared._White.FootPrint;
using Content.Shared.FootPrint;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.Random;

namespace Content.Client._White.FootPrint;
namespace Content.Client.FootPrint;

public sealed class FootPrintsVisualizerSystem : VisualizerSystem<FootPrintComponent>
{
Expand All @@ -29,21 +29,17 @@ private void OnInitialized(EntityUid uid, FootPrintComponent comp, ComponentInit

private void OnShutdown(EntityUid uid, FootPrintComponent comp, ComponentShutdown args)
{
if (TryComp<SpriteComponent>(uid, out var sprite) &&
sprite.LayerMapTryGet(FootPrintVisualLayers.Print, out var layer))
{
if (TryComp<SpriteComponent>(uid, out var sprite)
&& sprite.LayerMapTryGet(FootPrintVisualLayers.Print, out var layer))
sprite.RemoveLayer(layer);
}
}

private void UpdateAppearance(EntityUid uid, FootPrintComponent component, SpriteComponent sprite)
{
if (!sprite.LayerMapTryGet(FootPrintVisualLayers.Print, out var layer)
|| !TryComp<FootPrintsComponent>(component.PrintOwner, out var printsComponent)
|| !TryComp<AppearanceComponent>(uid, out var appearance))
return;

if (!_appearance.TryGetData<FootPrintVisuals>(uid, FootPrintVisualState.State, out var printVisuals, appearance))
|| !TryComp<AppearanceComponent>(uid, out var appearance)
|| !_appearance.TryGetData<FootPrintVisuals>(uid, FootPrintVisualState.State, out var printVisuals, appearance))
return;

sprite.LayerSetState(layer, new RSI.StateId(printVisuals switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
using Content.Shared.Inventory;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared._White.FootPrint;
using Content.Shared.FootPrint;
using Content.Shared.Standing;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
using Robust.Shared.Map;
using Robust.Shared.Random;

namespace Content.Server._White.FootPrint;
namespace Content.Server.FootPrint;

public sealed class FootPrintsSystem : EntitySystem
{
Expand All @@ -26,18 +26,18 @@ public sealed class FootPrintsSystem : EntitySystem
private EntityQuery<AppearanceComponent> _appearanceQuery;
private EntityQuery<LayingDownComponent> _layingQuery;

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

_transformQuery = GetEntityQuery<TransformComponent>();
_mobThresholdQuery = GetEntityQuery<MobThresholdsComponent>();
_appearanceQuery = GetEntityQuery<AppearanceComponent>();
_layingQuery = GetEntityQuery<LayingDownComponent>();
_transformQuery = GetEntityQuery<TransformComponent>();
_mobThresholdQuery = GetEntityQuery<MobThresholdsComponent>();
_appearanceQuery = GetEntityQuery<AppearanceComponent>();
_layingQuery = GetEntityQuery<LayingDownComponent>();

SubscribeLocalEvent<FootPrintsComponent, ComponentStartup>(OnStartupComponent);
SubscribeLocalEvent<FootPrintsComponent, MoveEvent>(OnMove);
}
SubscribeLocalEvent<FootPrintsComponent, ComponentStartup>(OnStartupComponent);
SubscribeLocalEvent<FootPrintsComponent, MoveEvent>(OnMove);
}

private void OnStartupComponent(EntityUid uid, FootPrintsComponent component, ComponentStartup args)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
using System.Linq;
using Content.Shared._White.FootPrint;
using Content.Shared.FootPrint;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Fluids;
using Content.Shared.Fluids.Components;
using Robust.Shared.Physics.Events;

namespace Content.Server._White.FootPrint;
namespace Content.Server.FootPrint;

public sealed class PuddleFootPrintsSystem : EntitySystem
{
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PuddleFootPrintsComponent, EndCollideEvent>(OnStepTrigger);
}
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PuddleFootPrintsComponent, EndCollideEvent>(OnStepTrigger);
}

private void OnStepTrigger(EntityUid uid, PuddleFootPrintsComponent component, ref EndCollideEvent args)
{
if (!TryComp<AppearanceComponent>(uid, out var appearance)
|| !TryComp<PuddleComponent>(uid, out var puddle)
|| !TryComp<FootPrintsComponent>(args.OtherEntity, out var tripper)
|| !TryComp<SolutionContainerManagerComponent>(uid, out var solutionManager)
||!_solutionContainer.ResolveSolution((uid, solutionManager), puddle.SolutionName, ref puddle.Solution, out var solutions))
|| !_solutionContainer.ResolveSolution((uid, solutionManager), puddle.SolutionName, ref puddle.Solution, out var solutions))
return;

// alles gut!
var totalSolutionQuantity = solutions.Contents.Sum(sol => (float)sol.Quantity);
var totalSolutionQuantity = solutions.Contents.Sum(sol => (float) sol.Quantity);
var waterQuantity = (from sol in solutions.Contents where sol.Reagent.Prototype == "Water" select (float) sol.Quantity).FirstOrDefault();

if (waterQuantity / (totalSolutionQuantity / 100f) > component.OffPercent || solutions.Contents.Count <= 0)
Expand All @@ -40,7 +39,7 @@ private void OnStepTrigger(EntityUid uid, PuddleFootPrintsComponent component, r

if (_appearance.TryGetData(uid, PuddleVisuals.SolutionColor, out var color, appearance)
&& _appearance.TryGetData(uid, PuddleVisuals.CurrentVolume, out var volume, appearance))
AddColor((Color)color, (float)volume * component.SizeRatio, tripper);
AddColor((Color) color, (float) volume * component.SizeRatio, tripper);

_solutionContainer.RemoveEachReagent(puddle.Solution.Value, 1);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using Content.Shared.Chemistry.Components;
using Robust.Shared.GameStates;

namespace Content.Shared._White.FootPrint;
namespace Content.Shared.FootPrint;

/// <summary>
/// This is used for marking footsteps, handling footprint drawing.
/// This is used for marking footsteps, handling footprint drawing.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class FootPrintComponent : Component
{
/// <summary>
/// Owner (with <see cref="FootPrintsComponent"/>) of a print (this component).
/// Owner (with <see cref="FootPrintsComponent"/>) of a print (this component).
/// </summary>
[AutoNetworkedField]
public EntityUid PrintOwner;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Robust.Shared.Serialization;

namespace Content.Shared._White.FootPrint;
namespace Content.Shared.FootPrint;

[Serializable, NetSerializable]
public enum FootPrintVisuals : byte
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;

namespace Content.Shared._White.FootPrint;
namespace Content.Shared.FootPrint;

[RegisterComponent]
public sealed partial class FootPrintsComponent : Component
{
[ViewVariables(VVAccess.ReadOnly), DataField]
public ResPath RsiPath = new("/Textures/_White/Effects/footprints.rsi");
public ResPath RsiPath = new("/Textures/Effects/footprints.rsi");

// all of those are set as a layer
[ViewVariables(VVAccess.ReadOnly), DataField]
Expand Down Expand Up @@ -41,25 +41,25 @@ public sealed partial class FootPrintsComponent : Component
public Color PrintsColor = Color.FromHex("#00000000");

/// <summary>
/// The size scaling factor for footprint steps. Must be positive.
/// The size scaling factor for footprint steps. Must be positive.
/// </summary>
[DataField]
public float StepSize = 0.7f;

/// <summary>
/// The size scaling factor for drag marks. Must be positive.
/// The size scaling factor for drag marks. Must be positive.
/// </summary>
[DataField]
public float DragSize = 0.5f;

/// <summary>
/// The amount of color to transfer from the source (e.g., puddle) to the footprint.
/// The amount of color to transfer from the source (e.g., puddle) to the footprint.
/// </summary>
[DataField]
public float ColorQuantity;

/// <summary>
/// The factor by which the alpha channel is reduced in subsequent footprints.
/// The factor by which the alpha channel is reduced in subsequent footprints.
/// </summary>
[DataField]
public float ColorReduceAlpha = 0.1f;
Expand All @@ -71,18 +71,18 @@ public sealed partial class FootPrintsComponent : Component
public Vector2 OffsetPrint = new(0.1f, 0f);

/// <summary>
/// Tracks which foot should make the next print. True for right foot, false for left.
/// Tracks which foot should make the next print. True for right foot, false for left.
/// </summary>
public bool RightStep = true;

/// <summary>
/// The position of the last footprint in world coordinates.
/// The position of the last footprint in world coordinates.
/// </summary>
public Vector2 StepPos = Vector2.Zero;

/// <summary>
/// Controls how quickly the footprint color transitions between steps.
/// Value between 0 and 1, where higher values mean faster color changes.
/// Controls how quickly the footprint color transitions between steps.
/// Value between 0 and 1, where higher values mean faster color changes.
/// </summary>
public float ColorInterpolationFactor = 0.2f;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Content.Shared._White.FootPrint;
namespace Content.Shared.FootPrint;

[RegisterComponent]
public sealed partial class PuddleFootPrintsComponent : Component
Expand Down
40 changes: 39 additions & 1 deletion Resources/Prototypes/Entities/Effects/puddle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,42 @@
solution: puddle
- type: BadDrink
- type: IgnoresFingerprints
- type: PuddleFootPrints # WD EDIT
- type: PuddleFootPrints

- type: entity
name: Footstep
id: Footstep
save: false
description: Trace of liquid
components:
- type: Clickable
- type: FootstepModifier
footstepSoundCollection:
collection: FootstepWater
params:
volume: 3
- type: Transform
noRot: false
- type: Sprite
drawdepth: FloorObjects
color: "#FFFFFF80"
- type: Physics
bodyType: Static
- type: Fixtures
fixtures:
slipFixture:
shape:
!type:PhysShapeAabb
bounds: "-0.4,-0.4,0.4,0.4"
mask:
- ItemMask
layer:
- SlipLayer
hard: false
- type: SolutionContainerManager
solutions:
step: { maxVol: 2 }
- type: FootPrint
- type: Puddle
solution: step
- type: Appearance
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/Player/arachnid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
Asphyxiation: 1.5 # This makes space and crit more lethal to arachnids.
damageRecovery:
types:
Asphyxiation: -0.5
Asphyxiation: -0.5
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/Player/human.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name: Urist McHands
parent: BaseMobHuman
id: MobHuman

#Syndie
- type: entity
parent: MobHuman
Expand Down
2 changes: 0 additions & 2 deletions Resources/Prototypes/Entities/Mobs/Species/arachne.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,9 @@
fireStackAlternateState: 3
- type: Spider
- type: IgnoreSpiderWeb
# WD EDIT START
- type: FootPrints
leftBarePrint: "footprint-left-bare-spider"
rightBarePrint: "footprint-right-bare-spider"
# WD EDIT END

- type: entity
save: false
Expand Down
2 changes: 0 additions & 2 deletions Resources/Prototypes/Entities/Mobs/Species/diona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,9 @@
whitelist:
types:
- Shard
# WD EDIT START
- type: FootPrints
leftBarePrint: "footprint-left-bare-diona"
rightBarePrint: "footprint-right-bare-diona"
# WD EDIT END

- type: entity
parent: BaseSpeciesDummy
Expand Down
6 changes: 2 additions & 4 deletions Resources/Prototypes/Entities/Mobs/Species/harpy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,9 @@
- Shard
- Landmine
- Mousetrap
# WD EDIT START
- type: FootPrints
leftBarePrint: "footprint-left-bare-lizard"
rightBarePrint: "footprint-right-bare-lizard"
# WD EDIT END
rightBarePrint: "footprint-right-bare-lizard" # I was about to complain about this, then I remembered birbs have dinosaur feet. So this is valid.

- type: entity
save: false
Expand Down Expand Up @@ -223,4 +221,4 @@
checkCanInteract: false
icon: { sprite: Interface/Actions/flight.rsi, state: flight_off }
iconOn: { sprite : Interface/Actions/flight.rsi, state: flight_on }
event: !type:ToggleFlightEvent
event: !type:ToggleFlightEvent
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/Species/human.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
understands:
- TauCetiBasic
- SolCommon
- type: FootPrints # WD EDIT
- type: FootPrints

- type: entity
parent: BaseSpeciesDummy
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/Species/moth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
sprite: "Effects/creampie.rsi"
state: "creampie_moth"
visible: false
- type: FootPrints # WD EDIT
- type: FootPrints

- type: entity
parent: BaseSpeciesDummy
Expand Down
2 changes: 0 additions & 2 deletions Resources/Prototypes/Entities/Mobs/Species/reptilian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,9 @@
understands:
- TauCetiBasic
- Draconic
# WD EDIT START
- type: FootPrints
leftBarePrint: "footprint-left-bare-lizard"
rightBarePrint: "footprint-right-bare-lizard"
# WD EDIT END

- type: entity
parent: BaseSpeciesDummy
Expand Down
4 changes: 2 additions & 2 deletions Resources/Prototypes/Entities/Mobs/Species/skeleton.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
components:
- type: HumanoidAppearance
species: Skeleton
- type: Carriable # Carrying system from nyanotrasen.
- type: Carriable # Carrying system from nyanotrasen.
- type: Icon
sprite: Mobs/Species/Skeleton/parts.rsi
state: full
Expand Down Expand Up @@ -102,7 +102,7 @@
probability: 0.5
- type: FireVisuals
alternateState: Standing
- type: FootPrints # WD EDIT
- type: FootPrints

- type: entity
parent: BaseSpeciesDummy
Expand Down
Loading

0 comments on commit 5fd4468

Please sign in to comment.