Skip to content

Commit

Permalink
Zombie Rework & Polymorph Expansion (#8413)
Browse files Browse the repository at this point in the history
Co-authored-by: Kara <[email protected]>
Co-authored-by: metalgearsloth <[email protected]>
  • Loading branch information
3 people authored Jun 12, 2022
1 parent a45529d commit 63fd01f
Show file tree
Hide file tree
Showing 30 changed files with 485 additions and 422 deletions.
19 changes: 0 additions & 19 deletions Content.Server/Disease/Components/DiseaseBuildupComponent.cs

This file was deleted.

30 changes: 30 additions & 0 deletions Content.Server/Disease/Effects/DiseaseAddComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using JetBrains.Annotations;
using Content.Shared.Disease;

namespace Content.Server.Disease.Effects
{
/// <summary>
/// Adds a component to the diseased entity
/// </summary>
[UsedImplicitly]
public sealed class DiseaseAddComponent : DiseaseEffect
{
/// <summary>
/// The component that is added at the end of build up
/// </summary>
[DataField("comp")]
public string? Comp = null;

public override void Effect(DiseaseEffectArgs args)
{
if (Comp == null)
return;

EntityUid uid = args.DiseasedEntity;
var newComponent = (Component) IoCManager.Resolve<IComponentFactory>().GetComponent(Comp);
newComponent.Owner = uid;
if (!args.EntityManager.HasComponent(uid, newComponent.GetType()))
args.EntityManager.AddComponent(uid, newComponent);
}
}
}
45 changes: 0 additions & 45 deletions Content.Server/Disease/Effects/DiseaseProgression.cs

This file was deleted.

37 changes: 0 additions & 37 deletions Content.Server/Disease/Zombie/Components/DiseaseZombieComponent.cs

This file was deleted.

130 changes: 0 additions & 130 deletions Content.Server/Disease/Zombie/DiseaseZombieSystem.cs

This file was deleted.

31 changes: 31 additions & 0 deletions Content.Server/Inventory/ServerInventorySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Shared.Interaction.Events;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Robust.Shared.Containers;
using InventoryComponent = Content.Shared.Inventory.InventoryComponent;

namespace Content.Server.Inventory
Expand Down Expand Up @@ -42,5 +43,35 @@ private void OnOpenSlotStorage(OpenSlotStorageNetworkMessage ev, EntitySessionEv
_storageSystem.OpenStorageUI(entityUid.Value, uid, storageComponent);
}
}

public void TransferEntityInventories(EntityUid uid, EntityUid target)
{
if (TryGetContainerSlotEnumerator(uid, out var enumerator))
{
Dictionary<string, EntityUid?> inventoryEntities = new();
var slots = GetSlots(uid);
while (enumerator.MoveNext(out var containerSlot))
{
//records all the entities stored in each of the target's slots
foreach (var slot in slots)
{
if (TryGetSlotContainer(target, slot.Name, out var conslot, out var _) &&
conslot.ID == containerSlot.ID)
{
inventoryEntities.Add(slot.Name, containerSlot.ContainedEntity);
}
}
//drops everything in the target's inventory on the ground
containerSlot.EmptyContainer();
}
/// This takes the objects we removed and stored earlier
/// and actually equips all of it to the new entity
foreach (var item in inventoryEntities)
{
if (item.Value != null)
TryEquip(target, item.Value.Value, item.Key, true);
}
}
}
}
}
Loading

0 comments on commit 63fd01f

Please sign in to comment.