Skip to main content
Located in shared/config/vaccines.lua, you can define items that give local players temporary or permanent immunities against specific diseases.

Global Properties

  • applyAnimation: Defines the interaction played when administering the vaccine. Defaults to the horse injection anim (mech_animal_interaction@horse@left@injection).

Item Configurations (Config.vaccines.items)

This is a table where keys are item IDs and values declare the rules for that specific syringe.
  • item: Item ID.
  • displayName: The name shown in tooltips.
  • applyDuration: Milliseconds it takes to inject.
  • allowedJobs: A list of job strings allowed to utilize this item. Replace with nil if you want it openly usable by any player.
  • immunities: A nested dictionary determining which diseases the syringe targets.
    • probability: (0.0 to 1.0) Likelihood the vaccine effectively applies the targeted immunity.
    • duration: The duration of immunity in real-life minutes. Set to -1 for infinite duration.

Example Configuration

Config.vaccines = {
    items = {
        ['malaria_vaccine'] = {
            item = 'malaria_vaccine',
            displayName = "Malaria Vaccine",
            applyDuration = 1500,
            allowedJobs = { "doctor" }, 
            immunities = {
                ['malaria'] = {
                    probability = 1.0,  -- 100% effective
                    duration = -1       -- Permanent immunity
                }
            }
        },
        ['cold_vaccine'] = {
            item = 'cold_vaccine',
            displayName = "Cold Vaccine",
            applyDuration = 1500,
            allowedJobs = { "doctor" }, 
            immunities = {
                ['cold'] = {
                    probability = 1.0,
                    duration = 10080    -- Lasts exactly 7 days
                }
            }
        }
    },
    
    applyAnimation = {
        dict = 'mech_animal_interaction@horse@left@injection',
        anim = 'injection_player',
        flags = 28
    }
}