/// <summary> /// Gets all reachable reagent containers. /// </summary> /// <returns></returns> public List <ReagentContainer> GetReagentContainers() { List <ReagentContainer> reagentContainers = MatrixManager.GetReachableAdjacent <ReagentContainer>( playerScript.PlayerSync.ClientPosition, true ); reagentContainers.AddRange(MatrixManager.GetAt <ReagentContainer>( PlayerScript.PlayerSync.ClientPosition, true )); foreach (ItemSlot handSlot in playerScript.DynamicItemStorage.GetHandSlots()) { if ( handSlot.ItemObject != null && handSlot.ItemObject.TryGetComponent(out ReagentContainer reagentContainer) ) { reagentContainers.Add(reagentContainer); } } foreach (ItemSlot pocketsSlot in playerScript.DynamicItemStorage.GetPocketsSlots()) { if ( pocketsSlot.ItemObject != null && pocketsSlot.ItemObject.TryGetComponent(out ReagentContainer reagentContainer) ) { reagentContainers.Add(reagentContainer); } } return(reagentContainers); }
/// <summary> /// Gets all reachable items, including items in player's hands and pockets. /// </summary> /// <param name="networkSide">On which side we're executing the method?</param> /// <returns>All reachable items.</returns> public List <CraftingIngredient> GetPossibleIngredients(NetworkSide networkSide) { List <CraftingIngredient> possibleIngredients = MatrixManager.GetReachableAdjacent <CraftingIngredient>( playerScript.PlayerSync.ClientPosition, networkSide == NetworkSide.Server ); possibleIngredients.AddRange(MatrixManager.GetAt <CraftingIngredient>( playerScript.PlayerSync.ClientPosition, networkSide == NetworkSide.Server )); foreach (ItemSlot handSlot in playerScript.DynamicItemStorage.GetHandSlots()) { if ( handSlot.ItemObject != null && handSlot.ItemObject.TryGetComponent(out CraftingIngredient possibleIngredient) ) { possibleIngredients.Add(possibleIngredient); } } foreach (ItemSlot pocketsSlot in playerScript.DynamicItemStorage.GetPocketsSlots()) { if ( pocketsSlot.ItemObject != null && pocketsSlot.ItemObject.TryGetComponent(out CraftingIngredient possibleIngredient) ) { possibleIngredients.Add(possibleIngredient); } } return(possibleIngredients); }
/// <summary> /// Gets all reachable possible tools, including player's hands and pockets. /// </summary> /// <param name="networkSide">On which side we're executing the method?</param> /// <returns>All possible tools that may be used for crafting.</returns> public List <ItemAttributesV2> GetPossibleTools(NetworkSide networkSide) { List <ItemAttributesV2> possibleTools = MatrixManager.GetReachableAdjacent <ItemAttributesV2>( playerScript.PlayerSync.ClientPosition, networkSide == NetworkSide.Server ); possibleTools.AddRange(MatrixManager.GetAt <ItemAttributesV2>( playerScript.PlayerSync.ClientPosition, networkSide == NetworkSide.Server )); foreach (ItemSlot handSlot in playerScript.DynamicItemStorage.GetHandSlots()) { if ( handSlot.ItemObject != null && handSlot.ItemObject.TryGetComponent(out ItemAttributesV2 possibleTool) && possibleTool.InitialTraits.Count > 0 ) { possibleTools.Add(possibleTool); } } foreach (ItemSlot pocketsSlot in playerScript.DynamicItemStorage.GetPocketsSlots()) { if ( pocketsSlot.ItemObject != null && pocketsSlot.ItemObject.TryGetComponent(out ItemAttributesV2 possibleTool) && possibleTool.InitialTraits.Count > 0 ) { possibleTools.Add(possibleTool); } } return(possibleTools); }