Melting molds (#347)
* temp tweak * add metall bars * melting molds * add sawing molds table * sawing sounds * fix
This commit is contained in:
@@ -47,21 +47,6 @@ public sealed class EntityHeaterSystem : EntitySystem
|
||||
_temperature.ChangeHeat(ent, energy);
|
||||
}
|
||||
}
|
||||
|
||||
//CrystallPunk bonfire
|
||||
var flammbaleQuery = EntityQueryEnumerator<CP14FlammableEntityHeaterComponent, ItemPlacerComponent, FlammableComponent>();
|
||||
while (flammbaleQuery.MoveNext(out var uid, out var heater, out var placer, out var flammable))
|
||||
{
|
||||
if (!flammable.OnFire)
|
||||
return;
|
||||
|
||||
var energy = flammable.FireStacks * deltaTime * heater.EnergyPerFireStack;
|
||||
foreach (var ent in placer.PlacedEntities)
|
||||
{
|
||||
_temperature.ChangeHeat(ent, energy);
|
||||
}
|
||||
}
|
||||
//CrystallPunk bonfire end
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, EntityHeaterComponent comp, ExaminedEvent args)
|
||||
|
||||
@@ -9,5 +9,5 @@ namespace Content.Server._CP14.Temperature;
|
||||
public sealed partial class CP14FlammableEntityHeaterComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public float EnergyPerFireStack = 300f;
|
||||
public float DegreesPerStack = 300f;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Content.Server._CP14.Temperature;
|
||||
/// <summary>
|
||||
/// allows you to heat the temperature of solutions depending on the number of stacks of fire
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(CP14SolutionTemperatureSystem))]
|
||||
[RegisterComponent, Access(typeof(CP14TemperatureSystem))]
|
||||
public sealed partial class CP14FlammableSolutionHeaterComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Content.Server._CP14.Temperature;
|
||||
/// <summary>
|
||||
/// passively returns the solution temperature to the standard
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(CP14SolutionTemperatureSystem))]
|
||||
[RegisterComponent, Access(typeof(CP14TemperatureSystem))]
|
||||
public sealed partial class CP14SolutionTemperatureComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
|
||||
@@ -1,34 +1,60 @@
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Chemistry.Containers.EntitySystems;
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Server.Temperature.Systems;
|
||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||
using Content.Shared.Chemistry.EntitySystems;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Placeable;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server._CP14.Temperature;
|
||||
|
||||
public sealed partial class CP14SolutionTemperatureSystem : EntitySystem
|
||||
public sealed partial class CP14TemperatureSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
|
||||
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly TemperatureSystem _temperature = default!;
|
||||
|
||||
private TimeSpan _updateTick = TimeSpan.FromSeconds(1f);
|
||||
private readonly TimeSpan _updateTick = TimeSpan.FromSeconds(1f);
|
||||
private TimeSpan _timeToNextUpdate = TimeSpan.Zero;
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
FlammableEntityHeating(frameTime);
|
||||
|
||||
if (_timing.CurTime <= _timeToNextUpdate)
|
||||
return;
|
||||
|
||||
_timeToNextUpdate = _timing.CurTime + _updateTick;
|
||||
|
||||
FlammableHeating();
|
||||
NormalizeTemperature();
|
||||
FlammableSolutionHeating();
|
||||
NormalizeSolutionTemperature();
|
||||
}
|
||||
|
||||
private void NormalizeTemperature()
|
||||
private float GetTargetTemperature(FlammableComponent flammable, CP14FlammableSolutionHeaterComponent heater)
|
||||
{
|
||||
return flammable.FireStacks * heater.DegreesPerStack;
|
||||
}
|
||||
|
||||
private void FlammableEntityHeating(float frameTime)
|
||||
{
|
||||
var flammableQuery = EntityQueryEnumerator<CP14FlammableEntityHeaterComponent, ItemPlacerComponent, FlammableComponent>();
|
||||
while (flammableQuery.MoveNext(out var uid, out var heater, out var placer, out var flammable))
|
||||
{
|
||||
if (!flammable.OnFire)
|
||||
return;
|
||||
|
||||
var energy = flammable.FireStacks * frameTime * heater.DegreesPerStack;
|
||||
foreach (var ent in placer.PlacedEntities)
|
||||
{
|
||||
_temperature.ChangeHeat(ent, energy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void NormalizeSolutionTemperature()
|
||||
{
|
||||
var query = EntityQueryEnumerator<CP14SolutionTemperatureComponent, SolutionContainerManagerComponent>();
|
||||
while (query.MoveNext(out var uid, out var temp, out var container))
|
||||
@@ -40,7 +66,8 @@ public sealed partial class CP14SolutionTemperatureSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
}
|
||||
private void FlammableHeating()
|
||||
|
||||
private void FlammableSolutionHeating()
|
||||
{
|
||||
var query =
|
||||
EntityQueryEnumerator<CP14FlammableSolutionHeaterComponent, ItemPlacerComponent, FlammableComponent>();
|
||||
@@ -54,10 +81,9 @@ public sealed partial class CP14SolutionTemperatureSystem : EntitySystem
|
||||
if (!TryComp<SolutionContainerManagerComponent>(heatingEntity, out var container))
|
||||
continue;
|
||||
|
||||
var targetT = flammable.FireStacks * heater.DegreesPerStack;
|
||||
foreach (var (_, soln) in _solutionContainer.EnumerateSolutions((heatingEntity, container)))
|
||||
{
|
||||
if (TryAffectTemp(soln.Comp.Solution.Temperature, targetT, soln.Comp.Solution.Volume, out var newT))
|
||||
if (TryAffectTemp(soln.Comp.Solution.Temperature, GetTargetTemperature(flammable, heater), soln.Comp.Solution.Volume, out var newT))
|
||||
_solutionContainer.SetTemperature(soln, newT);
|
||||
}
|
||||
}
|
||||
@@ -71,7 +97,7 @@ public sealed partial class CP14SolutionTemperatureSystem : EntitySystem
|
||||
if (mass == 0)
|
||||
return false;
|
||||
|
||||
newT = (float) (oldT + ((targetT - oldT) / mass) * power);
|
||||
newT = (float) (oldT + (targetT - oldT) / mass * power);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared._CP14.Workbench.Prototypes;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.Workbench;
|
||||
@@ -12,4 +13,7 @@ public sealed partial class CP14WorkbenchComponent : Component
|
||||
|
||||
[DataField]
|
||||
public List<ProtoId<CP14WorkbenchRecipePrototype>> Recipes = new();
|
||||
|
||||
[DataField]
|
||||
public SoundSpecifier CraftSound = new SoundCollectionSpecifier("CP14Hammering");
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ public sealed class CP14WorkbenchSystem : SharedCP14WorkbenchSystem
|
||||
};
|
||||
|
||||
_doAfter.TryStartDoAfter(doAfterArgs);
|
||||
_audio.PlayPvs(recipe.CraftSound, workbench);
|
||||
_audio.PlayPvs(recipe.OverrideCraftSound ?? workbench.Comp.CraftSound, workbench);
|
||||
}
|
||||
|
||||
private List<CP14WorkbenchRecipePrototype> GetPossibleCrafts(Entity<CP14WorkbenchComponent> workbench, HashSet<EntityUid> ingrediEnts)
|
||||
|
||||
Reference in New Issue
Block a user