module SmokersChoice
{
    imports
    {
        Base
    }

    /* Battery heated tobacco device.
       Smoked like a vanilla cigarette pack (consumable drainable), so each
       smoke uses one battery charge: UseDelta 0.1 = 10 charges. Lua then
       spreads a battery over a random 7-9 smokes (SmokersChoice.Config
       batteryMin / batteryMax).
       KeepOnDeplete keeps the empty device for a new battery.
       base:usesbattery opts it into vanilla's InsertBattery / RemoveBattery
       recipes (recipes_electrical.txt), which match items tagged
       base:flashlight OR base:usesbattery, the same way the electric sheep
       shears get battery swapping without being a flashlight.
       Requires a heat stick: vanilla's take-pill action uses one charge of
       the required item per smoke (the same code that uses up a lighter for
       cigarettes). The list is checked in order, so loose sticks are used
       before a pack, and regular sticks before menthol. Which kind was used
       is worked out in Lua, which adds the menthol unhappiness and removes
       spent loose sticks afterwards.
       No smokable tag on purpose: vanilla lets smokables skip the required
       item near an open flame or a car lighter.
       No cough fields: like vanilla chewing tobacco, it never makes you
       cough. */
    item TobaccoVape
    {
        DisplayCategory = Junk,
        ItemType = base:drainable,
        Weight = 0.2,
        Icon = SC_Vape,
        MetalValue = 1.0,
        UseDelta = 0.1,
        UseWhileEquipped = false,
        cantBeConsolided = true,
        KeepOnDeplete = true,
        StaticModel = Pager,
        WorldStaticModel = Pager,
        Tags = base:hasmetal;base:consumable;base:usesbattery,
        CustomContextMenu = Smoke,
        EatType = Cigarettes,
        OnEat = RecipeCodeOnEat.consumeNicotine,
        RequireInHandOrInventory = SmokersChoice.HeatStick/SmokersChoice.HeatStickMenthol/SmokersChoice.HeatStickPack/SmokersChoice.HeatStickPackMenthol,
        StressChange = -4,
        CustomEatSound = ,
        Eattime = 300,
        FoodSicknessChange = 14,
        Tooltip = Tooltip_SV_TobaccoVape,
    }

    /* Pack of 10 heat sticks: one used per smoke. Not consumable itself,
       so it has no smoke option of its own. Disappears when empty. */
    item HeatStickPack
    {
        OnCreate = SmokersChoiceBrands.onCreate,
        DisplayCategory = Junk,
        ItemType = base:drainable,
        Weight = 0.1,
        Icon = SC_HeatStickPack,
        UseDelta = 0.1,
        UseWhileEquipped = false,
        WorldStaticModel = SC_Pack_Clearpuff,
        Tags = base:lessfull,
        KeepOnDeplete = false,
    }

    /* Loose heat stick: a single-use drainable (UseDelta 1.0, like vanilla
       PaperNapkins2 / AlcoholedCottonBalls), because the requirement code
       drains drainables. Not consumable itself, so no smoke option. */
    item HeatStick
    {
        OnCreate = SmokersChoiceBrands.onCreate,
        DisplayCategory = Junk,
        ItemType = base:drainable,
        Weight = 0.01,
        Icon = SC_HeatStick,
        UseDelta = 1.0,
        UseWhileEquipped = false,
        WorldStaticModel = SC_Cig_HeatStick,
        KeepOnDeplete = false,
    }

    /* Menthol heat sticks: copies of the above. */
    item HeatStickPackMenthol
    {
        OnCreate = SmokersChoiceBrands.onCreate,
        DisplayCategory = Junk,
        ItemType = base:drainable,
        Weight = 0.1,
        Icon = SC_HeatStickPackMenthol,
        UseDelta = 0.1,
        UseWhileEquipped = false,
        WorldStaticModel = SC_Pack_ClearpuffMenthol,
        Tags = base:lessfull,
        KeepOnDeplete = false,
    }

    item HeatStickMenthol
    {
        OnCreate = SmokersChoiceBrands.onCreate,
        DisplayCategory = Junk,
        ItemType = base:drainable,
        Weight = 0.01,
        Icon = SC_HeatStickMenthol,
        UseDelta = 1.0,
        UseWhileEquipped = false,
        WorldStaticModel = SC_Cig_HeatStickMenthol,
        KeepOnDeplete = false,
    }

