Files
dsrc/sku.0/sys.server/compiled/game/script/space/crafting/component_countermeasure.java
T

81 lines
2.6 KiB
Java
Executable File

package script.space.crafting;
import script.library.utils;
import script.obj_id;
public class component_countermeasure extends script.base_script
{
public component_countermeasure()
{
}
public int OnInitialize(obj_id self) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int OnGetAttributes(obj_id self, obj_id player, String[] names, String[] attribs) throws InterruptedException
{
int idx = utils.getValidAttributeIndex(names);
if (idx == -1)
{
return SCRIPT_CONTINUE;
}
if (hasObjVar(self, "fltMinDamage"))
{
float value = getFloatObjVar(self, "fltMinDamage");
names[idx] = "chaff_effectiveness_min";
attribs[idx] = Float.toString(value);
idx++;
}
if (hasObjVar(self, "fltMaxDamage"))
{
float value = getFloatObjVar(self, "fltMaxDamage");
names[idx] = "chaff_effectiveness_max";
attribs[idx] = Float.toString(value);
idx++;
}
if (hasObjVar(self, "fltRefireRate"))
{
float value = getFloatObjVar(self, "fltRefireRate");
names[idx] = "refire_rate";
attribs[idx] = Float.toString(value);
idx++;
}
if (hasObjVar(self, "fltShieldEffectiveness"))
{
float value = getFloatObjVar(self, "fltShieldEffectiveness");
names[idx] = "effective_shields";
attribs[idx] = Float.toString(value);
idx++;
}
if (hasObjVar(self, "fltArmorEffectiveness"))
{
float value = getFloatObjVar(self, "fltArmorEffectiveness");
names[idx] = "effective_armor";
attribs[idx] = Float.toString(value);
idx++;
}
if (hasObjVar(self, "fltMinEffectiveness"))
{
float value = getFloatObjVar(self, "fltMinEffectiveness");
names[idx] = "chaff_effectiveness_min";
attribs[idx] = Float.toString(value);
idx++;
}
if (hasObjVar(self, "fltMaxEffectiveness"))
{
float value = getFloatObjVar(self, "fltMaxEffectiveness");
names[idx] = "chaff_effectiveness_max";
attribs[idx] = Float.toString(value);
idx++;
}
if (getCount(self) > 0)
{
int ammo = getCount(self);
names[idx] = "ammo";
attribs[idx] = Integer.toString(ammo);
idx++;
}
return SCRIPT_CONTINUE;
}
}