Drop items on entering dead or crit states (#1082)
* Drop items on dead or crit
This commit is contained in:
committed by
GitHub
parent
21c41f28ed
commit
952fa9f7ed
@@ -189,7 +189,7 @@ namespace Content.Server.GameObjects
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool Drop(string slot, GridCoordinates coords)
|
||||
public bool Drop(string slot, GridCoordinates coords, bool doMobChecks = true)
|
||||
{
|
||||
if (!CanDrop(slot))
|
||||
{
|
||||
@@ -204,7 +204,7 @@ namespace Content.Server.GameObjects
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_entitySystemManager.GetEntitySystem<InteractionSystem>().TryDroppedInteraction(Owner, item.Owner))
|
||||
if (doMobChecks && !_entitySystemManager.GetEntitySystem<InteractionSystem>().TryDroppedInteraction(Owner, item.Owner))
|
||||
return false;
|
||||
|
||||
item.RemovedFromSlot();
|
||||
@@ -216,7 +216,7 @@ namespace Content.Server.GameObjects
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Drop(IEntity entity, GridCoordinates coords)
|
||||
public bool Drop(IEntity entity, GridCoordinates coords, bool doMobChecks = true)
|
||||
{
|
||||
if (entity == null)
|
||||
{
|
||||
@@ -229,10 +229,10 @@ namespace Content.Server.GameObjects
|
||||
throw new ArgumentException("Entity must be held in one of our hands.", nameof(entity));
|
||||
}
|
||||
|
||||
return Drop(slot, coords);
|
||||
return Drop(slot, coords, doMobChecks);
|
||||
}
|
||||
|
||||
public bool Drop(string slot)
|
||||
public bool Drop(string slot, bool doMobChecks = true)
|
||||
{
|
||||
if (!CanDrop(slot))
|
||||
{
|
||||
@@ -242,7 +242,7 @@ namespace Content.Server.GameObjects
|
||||
var inventorySlot = hands[slot];
|
||||
var item = inventorySlot.ContainedEntity.GetComponent<ItemComponent>();
|
||||
|
||||
if (!_entitySystemManager.GetEntitySystem<InteractionSystem>().TryDroppedInteraction(Owner, item.Owner))
|
||||
if (doMobChecks && !_entitySystemManager.GetEntitySystem<InteractionSystem>().TryDroppedInteraction(Owner, item.Owner))
|
||||
return false;
|
||||
|
||||
if (!inventorySlot.Remove(inventorySlot.ContainedEntity))
|
||||
@@ -263,7 +263,7 @@ namespace Content.Server.GameObjects
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Drop(IEntity entity)
|
||||
public bool Drop(IEntity entity, bool doMobChecks = true)
|
||||
{
|
||||
if (entity == null)
|
||||
{
|
||||
@@ -276,10 +276,10 @@ namespace Content.Server.GameObjects
|
||||
throw new ArgumentException("Entity must be held in one of our hands.", nameof(entity));
|
||||
}
|
||||
|
||||
return Drop(slot);
|
||||
return Drop(slot, doMobChecks);
|
||||
}
|
||||
|
||||
public bool Drop(string slot, BaseContainer targetContainer)
|
||||
public bool Drop(string slot, BaseContainer targetContainer, bool doMobChecks = true)
|
||||
{
|
||||
if (slot == null)
|
||||
{
|
||||
@@ -296,8 +296,15 @@ namespace Content.Server.GameObjects
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var inventorySlot = hands[slot];
|
||||
var item = inventorySlot.ContainedEntity.GetComponent<ItemComponent>();
|
||||
|
||||
if (doMobChecks && !_entitySystemManager.GetEntitySystem<InteractionSystem>().TryDroppedInteraction(Owner, item.Owner))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!inventorySlot.CanRemove(inventorySlot.ContainedEntity))
|
||||
{
|
||||
return false;
|
||||
@@ -324,7 +331,7 @@ namespace Content.Server.GameObjects
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Drop(IEntity entity, BaseContainer targetContainer)
|
||||
public bool Drop(IEntity entity, BaseContainer targetContainer, bool doMobChecks = true)
|
||||
{
|
||||
if (entity == null)
|
||||
{
|
||||
@@ -337,7 +344,7 @@ namespace Content.Server.GameObjects
|
||||
throw new ArgumentException("Entity must be held in one of our hands.", nameof(entity));
|
||||
}
|
||||
|
||||
return Drop(slot, targetContainer);
|
||||
return Drop(slot, targetContainer, doMobChecks);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user