(54ae135f5) Items can be dragged and dropped directly from the inventory into containers without having to select the container first.
This commit is contained in:
@@ -88,10 +88,19 @@ namespace Barotrauma
|
||||
{
|
||||
if (Items[i] == null) return i;
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public bool CanBePut(Item item)
|
||||
{
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
if (CanBePut(item, i)) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool CanBePut(Item item, int i)
|
||||
{
|
||||
if (ItemOwnsSelf(item)) return false;
|
||||
|
||||
@@ -43,10 +43,9 @@ namespace Barotrauma
|
||||
{
|
||||
if (ItemOwnsSelf(item)) return false;
|
||||
if (i < 0 || i >= Items.Length) return false;
|
||||
return (item!=null && Items[i]==null && container.CanBeContained(item));
|
||||
return (item != null && Items[i] == null && container.CanBeContained(item));
|
||||
}
|
||||
|
||||
|
||||
public override bool TryPutItem(Item item, Character user, List<InvSlotType> allowedSlots = null, bool createNetworkEvent = true)
|
||||
{
|
||||
bool wasPut = base.TryPutItem(item, user, allowedSlots, createNetworkEvent);
|
||||
|
||||
@@ -785,6 +785,39 @@ namespace Barotrauma
|
||||
|
||||
AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList();
|
||||
|
||||
if (sprite == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!");
|
||||
#if SERVER
|
||||
sprite = new Sprite("", Vector2.Zero);
|
||||
sprite.SourceRect = new Rectangle(0, 0, 32, 32);
|
||||
#else
|
||||
sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null)
|
||||
{
|
||||
Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2
|
||||
};
|
||||
#endif
|
||||
size = sprite.size;
|
||||
sprite.EntityID = identifier;
|
||||
}
|
||||
|
||||
if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier))
|
||||
{
|
||||
DebugConsole.ThrowError(
|
||||
"Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading.");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(identifier))
|
||||
{
|
||||
MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier);
|
||||
if (existingPrefab != null)
|
||||
{
|
||||
DebugConsole.ThrowError(
|
||||
"Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!");
|
||||
}
|
||||
}
|
||||
|
||||
AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList();
|
||||
|
||||
List.Add(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user