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

Milking Machine #384

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,10 @@ public sealed partial class SolutionRegenerationComponent : Component
[DataField("nextChargeTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
[AutoPausedField]
public TimeSpan NextRegenTime = TimeSpan.FromSeconds(0);

/// <summary>
/// Whether the entity with the solution needs to be equipped
/// </summary>
[DataField("needsEquipped"), ViewVariables(VVAccess.ReadWrite)]
public bool NeedsEquipped = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Clothing.Components;
using Content.Shared.FixedPoint;
using Robust.Shared.Timing;

Expand All @@ -20,7 +21,20 @@ public override void Update(float frameTime)
while (query.MoveNext(out var uid, out var regen, out var manager))
{
if (_timing.CurTime < regen.NextRegenTime)
{
continue;
}

if (regen.NeedsEquipped)
{
if(EntityManager.TryGetComponent(uid, out ClothingComponent? clothing))
{
if (!clothing.IsEquipped)
{
continue;
}
}
}
Lyroth001 marked this conversation as resolved.
Show resolved Hide resolved

// timer ignores if its full, it's just a fixed cycle
regen.NextRegenTime = _timing.CurTime + regen.Duration;
Expand Down
3 changes: 3 additions & 0 deletions Content.Shared/Clothing/Components/ClothingComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public sealed partial class ClothingComponent : Component
[DataField("unisexMask")]
public ClothingMask UnisexMask = ClothingMask.UniformFull;

[DataField("isEquipped")]
public bool IsEquipped;

Lyroth001 marked this conversation as resolved.
Show resolved Hide resolved
/// <summary>
/// Name of the inventory slot the clothing is in.
/// </summary>
Expand Down
6 changes: 5 additions & 1 deletion Content.Shared/Clothing/EntitySystems/ClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ protected virtual void OnGotEquipped(EntityUid uid, ClothingComponent component,

var didEquippedEvent = new ClothingDidEquippedEvent((uid, component));
RaiseLocalEvent(args.Equipee, ref didEquippedEvent);


}
component.IsEquipped = true;
}

protected virtual void OnGotUnequipped(EntityUid uid, ClothingComponent component, GotUnequippedEvent args)
Expand All @@ -151,6 +154,7 @@ protected virtual void OnGotUnequipped(EntityUid uid, ClothingComponent componen
RaiseLocalEvent(args.Equipee, ref didUnequippedEvent);
}

component.IsEquipped = false;
component.InSlot = null;
CheckEquipmentForLayerHide(args.Equipment, args.Equipee);
}
Expand Down Expand Up @@ -288,4 +292,4 @@ public void SetLayerState(ClothingComponent clothing, string slot, string mapKey
}

#endregion
}
}
32 changes: 32 additions & 0 deletions Resources/Prototypes/Floof/Entities/Clothing/Uniforms/misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,35 @@
sprite: Floof/Clothing/Uniforms/musiciankingblack.rsi
- type: Clothing
sprite: Floof/Clothing/Uniforms/musiciankingblack.rsi

- type: entity
parent: ClothingUniformBase
id: ClothingUniformMilkingMachine
name: milking machine
components:
- type: Sprite
sprite: Floof/Clothing/Uniforms/codervalidthong.rsi
- type: Clothing
sprite: Floof/Clothing/Uniforms/codervalidthong.rsi
- type: Tag #DeltaV, needed for species with nonhuman legs/can only wear skirts
tags:
- Skirt
- type: SolutionContainerManager
solutions:
tank:
maxVol: 100
- type: DrawableSolution
solution: tank
- type: DrainableSolution
solution: tank
- type: ExaminableSolution
solution: tank
- type: SolutionItemStatus
solution: tank
- type: SolutionRegeneration
solution: tank
generated:
reagents:
- ReagentId: Cum
Quantity: 0.01
needsEquipped: true