mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
66 lines
1.8 KiB
Plaintext
66 lines
1.8 KiB
Plaintext
/**
|
|
* Copyright (c)2000-2002 Sony Online Entertainment Inc.
|
|
* All Rights Reserved
|
|
*
|
|
* Title: terminal_food.script
|
|
* Description: BETA SCRIPT: food dispenser
|
|
* @author $Author:$
|
|
* @version $Revision:$
|
|
*/
|
|
|
|
/***** INCLUDES ********************************************************/
|
|
|
|
|
|
|
|
/***** 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;
|
|
}
|
|
|
|
}
|
|
|
|
/***** FUNCTIONS *******************************************************/
|
|
|
|
|
|
/***** MESSAGEHANDLERS *************************************************/
|