mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-09-28 14:13:01 -04:00
54 lines
1.3 KiB
Plaintext
54 lines
1.3 KiB
Plaintext
include library.utils;
|
|
include library.healing;
|
|
|
|
const string_id CANNOT_USE_ITEM = new string_id("base_player", "cannot_use_item");
|
|
|
|
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
|
{
|
|
if (canManipulate(player, self, true, true, 15, true))
|
|
{
|
|
menu_info_data mid = mi.getMenuItemByType(menu_info_types.ITEM_USE);
|
|
if ( mid != null )
|
|
mid.setServerNotify(true);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
if(utils.getContainingPlayer(self) != player || !hasObjVar(self, "commandName"))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
string command = getStringObjVar(self, "commandName");
|
|
|
|
if(!hasCommand(player, command))
|
|
{
|
|
healing.sendMedicalSpam(player, CANNOT_USE_ITEM, COMBAT_RESULT_MEDICAL);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if( item == menu_info_types.ITEM_USE)
|
|
{
|
|
int commandCrc = getStringCrc(toLower(command));
|
|
queueCommand(player, commandCrc, getLookAtTarget(player), "" + self, COMMAND_PRIORITY_NORMAL);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnGetAttributes(obj_id player, string[] names, string[] attribs)
|
|
{
|
|
int idx = utils.getValidAttributeIndex(names);
|
|
if(idx == -1)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if(hasObjVar(self, "healing.enhancement"))
|
|
{
|
|
names[idx] = "enhancer_power";
|
|
attribs[idx] = "" + Math.floor(getFloatObjVar(self, "healing.enhancement"));
|
|
}
|
|
|
|
|
|
return SCRIPT_CONTINUE;
|
|
} |