mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-08-01 02:16:04 -04:00
53 lines
1.5 KiB
Plaintext
53 lines
1.5 KiB
Plaintext
/**
|
|
* Title: terminal_food.script
|
|
* Description: BETA SCRIPT: food dispenser
|
|
*/
|
|
|
|
/***** INHERITS ********************************************************/
|
|
|
|
inherits terminal.base.terminal_add_use;
|
|
|
|
/***** CONSTANTS *******************************************************/
|
|
|
|
const string_id SID_ORDER_FOOD = new string_id ("sui", "order_food");
|
|
|
|
const string[] TEMPLATES = {
|
|
"object/tangible/food/bread_loaf_full_s1.iff",
|
|
"object/tangible/food/fruit_melon.iff",
|
|
"object/tangible/food/meat_kabob.iff"
|
|
};
|
|
|
|
/***** TRIGGERS ********************************************************/
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
|
{
|
|
|
|
if ( item == menu_info_types.ITEM_USE)
|
|
{
|
|
//grant food here
|
|
obj_id inv = getObjectInSlot(player, "inventory");
|
|
//debugSpeakMsg(self, "player inventory = " + inv);
|
|
|
|
int idx = rand(0, TEMPLATES.length -1);
|
|
obj_id food = createObject(TEMPLATES[idx], inv, "");
|
|
if ( (food == null) || (food == obj_id.NULL_ID) )
|
|
{
|
|
sendSystemMessageTestingOnly(player, "Unable to create food. Make sure you have space in your inventory.");
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(player, "A random foodstuff has been created in your inventory.");
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|