mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
89 lines
1.9 KiB
Plaintext
89 lines
1.9 KiB
Plaintext
include library.space_crafting;
|
|
include library.space_utils;
|
|
include library.utils;
|
|
|
|
trigger OnInitialize()
|
|
{
|
|
|
|
if(!hasObjVar(self, "ship_comp.armor_hitpoints_current"))
|
|
{
|
|
// I HAVE NOT BEEN INITIALIZED!
|
|
// MAKE ME A COMPONENT!
|
|
space_crafting.initializeSpaceShipComponent(self);
|
|
}
|
|
|
|
int flags = getIntObjVar(self, "ship_comp.flags");
|
|
boolean isBitSet = (flags & ship_component_flags.SCF_reverse_engineered) != 0;
|
|
|
|
obj_id player = utils.getContainingPlayer(self);
|
|
|
|
// Non-reverse engineered weapons should never have their fire rate recalculated.
|
|
if(isBitSet)
|
|
{
|
|
string ship_refire_table = "datatables/space_loot/ship_refire_fix/" + getClusterName() + "_ships.iff";
|
|
|
|
string id = "" + self;
|
|
|
|
dictionary refireDict = utils.dataTableGetRow(ship_refire_table, id);
|
|
|
|
if(refireDict != null)
|
|
{
|
|
space_crafting.recalculateFireRateFromObject(player, self);
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnGetAttributes( obj_id player, string[] names, string[] attribs )
|
|
{
|
|
int flags = getIntObjVar(self, "ship_comp.flags");
|
|
boolean isBitSet = (flags & ship_component_flags.SCF_reverse_engineered) != 0;
|
|
|
|
if (isBitSet==true)
|
|
{
|
|
int idx = utils.getValidAttributeIndex(names);
|
|
if (idx == -1)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
names[idx] = "reverseEngineered";
|
|
|
|
attribs[idx] = "";
|
|
|
|
}
|
|
else
|
|
{
|
|
int level = space_crafting.getReverseEngineeringLevel(self);
|
|
|
|
int idx = utils.getValidAttributeIndex(names);
|
|
if (idx == -1)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
names[idx] = "reverseEngineeringLevel";
|
|
|
|
attribs[idx] = Integer.toString(level);
|
|
}
|
|
|
|
if (hasObjVar(self, "isMiningLaser"))
|
|
{
|
|
float min = space_crafting.getWeaponMinimumDamage(self);
|
|
float max = space_crafting.getWeaponMaximumDamage(self);
|
|
min = min/100;
|
|
max = max/100;
|
|
|
|
string atr = min + " - " + max;
|
|
|
|
int idx = utils.getValidAttributeIndex(names);
|
|
if (idx == -1)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
names[idx] = "miningExtractionRate";
|
|
|
|
attribs[idx] = atr;
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
|
|
}
|
|
|