Content ecs containers (#22484)

This commit is contained in:
TemporalOroboros
2023-12-27 21:30:03 -08:00
committed by GitHub
parent 1d06539432
commit 7a77d6d5dd
72 changed files with 172 additions and 160 deletions

View File

@@ -48,7 +48,7 @@ public abstract partial class SharedGunSystem
return;
component.Entities.Add(args.Used);
component.Container.Insert(args.Used);
Containers.Insert(args.Used, component.Container);
// Not predicted so
Audio.PlayPredicted(component.SoundInsert, uid, args.User);
args.Handled = true;
@@ -241,7 +241,7 @@ public abstract partial class SharedGunSystem
args.Ammo.Add((entity, EnsureShootable(entity)));
component.Entities.RemoveAt(component.Entities.Count - 1);
component.Container.Remove(entity);
Containers.Remove(entity, component.Container);
}
else if (component.UnspawnedCount > 0)
{

View File

@@ -290,7 +290,7 @@ public abstract partial class SharedGunSystem
if (entity == null)
return false;
container.Remove(entity.Value);
Containers.Remove(entity.Value, container);
return true;
}
@@ -316,7 +316,7 @@ public abstract partial class SharedGunSystem
{
return Containers.TryGetContainer(uid, ChamberSlot, out var container) &&
container is ContainerSlot slot &&
slot.Insert(ammo);
Containers.Insert(ammo, slot);
}
private void OnChamberAmmoCount(EntityUid uid, ChamberMagazineAmmoProviderComponent component, ref GetAmmoCountEvent args)

View File

@@ -28,7 +28,7 @@ public partial class SharedGunSystem
var ent = container.ContainedEntities[0];
if (_netManager.IsServer)
container.Remove(ent);
Containers.Remove(ent, container);
args.Ammo.Add((ent, EnsureShootable(ent)));
}

View File

@@ -132,7 +132,7 @@ public partial class SharedGunSystem
}
component.AmmoSlots[index] = ent.Value;
component.AmmoContainer.Insert(ent.Value, EntityManager);
Containers.Insert(ent.Value, component.AmmoContainer);
if (ev.Ammo.Count == 0)
break;
@@ -160,7 +160,7 @@ public partial class SharedGunSystem
}
component.AmmoSlots[index] = uid;
component.AmmoContainer.Insert(uid);
Containers.Insert(uid, component.AmmoContainer);
Audio.PlayPredicted(component.SoundInsert, revolverUid, user);
Popup(Loc.GetString("gun-revolver-insert"), revolverUid, user);
UpdateRevolverAppearance(revolverUid, component);
@@ -283,7 +283,7 @@ public partial class SharedGunSystem
else
{
component.AmmoSlots[i] = null;
component.AmmoContainer.Remove(slot.Value);
Containers.Remove(slot.Value, component.AmmoContainer);
if (!_netManager.IsClient)
EjectCartridge(slot.Value);
@@ -366,7 +366,7 @@ public partial class SharedGunSystem
continue;
}
component.AmmoContainer.Remove(ent.Value);
Containers.Remove(ent.Value, component.AmmoContainer);
component.AmmoSlots[index] = null;
args.Ammo.Add((ent.Value, EnsureShootable(ent.Value)));
TransformSystem.SetCoordinates(ent.Value, args.Coordinates);