Based on the original "pub.c" code, this version allows you to buy an actual drink (inna glass) instead of just forcefeeding you with whatever you purchase. You can also create food and serve it on plates, in boxes, or whatever.
The items on sale are either cloned from the armoury, cloned from a file or cloned in the "create_item()" code in the pub code itself. Containers for these items are done in the same way, using the "create_container()" function. This is the same as the "create_object()" system in "item_shop.c". You can also buy items for other people (or groups of other people) in the pub.
There are several standard glasses and plates available for drinks and food in the "pub_shop.h" header file, if you don't want to create the glasses and plates yourself. These plates use the "/obj/misc/plate.c" inheritable file.
A "counter" will automatically be placed in the pub. If any item cannot be moved into the person who ordered it (i.e they are carrying too much ) it will be placed on the counter. Empty glasses and so on will be cleared from the counter after 3 seconds. To ensure that this happens, make sure that the container object you use has the property "pub item" added to it. Items will only be cleared if they are empty.
See also:
/std/shops/pub_shop.c, /include/shops/pub_shop.h and /include/volumes.h
Written by Lemming
Started 23/10/1999
.
void add_menu_alias(mixed alias, string actual)
// Allow "buy lancre ale" instead of "buy Ale from Lancre" add_menu_alias( "lancre ale", "Ale from Lancre" );
void add_menu_aliases(string * aliases, string actual)
// Add friendly aliases to "Beef burger and chips" add_menu_aliases( ({ "beef burger", "beefburger", "burger" }), "Beef burger and chips" );
varargs void add_menu_item(string name, int type, int cost, string item, string container, int volume, int intox)
The "type" parameter is used to determine which section of the menu the item should reside in, and should be selected from those in the "pub_shop.h" header file.
The "item" parameter is used to generate the actual product on sale. This value can be:
The "container" parameter is the same as the "item" parameter, except that it refers to the container the item comes in and is passed to "create_container()" instead of "create_item()". You can also use the standard containers listed in the "pub_shop.h" header file. It is optional, and setting it to 0 will cause it to be ignored.
The "volume" parameter is optional and is passed directly to "set_amount()" on the object cloned from "item". It can be used to alter the volume of a liquid cloned from a file, so the file itself does not have to be changed. It is optional, and setting it to 0 will cause it to be ignored. If this is set to 0 then the item will fill up the container. Standard volume definitions can be found in the "volumes.h" header file.
The last parameter, "intox", is optional and is used only by NPCs to determine how alcoholic an item is. This should be between 0 and 10, with 0 being non-alcoholic and 10 being something like Suicider. It defaults to 0. Note: This has no effect on the actual alcohol content of the item.
The different volumes of standard containers can be taken from
/include/volumes.h which has defines for all the standard volumes.
// Add a main course called "Big meat pie", cloned from the file // "/obj/food/meatpie.food" add_menu_item( "Big meat pie", PUB_MAINCOURSE, 1000, "/obj/food/meatpie.food" );
// Same as above, but let's put the pie on a plate add_menu_item( "Big meat pie", PUB_MAINCOURSE, 1000, "/obj/food/meatpie.food", PUB_STD_PLATE );
// Add a glass of ale, with the ale cloned from a file and the glass // cloned in the "create_container()" function in the room code add_menu_item( "Pint of ale", PUB_ALCOHOL, 500, "/obj/food/ale.food", "new_pint_glass" );
// The same as above, but we only want half a pint of ale in the glass, we // want to use the standard glasses in the header file and we want to set // the intoxification value of the ale to 5 add_menu_item( "Half-pint of ale in a pint glass", PUB_ALCOHOL, 300, "/obj/food/ale.food", PUB_STD_PINT, VOLUME_HALFPINT, 5 );
// Create a beefburger with added vodka in the "create_item()" function in // the room code and put it in a small satchel from the armoury add_menu_item( "Beefburger with special sauce", PUB_MAINCOURSE, 800, "vodka_burger", "small satchel", 0, 7 );
object make_counter()
object query_counter()
float query_discount(object ob)
// Give Priests a 10% discount float query_discount( object ob ) { if( ob->query_guild_ob() == "/std/guilds/priest.c" ) return 0.9; else return 1.0; }
int query_display_header()
int query_display_subheadings()
string query_language()
object query_menu()
mapping query_menu_aliases()
string query_menu_header()
mapping query_menu_items()
string * query_menu_subheadings()
int query_no_standard_alias()
int query_pub()
string read()
int remove_menu_alias(string alias)
int remove_menu_item(string name)
void set_display_header(int value)
void set_display_subheadings(int value)
void set_language(string language)
void set_menu_header(string header)
void set_menu_subheadings(int subheading, string text)
void set_no_standard_alias(int flag)