mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-07-31 01:15:55 -04:00
212 lines
5.9 KiB
Plaintext
212 lines
5.9 KiB
Plaintext
include library.utils;
|
|
include library.sui;
|
|
include library.combat;
|
|
include library.static_item
|
|
|
|
inherits systems.combat.combat_base;
|
|
|
|
|
|
trigger OnAttach()
|
|
{
|
|
if (static_item.isStaticItem(self))
|
|
return SCRIPT_CONTINUE;
|
|
else
|
|
setCount(self, 10);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnInitialize()
|
|
{
|
|
//lets fix any grenades that have a min range greater than 0
|
|
if(getMinRange(self) != 0)
|
|
{
|
|
//we cant just set min range because rangedata is abunch of information
|
|
range_info rangeData = getWeaponRangeInfo(self);
|
|
if (rangeData != null)
|
|
{
|
|
rangeData.minRange=0;
|
|
rangeData.maxRange=getMaxRange(self);
|
|
setWeaponRangeInfo(self, rangeData);
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
|
|
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
|
{
|
|
if(hasObjVar(self, "intUsed"))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
menu_info_data mid = mi.getMenuItemByType(menu_info_types.EXAMINE);
|
|
if ( mid != null )
|
|
{
|
|
mid.setServerNotify(true);
|
|
}
|
|
|
|
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 ( item == menu_info_types.ITEM_USE)
|
|
{
|
|
string myTemplate = getSharedObjectTemplateName(self);
|
|
string strParams = self.toString();
|
|
obj_id target = getIntendedTarget(player);
|
|
|
|
if(isIdValid(target) && pvpCanAttack(player, target) )
|
|
{
|
|
// Weeeee! getStringCrc() is unreliable, often returning a crc from an alternate universe other then ours. So here comes the ifs!
|
|
if(myTemplate.equals("object/weapon/ranged/grenade/shared_grenade_cryoban.iff") )
|
|
{
|
|
queueCommand(player, ##"throwGrenadeCryoban", target, strParams, COMMAND_PRIORITY_FRONT);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(myTemplate.equals("object/weapon/ranged/grenade/shared_grenade_fragmentation.iff") )
|
|
{
|
|
queueCommand(player, ##"throwGrenadeFragmentation", target, strParams, COMMAND_PRIORITY_FRONT);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(myTemplate.equals("object/weapon/ranged/grenade/shared_grenade_bug_bomb.iff") )
|
|
{
|
|
queueCommand(player, ##"throwGrenadeBug", target, strParams, COMMAND_PRIORITY_FRONT);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(myTemplate.equals("object/weapon/ranged/grenade/shared_grenade_fragmentation_light.iff") )
|
|
{
|
|
queueCommand(player, ##"throwGrenadeFragmentation", target, strParams, COMMAND_PRIORITY_FRONT);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(myTemplate.equals("object/weapon/ranged/grenade/shared_grenade_glop.iff") )
|
|
{
|
|
queueCommand(player, ##"throwGrenadeGlop", target, strParams, COMMAND_PRIORITY_FRONT);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(myTemplate.equals("object/weapon/ranged/grenade/shared_grenade_imperial_detonator.iff") )
|
|
{
|
|
queueCommand(player, ##"throwGrenadeImperialDetonator", target, strParams, COMMAND_PRIORITY_FRONT);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(myTemplate.equals("object/weapon/ranged/grenade/shared_grenade_proton.iff") )
|
|
{
|
|
queueCommand(player, ##"throwGrenadeProton", target, strParams, COMMAND_PRIORITY_FRONT);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(myTemplate.equals("object/weapon/ranged/grenade/shared_grenade_thermal_detonator.iff") )
|
|
{
|
|
queueCommand(player, ##"throwGrenadeThermalDetonator", target, strParams, COMMAND_PRIORITY_FRONT);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(myTemplate.equals("object/weapon/ranged/grenade/shared_grenade_fragmentation_generic.iff") )
|
|
{
|
|
queueCommand(player, ##"throwGrenadeFragmentation", target, strParams, COMMAND_PRIORITY_FRONT);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAddedToWorld()
|
|
{
|
|
removeObjVar(self, "intUsed");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
trigger OnGetAttributes( obj_id player, string[] names, string[] attribs )
|
|
{
|
|
int idx = utils.getValidAttributeIndex( names );
|
|
if ( idx == -1 )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
/* string effect_class = getStringObjVar( self, "effect_class" );
|
|
if ( effect_class == null )
|
|
return SCRIPT_CONTINUE;
|
|
if ( effect_class.equals( "fragmentation" ) )
|
|
{
|
|
names[idx] = "specialEffect";
|
|
attribs[idx] = "@grenade:frag_effect";
|
|
}
|
|
else if ( effect_class.equals( "cryoban" ) )
|
|
{
|
|
names[idx] = "specialEffect";
|
|
attribs[idx] = "@grenade:cryoban_effect1";
|
|
idx++;
|
|
names[idx] = "cryoban_snare1";
|
|
attribs[idx] = "20%";
|
|
idx++;
|
|
names[idx] = "cryoban_snare2";
|
|
attribs[idx] = "5s";
|
|
idx++;
|
|
names[idx] = "closeRangeEffect";
|
|
attribs[idx] = "@grenade:cryoban_effect2";
|
|
idx++;
|
|
names[idx] = "cryoban_slow_pct";
|
|
attribs[idx] = Integer.toString( getIntObjVar( self, "slowIntensity" ) ) + "%";
|
|
idx++;
|
|
names[idx] = "cryoban_slow_dur";
|
|
attribs[idx] = Integer.toString( getIntObjVar( self, "slowDuration" ) ) + "s";
|
|
}
|
|
else if ( effect_class.equals( "glop" ) )
|
|
{
|
|
names[idx] = "closeRangeEffect";
|
|
attribs[idx] = "@grenade:glop_effect";
|
|
idx++;
|
|
names[idx] = "glop_blind_pct";
|
|
attribs[idx] = Integer.toString( getIntObjVar( self, "blindChance" ) ) + "%";
|
|
idx++;
|
|
names[idx] = "glop_blind_dur";
|
|
attribs[idx] = Integer.toString( getIntObjVar( self, "blindDuration" ) ) + "s";
|
|
}
|
|
else if ( effect_class.equals( "imperial_detonator" ) )
|
|
{
|
|
names[idx] = "closeRangeEffect";
|
|
attribs[idx] = "@grenade:impdet_effect";
|
|
}
|
|
else if ( effect_class.equals( "proton" ) )
|
|
{
|
|
names[idx] = "closeRangeEffect";
|
|
attribs[idx] = "@grenade:proton_burn";
|
|
idx++;
|
|
names[idx] = "proton_burn";
|
|
attribs[idx] = Integer.toString( getIntObjVar( self, "burnIntensity" ) );
|
|
idx++;
|
|
names[idx] = "proton_burn_dur";
|
|
attribs[idx] = Integer.toString( getIntObjVar( self, "burnDuration" ) ) + "s";
|
|
}
|
|
else if ( effect_class.equals( "thermal_detonator" ) )
|
|
{
|
|
names[idx] = "closeRangeEffect";
|
|
attribs[idx] = "@grenade:thermal_burn";
|
|
idx++;
|
|
names[idx] = "proton_burn";
|
|
attribs[idx] = Integer.toString( getIntObjVar( self, "burnIntensity" ) );
|
|
idx++;
|
|
names[idx] = "proton_burn_dur";
|
|
attribs[idx] = Integer.toString( getIntObjVar( self, "burnDuration" ) ) + "s";
|
|
}
|
|
|
|
*/
|
|
return SCRIPT_CONTINUE;
|
|
} |