    /* Copies of vanilla UnpackCigarettes / PackCigarettes / TakeACigarette /
       AddACigarette (recipes_packing.txt). */
    craftRecipe UnpackHeatSticks
    {
        OnCreate = SmokersChoiceBrands.inherit,
        timedAction = UnpackCigarettes,
        time = 25,
        Tags = InHandCraft;CanBeDoneInDark,
        category = Miscellaneous,
        inputs
        {
            item 1 [SmokersChoice.HeatStickPack] mode:destroy flags[IsFull;AllowFavorite;InheritFavorite],
        }
        outputs
        {
            item 10 SmokersChoice.HeatStick,
        }
    }

    craftRecipe PackHeatSticks
    {
        OnCreate = SmokersChoiceBrands.inherit,
        timedAction = PackCigarettes,
        time = 25,
        Tags = InHandCraft;CanBeDoneInDark,
        category = Miscellaneous,
        inputs
        {
            item 10 [SmokersChoice.HeatStick] flags[IsFull;AllowFavorite;InheritFavorite],
        }
        outputs
        {
            item 1 SmokersChoice.HeatStickPack,
        }
    }

    craftRecipe TakeAHeatStick
    {
        OnCreate = SmokersChoiceBrands.inherit,
        timedAction = TakeCigarette,
        time = 15,
        Tags = InHandCraft;CanBeDoneInDark,
        category = Miscellaneous,
        inputs
        {
            item 1 [SmokersChoice.HeatStickPack] flags[AllowFavorite;InheritFavorite],
        }
        outputs
        {
            item 1 SmokersChoice.HeatStick,
        }
    }

    craftRecipe AddAHeatStick
    {
        timedAction = AddCigarette,
        time = 25,
        OnCreate = SmokersChoiceBrands.addToPack,
        OnTest = SmokersChoice.canAddToPack,
        Tags = InHandCraft;CanBeDoneInDark,
        category = Miscellaneous,
        inputs
        {
            item 1 [SmokersChoice.HeatStick] flags[IsFull;AllowFavorite;InheritFavorite],
            item 1 [SmokersChoice.HeatStickPack] mode:keep flags[AllowFavorite;InheritFavorite],
        }
        outputs
        {
        }
    }

    craftRecipe UnpackHeatSticksMenthol
    {
        OnCreate = SmokersChoiceBrands.inherit,
        timedAction = UnpackCigarettes,
        time = 25,
        Tags = InHandCraft;CanBeDoneInDark,
        category = Miscellaneous,
        inputs
        {
            item 1 [SmokersChoice.HeatStickPackMenthol] mode:destroy flags[IsFull;AllowFavorite;InheritFavorite],
        }
        outputs
        {
            item 10 SmokersChoice.HeatStickMenthol,
        }
    }

    craftRecipe PackHeatSticksMenthol
    {
        OnCreate = SmokersChoiceBrands.inherit,
        timedAction = PackCigarettes,
        time = 25,
        Tags = InHandCraft;CanBeDoneInDark,
        category = Miscellaneous,
        inputs
        {
            item 10 [SmokersChoice.HeatStickMenthol] flags[IsFull;AllowFavorite;InheritFavorite],
        }
        outputs
        {
            item 1 SmokersChoice.HeatStickPackMenthol,
        }
    }

    craftRecipe TakeAHeatStickMenthol
    {
        OnCreate = SmokersChoiceBrands.inherit,
        timedAction = TakeCigarette,
        time = 15,
        Tags = InHandCraft;CanBeDoneInDark,
        category = Miscellaneous,
        inputs
        {
            item 1 [SmokersChoice.HeatStickPackMenthol] flags[AllowFavorite;InheritFavorite],
        }
        outputs
        {
            item 1 SmokersChoice.HeatStickMenthol,
        }
    }

    craftRecipe AddAHeatStickMenthol
    {
        timedAction = AddCigarette,
        time = 25,
        OnCreate = SmokersChoiceBrands.addToPack,
        OnTest = SmokersChoice.canAddToPack,
        Tags = InHandCraft;CanBeDoneInDark,
        category = Miscellaneous,
        inputs
        {
            item 1 [SmokersChoice.HeatStickMenthol] flags[IsFull;AllowFavorite;InheritFavorite],
            item 1 [SmokersChoice.HeatStickPackMenthol] mode:keep flags[AllowFavorite;InheritFavorite],
        }
        outputs
        {
        }
    }
}
