Skip to content

Commit

Permalink
getting the groundwork for the system
Browse files Browse the repository at this point in the history
  • Loading branch information
SleepyScarecrow committed Aug 12, 2024
1 parent 928ef92 commit d30ffcf
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 103 deletions.
8 changes: 8 additions & 0 deletions Content.Server/Kitchen/Components/ActiveBoilingComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Content.Shared.Kitchen;

namespace Content.Server.Kitchen.Components;

[RegisterComponent]
public sealed partial class ActiveBoilingComponent : Component
{
}
13 changes: 0 additions & 13 deletions Content.Server/Kitchen/Components/ActiveKettleComponent.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Content.Server/Kitchen/Components/ActivelyBoilingComponent.cs

This file was deleted.

5 changes: 1 addition & 4 deletions Content.Server/Kitchen/Components/KettleComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@ public sealed partial class KettleComponent : Component

public Container Storage = default!;

[DataField, ViewVariables(VVAccess.ReadWrite)]
[DataField, ViewVariables(VVAccess.ReadOnly)]
public int Capacity = 3;

[DataField("objectHeatMultiplier"), ViewVariables(VVAccess.ReadWrite)]
public float ObjectHeatMultiplier = 100;

[DataField("failureResult", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string BadRecipeEntityId = "FoodBadRecipe";

#region audio
[DataField("beginBoilSound")]
public SoundSpecifier StartBoilingSound = new SoundPathSpecifier("/Audio/Items/Kettle/kettle_switch_on.ogg");
Expand Down
149 changes: 74 additions & 75 deletions Content.Server/Kitchen/EntitySystems/KettleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,87 +1,86 @@
using Content.Server.Body.Systems;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Construction;
using Content.Server.Explosion.EntitySystems;
using Content.Server.DeviceLinking.Events;
using Content.Server.DeviceLinking.Systems;
using Content.Server.Hands.Systems;
using Content.Server.Kitchen.Components;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Server.Temperature.Components;
using Content.Server.Temperature.Systems;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Construction.EntitySystems;
using Content.Shared.Destructible;
using Content.Shared.FixedPoint;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Robust.Shared.Random;
using Robust.Shared.Audio;
using Content.Server.Lightning;
using Content.Shared.Item;
using Content.Shared.Kitchen;
using Content.Shared.Kitchen.Components;
using Content.Shared.Popups;
using Content.Shared.Power;
using Content.Shared.Tag;
using Robust.Server.GameObjects;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Player;
using System.Linq;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Content.Server.Ghost;

namespace Content.Server.Kitchen.EntitySystems
{
public sealed partial class KettleSystem : EntitySystem
{
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
public override void Initialize()
{
base.Initialize();
}
}
}





































































SubscribeLocalEvent<ActiveBoilingComponent, ComponentStartup>(OnBoilStart);
SubscribeLocalEvent<ActiveBoilingComponent, ComponentShutdown>(OnBoilStop);
}
// make it turn on first //
public void OnBoilStart(Entity<ActiveBoilingComponent> ent, ref ComponentStartup args)
{
if (!TryComp<KettleComponent>(ent, out var kettleComponent))
return;
SetAppearance(ent.Owner, KettleVisualState.Boiling, kettleComponent);

kettleComponent.PlayingStream =
_audio.PlayPvs(kettleComponent.LoopingSound, ent, AudioParams.Default.WithLoop(true).WithMaxDistance(5)).Value.Entity;
}

public void SetAppearance(EntityUid uid, KettleVisualState state, KettleComponent? component = null, AppearanceComponent? appearanceComponent = null)
{
if (!Resolve(uid, ref component, ref appearanceComponent, false))
return;
_appearance.SetData(uid, PowerDeviceVisuals.VisualState, state, appearanceComponent);
}

public override void Update(float frameTime)
{
base.Update(frameTime);

var query = EntityQueryEnumerator<ActiveBoilingComponent, KettleComponent>();
while (query.MoveNext(out var uid, out var active, out var kettle))
{
/* need this to check solutions within the kettle's cotainer and add heat to it */s
}
}

}
}

// using Content.Server.Body.Systems;
// using Content.Server.Chemistry.Containers.EntitySystems;
Expand Down Expand Up @@ -137,11 +136,11 @@ public override void Initialize()
// {
// base.Initialize();

// SubscribeLocalEvent<ActiveKettleComponent, ComponentStartup>(OnBoilStart);
// SubscribeLocalEvent<ActiveKettleComponent, ComponentShutdown>(OnBoilStop);
// SubscribeLocalEvent<ActivelyBoilingComponent, ComponentStartup>(OnBoilStart);
// SubscribeLocalEvent<ActivelyBoilingComponent, ComponentShutdown>(OnBoilStop);
// }

// public void OnBoilStart(Entity<ActiveKettleComponent> ent, ref ComponentStartup args)
// public void OnBoilStart(Entity<ActivelyBoilingComponent> ent, ref ComponentStartup args)
// {
// if (!TryComp<KettleComponent>(ent, out var kettleComponent))
// return;
Expand All @@ -151,7 +150,7 @@ public override void Initialize()
// _audio.PlayPvs(kettleComponent.LoopingSound, ent, AudioParams.Default.WithLoop(true).WithMaxDistance(5)).Value.Entity;
// }

// private void OnBoilStop(Entity<ActiveKettleComponent> ent, ref ComponentShutdown args)
// private void OnBoilStop(Entity<ActivelyBoilingComponent> ent, ref ComponentShutdown args)
// {
// if (!TryComp<KettleComponent>(ent, out var kettleComponent))
// return;
Expand Down

0 comments on commit d30ffcf

Please sign in to comment.