adds machine upgrades for microwave (#12010)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Construction.Prototypes;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -8,8 +9,13 @@ namespace Content.Server.Kitchen.Components
|
||||
[RegisterComponent]
|
||||
public sealed class MicrowaveComponent : Component
|
||||
{
|
||||
[DataField("cookTimeMultiplier")]
|
||||
public int CookTimeMultiplier = 1; //For upgrades and stuff I guess? don't ask me.
|
||||
[DataField("cookTimeMultiplier"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public float CookTimeMultiplier = 1;
|
||||
[DataField("machinePartCookTimeMultiplier", customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
|
||||
public string MachinePartCookTimeMultiplier = "Laser";
|
||||
[DataField("cookTimeScalingConstant")]
|
||||
public float CookTimeScalingConstant = 0.5f;
|
||||
|
||||
[DataField("failureResult", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string BadRecipeEntityId = "FoodBadRecipe";
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
SubscribeLocalEvent<MicrowaveComponent, BreakageEventArgs>(OnBreak);
|
||||
SubscribeLocalEvent<MicrowaveComponent, PowerChangedEvent>(OnPowerChanged);
|
||||
SubscribeLocalEvent<MicrowaveComponent, SuicideEvent>(OnSuicide);
|
||||
SubscribeLocalEvent<MicrowaveComponent, RefreshPartsEvent>(OnRefreshParts);
|
||||
|
||||
SubscribeLocalEvent<MicrowaveComponent, MicrowaveStartCookMessage>((u,c,_) => Wzhzhzh(u,c));
|
||||
SubscribeLocalEvent<MicrowaveComponent, MicrowaveEjectMessage>(OnEjectMessage);
|
||||
@@ -269,6 +270,12 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
UpdateUserInterfaceState(uid, component);
|
||||
}
|
||||
|
||||
private void OnRefreshParts(EntityUid uid, MicrowaveComponent component, RefreshPartsEvent args)
|
||||
{
|
||||
var cookRating = args.PartRatings[component.MachinePartCookTimeMultiplier];
|
||||
component.CookTimeMultiplier = MathF.Pow(component.CookTimeScalingConstant, cookRating - 1);
|
||||
}
|
||||
|
||||
public void UpdateUserInterfaceState(EntityUid uid, MicrowaveComponent component)
|
||||
{
|
||||
var ui = _userInterface.GetUiOrNull(uid, MicrowaveUiKey.Key);
|
||||
@@ -371,7 +378,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
_audio.PlayPvs(component.StartCookingSound, uid);
|
||||
var activeComp = AddComp<ActiveMicrowaveComponent>(uid); //microwave is now cooking
|
||||
activeComp.CookTimeRemaining = component.CurrentCookTimerTime * component.CookTimeMultiplier;
|
||||
activeComp.TotalTime = component.CurrentCookTimerTime * component.CookTimeMultiplier;
|
||||
activeComp.TotalTime = component.CurrentCookTimerTime; //this doesn't scale so that we can have the "actual" time
|
||||
activeComp.PortionedRecipe = portionedRecipe;
|
||||
UpdateUserInterfaceState(uid, component);
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@
|
||||
- type: MachineBoard
|
||||
prototype: KitchenMicrowave
|
||||
requirements:
|
||||
MatterBin: 1
|
||||
Capacitor: 1
|
||||
Laser: 1
|
||||
materialRequirements:
|
||||
Glass: 2
|
||||
|
||||
@@ -59,6 +59,9 @@
|
||||
acts: ["Breakage"]
|
||||
- type: ApcPowerReceiver
|
||||
powerLoad: 400
|
||||
- type: UpgradePowerDraw
|
||||
powerDrawMultiplier: 0.75
|
||||
scaling: Exponential
|
||||
- type: Machine
|
||||
board: MicrowaveMachineCircuitboard
|
||||
- type: ContainerContainer
|
||||
|
||||
Reference in New Issue
Block a user