Fixes server shutdown crash & client error log spam. (#67)
This commit is contained in:
committed by
GitHub
parent
2d9285f790
commit
205a4fc530
@@ -27,6 +27,13 @@ namespace Content.Client.GameObjects
|
|||||||
private string TemplateName = "HumanInventory"; //stored for serialization purposes
|
private string TemplateName = "HumanInventory"; //stored for serialization purposes
|
||||||
public event EventHandler<BoundKeyChangedMessage> OnCharacterMenuKey;
|
public event EventHandler<BoundKeyChangedMessage> OnCharacterMenuKey;
|
||||||
|
|
||||||
|
public override void OnRemove()
|
||||||
|
{
|
||||||
|
base.OnRemove();
|
||||||
|
|
||||||
|
Window.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
public override void ExposeData(EntitySerializer serializer)
|
public override void ExposeData(EntitySerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using SS14.Shared.IoC;
|
|||||||
using SS14.Server.Interfaces.Player;
|
using SS14.Server.Interfaces.Player;
|
||||||
using SS14.Shared.GameObjects.Serialization;
|
using SS14.Shared.GameObjects.Serialization;
|
||||||
using SS14.Shared.ContentPack;
|
using SS14.Shared.ContentPack;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects
|
namespace Content.Server.GameObjects
|
||||||
{
|
{
|
||||||
@@ -24,7 +25,7 @@ namespace Content.Server.GameObjects
|
|||||||
public override void ExposeData(EntitySerializer serializer)
|
public override void ExposeData(EntitySerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
serializer.DataField(ref TemplateName, "Template", "HumanInventory");
|
serializer.DataField(ref TemplateName, "Template", "HumanInventory");
|
||||||
CreateInventory(TemplateName);
|
CreateInventory(TemplateName);
|
||||||
}
|
}
|
||||||
@@ -35,7 +36,7 @@ namespace Content.Server.GameObjects
|
|||||||
Inventory inventory = (Inventory)Activator.CreateInstance(type);
|
Inventory inventory = (Inventory)Activator.CreateInstance(type);
|
||||||
foreach (Slots slotnames in inventory.SlotMasks)
|
foreach (Slots slotnames in inventory.SlotMasks)
|
||||||
{
|
{
|
||||||
if(slotnames != Slots.NONE)
|
if (slotnames != Slots.NONE)
|
||||||
{
|
{
|
||||||
var newslot = AddSlot(slotnames);
|
var newslot = AddSlot(slotnames);
|
||||||
}
|
}
|
||||||
@@ -44,7 +45,8 @@ namespace Content.Server.GameObjects
|
|||||||
|
|
||||||
public override void OnRemove()
|
public override void OnRemove()
|
||||||
{
|
{
|
||||||
foreach (var slot in SlotContainers.Keys)
|
var slots = SlotContainers.Keys.ToList();
|
||||||
|
foreach (var slot in slots)
|
||||||
{
|
{
|
||||||
RemoveSlot(slot);
|
RemoveSlot(slot);
|
||||||
}
|
}
|
||||||
@@ -87,7 +89,7 @@ namespace Content.Server.GameObjects
|
|||||||
throw new ArgumentNullException(nameof(clothing), "Clothing must be passed here. To remove some clothing from a slot, use Unequip()");
|
throw new ArgumentNullException(nameof(clothing), "Clothing must be passed here. To remove some clothing from a slot, use Unequip()");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(clothing.SlotFlags == SlotFlags.PREVENTEQUIP //Flag to prevent equipping at all
|
if (clothing.SlotFlags == SlotFlags.PREVENTEQUIP //Flag to prevent equipping at all
|
||||||
|| (clothing.SlotFlags & SlotMasks[slot]) == 0) //Does the clothing flag have any of our requested slot flags
|
|| (clothing.SlotFlags & SlotMasks[slot]) == 0) //Does the clothing flag have any of our requested slot flags
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -235,7 +237,7 @@ namespace Content.Server.GameObjects
|
|||||||
if (activehand != null && activehand.Owner.TryGetComponent(out ClothingComponent clothing))
|
if (activehand != null && activehand.Owner.TryGetComponent(out ClothingComponent clothing))
|
||||||
{
|
{
|
||||||
hands.Drop(hands.ActiveIndex);
|
hands.Drop(hands.ActiveIndex);
|
||||||
if(!Equip(msg.Inventoryslot, clothing))
|
if (!Equip(msg.Inventoryslot, clothing))
|
||||||
{
|
{
|
||||||
hands.PutInHand(clothing);
|
hands.PutInHand(clothing);
|
||||||
}
|
}
|
||||||
@@ -257,7 +259,7 @@ namespace Content.Server.GameObjects
|
|||||||
{
|
{
|
||||||
base.HandleMessage(message, netChannel, component);
|
base.HandleMessage(message, netChannel, component);
|
||||||
|
|
||||||
switch(message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case ClientInventoryMessage msg:
|
case ClientInventoryMessage msg:
|
||||||
var playerMan = IoCManager.Resolve<IPlayerManager>();
|
var playerMan = IoCManager.Resolve<IPlayerManager>();
|
||||||
|
|||||||
Reference in New Issue
Block a user