fix microwave construction (#30232)

* fix microwave construction

* retry
This commit is contained in:
slarticodefast
2024-07-21 18:20:09 +02:00
committed by GitHub
parent 3e3cfdb948
commit d5bdada430
2 changed files with 7 additions and 1 deletions

View File

@@ -79,6 +79,9 @@ namespace Content.Server.Kitchen.Components
public Container Storage = default!; public Container Storage = default!;
[DataField]
public string ContainerId = "microwave_entity_container";
[DataField, ViewVariables(VVAccess.ReadWrite)] [DataField, ViewVariables(VVAccess.ReadWrite)]
public int Capacity = 10; public int Capacity = 10;

View File

@@ -252,7 +252,7 @@ namespace Content.Server.Kitchen.EntitySystems
private void OnInit(Entity<MicrowaveComponent> ent, ref ComponentInit args) private void OnInit(Entity<MicrowaveComponent> ent, ref ComponentInit args)
{ {
// this really does have to be in ComponentInit // this really does have to be in ComponentInit
ent.Comp.Storage = _container.EnsureContainer<Container>(ent, "microwave_entity_container"); ent.Comp.Storage = _container.EnsureContainer<Container>(ent, ent.Comp.ContainerId);
} }
private void OnMapInit(Entity<MicrowaveComponent> ent, ref MapInitEvent args) private void OnMapInit(Entity<MicrowaveComponent> ent, ref MapInitEvent args)
@@ -312,6 +312,9 @@ namespace Content.Server.Kitchen.EntitySystems
private void OnInsertAttempt(Entity<MicrowaveComponent> ent, ref ContainerIsInsertingAttemptEvent args) private void OnInsertAttempt(Entity<MicrowaveComponent> ent, ref ContainerIsInsertingAttemptEvent args)
{ {
if (args.Container.ID != ent.Comp.ContainerId)
return;
if (ent.Comp.Broken) if (ent.Comp.Broken)
{ {
args.Cancel(); args.Cancel();