Skip to Content

CafeData

shared/cafe_data.lua is the default data center for cafes, ingredients, menus, recipes, and menu metadata.

How seeding works

When Config.CafeSeed.Enabled = true, Prism Restaurant checks CafeData during resource start.

  • Missing ingredients are inserted by name.
  • Missing cafes are inserted by name.
  • Missing menu items are inserted by cafe_name + name.
  • Existing database rows are not overwritten.
  • Recipes and metadata are copied only when a new menu item is inserted.

This keeps admin UI edits safe after restart.

Add an ingredient

shared/cafe_data.lua
CafeData.Ingredients = { { name = 'vanilla_syrup', label = 'Vanilla Syrup', price = 5, image = 'vanilla_syrup', }, }

The name is the database identity. Do not rename it after players already use the item unless you also migrate old data.

Add a cafe

shared/cafe_data.lua
CafeData.Cafes = { { name = 'beanmachine', label = 'Bean Machine', owner = nil, balance = 0, open = true, theme = { color = '#BEEE11', }, }, }

When a new cafe is seeded, the resource also creates its job and default storages using config defaults.

Add menu items

shared/cafe_data.lua
CafeData.DefaultMenus = { beanmachine = { items = { { name = 'vanilla_latte', label = 'Vanilla Latte', price = 12, category = 'drink', image = 'vanilla_latte', recipe = { { ingredient_name = 'coffee_beans', amount = 1 }, { ingredient_name = 'milk', amount = 1 }, { ingredient_name = 'vanilla_syrup', amount = 1 }, }, }, }, }, }

Menu item id is generated at runtime. Do not add id fields in CafeData.

Menu items can include metadata for consumable behavior.

shared/cafe_data.lua
{ name = 'vanilla_latte', label = 'Vanilla Latte', price = 12, category = 'drink', image = 'vanilla_latte', recipe = { { ingredient_name = 'coffee_beans', amount = 1 }, { ingredient_name = 'milk', amount = 1 }, }, metadata = { degradeMinutes = 90, -- minutes before freshness expires; 0 disables degrade. useDuration = 4500, -- milliseconds for consume progress. effects = { hunger = 0, thirst = 25, stress = 5, -- stress reduction. }, animation = { type = 'emote', command = 'coffee', }, }, }

Animation dict example

Use type = 'anim' when you want a GTA animation dictionary instead of an emote command.

shared/cafe_data.lua
metadata = { degradeMinutes = 60, useDuration = 5000, effects = { hunger = 35, thirst = 0, stress = 0 }, animation = { type = 'anim', dict = 'mp_player_inteat@burger', clip = 'mp_player_int_eat_burger', flag = 49, }, }

Important behavior

CafeData is the default source for missing data only. If a menu item already exists in the database, restart will not reset its price, label, recipe, metadata, or image.

Last updated on