/// <summary> /// Compares an entites crafting flags and compares it with the craft flags on a recipe /// to see if the entity is capable of crafting that recipe. /// </summary> /// <param name="entity_flags"></param> /// <param name="craft_flags"></param> /// <returns></returns> public bool isCompatibleCraftingType(ENTITY_TYPE entity_flags, CRAFT_TYPE craft_flags) { if (ENTITY_UTILITY.HasTag(entity_flags, ENTITY_TYPE.Player) && CRAFT_UTILITY.HasTag(craft_flags, CRAFT_TYPE.HandCraftable)) { return(true); } else if (ENTITY_UTILITY.HasTag(entity_flags, ENTITY_TYPE.AutoCrafter) && CRAFT_UTILITY.HasTag(craft_flags, CRAFT_TYPE.MachineCraftable)) { return(true); } else if (ENTITY_UTILITY.HasTag(entity_flags, ENTITY_TYPE.Smelter) && CRAFT_UTILITY.HasTag(craft_flags, CRAFT_TYPE.Smelting)) { return(true); } return(false); }
/// <summary> /// Checks if a given set of flags contains a flag /// Cannot check for flag none. /// </summary> /// <param name="FLAGS"></param> /// <param name="NEW_FLAG"></param> /// <returns></returns> public bool HasTag(CRAFT_TYPE FLAGS, CRAFT_TYPE NEW_FLAG) { return((FLAGS & NEW_FLAG) != 0); }
/// <summary> /// Toggles a given flag within the set of flags. /// If it was false, makes it true, if it was true, makes it false. /// </summary> /// <param name="FLAGS"></param> /// <param name="NEW_FLAG"></param> /// <returns></returns> public CRAFT_TYPE ToggleTag(CRAFT_TYPE FLAGS, CRAFT_TYPE NEW_FLAG) { return(FLAGS ^= NEW_FLAG); }
/// <summary> /// Removes a given flag for an item /// </summary> /// <param name="FLAGS"></param> /// <param name="NEW_FLAG"></param> /// <returns></returns> public CRAFT_TYPE RemoveTag(CRAFT_TYPE FLAGS, CRAFT_TYPE NEW_FLAG) { return(FLAGS &= ~NEW_FLAG); }
/// <summary> /// Adds new tags to items /// </summary> /// <param name="FLAGS"></param> /// <param name="NEW_FLAG"></param> /// <returns></returns> public CRAFT_TYPE AddTag(CRAFT_TYPE FLAGS, CRAFT_TYPE NEW_FLAG) { return(FLAGS |= NEW_FLAG); }