mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-09-28 14:13:01 -04:00
68 lines
1.3 KiB
Plaintext
68 lines
1.3 KiB
Plaintext
/**
|
|
|
|
*
|
|
* Title: stimpack script
|
|
* Description: script for handling stimpacks
|
|
|
|
*/
|
|
|
|
include library.buff;
|
|
include library.sui;
|
|
include library.utils;
|
|
include library.healing;
|
|
|
|
|
|
trigger OnGetAttributes (obj_id player, string[] names, string[] attribs)
|
|
{
|
|
int idx = utils.getValidAttributeIndex(names);
|
|
if (idx == -1)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (hasObjVar(self, "healing.power"))
|
|
{
|
|
names[idx] = "healing_power";
|
|
float value = getIntObjVar(self, "healing.power");
|
|
attribs[idx] = "" + value;
|
|
idx++;
|
|
if (idx >= names.length)
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
names[idx] = "count";
|
|
int value = getCount(self);
|
|
attribs[idx] = "" + value;
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
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(isDead(player) || isIncapacitated(player))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if(buff.hasBuff(player, "feign_death"))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( item == menu_info_types.ITEM_USE)
|
|
{
|
|
// StimPack
|
|
healing.useHealPetItem(player, getLookAtTarget(player), self);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|