mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-10-06 21:13:37 -04:00
Implemented slot checking when transferring items
This commit is contained in:
@@ -141,7 +141,7 @@ public abstract class SWGObject extends BaselineObject implements Comparable<SWG
|
||||
// Check to make sure this object is able to go into a slot in the parent
|
||||
List<String> requiredSlots = object.getArrangement().get(arrangementId - 4);
|
||||
// Note that some objects don't have a descriptor, meaning it has no slots
|
||||
|
||||
|
||||
// Add object to the slot
|
||||
for (String requiredSlot : requiredSlots) {
|
||||
setSlot(requiredSlot, object);
|
||||
@@ -194,10 +194,17 @@ public abstract class SWGObject extends BaselineObject implements Comparable<SWG
|
||||
Log.w("SWGObject", "Unable to add object to container! Container Full");
|
||||
return ContainerResult.CONTAINER_FULL;
|
||||
}
|
||||
} else {
|
||||
// Item is going into slot(s)
|
||||
Map<String, SWGObject> containerSlots = container.getSlots();
|
||||
for (String slotName : getArrangement().get(arrangementId - 4)) {
|
||||
SWGObject equippedItem = containerSlots.get(slotName);
|
||||
if (equippedItem != null) {
|
||||
equippedItem.moveToContainer(requester, container.getSlottedObject("inventory"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Slot occupation check, old version was not working properly, always returning SLOT_OCCUPIED
|
||||
|
||||
|
||||
// Get a pre-parent-removal list of the observers so we can send create/destroy/update messages
|
||||
Set<SWGObject> oldObservers = getObservers();
|
||||
Player prevOwner = getOwner();
|
||||
|
||||
Reference in New Issue
Block a user