/// <summary> /// Checks an inventories permissions against an entities' flags to see if it has access to the inventory. /// </summary> /// <param name="entity_flags"></param> /// <param name="inventory_flags"></param> /// <returns></returns> public bool CheckInventoryPermissions(ENTITY_TYPE entity_flags, INVENTORY_MODIFIERS inventory_flags) { //Check if the inventory is machine accessible and if the entity is a machine. if (INV_UTILITY.HasTag(inventory_flags, INVENTORY_MODIFIERS.MachineAccessible) && ENTITY_UTILITY.HasTag(entity_flags, ENTITY_TYPE.Machine)) { return(true); }// Check if the inventory is player accessible and if the entity is a player. else if (INV_UTILITY.HasTag(inventory_flags, INVENTORY_MODIFIERS.PlayerAccessible) && ENTITY_UTILITY.HasTag(entity_flags, ENTITY_TYPE.Player)) { return(true); } //If it reaches this point then we don't have the right permissions. return(false); }
/// <summary> /// Outputs items to our target output inventory. /// Method is only called when inventory is full. /// </summary> public void OutputItems() { // Always decrement timer if we have a target. EXTRACT_TIMER -= Time.deltaTime; if (EXTRACT_TIMER <= 0) { if (ENT_UTIL.HasTag(OUT_TARGET.INFO.FLAGS, ENTITY_TYPE.InventoryEntity)) { OutputToInventory(OUT_TARGET.GetComponent <IInventory>()); } else if (ENT_UTIL.HasTag(OUT_TARGET.INFO.FLAGS, ENTITY_TYPE.TransportEntity)) { OutputToBelt(OUT_TARGET.GetComponent <IBelt>()); } } }