mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
73 lines
2.0 KiB
Plaintext
73 lines
2.0 KiB
Plaintext
/***** INCLUDES ********************************************************/
|
|
|
|
include library.powerup;
|
|
include library.utils;
|
|
include library.prose;
|
|
|
|
/***** INHERITS ********************************************************/
|
|
|
|
|
|
/***** CONSTANTS *******************************************************/
|
|
|
|
const string_id MNU_REMOVE_POWERUP = new string_id("powerup","mnu_remove_powerup");
|
|
|
|
const string_id PROSE_REMOVE_POWERUP = new string_id("powerup","prose_remove_powerup");
|
|
|
|
/***** TRIGGER *********************************************************/
|
|
|
|
trigger OnApplyPowerup (obj_id player, obj_id target)
|
|
{
|
|
//if ( !powerup.applyPowerup(player, self, target) )
|
|
return SCRIPT_OVERRIDE;
|
|
//return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach()
|
|
{
|
|
LOG("powerup", "powerup.weapon.onAttach");
|
|
if ( hasObjVar(self, powerup.VAR_POWERUP_USES_LEFT) )
|
|
{
|
|
LOG("powerup", "powerup.weapon.onAttach found the objvar" + powerup.VAR_POWERUP_USES_LEFT);
|
|
setCondition(self, CONDITION_MAGIC_ITEM);
|
|
}
|
|
else if ( setObjVar(self, powerup.VAR_POWERUP_USES_LEFT, powerup.DEFAULT_USE_COUNT) )
|
|
setCondition(self, CONDITION_MAGIC_ITEM);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnGetAttributes(obj_id player, string[] names, string[] attribs)
|
|
{
|
|
powerup.getWeaponAttributes (player, self, names, attribs, true);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
|
{
|
|
if ( utils.isNestedWithin(self, player) )
|
|
mi.addRootMenu(menu_info_types.SERVER_MENU9, MNU_REMOVE_POWERUP);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
LOG("powerup", "Selected cleanup item " + item);
|
|
if ( item == menu_info_types.SERVER_MENU9 )
|
|
{
|
|
LOG("powerup", "Selected cleanup.");
|
|
if ( utils.isNestedWithin(self, player) )
|
|
{
|
|
if ( powerup.cleanupWeaponPowerup(self) )
|
|
{
|
|
prose_package ppRemovePowerup = prose.getPackage(PROSE_REMOVE_POWERUP, self);
|
|
sendSystemMessageProse(player, ppRemovePowerup);
|
|
}
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
/***** MESSAGEHANDLERS **************************************************/
|