/*
    Hags' Firearm Maintenance - item definitions

    Names: DisplayName here is the fallback; the ItemName_<module>.<item>
    keys in media/lua/shared/Translate/EN/ItemName.json override it.
    Icons map to media/textures/Item_<Icon>.png (e.g. Icon = HFMCLP -> Item_HFMCLP.png).
    No WorldStaticModel is set, so dropped items show their icon on the ground.
*/
module HagsFirearmMaintenance
{
    /* ---- Disassembled parts. All gun state is stored in the item's modData. ---- */

    item GunPartsSmall
    {
        DisplayName     = Disassembled Gun Parts,
        DisplayCategory = Tool,
        ItemType        = base:normal,
        Weight          = 0.1,          /* overwritten per-gun at disassembly */
        Icon            = HFMGunPartsSmall,
    }

    item GunPartsLarge
    {
        DisplayName     = Disassembled Gun Parts,
        DisplayCategory = Tool,
        ItemType        = base:normal,
        Weight          = 0.1,          /* overwritten per-gun at disassembly */
        Icon            = HFMGunPartsLarge,
    }

    /* ---- Tools (never consumed) ---- */

    /* Disassemble, reassemble, clean */
    item FirearmMaintenanceKit
    {
        DisplayName     = Firearm Maintenance Kit,
        DisplayCategory = Tool,
        ItemType        = base:normal,
        Weight          = 0.3,          /* soft pouch: rods, brush, small oiler */
        Icon            = HFMFirearmMaintenanceKit,
    }

    /* Disassemble, reassemble, repair */
    item GunsmithingTools
    {
        DisplayName     = Gunsmithing Tools,
        DisplayCategory = Tool,
        ItemType        = base:normal,
        Weight          = 2.5,
        Icon            = HFMGunsmithingTools,
    }

    /* ---- Consumable ---- */

    /* DEPRECATED old-style CLP: a drainable with 10 discrete uses.
       Kept working so existing saves don't break, but no longer spawns.
       Convert it to the fluid version from the context menu. */
    item CLP
    {
        DisplayName      = CLP (Old Stock),
        Tooltip          = Tooltip_HFM_CLPOld,
        DisplayCategory  = Tool,
        ItemType         = base:drainable,
        Weight           = 0.33,          /* heavier than a modern bottle on purpose:
                                             a nudge to convert rather than hoard */
        UseDelta         = 0.1,
        UseWhileEquipped = FALSE,
        Icon             = HFMCLP,
    }


    /* ---- CLP as a fluid ---- */

    /* 0.1 L (about 3.5 fl oz) = 10 uses of 10 ml each. */
    item CLPBottle
    {
        DisplayName     = CLP Bottle,
        DisplayCategory = Tool,
        ItemType        = base:normal,
        Tooltip         = Tooltip_HFM_CLPBottle,
        Weight          = 0.03,          /* empty; the fluid adds the rest */
        Icon            = HFMCLP,
        OnCreate        = HFMItemOnCreate.randomCLPFill,
        component FluidContainer
        {
            ContainerName = CLPBottle,
            Capacity      = 0.1,
            Fluids
            {
                fluid = HFMCLP:1.0,
            }
        }
    }

    /* 1 L = exactly ten bottles, so a jug always empties cleanly. */
    item CLPJug
    {
        DisplayName     = CLP Jug,
        DisplayCategory = Tool,
        ItemType        = base:normal,
        Tooltip         = Tooltip_HFM_CLPJug,
        Weight          = 0.15,          /* empty */
        Icon            = HFMCLPJug,
        OnCreate        = HFMItemOnCreate.randomCLPFill,
        component FluidContainer
        {
            ContainerName = CLPJug,
            Capacity      = 1.0,
            Fluids
            {
                fluid = HFMCLP:1.0,
            }
        }
    }

    /* ---- Literature ---- */

    /* A recipe magazine, built the way vanilla builds them: literature that
       teaches a recipe. Reading it is the ordinary Read action, which brings
       the tick mark, Reread, the boredom/stress relief and the knowledge
       tracking (including multiplayer sync) for free.
       Knowing its recipe is also what unlocks firearm repair. */
    item AmericanGunsmithing
    {
        DisplayName      = American Gunsmithing,
        DisplayCategory  = RecipeResource,
        ItemType         = base:literature,
        Weight           = 0.3,
        Icon             = HFMGunsmithingManual,
        Tooltip          = Tooltip_item_HFMManual,
        BoredomChange    = -20,
        StressChange     = -15,
        LearnedRecipes   = HFMCraftMaintenanceKit;HFMCraftGunsmithingTools,
        StaticModel      = Magazine,
        WorldStaticModel = MagazineGround,
        Tags             = base:magazine,
        OnCreate         = ItemCodeOnCreate.onCreateRecipeMagazine,
    }
}
