mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-09-11 22:45:06 -04:00
who isn't sick of converting the freaking scripts? this negates the need
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package script.space_mining;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.space_content;
|
||||
|
||||
public class asteroid extends script.base_script
|
||||
{
|
||||
public asteroid()
|
||||
{
|
||||
}
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnInitialize(obj_id self) throws InterruptedException
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnDestroy(obj_id self) throws InterruptedException
|
||||
{
|
||||
if (hasObjVar(self, "objParent"))
|
||||
{
|
||||
space_content.notifySpawner(self);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
include library.space_content;
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnInitialize()
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
trigger OnDestroy()
|
||||
{
|
||||
if(hasObjVar(self, "objParent"))
|
||||
{
|
||||
space_content.notifySpawner(self);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
package script.space_mining;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.ai_lib;
|
||||
import script.library.buff;
|
||||
import script.library.chat;
|
||||
import script.library.combat;
|
||||
import script.library.features;
|
||||
import script.library.money;
|
||||
import script.library.pclib;
|
||||
import script.library.ship_ai;
|
||||
import script.library.space_combat;
|
||||
import script.library.space_utils;
|
||||
import script.library.sui;
|
||||
import script.library.quests;
|
||||
import script.library.utils;
|
||||
import script.library.vehicle;
|
||||
|
||||
public class mining_asteroid_chunk extends script.base_script
|
||||
{
|
||||
public mining_asteroid_chunk()
|
||||
{
|
||||
}
|
||||
public static final int MAX_RESOURCE = 1000000;
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
setHitpoints(self, 25);
|
||||
setMaxHitpoints(self, 25);
|
||||
LOG("space_mining", "OnAttach " + self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnShipInternalDamageOverTimeRemoved(obj_id self, int chassisSlot, float damageRate, float damageThreshold) throws InterruptedException
|
||||
{
|
||||
obj_id pilot = getPilotId(self);
|
||||
if (pilot != null)
|
||||
{
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public boolean shipAbsorbAsteroid(obj_id asteroid, obj_id attacker, int amount) throws InterruptedException
|
||||
{
|
||||
LOG("space_mining", "shipAbsorbAsteroid " + asteroid + ", " + attacker + ", " + amount);
|
||||
if (!isShipSlotInstalled(attacker, ship_chassis_slot_type.SCST_cargo_hold))
|
||||
{
|
||||
LOG("space_mining", "no hold");
|
||||
space_utils.sendSystemMessageShip(attacker, new string_id("space_mining", "no_hold"), true, true, true, true);
|
||||
return false;
|
||||
}
|
||||
LOG("space_mining", "shipAbsorbAsteroid 0");
|
||||
obj_id attackingPilot = space_utils.getPilotForRealsies(attacker);
|
||||
String strAsteroidTable = "datatables/space_mining/mining_asteroids.iff";
|
||||
String strAsteroidType = getStringObjVar(asteroid, "strAsteroidType");
|
||||
int contentsMax = getShipCargoHoldContentsMaximum(attacker);
|
||||
int contentsCurrent = getShipCargoHoldContentsCurrent(attacker);
|
||||
if (contentsMax <= 0)
|
||||
{
|
||||
space_utils.sendSystemMessageShip(attacker, new string_id("space_mining", "no_hold"), true, true, true, true);
|
||||
return false;
|
||||
}
|
||||
LOG("space_mining", "shipAbsorbAsteroid 1");
|
||||
if (contentsCurrent >= contentsMax)
|
||||
{
|
||||
space_utils.sendSystemMessageShip(attacker, new string_id("space_mining", "hold_full"), true, true, true, true);
|
||||
return false;
|
||||
}
|
||||
LOG("space_mining", "shipAbsorbAsteroid 2");
|
||||
if (buff.hasBuff(attackingPilot, "tcg_series4_falleens_fist"))
|
||||
{
|
||||
amount = (int)(amount * 1.5f);
|
||||
LOG("space_mining", "Falleen's Fist Buff: Granting 50% increase in resources for Pilot: " + attackingPilot);
|
||||
}
|
||||
String resourceClassName = getResourceClassNameForAsteroid(strAsteroidType);
|
||||
int deltaAmount = modifyShipCargoHoldContent(attacker, resourceClassName, amount);
|
||||
LOG("space_mining", "shipAbsorbAsteroid deltaAmount=" + deltaAmount);
|
||||
dictionary d = new dictionary();
|
||||
d.put("resourceAmt", deltaAmount);
|
||||
d.put("player", attackingPilot);
|
||||
d.put("resourceType", strAsteroidType);
|
||||
messageTo(attackingPilot, "handleAsteroidMined", d, 0, false);
|
||||
return true;
|
||||
}
|
||||
public int OnShipWasHit(obj_id self, obj_id attacker, int weaponIndex, boolean isMissile, int missileType, int chassisSlot, boolean isPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o) throws InterruptedException
|
||||
{
|
||||
obj_id attackingPilot = space_utils.getPilotForRealsies(attacker);
|
||||
if (!features.hasEpisode3Expansion(attackingPilot))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
LOG("space_mining", "OnShipWasHit " + self + ", " + attacker + ", " + weaponIndex);
|
||||
int intWeaponSlot = weaponIndex + ship_chassis_slot_type.SCST_weapon_0;
|
||||
location attackingLocation = getLocation(attacker);
|
||||
vector attackingPosition_w = new vector(attackingLocation.x, attackingLocation.y, attackingLocation.z);
|
||||
transform selfTransform = getTransform_o2w(self);
|
||||
vector attackingLocation_o = selfTransform.rotateTranslate_p2l(attackingPosition_w);
|
||||
int weaponCrc = getShipComponentCrc(attacker, weaponIndex + ship_chassis_slot_type.SCST_weapon_first);
|
||||
if (getShipComponentDescriptorWeaponIsTractor(weaponCrc))
|
||||
{
|
||||
vector currentVelocity_w = getDynamicMiningAsteroidVelocity(self);
|
||||
vector directionToAttacker_w = new vector(attackingPosition_w);
|
||||
directionToAttacker_w = directionToAttacker_w.subtract(selfTransform.getPosition_p());
|
||||
directionToAttacker_w = directionToAttacker_w.normalize();
|
||||
directionToAttacker_w = directionToAttacker_w.multiply(30.0f);
|
||||
currentVelocity_w = currentVelocity_w.add(directionToAttacker_w);
|
||||
float velocityMagnitude = currentVelocity_w.magnitude();
|
||||
float MAX_VELOCITY_MAGNITUDE = 55.0f;
|
||||
if (velocityMagnitude > MAX_VELOCITY_MAGNITUDE)
|
||||
{
|
||||
float velocityMultiplier = MAX_VELOCITY_MAGNITUDE / velocityMagnitude;
|
||||
currentVelocity_w = currentVelocity_w.multiply(velocityMultiplier);
|
||||
}
|
||||
setDynamicMiningAsteroidVelocity(self, currentVelocity_w);
|
||||
location selfLoc = getLocation(self);
|
||||
location attackerLoc = getLocation(attacker);
|
||||
float distance = getDistance(selfLoc, attackerLoc);
|
||||
float radius = getObjectCollisionRadius(attacker);
|
||||
distance = distance - radius;
|
||||
if (distance < 100.0f)
|
||||
{
|
||||
if (shipAbsorbAsteroid(self, attacker, 40))
|
||||
{
|
||||
destroyObject(self);
|
||||
grantRareAsteroid(attackingPilot);
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (getShipComponentDescriptorWeaponIsMining(weaponCrc))
|
||||
{
|
||||
float fltDamage = space_combat.getShipWeaponDamage(attacker, self, intWeaponSlot);
|
||||
fltDamage = fltDamage / 100;
|
||||
int maxHitpoints = getMaxHitpoints(self);
|
||||
int oldHitpoints = getHitpoints(self);
|
||||
setHitpoints(self, oldHitpoints - (int)fltDamage);
|
||||
int newHitpoints = getHitpoints(self);
|
||||
if (newHitpoints <= 0)
|
||||
{
|
||||
shipAbsorbAsteroid(self, attacker, 20);
|
||||
grantRareAsteroid(attackingPilot);
|
||||
handleShipDestruction(self, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
vector hitLocation_o = new vector(hitLocationX_o, hitLocationY_o, hitLocationZ_o);
|
||||
notifyShipHit(self, attackingLocation_o, hitLocation_o, ship_hit_type.HT_chassis, 0.5f, 1.0f);
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public obj_id getResourceStack(obj_id objContainer, obj_id objResource) throws InterruptedException
|
||||
{
|
||||
if (!isIdValid(objContainer))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
obj_id[] objContents = getContents(objContainer);
|
||||
if (objContents == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for (int intI = 0; intI < objContents.length; intI++)
|
||||
{
|
||||
obj_id objType = getResourceContainerResourceType(objContents[intI]);
|
||||
if (objType == objResource)
|
||||
{
|
||||
int intCount = getResourceContainerQuantity(objContents[intI]);
|
||||
if (intCount < MAX_RESOURCE)
|
||||
{
|
||||
return objContents[intI];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public obj_id grantRareAsteroid(obj_id player) throws InterruptedException
|
||||
{
|
||||
obj_id playerInv = utils.getInventoryContainer(player);
|
||||
String datatable = "datatables/space_mining/mining_rares.iff";
|
||||
int rows = dataTableGetNumRows(datatable);
|
||||
int row = rand(0, rows - 1);
|
||||
String template = dataTableGetString(datatable, row, 0);
|
||||
int rarity = dataTableGetInt(datatable, row, 1);
|
||||
int roll = rand(1, rarity);
|
||||
if (roll <= 1)
|
||||
{
|
||||
obj_id rare = createObject(template, playerInv, "");
|
||||
if (!isIdValid(rare))
|
||||
{
|
||||
string_id haHa = new string_id("space_mining", "invfull");
|
||||
sendSystemMessage(player, haHa);
|
||||
return null;
|
||||
}
|
||||
string_id gotRare = new string_id("space_mining", "gotrare");
|
||||
sendSystemMessage(player, gotRare);
|
||||
return rare;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public String getResourceClassNameForAsteroid(String strAsteroidType) throws InterruptedException
|
||||
{
|
||||
if (strAsteroidType.equals("iron"))
|
||||
{
|
||||
return "space_metal_iron";
|
||||
}
|
||||
else if (strAsteroidType.equals("carbonaceous"))
|
||||
{
|
||||
return "space_metal_carbonaceous";
|
||||
}
|
||||
else if (strAsteroidType.equals("silicaceous"))
|
||||
{
|
||||
return "space_metal_silicaceous";
|
||||
}
|
||||
else if (strAsteroidType.equals("ice"))
|
||||
{
|
||||
return "space_metal_ice";
|
||||
}
|
||||
else if (strAsteroidType.equals("obsidian"))
|
||||
{
|
||||
return "space_metal_obsidian";
|
||||
}
|
||||
else if (strAsteroidType.equals("diamond"))
|
||||
{
|
||||
return "space_gem_diamond";
|
||||
}
|
||||
else if (strAsteroidType.equals("crystal"))
|
||||
{
|
||||
return "space_gem_crystal";
|
||||
}
|
||||
else if (strAsteroidType.equals("petrochem"))
|
||||
{
|
||||
return "space_chemical_petrochem";
|
||||
}
|
||||
else if (strAsteroidType.equals("acid"))
|
||||
{
|
||||
return "space_chemical_acid";
|
||||
}
|
||||
else if (strAsteroidType.equals("cyanomethanic"))
|
||||
{
|
||||
return "space_chemical_cyanomethanic";
|
||||
}
|
||||
else if (strAsteroidType.equals("sulfuric"))
|
||||
{
|
||||
return "space_chemical_sulfuric";
|
||||
}
|
||||
else if (strAsteroidType.equals("methane"))
|
||||
{
|
||||
return "space_gas_methane";
|
||||
}
|
||||
else if (strAsteroidType.equals("organometallic"))
|
||||
{
|
||||
return "space_gas_organometallic";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,322 +0,0 @@
|
||||
include library.ai_lib;
|
||||
include library.buff;
|
||||
include library.chat;
|
||||
include library.combat;
|
||||
include library.features;
|
||||
include library.money;
|
||||
include library.pclib;
|
||||
include library.ship_ai;
|
||||
include library.space_combat;
|
||||
include library.space_utils;
|
||||
include library.sui;
|
||||
include library.quests;
|
||||
include library.utils;
|
||||
include library.vehicle;
|
||||
|
||||
const int MAX_RESOURCE = 1000000;
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
setHitpoints(self, 25);
|
||||
setMaxHitpoints(self, 25);
|
||||
|
||||
LOG("space_mining", "OnAttach " + self);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnShipInternalDamageOverTimeRemoved(int chassisSlot, float damageRate, float damageThreshold)
|
||||
{
|
||||
obj_id pilot = getPilotId(self);
|
||||
|
||||
if (pilot != null)
|
||||
{
|
||||
//sendSystemMessageTestingOnly(pilot, "jwatson_ship IDOT removed slot=" + chassisSlot + ", damageRate=" + damageRate + ", threshold=" + damageThreshold);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
boolean shipAbsorbAsteroid(obj_id asteroid, obj_id attacker, int amount)
|
||||
{
|
||||
LOG("space_mining", "shipAbsorbAsteroid " + asteroid + ", " + attacker + ", " + amount);
|
||||
|
||||
if(!isShipSlotInstalled(attacker, ship_chassis_slot_type.SCST_cargo_hold))
|
||||
{
|
||||
LOG("space_mining", "no hold");
|
||||
space_utils.sendSystemMessageShip(attacker, new string_id("space_mining", "no_hold"), true, true, true, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG("space_mining", "shipAbsorbAsteroid 0");
|
||||
|
||||
obj_id attackingPilot = space_utils.getPilotForRealsies(attacker);
|
||||
string strAsteroidTable = "datatables/space_mining/mining_asteroids.iff";
|
||||
string strAsteroidType = getStringObjVar(asteroid, "strAsteroidType");
|
||||
|
||||
//does the hold have room?
|
||||
|
||||
int contentsMax = getShipCargoHoldContentsMaximum(attacker);
|
||||
int contentsCurrent = getShipCargoHoldContentsCurrent(attacker);
|
||||
|
||||
if (contentsMax <= 0)
|
||||
{
|
||||
space_utils.sendSystemMessageShip(attacker, new string_id("space_mining", "no_hold"), true, true, true, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG("space_mining", "shipAbsorbAsteroid 1");
|
||||
|
||||
if (contentsCurrent >= contentsMax)
|
||||
{
|
||||
space_utils.sendSystemMessageShip(attacker, new string_id("space_mining", "hold_full"), true, true, true, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG("space_mining", "shipAbsorbAsteroid 2");
|
||||
|
||||
//granting resources for mining the little chunks
|
||||
|
||||
//TCG FALLEEN's FIST BUFF - 50% Increase in Resource Gathering
|
||||
if(buff.hasBuff(attackingPilot, "tcg_series4_falleens_fist"))
|
||||
{
|
||||
amount = (int)(amount * 1.5f);
|
||||
LOG("space_mining", "Falleen's Fist Buff: Granting 50% increase in resources for Pilot: " + attackingPilot);
|
||||
}
|
||||
|
||||
string resourceClassName = getResourceClassNameForAsteroid(strAsteroidType);
|
||||
int deltaAmount = modifyShipCargoHoldContent(attacker, resourceClassName, amount);
|
||||
|
||||
LOG("space_mining", "shipAbsorbAsteroid deltaAmount=" + deltaAmount);
|
||||
|
||||
dictionary d = new dictionary();
|
||||
d.put("resourceAmt", deltaAmount);
|
||||
d.put("player", attackingPilot);
|
||||
d.put("resourceType", strAsteroidType);
|
||||
messageTo(attackingPilot, "handleAsteroidMined", d, 0, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
trigger OnShipWasHit (obj_id attacker, int weaponIndex, boolean isMissile, int missileType, int chassisSlot, boolean isPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o)
|
||||
{
|
||||
|
||||
obj_id attackingPilot = space_utils.getPilotForRealsies(attacker);
|
||||
if(!features.hasEpisode3Expansion(attackingPilot))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
LOG("space_mining", "OnShipWasHit " + self + ", " + attacker + ", " + weaponIndex);
|
||||
|
||||
int intWeaponSlot = weaponIndex + ship_chassis_slot_type.SCST_weapon_0;
|
||||
|
||||
location attackingLocation = getLocation(attacker);
|
||||
vector attackingPosition_w = new vector(attackingLocation.x, attackingLocation.y, attackingLocation.z);
|
||||
|
||||
transform selfTransform = getTransform_o2w(self);
|
||||
|
||||
vector attackingLocation_o = selfTransform.rotateTranslate_p2l(attackingPosition_w);
|
||||
|
||||
int weaponCrc = getShipComponentCrc(attacker, weaponIndex + ship_chassis_slot_type.SCST_weapon_first);
|
||||
|
||||
//---
|
||||
|
||||
if (getShipComponentDescriptorWeaponIsTractor(weaponCrc))
|
||||
{
|
||||
vector currentVelocity_w = getDynamicMiningAsteroidVelocity(self);
|
||||
vector directionToAttacker_w = new vector(attackingPosition_w);
|
||||
directionToAttacker_w = directionToAttacker_w.subtract(selfTransform.getPosition_p());
|
||||
directionToAttacker_w = directionToAttacker_w.normalize();
|
||||
directionToAttacker_w = directionToAttacker_w.multiply(30.0f);
|
||||
currentVelocity_w = currentVelocity_w.add(directionToAttacker_w);
|
||||
|
||||
//-- clamp velocity to 40 m/s
|
||||
float velocityMagnitude = currentVelocity_w.magnitude();
|
||||
|
||||
float MAX_VELOCITY_MAGNITUDE = 55.0f;
|
||||
|
||||
if (velocityMagnitude > MAX_VELOCITY_MAGNITUDE)
|
||||
{
|
||||
float velocityMultiplier = MAX_VELOCITY_MAGNITUDE / velocityMagnitude;
|
||||
currentVelocity_w = currentVelocity_w.multiply(velocityMultiplier);
|
||||
}
|
||||
|
||||
setDynamicMiningAsteroidVelocity(self, currentVelocity_w);
|
||||
|
||||
location selfLoc = getLocation(self);
|
||||
location attackerLoc = getLocation(attacker);
|
||||
|
||||
float distance = getDistance(selfLoc, attackerLoc);
|
||||
|
||||
float radius = getObjectCollisionRadius(attacker);
|
||||
|
||||
distance = distance - radius;
|
||||
|
||||
if (distance < 100.0f)
|
||||
{
|
||||
if (shipAbsorbAsteroid(self, attacker, 40))
|
||||
{
|
||||
destroyObject(self);
|
||||
grantRareAsteroid(attackingPilot);
|
||||
}
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
//--
|
||||
|
||||
if (getShipComponentDescriptorWeaponIsMining(weaponCrc))
|
||||
{
|
||||
float fltDamage = space_combat.getShipWeaponDamage(attacker, self, intWeaponSlot);
|
||||
fltDamage = fltDamage/100;
|
||||
|
||||
int maxHitpoints = getMaxHitpoints(self);
|
||||
int oldHitpoints = getHitpoints(self);
|
||||
|
||||
setHitpoints(self, oldHitpoints - (int)fltDamage);
|
||||
|
||||
int newHitpoints = getHitpoints(self);
|
||||
if (newHitpoints <= 0)
|
||||
{
|
||||
shipAbsorbAsteroid(self, attacker, 20);
|
||||
grantRareAsteroid(attackingPilot);
|
||||
handleShipDestruction(self, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
vector hitLocation_o = new vector(hitLocationX_o, hitLocationY_o, hitLocationZ_o);
|
||||
notifyShipHit(self, attackingLocation_o, hitLocation_o, ship_hit_type.HT_chassis, 0.5f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
obj_id getResourceStack(obj_id objContainer, obj_id objResource)
|
||||
{
|
||||
|
||||
if(!isIdValid(objContainer))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
obj_id[] objContents= getContents(objContainer);
|
||||
if(objContents==null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
for ( int intI= 0; intI< objContents.length; intI++)
|
||||
{
|
||||
obj_id objType = getResourceContainerResourceType(objContents[intI]);
|
||||
if(objType==objResource)
|
||||
{
|
||||
|
||||
int intCount = getResourceContainerQuantity(objContents[intI]);
|
||||
if(intCount<MAX_RESOURCE)
|
||||
{
|
||||
return objContents[intI];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
obj_id grantRareAsteroid(obj_id player)
|
||||
{
|
||||
obj_id playerInv = utils.getInventoryContainer(player);
|
||||
|
||||
string datatable = "datatables/space_mining/mining_rares.iff";
|
||||
int rows = dataTableGetNumRows(datatable);
|
||||
|
||||
int row = rand(0, rows-1);
|
||||
|
||||
string template = dataTableGetString(datatable, row, 0);
|
||||
|
||||
int rarity = dataTableGetInt(datatable, row, 1);
|
||||
|
||||
int roll = rand(1, rarity);
|
||||
|
||||
if (roll <= 1)
|
||||
{
|
||||
obj_id rare = createObject(template, playerInv, "");
|
||||
|
||||
if (!isIdValid(rare))
|
||||
{
|
||||
string_id haHa = new string_id("space_mining", "invfull");
|
||||
sendSystemMessage(player, haHa);
|
||||
return null;
|
||||
}
|
||||
|
||||
string_id gotRare = new string_id("space_mining", "gotrare");
|
||||
sendSystemMessage(player, gotRare);
|
||||
|
||||
return rare;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
string getResourceClassNameForAsteroid(string strAsteroidType)
|
||||
{
|
||||
if (strAsteroidType == "iron")
|
||||
{
|
||||
return "space_metal_iron";
|
||||
}
|
||||
else if (strAsteroidType == "carbonaceous")
|
||||
{
|
||||
return "space_metal_carbonaceous";
|
||||
}
|
||||
else if (strAsteroidType == "silicaceous")
|
||||
{
|
||||
return "space_metal_silicaceous";
|
||||
}
|
||||
else if (strAsteroidType == "ice")
|
||||
{
|
||||
return "space_metal_ice";
|
||||
}
|
||||
else if (strAsteroidType =="obsidian")
|
||||
{
|
||||
return "space_metal_obsidian";
|
||||
}
|
||||
else if (strAsteroidType =="diamond")
|
||||
{
|
||||
return "space_gem_diamond";
|
||||
}
|
||||
else if (strAsteroidType =="crystal")
|
||||
{
|
||||
return "space_gem_crystal";
|
||||
}
|
||||
else if (strAsteroidType =="petrochem")
|
||||
{
|
||||
return "space_chemical_petrochem";
|
||||
}
|
||||
else if (strAsteroidType =="acid")
|
||||
{
|
||||
return "space_chemical_acid";
|
||||
}
|
||||
else if (strAsteroidType =="cyanomethanic")
|
||||
{
|
||||
return "space_chemical_cyanomethanic";
|
||||
}
|
||||
else if (strAsteroidType =="sulfuric")
|
||||
{
|
||||
return "space_chemical_sulfuric";
|
||||
}
|
||||
else if (strAsteroidType =="methane")
|
||||
{
|
||||
return "space_gas_methane";
|
||||
}
|
||||
else if (strAsteroidType =="organometallic")
|
||||
{
|
||||
return "space_gas_organometallic";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
package script.space_mining;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.combat;
|
||||
import script.library.sui;
|
||||
import script.library.quests;
|
||||
import script.library.ai_lib;
|
||||
import script.library.money;
|
||||
import script.library.chat;
|
||||
import script.library.pclib;
|
||||
import script.library.vehicle;
|
||||
import script.library.ship_ai;
|
||||
import script.library.utils;
|
||||
import script.library.space_utils;
|
||||
import script.library.space_combat;
|
||||
import script.library.features;
|
||||
|
||||
public class mining_asteroid_dynamic extends script.base_script
|
||||
{
|
||||
public mining_asteroid_dynamic()
|
||||
{
|
||||
}
|
||||
public static final int MAX_RESOURCE = 1000000;
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
setHitpoints(self, 50);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnShipInternalDamageOverTimeRemoved(obj_id self, int chassisSlot, float damageRate, float damageThreshold) throws InterruptedException
|
||||
{
|
||||
obj_id pilot = getPilotId(self);
|
||||
if (pilot != null)
|
||||
{
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnShipWasHit(obj_id self, obj_id attacker, int weaponIndex, boolean isMissile, int missileType, int chassisSlot, boolean isPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o) throws InterruptedException
|
||||
{
|
||||
obj_id attackingPilot = space_utils.getPilotForRealsies(attacker);
|
||||
if (!features.hasEpisode3Expansion(attackingPilot))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String strAsteroidTable = "datatables/space_mining/mining_asteroids.iff";
|
||||
String strAsteroidType = getStringObjVar(self, "strAsteroidType");
|
||||
int intWeaponSlot = weaponIndex + ship_chassis_slot_type.SCST_weapon_0;
|
||||
location attackingLocation = getLocation(attacker);
|
||||
vector attackingPosition_w = new vector(attackingLocation.x, attackingLocation.y, attackingLocation.z);
|
||||
transform selfTransform = getTransform_o2w(self);
|
||||
vector attackingLocation_o = selfTransform.rotateTranslate_p2l(attackingPosition_w);
|
||||
int weaponCrc = getShipComponentCrc(attacker, weaponIndex + ship_chassis_slot_type.SCST_weapon_first);
|
||||
if (getShipComponentDescriptorWeaponIsTractor(weaponCrc))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else if (getShipComponentDescriptorWeaponIsMining(weaponCrc))
|
||||
{
|
||||
float fltDamage = space_combat.getShipWeaponDamage(attacker, self, intWeaponSlot);
|
||||
fltDamage = fltDamage / 100;
|
||||
int maxHitpoints = getMaxHitpoints(self);
|
||||
int oldHitpoints = getHitpoints(self);
|
||||
setHitpoints(self, oldHitpoints - (int)fltDamage);
|
||||
int newHitpoints = getHitpoints(self);
|
||||
if (newHitpoints <= 0)
|
||||
{
|
||||
location selfLocation = getLocation(self);
|
||||
int choice = rand(5, 6);
|
||||
String template = dataTableGetString(strAsteroidTable, strAsteroidType, choice);
|
||||
int chunks = rand(2, 7);
|
||||
for (int i = 0; i < chunks; i++)
|
||||
{
|
||||
obj_id spawnDynamicAsteroid = createObject(template, selfLocation);
|
||||
setObjVar(spawnDynamicAsteroid, "strAsteroidType", strAsteroidType);
|
||||
vector currentVelocity_w = getDynamicMiningAsteroidVelocity(self);
|
||||
vector spawnDirection_w = currentVelocity_w.cross(vector.randomUnit());
|
||||
spawnDirection_w = spawnDirection_w.normalize();
|
||||
spawnDirection_w = spawnDirection_w.multiply(10.0f);
|
||||
currentVelocity_w = currentVelocity_w.add(spawnDirection_w);
|
||||
setDynamicMiningAsteroidVelocity(spawnDynamicAsteroid, currentVelocity_w);
|
||||
currentVelocity_w = currentVelocity_w.subtract(spawnDirection_w);
|
||||
currentVelocity_w = currentVelocity_w.subtract(spawnDirection_w);
|
||||
setDynamicMiningAsteroidVelocity(self, currentVelocity_w);
|
||||
obj_id parentRoid = getObjIdObjVar(self, "objParentAsteroid");
|
||||
messageTo(parentRoid, "decrementCount", null, 0, false);
|
||||
handleShipDestruction(self, 1.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vector hitLocation_o = new vector(hitLocationX_o, hitLocationY_o, hitLocationZ_o);
|
||||
notifyShipHit(self, attackingLocation_o, hitLocation_o, ship_hit_type.HT_chassis, 0.5f, 1.0f);
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public void giveResourceReward(obj_id objAsteroid, obj_id objAttacker, int intAmount) throws InterruptedException
|
||||
{
|
||||
String strAsteroidType = getStringObjVar(objAsteroid, "strAsteroidType");
|
||||
obj_id objPilot = space_utils.getPilotForRealsies(objAttacker);
|
||||
obj_id objContainer = null;
|
||||
if (space_utils.isShipWithInterior(objAttacker))
|
||||
{
|
||||
objContainer = getObjIdObjVar(objAttacker, "objLootBox");
|
||||
}
|
||||
else
|
||||
{
|
||||
objPilot = space_utils.getPilotForRealsies(objAttacker);
|
||||
if (!isIdValid(objPilot))
|
||||
{
|
||||
return;
|
||||
}
|
||||
objContainer = utils.getInventoryContainer(objPilot);
|
||||
}
|
||||
if (!isIdValid(objContainer))
|
||||
{
|
||||
LOG("space", "null loot container");
|
||||
return;
|
||||
}
|
||||
String strResourceType = getResourceType(strAsteroidType);
|
||||
obj_id[] objResourceIds = getResourceTypes(strResourceType);
|
||||
obj_id objResourceId = null;
|
||||
if ((objResourceIds != null) && (objResourceIds.length > 0))
|
||||
{
|
||||
objResourceId = objResourceIds[rand(0, objResourceIds.length - 1)];
|
||||
}
|
||||
if (!isIdValid(objResourceId))
|
||||
{
|
||||
sendSystemMessageTestingOnly(objPilot, "No resources, bucko!");
|
||||
}
|
||||
obj_id objStack = getResourceStack(objContainer, objResourceId);
|
||||
if (isIdValid(objStack))
|
||||
{
|
||||
int intCount = getResourceContainerQuantity(objStack);
|
||||
intCount += intAmount;
|
||||
if (intCount > MAX_RESOURCE)
|
||||
{
|
||||
intCount = intCount - MAX_RESOURCE;
|
||||
intAmount = intAmount - intCount;
|
||||
addResourceToContainer(objStack, objResourceId, intAmount, null);
|
||||
objStack = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
addResourceToContainer(objStack, objResourceId, intAmount, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
objStack = createResourceCrate(objResourceId, intAmount, objContainer);
|
||||
if (objStack == null)
|
||||
{
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public obj_id getResourceStack(obj_id objContainer, obj_id objResource) throws InterruptedException
|
||||
{
|
||||
if (!isIdValid(objContainer))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
obj_id[] objContents = getContents(objContainer);
|
||||
if (objContents == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for (int intI = 0; intI < objContents.length; intI++)
|
||||
{
|
||||
obj_id objType = getResourceContainerResourceType(objContents[intI]);
|
||||
if (objType == objResource)
|
||||
{
|
||||
int intCount = getResourceContainerQuantity(objContents[intI]);
|
||||
if (intCount < MAX_RESOURCE)
|
||||
{
|
||||
return objContents[intI];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public String getResourceType(String strAsteroidType) throws InterruptedException
|
||||
{
|
||||
if (strAsteroidType.equals("iron"))
|
||||
{
|
||||
return "space_metal_iron";
|
||||
}
|
||||
else if (strAsteroidType.equals("carbonaceous"))
|
||||
{
|
||||
return "space_metal_carbonaceous";
|
||||
}
|
||||
else if (strAsteroidType.equals("silicaceous"))
|
||||
{
|
||||
return "space_metal_silicaceous";
|
||||
}
|
||||
else if (strAsteroidType.equals("ice"))
|
||||
{
|
||||
return "space_metal_ice";
|
||||
}
|
||||
else if (strAsteroidType.equals("obsidian"))
|
||||
{
|
||||
return "space_metal_obsidian";
|
||||
}
|
||||
else if (strAsteroidType.equals("diamond"))
|
||||
{
|
||||
return "space_gem_diamond";
|
||||
}
|
||||
else if (strAsteroidType.equals("crystal"))
|
||||
{
|
||||
return "space_gem_crystal";
|
||||
}
|
||||
else if (strAsteroidType.equals("petrochem"))
|
||||
{
|
||||
return "space_chemical_petrochem";
|
||||
}
|
||||
else if (strAsteroidType.equals("acid"))
|
||||
{
|
||||
return "space_chemical_acid";
|
||||
}
|
||||
else if (strAsteroidType.equals("cyanomethanic"))
|
||||
{
|
||||
return "space_chemical_cyanomethanic";
|
||||
}
|
||||
else if (strAsteroidType.equals("sulfuric"))
|
||||
{
|
||||
return "space_chemical_sulfuric";
|
||||
}
|
||||
else if (strAsteroidType.equals("methane"))
|
||||
{
|
||||
return "space_gas_methane";
|
||||
}
|
||||
else if (strAsteroidType.equals("organometallic"))
|
||||
{
|
||||
return "space_gas_organometallic";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,320 +0,0 @@
|
||||
|
||||
include library.combat;
|
||||
include library.sui;
|
||||
include library.quests;
|
||||
include library.ai_lib;
|
||||
include library.money;
|
||||
include library.chat;
|
||||
include library.pclib;
|
||||
include library.vehicle;
|
||||
include library.ship_ai;
|
||||
include library.utils;
|
||||
include library.space_utils;
|
||||
include library.space_combat;
|
||||
include library.features;
|
||||
const int MAX_RESOURCE = 1000000;
|
||||
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
setHitpoints(self, 50);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnShipInternalDamageOverTimeRemoved(int chassisSlot, float damageRate, float damageThreshold)
|
||||
{
|
||||
obj_id pilot = getPilotId(self);
|
||||
|
||||
if (pilot != null)
|
||||
{
|
||||
//sendSystemMessageTestingOnly(pilot, "jwatson_ship IDOT removed slot=" + chassisSlot + ", damageRate=" + damageRate + ", threshold=" + damageThreshold);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnShipWasHit (obj_id attacker, int weaponIndex, boolean isMissile, int missileType, int chassisSlot, boolean isPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o)
|
||||
{
|
||||
obj_id attackingPilot = space_utils.getPilotForRealsies(attacker);
|
||||
|
||||
if(!features.hasEpisode3Expansion(attackingPilot))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
string strAsteroidTable = "datatables/space_mining/mining_asteroids.iff";
|
||||
|
||||
string strAsteroidType = getStringObjVar(self, "strAsteroidType");
|
||||
|
||||
int intWeaponSlot = weaponIndex + ship_chassis_slot_type.SCST_weapon_0;
|
||||
|
||||
location attackingLocation = getLocation(attacker);
|
||||
vector attackingPosition_w = new vector(attackingLocation.x, attackingLocation.y, attackingLocation.z);
|
||||
|
||||
transform selfTransform = getTransform_o2w(self);
|
||||
|
||||
vector attackingLocation_o = selfTransform.rotateTranslate_p2l(attackingPosition_w);
|
||||
|
||||
int weaponCrc = getShipComponentCrc(attacker, weaponIndex + ship_chassis_slot_type.SCST_weapon_first);
|
||||
|
||||
if (getShipComponentDescriptorWeaponIsTractor(weaponCrc))
|
||||
{
|
||||
//-- is missile, do tractor beam action
|
||||
|
||||
//vector currentVelocity_w = getDynamicMiningAsteroidVelocity(self);
|
||||
//vector directionToAttacker_w = new vector(attackingPosition_w);
|
||||
//directionToAttacker_w = directionToAttacker_w.subtract(selfTransform.getPosition_p());
|
||||
//directionToAttacker_w = directionToAttacker_w.normalize();
|
||||
//directionToAttacker_w = directionToAttacker_w.multiply(20.0f);
|
||||
//currentVelocity_w = currentVelocity_w.add(directionToAttacker_w);
|
||||
|
||||
//-- clamp velocity to 50 m/s
|
||||
//float velocityMagnitude = currentVelocity_w.magnitude();
|
||||
|
||||
//float MAX_VELOCITY_MAGNITUDE = 50.0f;
|
||||
|
||||
//if (velocityMagnitude > MAX_VELOCITY_MAGNITUDE)
|
||||
//{
|
||||
// float velocityMultiplier = MAX_VELOCITY_MAGNITUDE / velocityMagnitude;
|
||||
// currentVelocity_w = currentVelocity_w.multiply(velocityMultiplier);
|
||||
//}
|
||||
|
||||
//sendSystemMessageTestingOnly(attackingPilot, "*** asteroid dynamic TRACTOR PULSE add=" + directionToAttacker_w);
|
||||
|
||||
//setDynamicMiningAsteroidVelocity(self, currentVelocity_w);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else if (getShipComponentDescriptorWeaponIsMining(weaponCrc))
|
||||
{
|
||||
|
||||
float fltDamage = space_combat.getShipWeaponDamage(attacker, self, intWeaponSlot);
|
||||
fltDamage = fltDamage/100;
|
||||
|
||||
int maxHitpoints = getMaxHitpoints(self);
|
||||
int oldHitpoints = getHitpoints(self);
|
||||
|
||||
setHitpoints(self, oldHitpoints - (int)fltDamage);
|
||||
|
||||
int newHitpoints = getHitpoints(self);
|
||||
|
||||
//sendSystemMessageTestingOnly(attackingPilot, "hit asteroid dynamic " + newHitpoints + "/" + maxHitpoints);
|
||||
|
||||
if (newHitpoints <= 0)
|
||||
{
|
||||
location selfLocation = getLocation(self);
|
||||
int choice = rand(5, 6);
|
||||
string template = dataTableGetString(strAsteroidTable, strAsteroidType, choice);
|
||||
|
||||
//lets make a few nuggety chunks!
|
||||
|
||||
int chunks = rand(2,7);
|
||||
|
||||
//sendSystemMessageTestingOnly(attackingPilot, "Should spawn " + chunks + " chunks");
|
||||
//sendSystemMessageTestingOnly(attackingPilot, "Chunks are " + template);
|
||||
|
||||
for (int i = 0; i < chunks; i++)
|
||||
{
|
||||
obj_id spawnDynamicAsteroid =
|
||||
createObject(template, selfLocation);
|
||||
|
||||
setObjVar(spawnDynamicAsteroid, "strAsteroidType", strAsteroidType);
|
||||
|
||||
vector currentVelocity_w = getDynamicMiningAsteroidVelocity(self);
|
||||
|
||||
|
||||
|
||||
vector spawnDirection_w = currentVelocity_w.cross(vector.randomUnit());
|
||||
spawnDirection_w = spawnDirection_w.normalize();
|
||||
|
||||
spawnDirection_w = spawnDirection_w.multiply(10.0f);
|
||||
|
||||
currentVelocity_w = currentVelocity_w.add(spawnDirection_w);
|
||||
setDynamicMiningAsteroidVelocity(spawnDynamicAsteroid, currentVelocity_w);
|
||||
currentVelocity_w = currentVelocity_w.subtract(spawnDirection_w);
|
||||
currentVelocity_w = currentVelocity_w.subtract(spawnDirection_w);
|
||||
setDynamicMiningAsteroidVelocity(self, currentVelocity_w);
|
||||
|
||||
//sendSystemMessageTestingOnly(attackingPilot, "*** asteroid dynamic DESTROYED");
|
||||
|
||||
//decrement count on staic asteroid
|
||||
|
||||
obj_id parentRoid = getObjIdObjVar(self, "objParentAsteroid");
|
||||
|
||||
messageTo(parentRoid, "decrementCount", null, 0, false);
|
||||
|
||||
handleShipDestruction(self, 1.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vector hitLocation_o = new vector(hitLocationX_o, hitLocationY_o, hitLocationZ_o);
|
||||
notifyShipHit(self, attackingLocation_o, hitLocation_o, ship_hit_type.HT_chassis, 0.5f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
void giveResourceReward(obj_id objAsteroid , obj_id objAttacker, int intAmount)
|
||||
{
|
||||
|
||||
// get their inventory container
|
||||
string strAsteroidType = getStringObjVar(objAsteroid, "strAsteroidType");
|
||||
obj_id objPilot = space_utils.getPilotForRealsies(objAttacker);
|
||||
obj_id objContainer = null;
|
||||
if(space_utils.isShipWithInterior(objAttacker))
|
||||
{
|
||||
objContainer = getObjIdObjVar(objAttacker, "objLootBox");
|
||||
}
|
||||
else
|
||||
{
|
||||
objPilot = space_utils.getPilotForRealsies(objAttacker);
|
||||
if(!isIdValid(objPilot))
|
||||
{
|
||||
return;
|
||||
}
|
||||
objContainer = utils.getInventoryContainer(objPilot);
|
||||
}
|
||||
if(!isIdValid(objContainer))
|
||||
{
|
||||
LOG("space", "null loot container");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
string strResourceType = getResourceType(strAsteroidType);
|
||||
|
||||
obj_id[] objResourceIds = getResourceTypes(strResourceType);
|
||||
obj_id objResourceId = null;
|
||||
if((objResourceIds!=null)&&(objResourceIds.length>0))
|
||||
{
|
||||
objResourceId = objResourceIds[rand(0, objResourceIds.length-1)];
|
||||
}
|
||||
if(!isIdValid(objResourceId))
|
||||
{
|
||||
sendSystemMessageTestingOnly(objPilot, "No resources, bucko!");
|
||||
}
|
||||
|
||||
obj_id objStack = getResourceStack(objContainer, objResourceId);
|
||||
if(isIdValid(objStack))
|
||||
{
|
||||
int intCount = getResourceContainerQuantity(objStack);
|
||||
intCount += intAmount;
|
||||
if(intCount>MAX_RESOURCE)
|
||||
{
|
||||
// add the diff
|
||||
intCount = intCount - MAX_RESOURCE;
|
||||
//sendSystemMessageTestingOnly(objPilot, "Add the Diff! " + intCount);
|
||||
// add the diff
|
||||
intAmount = intAmount - intCount;
|
||||
addResourceToContainer(objStack, objResourceId , intAmount, null);
|
||||
objStack = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// increment the count
|
||||
addResourceToContainer(objStack, objResourceId, intAmount, null);
|
||||
//sendSystemMessageTestingOnly(objPilot, "Incrementing count!");
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// make a new stack and set the count
|
||||
objStack = createResourceCrate(objResourceId, intAmount, objContainer);
|
||||
if (objStack == null)
|
||||
{
|
||||
//sendSystemMessageTestingOnly(player, "Full Inventory");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
obj_id getResourceStack(obj_id objContainer, obj_id objResource)
|
||||
{
|
||||
|
||||
if(!isIdValid(objContainer))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
obj_id[] objContents= getContents(objContainer);
|
||||
if(objContents==null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
for ( int intI= 0; intI< objContents.length; intI++)
|
||||
{
|
||||
obj_id objType = getResourceContainerResourceType(objContents[intI]);
|
||||
if(objType==objResource)
|
||||
{
|
||||
|
||||
int intCount = getResourceContainerQuantity(objContents[intI]);
|
||||
if(intCount<MAX_RESOURCE)
|
||||
{
|
||||
return objContents[intI];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
string getResourceType(string strAsteroidType)
|
||||
{
|
||||
if (strAsteroidType == "iron")
|
||||
{
|
||||
return "space_metal_iron";
|
||||
}
|
||||
else if (strAsteroidType == "carbonaceous")
|
||||
{
|
||||
return "space_metal_carbonaceous";
|
||||
}
|
||||
else if (strAsteroidType == "silicaceous")
|
||||
{
|
||||
return "space_metal_silicaceous";
|
||||
}
|
||||
else if (strAsteroidType == "ice")
|
||||
{
|
||||
return "space_metal_ice";
|
||||
}
|
||||
else if (strAsteroidType =="obsidian")
|
||||
{
|
||||
return "space_metal_obsidian";
|
||||
}
|
||||
else if (strAsteroidType =="diamond")
|
||||
{
|
||||
return "space_gem_diamond";
|
||||
}
|
||||
else if (strAsteroidType =="crystal")
|
||||
{
|
||||
return "space_gem_crystal";
|
||||
}
|
||||
else if (strAsteroidType =="petrochem")
|
||||
{
|
||||
return "space_chemical_petrochem";
|
||||
}
|
||||
else if (strAsteroidType =="acid")
|
||||
{
|
||||
return "space_chemical_acid";
|
||||
}
|
||||
else if (strAsteroidType =="cyanomethanic")
|
||||
{
|
||||
return "space_chemical_cyanomethanic";
|
||||
}
|
||||
else if (strAsteroidType =="sulfuric")
|
||||
{
|
||||
return "space_chemical_sulfuric";
|
||||
}
|
||||
else if (strAsteroidType =="methane")
|
||||
{
|
||||
return "space_gas_methane";
|
||||
}
|
||||
else if (strAsteroidType =="organometallic")
|
||||
{
|
||||
return "space_gas_organometallic";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
package script.space_mining;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.combat;
|
||||
import script.library.sui;
|
||||
import script.library.quests;
|
||||
import script.library.ai_lib;
|
||||
import script.library.money;
|
||||
import script.library.chat;
|
||||
import script.library.pclib;
|
||||
import script.library.vehicle;
|
||||
import script.library.ship_ai;
|
||||
import script.library.space_content;
|
||||
import script.library.space_combat;
|
||||
import script.library.space_transition;
|
||||
import script.library.space_create;
|
||||
import script.library.space_utils;
|
||||
import script.library.features;
|
||||
|
||||
public class mining_asteroid_static extends script.base_script
|
||||
{
|
||||
public mining_asteroid_static()
|
||||
{
|
||||
}
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
setObjVar(self, "mining_asteroid.numShipsSpawned", 0);
|
||||
setObjVar(self, "dynamicCount", 0);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnShipInternalDamageOverTimeRemoved(obj_id self, int chassisSlot, float damageRate, float damageThreshold) throws InterruptedException
|
||||
{
|
||||
obj_id pilot = getPilotId(self);
|
||||
if (pilot != null)
|
||||
{
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnShipWasHit(obj_id self, obj_id attacker, int weaponIndex, boolean isMissile, int missileType, int chassisSlot, boolean isPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o) throws InterruptedException
|
||||
{
|
||||
String strAsteroidTable = "datatables/space_mining/mining_asteroids.iff";
|
||||
int intDangerLevel = getIntObjVar(self, "intDangerLevel");
|
||||
int intDangerPct = getIntObjVar(self, "intDangerPct");
|
||||
obj_id attackingPilot = space_utils.getPilotForRealsies(attacker);
|
||||
if (!isIdValid(attackingPilot) || !features.hasEpisode3Expansion(attackingPilot))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int intWeaponSlot = weaponIndex + ship_chassis_slot_type.SCST_weapon_0;
|
||||
String strAsteroidType = getStringObjVar(self, "strAsteroidType");
|
||||
location attackingLocation = getLocation(attacker);
|
||||
vector attackingPosition_w = new vector(attackingLocation.x, attackingLocation.y, attackingLocation.z);
|
||||
transform selfTransform = getTransform_o2w(self);
|
||||
vector attackingLocation_o = selfTransform.rotateTranslate_p2l(attackingPosition_w);
|
||||
int weaponCrc = getShipComponentCrc(attacker, weaponIndex + ship_chassis_slot_type.SCST_weapon_first);
|
||||
if (getShipComponentDescriptorWeaponIsMining(weaponCrc))
|
||||
{
|
||||
float fltDamage = space_combat.getShipWeaponDamage(attacker, self, intWeaponSlot);
|
||||
fltDamage = fltDamage / 100;
|
||||
int maxHitpoints = getMaxHitpoints(self);
|
||||
int oldHitpoints = getHitpoints(self);
|
||||
setHitpoints(self, oldHitpoints - (int)fltDamage);
|
||||
int newHitpoints = getHitpoints(self);
|
||||
if (newHitpoints <= 0)
|
||||
{
|
||||
handleShipDestruction(self, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
vector hitLocation_o = new vector(hitLocationX_o, hitLocationY_o, hitLocationZ_o);
|
||||
notifyShipHit(self, attackingLocation_o, hitLocation_o, ship_hit_type.HT_chassis, 0.5f, 1.0f);
|
||||
int newDamageBracket = newHitpoints / 50;
|
||||
int oldDamageBracket = oldHitpoints / 50;
|
||||
int damageBracketDifference = oldDamageBracket - newDamageBracket;
|
||||
vector direction_o = attackingLocation_o.approximateNormalize();
|
||||
location selfLocation = getLocation(self);
|
||||
for (int i = 0; i < damageBracketDifference; ++i)
|
||||
{
|
||||
vector spawnDirection_o = new vector(direction_o.x * random.rand(), direction_o.y * random.rand(), direction_o.z * random.rand());
|
||||
spawnDirection_o = spawnDirection_o.approximateNormalize();
|
||||
vector spawnDirection_o_clone = spawnDirection_o;
|
||||
vector spawnLocation_o = spawnDirection_o_clone.multiply(200.0f);
|
||||
vector spawnLocation_w = (getTransform_o2w(self)).rotateTranslate_l2p(spawnLocation_o);
|
||||
location spawnLoc = new location(spawnLocation_w.x, spawnLocation_w.y, spawnLocation_w.z);
|
||||
if (intDangerLevel == 0 || intDangerLevel == 1)
|
||||
{
|
||||
spawnDirection_o = spawnDirection_o.multiply(20.0f + (random.rand() * 20.0f));
|
||||
}
|
||||
else if (intDangerLevel == 2 || intDangerLevel == 3)
|
||||
{
|
||||
spawnDirection_o = spawnDirection_o.multiply(30.0f + (random.rand() * 20.0f));
|
||||
}
|
||||
else if (intDangerLevel == 4)
|
||||
{
|
||||
spawnDirection_o = spawnDirection_o.multiply(40.0f + (random.rand() * 20.0f));
|
||||
}
|
||||
else if (intDangerLevel == 5)
|
||||
{
|
||||
spawnDirection_o = spawnDirection_o.multiply(45.0f + (random.rand() * 20.0f));
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnDirection_o = spawnDirection_o.multiply(40.0f + (random.rand() * 20.0f));
|
||||
}
|
||||
int choice = rand(3, 4);
|
||||
int dynamicCount = getIntObjVar(self, "dynamicCount");
|
||||
if (dynamicCount >= 3)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String template = dataTableGetString(strAsteroidTable, strAsteroidType, choice);
|
||||
obj_id spawnDynamicAsteroid = createObject(template, spawnLoc);
|
||||
setObjVar(self, "dynamicCount", dynamicCount + 1);
|
||||
if (null == spawnDynamicAsteroid)
|
||||
{
|
||||
space_utils.sendSystemMessageShip(attacker, new string_id("unlocalized", "FAILED TO CREATE DYNAMIC ASTEROID: " + template), true, true, true, true);
|
||||
continue;
|
||||
}
|
||||
setObjVar(spawnDynamicAsteroid, "strAsteroidType", strAsteroidType);
|
||||
setObjVar(spawnDynamicAsteroid, "objParentAsteroid", self);
|
||||
setDynamicMiningAsteroidVelocity(spawnDynamicAsteroid, spawnDirection_o);
|
||||
int roll = rand(1, 100);
|
||||
if (roll <= intDangerPct && getIntObjVar(self, "mining_asteroid.numShipsSpawned") < 16)
|
||||
{
|
||||
int squad = ship_ai.squadCreateSquadId();
|
||||
String attackTable = "datatables/space_mining/mining_threat/threat_tier_" + intDangerLevel + ".iff";
|
||||
int rows = dataTableGetNumRows(attackTable);
|
||||
int spawnGroup = rand(0, rows - 1);
|
||||
for (int j = 1; j < 9; j++)
|
||||
{
|
||||
if (getIntObjVar(self, "mining_asteroid.numShipsSpawned") < 16)
|
||||
{
|
||||
String spawn = dataTableGetString(attackTable, spawnGroup, j);
|
||||
if (spawn == null)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
transform playerLocation = getTransform_o2w(attacker);
|
||||
float dist = rand(700.f, 800.f);
|
||||
vector n = ((playerLocation.getLocalFrameK_p()).normalize()).multiply(dist);
|
||||
playerLocation = playerLocation.move_p(n);
|
||||
playerLocation = playerLocation.yaw_l(3.14f);
|
||||
vector vi = ((playerLocation.getLocalFrameI_p()).normalize()).multiply(rand(-150.f, 150.f));
|
||||
vector vj = ((playerLocation.getLocalFrameJ_p()).normalize()).multiply(rand(-150.f, 150.f));
|
||||
vector vd = vi.add(vj);
|
||||
playerLocation = playerLocation.move_p(vd);
|
||||
obj_id newship = space_create.createShipHyperspace(spawn, playerLocation);
|
||||
attachScript(newship, "space_mining.mining_pirate");
|
||||
setObjVar(newship, "space_mining.parentRoid", self);
|
||||
int spawnCount = getIntObjVar(self, "mining_asteroid.numShipsSpawned");
|
||||
setObjVar(self, "mining_asteroid.numShipsSpawned", spawnCount + 1);
|
||||
if (isIdValid(newship))
|
||||
{
|
||||
ship_ai.unitSetSquadId(newship, squad);
|
||||
ship_ai.spaceAttack(newship, attacker);
|
||||
}
|
||||
}
|
||||
}
|
||||
ship_ai.squadSetFormationRandom(squad);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnDestroy(obj_id self) throws InterruptedException
|
||||
{
|
||||
if (hasObjVar(self, "objParent"))
|
||||
{
|
||||
space_content.notifySpawner(self);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int handlePirateKilled(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
int spawnCount = getIntObjVar(self, "mining_asteroid.numShipsSpawned");
|
||||
setObjVar(self, "mining_asteroid.numShipsSpawned", spawnCount - 1);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int decrementCount(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
int count = getIntObjVar(self, "dynamicCount");
|
||||
setObjVar(self, "dynamicCount", count - 1);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,248 +0,0 @@
|
||||
|
||||
include library.combat;
|
||||
include library.sui;
|
||||
include library.quests;
|
||||
include library.ai_lib;
|
||||
include library.money;
|
||||
include library.chat;
|
||||
include library.pclib;
|
||||
include library.vehicle;
|
||||
include library.ship_ai;
|
||||
include library.space_content;
|
||||
include library.space_combat;
|
||||
include library.space_transition;
|
||||
include library.space_create;
|
||||
include library.space_utils;
|
||||
include library.features;
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
setObjVar(self, "mining_asteroid.numShipsSpawned", 0);
|
||||
setObjVar(self, "dynamicCount", 0);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnShipInternalDamageOverTimeRemoved(int chassisSlot, float damageRate, float damageThreshold)
|
||||
{
|
||||
obj_id pilot = getPilotId(self);
|
||||
|
||||
if (pilot != null)
|
||||
{
|
||||
//sendSystemMessageTestingOnly(pilot, "jwatson_ship IDOT removed slot=" + chassisSlot + ", damageRate=" + damageRate + ", threshold=" + damageThreshold);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnShipWasHit (obj_id attacker, int weaponIndex, boolean isMissile, int missileType, int chassisSlot, boolean isPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o)
|
||||
{
|
||||
|
||||
|
||||
string strAsteroidTable = "datatables/space_mining/mining_asteroids.iff";
|
||||
|
||||
int intDangerLevel = getIntObjVar(self, "intDangerLevel");
|
||||
int intDangerPct = getIntObjVar(self, "intDangerPct");
|
||||
|
||||
// player ID of mining pilot
|
||||
obj_id attackingPilot = space_utils.getPilotForRealsies(attacker);
|
||||
|
||||
|
||||
|
||||
if(!isIdValid(attackingPilot) || !features.hasEpisode3Expansion(attackingPilot))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
int intWeaponSlot = weaponIndex + ship_chassis_slot_type.SCST_weapon_0;
|
||||
|
||||
string strAsteroidType = getStringObjVar(self, "strAsteroidType");
|
||||
|
||||
// current location of attacking ship
|
||||
location attackingLocation = getLocation(attacker);
|
||||
vector attackingPosition_w = new vector(attackingLocation.x, attackingLocation.y, attackingLocation.z);
|
||||
|
||||
transform selfTransform = getTransform_o2w(self);
|
||||
|
||||
vector attackingLocation_o = selfTransform.rotateTranslate_p2l(attackingPosition_w);
|
||||
|
||||
// HP calculations
|
||||
|
||||
int weaponCrc = getShipComponentCrc(attacker, weaponIndex + ship_chassis_slot_type.SCST_weapon_first);
|
||||
|
||||
if (getShipComponentDescriptorWeaponIsMining(weaponCrc))
|
||||
{
|
||||
float fltDamage = space_combat.getShipWeaponDamage(attacker, self, intWeaponSlot);
|
||||
fltDamage = fltDamage/100;
|
||||
|
||||
//space_utils.sendSystemMessageShip(attacker, new string_id("unlocalized", "fltDamage is " + fltDamage), true, true, true, true);
|
||||
|
||||
int maxHitpoints = getMaxHitpoints(self);
|
||||
int oldHitpoints = getHitpoints(self);
|
||||
|
||||
setHitpoints(self, oldHitpoints - (int)fltDamage);
|
||||
|
||||
int newHitpoints = getHitpoints(self);
|
||||
|
||||
//space_utils.sendSystemMessageShip(attacker, new string_id("unlocalized", "hit asteroid static " + newHitpoints + "/" + maxHitpoints), true, true, true, true);
|
||||
|
||||
if (newHitpoints <= 0)
|
||||
{
|
||||
//space_utils.sendSystemMessageShip(attacker, new string_id("unlocalized", "*** asteroid static DESTROYED"), true, true, true, true);
|
||||
|
||||
handleShipDestruction(self, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
vector hitLocation_o = new vector(hitLocationX_o, hitLocationY_o, hitLocationZ_o);
|
||||
notifyShipHit(self, attackingLocation_o, hitLocation_o, ship_hit_type.HT_chassis, 0.5f, 1.0f);
|
||||
|
||||
//-- spawn new mini-roid every 50 hps
|
||||
|
||||
int newDamageBracket = newHitpoints / 50;
|
||||
int oldDamageBracket = oldHitpoints / 50;
|
||||
|
||||
int damageBracketDifference = oldDamageBracket - newDamageBracket;
|
||||
|
||||
vector direction_o = attackingLocation_o.approximateNormalize();
|
||||
|
||||
location selfLocation = getLocation(self);
|
||||
|
||||
for (int i = 0; i < damageBracketDifference; ++i)
|
||||
{
|
||||
vector spawnDirection_o = new vector(direction_o.x * random.rand(), direction_o.y * random.rand(), direction_o.z * random.rand());
|
||||
spawnDirection_o = spawnDirection_o.approximateNormalize();
|
||||
|
||||
vector spawnDirection_o_clone = spawnDirection_o;
|
||||
vector spawnLocation_o = spawnDirection_o_clone.multiply(200.0f);
|
||||
|
||||
vector spawnLocation_w = getTransform_o2w(self).rotateTranslate_l2p(spawnLocation_o);
|
||||
location spawnLoc = new location(spawnLocation_w.x, spawnLocation_w.y, spawnLocation_w.z);
|
||||
|
||||
if (intDangerLevel == 0 || intDangerLevel == 1)
|
||||
spawnDirection_o = spawnDirection_o.multiply(20.0f + (random.rand() * 20.0f));
|
||||
|
||||
else if (intDangerLevel == 2 || intDangerLevel ==3 )
|
||||
spawnDirection_o = spawnDirection_o.multiply(30.0f + (random.rand() * 20.0f));
|
||||
else if (intDangerLevel == 4)
|
||||
spawnDirection_o = spawnDirection_o.multiply(40.0f + (random.rand() * 20.0f));
|
||||
else if (intDangerLevel == 5)
|
||||
spawnDirection_o = spawnDirection_o.multiply(45.0f + (random.rand() * 20.0f));
|
||||
else
|
||||
spawnDirection_o = spawnDirection_o.multiply(40.0f + (random.rand() * 20.0f));
|
||||
|
||||
int choice = rand(3, 4);
|
||||
|
||||
|
||||
int dynamicCount = getIntObjVar(self, "dynamicCount");
|
||||
|
||||
if (dynamicCount >= 3)
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
string template = dataTableGetString(strAsteroidTable, strAsteroidType, choice);
|
||||
obj_id spawnDynamicAsteroid = createObject(template, spawnLoc);
|
||||
|
||||
//track # of dynamic asteroids active
|
||||
|
||||
|
||||
setObjVar(self, "dynamicCount", dynamicCount+1);
|
||||
|
||||
|
||||
if (null == spawnDynamicAsteroid)
|
||||
{
|
||||
space_utils.sendSystemMessageShip(attacker, new string_id("unlocalized", "FAILED TO CREATE DYNAMIC ASTEROID: " + template), true, true, true, true);
|
||||
continue;
|
||||
}
|
||||
|
||||
setObjVar(spawnDynamicAsteroid, "strAsteroidType", strAsteroidType);
|
||||
setObjVar(spawnDynamicAsteroid, "objParentAsteroid", self);
|
||||
|
||||
setDynamicMiningAsteroidVelocity(spawnDynamicAsteroid, spawnDirection_o);
|
||||
|
||||
//roll to see if an attack happens!
|
||||
|
||||
int roll = rand(1 , 100);
|
||||
if (roll <= intDangerPct && getIntObjVar(self, "mining_asteroid.numShipsSpawned") < 16)
|
||||
{
|
||||
|
||||
int squad = ship_ai.squadCreateSquadId();
|
||||
|
||||
string attackTable = "datatables/space_mining/mining_threat/threat_tier_"+intDangerLevel+".iff";
|
||||
|
||||
|
||||
int rows = dataTableGetNumRows(attackTable);
|
||||
|
||||
int spawnGroup = rand(0, rows-1);
|
||||
|
||||
//some spawning stuff taken from breinhart's scripts
|
||||
for (int j = 1; j < 9; j++)
|
||||
{
|
||||
if (getIntObjVar(self, "mining_asteroid.numShipsSpawned") < 16)
|
||||
{
|
||||
string spawn = dataTableGetString(attackTable, spawnGroup, j);
|
||||
//space_utils.sendSystemMessageShip(attacker, new string_id("unlocalized", "Spawn is " + spawn), true, true, true, true);
|
||||
|
||||
if (spawn == null)
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
|
||||
transform playerLocation = getTransform_o2w( attacker );
|
||||
|
||||
float dist = rand( 700.f, 800.f );
|
||||
vector n = playerLocation.getLocalFrameK_p().normalize().multiply( dist ); // Project a point out in front of us.
|
||||
playerLocation = playerLocation.move_p( n );
|
||||
|
||||
playerLocation = playerLocation.yaw_l( 3.14f );
|
||||
|
||||
vector vi = playerLocation.getLocalFrameI_p().normalize().multiply( rand( -150.f, 150.f ) );
|
||||
vector vj = playerLocation.getLocalFrameJ_p().normalize().multiply( rand( -150.f, 150.f ) );
|
||||
vector vd = vi.add( vj );
|
||||
playerLocation = playerLocation.move_p( vd );
|
||||
|
||||
obj_id newship = space_create.createShipHyperspace(spawn , playerLocation );
|
||||
|
||||
attachScript(newship, "space_mining.mining_pirate");
|
||||
|
||||
setObjVar(newship, "space_mining.parentRoid", self);
|
||||
|
||||
int spawnCount = getIntObjVar(self, "mining_asteroid.numShipsSpawned");
|
||||
setObjVar(self, "mining_asteroid.numShipsSpawned", spawnCount + 1);
|
||||
|
||||
if(isIdValid(newship))
|
||||
{
|
||||
ship_ai.unitSetSquadId( newship, squad );
|
||||
ship_ai.spaceAttack( newship, attacker );
|
||||
}
|
||||
}
|
||||
}
|
||||
ship_ai.squadSetFormationRandom( squad );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnDestroy()
|
||||
{
|
||||
if(hasObjVar(self, "objParent"))
|
||||
{
|
||||
space_content.notifySpawner(self);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
messageHandler handlePirateKilled()
|
||||
{
|
||||
int spawnCount = getIntObjVar(self, "mining_asteroid.numShipsSpawned");
|
||||
setObjVar(self, "mining_asteroid.numShipsSpawned", spawnCount - 1);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
messageHandler decrementCount()
|
||||
{
|
||||
int count = getIntObjVar(self, "dynamicCount");
|
||||
setObjVar(self, "dynamicCount", count-1);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package script.space_mining;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
public class mining_pirate extends script.base_script
|
||||
{
|
||||
public mining_pirate()
|
||||
{
|
||||
}
|
||||
public int OnDestroy(obj_id self) throws InterruptedException
|
||||
{
|
||||
obj_id asteroid = getObjIdObjVar(self, "space_mining.parentRoid");
|
||||
messageTo(asteroid, "handlePirateKilled", null, 0, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
// OnDestroy trigger tells the parent asteroid to decrement spawned count by 1
|
||||
|
||||
trigger OnDestroy()
|
||||
{
|
||||
obj_id asteroid = getObjIdObjVar(self, "space_mining.parentRoid");
|
||||
messageTo(asteroid, "handlePirateKilled", null, 0, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
package script.space_mining;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.combat;
|
||||
import script.library.sui;
|
||||
import script.library.quests;
|
||||
import script.library.ai_lib;
|
||||
import script.library.money;
|
||||
import script.library.chat;
|
||||
import script.library.pclib;
|
||||
import script.library.vehicle;
|
||||
import script.library.ship_ai;
|
||||
import script.library.utils;
|
||||
import script.library.space_utils;
|
||||
import script.library.space_combat;
|
||||
|
||||
public class mining_salvage_hulk extends script.base_script
|
||||
{
|
||||
public mining_salvage_hulk()
|
||||
{
|
||||
}
|
||||
public static final int MAX_RESOURCE = 1000000;
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnShipInternalDamageOverTimeRemoved(obj_id self, int chassisSlot, float damageRate, float damageThreshold) throws InterruptedException
|
||||
{
|
||||
obj_id pilot = space_utils.getPilotForRealsies(self);
|
||||
if (pilot != null)
|
||||
{
|
||||
sendSystemMessageTestingOnly(pilot, "jwatson_ship IDOT removed slot=" + chassisSlot + ", damageRate=" + damageRate + ", threshold=" + damageThreshold);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnShipWasHit(obj_id self, obj_id attacker, int weaponIndex, boolean isMissile, int missileType, int chassisSlot, boolean isPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o) throws InterruptedException
|
||||
{
|
||||
obj_id attackingPilot = space_utils.getPilotForRealsies(attacker);
|
||||
String strAsteroidType = getStringObjVar(self, "strAsteroidType");
|
||||
int intWeaponSlot = weaponIndex + ship_chassis_slot_type.SCST_weapon_0;
|
||||
int weaponCrc = getShipComponentCrc(attacker, weaponIndex + ship_chassis_slot_type.SCST_weapon_first);
|
||||
location attackingLocation = getLocation(attacker);
|
||||
vector attackingPosition_w = new vector(attackingLocation.x, attackingLocation.y, attackingLocation.z);
|
||||
transform selfTransform = getTransform_o2w(self);
|
||||
if (getShipComponentDescriptorWeaponIsTractor(weaponCrc))
|
||||
{
|
||||
float fltDamage = 3.0f;
|
||||
int maxHitpoints = getMaxHitpoints(self);
|
||||
int oldHitpoints = getHitpoints(self);
|
||||
setHitpoints(self, oldHitpoints - (int)fltDamage);
|
||||
int newHitpoints = getHitpoints(self);
|
||||
int resourceAmt = oldHitpoints - newHitpoints;
|
||||
giveResourceReward(self, attacker, resourceAmt);
|
||||
dictionary d = new dictionary();
|
||||
d.put("resourceAmt", resourceAmt);
|
||||
d.put("player", attackingPilot);
|
||||
d.put("resourceType", strAsteroidType);
|
||||
messageTo(attackingPilot, "handleShipSalvage", d, 0, false);
|
||||
if (newHitpoints <= 0)
|
||||
{
|
||||
handleShipDestruction(self, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
vector hitLocation_o = new vector(hitLocationX_o, hitLocationY_o, hitLocationZ_o);
|
||||
notifyShipHit(self, attackingPosition_w, hitLocation_o, ship_hit_type.HT_chassis, 0.5f, 1.0f);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public void giveResourceReward(obj_id objAsteroid, obj_id objAttacker, int intAmount) throws InterruptedException
|
||||
{
|
||||
String strAsteroidType = getStringObjVar(objAsteroid, "strAsteroidType");
|
||||
obj_id objPilot = space_utils.getPilotForRealsies(objAttacker);
|
||||
obj_id objContainer = null;
|
||||
if (space_utils.isShipWithInterior(objAttacker))
|
||||
{
|
||||
objContainer = getObjIdObjVar(objAttacker, "objLootBox");
|
||||
}
|
||||
else
|
||||
{
|
||||
objPilot = space_utils.getPilotForRealsies(objAttacker);
|
||||
if (!isIdValid(objPilot))
|
||||
{
|
||||
return;
|
||||
}
|
||||
objContainer = utils.getInventoryContainer(objPilot);
|
||||
}
|
||||
if (!isIdValid(objContainer))
|
||||
{
|
||||
LOG("space", "null loot container");
|
||||
return;
|
||||
}
|
||||
String strResourceType = getResourceType(strAsteroidType);
|
||||
obj_id[] objResourceIds = getResourceTypes(strResourceType);
|
||||
obj_id objResourceId = null;
|
||||
if ((objResourceIds != null) && (objResourceIds.length > 0))
|
||||
{
|
||||
objResourceId = objResourceIds[rand(0, objResourceIds.length - 1)];
|
||||
}
|
||||
if (!isIdValid(objResourceId))
|
||||
{
|
||||
sendSystemMessageTestingOnly(objPilot, "No resources, bucko!");
|
||||
}
|
||||
obj_id objStack = getResourceStack(objContainer, objResourceId);
|
||||
if (isIdValid(objStack))
|
||||
{
|
||||
int intCount = getResourceContainerQuantity(objStack);
|
||||
intCount += intAmount;
|
||||
if (intCount > MAX_RESOURCE)
|
||||
{
|
||||
intCount = intCount - MAX_RESOURCE;
|
||||
sendSystemMessageTestingOnly(objPilot, "Add the Diff! " + intCount);
|
||||
intAmount = intAmount - intCount;
|
||||
addResourceToContainer(objStack, objResourceId, intAmount, null);
|
||||
objStack = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
addResourceToContainer(objStack, objResourceId, intAmount, null);
|
||||
sendSystemMessageTestingOnly(objPilot, "Incrementing count!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
objStack = createResourceCrate(objResourceId, intAmount, objContainer);
|
||||
if (objStack == null)
|
||||
{
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public obj_id getResourceStack(obj_id objContainer, obj_id objResource) throws InterruptedException
|
||||
{
|
||||
if (!isIdValid(objContainer))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
obj_id[] objContents = getContents(objContainer);
|
||||
if (objContents == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for (int intI = 0; intI < objContents.length; intI++)
|
||||
{
|
||||
obj_id objType = getResourceContainerResourceType(objContents[intI]);
|
||||
if (objType == objResource)
|
||||
{
|
||||
int intCount = getResourceContainerQuantity(objContents[intI]);
|
||||
if (intCount < MAX_RESOURCE)
|
||||
{
|
||||
return objContents[intI];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public String getResourceType(String strAsteroidType) throws InterruptedException
|
||||
{
|
||||
if (strAsteroidType.equals("iron"))
|
||||
{
|
||||
return "space_metal_iron";
|
||||
}
|
||||
else if (strAsteroidType.equals("carbonaceous"))
|
||||
{
|
||||
return "space_metal_carbonaceous";
|
||||
}
|
||||
else if (strAsteroidType.equals("silicaceous"))
|
||||
{
|
||||
return "space_metal_silicaceous";
|
||||
}
|
||||
else if (strAsteroidType.equals("ice"))
|
||||
{
|
||||
return "space_metal_ice";
|
||||
}
|
||||
else if (strAsteroidType.equals("obsidian"))
|
||||
{
|
||||
return "space_metal_obsidian";
|
||||
}
|
||||
else if (strAsteroidType.equals("diamond"))
|
||||
{
|
||||
return "space_gem_diamond";
|
||||
}
|
||||
else if (strAsteroidType.equals("crystal"))
|
||||
{
|
||||
return "space_gem_crystal";
|
||||
}
|
||||
else if (strAsteroidType.equals("petrochem"))
|
||||
{
|
||||
return "space_chemical_petrochem";
|
||||
}
|
||||
else if (strAsteroidType.equals("acid"))
|
||||
{
|
||||
return "space_chemical_acid";
|
||||
}
|
||||
else if (strAsteroidType.equals("cyanomethanic"))
|
||||
{
|
||||
return "space_chemical_cyanomethanic";
|
||||
}
|
||||
else if (strAsteroidType.equals("sulfuric"))
|
||||
{
|
||||
return "space_chemical_sulfuric";
|
||||
}
|
||||
else if (strAsteroidType.equals("methane"))
|
||||
{
|
||||
return "space_gas_methane";
|
||||
}
|
||||
else if (strAsteroidType.equals("organometallic"))
|
||||
{
|
||||
return "space_gas_organometallic";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,251 +0,0 @@
|
||||
|
||||
include library.combat;
|
||||
include library.sui;
|
||||
include library.quests;
|
||||
include library.ai_lib;
|
||||
include library.money;
|
||||
include library.chat;
|
||||
include library.pclib;
|
||||
include library.vehicle;
|
||||
include library.ship_ai;
|
||||
include library.utils;
|
||||
include library.space_utils;
|
||||
include library.space_combat;
|
||||
const int MAX_RESOURCE = 1000000;
|
||||
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnShipInternalDamageOverTimeRemoved(int chassisSlot, float damageRate, float damageThreshold)
|
||||
{
|
||||
obj_id pilot = space_utils.getPilotForRealsies(self);
|
||||
|
||||
if (pilot != null)
|
||||
{
|
||||
sendSystemMessageTestingOnly(pilot, "jwatson_ship IDOT removed slot=" + chassisSlot + ", damageRate=" + damageRate + ", threshold=" + damageThreshold);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnShipWasHit (obj_id attacker, int weaponIndex, boolean isMissile, int missileType, int chassisSlot, boolean isPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o)
|
||||
{
|
||||
obj_id attackingPilot = space_utils.getPilotForRealsies(attacker);
|
||||
|
||||
string strAsteroidType = getStringObjVar(self, "strAsteroidType");
|
||||
|
||||
int intWeaponSlot = weaponIndex + ship_chassis_slot_type.SCST_weapon_0;
|
||||
|
||||
int weaponCrc = getShipComponentCrc(attacker, weaponIndex + ship_chassis_slot_type.SCST_weapon_first);
|
||||
location attackingLocation = getLocation(attacker);
|
||||
vector attackingPosition_w = new vector(attackingLocation.x, attackingLocation.y, attackingLocation.z);
|
||||
|
||||
transform selfTransform = getTransform_o2w(self);
|
||||
|
||||
if (getShipComponentDescriptorWeaponIsTractor(weaponCrc))
|
||||
{
|
||||
//float fltDamage = space_combat.getShipWeaponDamage(attacker, self, intWeaponSlot);
|
||||
//fltDamage = fltDamage/100;
|
||||
|
||||
float fltDamage = 3.0f;
|
||||
|
||||
int maxHitpoints = getMaxHitpoints(self);
|
||||
int oldHitpoints = getHitpoints(self);
|
||||
|
||||
setHitpoints(self, oldHitpoints - (int)fltDamage);
|
||||
|
||||
//sendSystemMessageTestingOnly(attackingPilot, "Did " + fltDamage + "damage to the ship, Has " + getHitpoints(self) + " hitpoints left");
|
||||
|
||||
int newHitpoints = getHitpoints(self);
|
||||
|
||||
int resourceAmt = oldHitpoints - newHitpoints;
|
||||
|
||||
giveResourceReward(self, attacker, resourceAmt);
|
||||
|
||||
dictionary d = new dictionary();
|
||||
d.put("resourceAmt", resourceAmt);
|
||||
d.put("player", attackingPilot);
|
||||
d.put("resourceType", strAsteroidType);
|
||||
messageTo(attackingPilot, "handleShipSalvage", d, 0, false);
|
||||
|
||||
if (newHitpoints <= 0)
|
||||
{
|
||||
//sendSystemMessageTestingOnly(attackingPilot, "*** asteroid dynamic DESTROYED");
|
||||
handleShipDestruction(self, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
vector hitLocation_o = new vector(hitLocationX_o, hitLocationY_o, hitLocationZ_o);
|
||||
notifyShipHit(self, attackingPosition_w, hitLocation_o, ship_hit_type.HT_chassis, 0.5f, 1.0f);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
}
|
||||
|
||||
void giveResourceReward(obj_id objAsteroid , obj_id objAttacker, int intAmount)
|
||||
{
|
||||
|
||||
// get their inventory container
|
||||
string strAsteroidType = getStringObjVar(objAsteroid, "strAsteroidType");
|
||||
obj_id objPilot = space_utils.getPilotForRealsies(objAttacker);
|
||||
obj_id objContainer = null;
|
||||
if(space_utils.isShipWithInterior(objAttacker))
|
||||
{
|
||||
objContainer = getObjIdObjVar(objAttacker, "objLootBox");
|
||||
}
|
||||
else
|
||||
{
|
||||
objPilot = space_utils.getPilotForRealsies(objAttacker);
|
||||
if(!isIdValid(objPilot))
|
||||
{
|
||||
return;
|
||||
}
|
||||
objContainer = utils.getInventoryContainer(objPilot);
|
||||
}
|
||||
if(!isIdValid(objContainer))
|
||||
{
|
||||
LOG("space", "null loot container");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
string strResourceType = getResourceType(strAsteroidType);
|
||||
|
||||
obj_id[] objResourceIds = getResourceTypes(strResourceType);
|
||||
obj_id objResourceId = null;
|
||||
if((objResourceIds!=null)&&(objResourceIds.length>0))
|
||||
{
|
||||
objResourceId = objResourceIds[rand(0, objResourceIds.length-1)];
|
||||
}
|
||||
if(!isIdValid(objResourceId))
|
||||
{
|
||||
sendSystemMessageTestingOnly(objPilot, "No resources, bucko!");
|
||||
}
|
||||
|
||||
obj_id objStack = getResourceStack(objContainer, objResourceId);
|
||||
if(isIdValid(objStack))
|
||||
{
|
||||
int intCount = getResourceContainerQuantity(objStack);
|
||||
intCount += intAmount;
|
||||
if(intCount>MAX_RESOURCE)
|
||||
{
|
||||
// add the diff
|
||||
intCount = intCount - MAX_RESOURCE;
|
||||
sendSystemMessageTestingOnly(objPilot, "Add the Diff! " + intCount);
|
||||
// add the diff
|
||||
intAmount = intAmount - intCount;
|
||||
addResourceToContainer(objStack, objResourceId , intAmount, null);
|
||||
objStack = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// increment the count
|
||||
addResourceToContainer(objStack, objResourceId, intAmount, null);
|
||||
sendSystemMessageTestingOnly(objPilot, "Incrementing count!");
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// make a new stack and set the count
|
||||
objStack = createResourceCrate(objResourceId, intAmount, objContainer);
|
||||
if (objStack == null)
|
||||
{
|
||||
//sendSystemMessageTestingOnly(player, "Full Inventory");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
obj_id getResourceStack(obj_id objContainer, obj_id objResource)
|
||||
{
|
||||
|
||||
if(!isIdValid(objContainer))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
obj_id[] objContents= getContents(objContainer);
|
||||
if(objContents==null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
for ( int intI= 0; intI< objContents.length; intI++)
|
||||
{
|
||||
obj_id objType = getResourceContainerResourceType(objContents[intI]);
|
||||
if(objType==objResource)
|
||||
{
|
||||
|
||||
int intCount = getResourceContainerQuantity(objContents[intI]);
|
||||
if(intCount<MAX_RESOURCE)
|
||||
{
|
||||
return objContents[intI];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
string getResourceType(string strAsteroidType)
|
||||
{
|
||||
if (strAsteroidType == "iron")
|
||||
{
|
||||
return "space_metal_iron";
|
||||
}
|
||||
else if (strAsteroidType == "carbonaceous")
|
||||
{
|
||||
return "space_metal_carbonaceous";
|
||||
}
|
||||
else if (strAsteroidType == "silicaceous")
|
||||
{
|
||||
return "space_metal_silicaceous";
|
||||
}
|
||||
else if (strAsteroidType == "ice")
|
||||
{
|
||||
return "space_metal_ice";
|
||||
}
|
||||
else if (strAsteroidType =="obsidian")
|
||||
{
|
||||
return "space_metal_obsidian";
|
||||
}
|
||||
else if (strAsteroidType =="diamond")
|
||||
{
|
||||
return "space_gem_diamond";
|
||||
}
|
||||
else if (strAsteroidType =="crystal")
|
||||
{
|
||||
return "space_gem_crystal";
|
||||
}
|
||||
else if (strAsteroidType =="petrochem")
|
||||
{
|
||||
return "space_chemical_petrochem";
|
||||
}
|
||||
else if (strAsteroidType =="acid")
|
||||
{
|
||||
return "space_chemical_acid";
|
||||
}
|
||||
else if (strAsteroidType =="cyanomethanic")
|
||||
{
|
||||
return "space_chemical_cyanomethanic";
|
||||
}
|
||||
else if (strAsteroidType =="sulfuric")
|
||||
{
|
||||
return "space_chemical_sulfuric";
|
||||
}
|
||||
else if (strAsteroidType =="methane")
|
||||
{
|
||||
return "space_gas_methane";
|
||||
}
|
||||
else if (strAsteroidType =="organometallic")
|
||||
{
|
||||
return "space_gas_organometallic";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package script.space_mining;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.sui;
|
||||
import script.library.money;
|
||||
import script.library.space_utils;
|
||||
|
||||
public class resource_station extends script.base_script
|
||||
{
|
||||
public resource_station()
|
||||
{
|
||||
}
|
||||
public static final String SPACE_MINING = "space_mining";
|
||||
public int getPricePerUnit(obj_id station, String resourceClassName) throws InterruptedException
|
||||
{
|
||||
String priceList = getStringObjVar(station, "space_mining.priceList");
|
||||
String datatable = "";
|
||||
if (!priceList.equals(""))
|
||||
{
|
||||
datatable = "datatables/space_mining/station_price_list/" + priceList + "_price_list.iff";
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return dataTableGetInt(datatable, resourceClassName, "price_per_unit");
|
||||
}
|
||||
public int OnSpaceMiningSellResource(obj_id self, obj_id player, obj_id ship, obj_id station, obj_id resourceId, int amount) throws InterruptedException
|
||||
{
|
||||
if (getOwner(ship) != player)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (getShipCargoHoldContent(ship, resourceId) >= amount && amount > 0)
|
||||
{
|
||||
String resourceClassName = getResourceClass(resourceId);
|
||||
int pricePerUnit = getPricePerUnit(self, resourceClassName);
|
||||
if (pricePerUnit > 0)
|
||||
{
|
||||
modifyShipCargoHoldContent(ship, resourceId, -amount);
|
||||
int cashForPlayer = pricePerUnit * amount;
|
||||
money.bankTo("space_resource_sale", player, cashForPlayer);
|
||||
space_utils.sendSystemMessageShip(ship, new string_id("space_mining", "sold"), true, true, true, true);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
include library.utils;
|
||||
include library.sui;
|
||||
include library.money;
|
||||
include library.space_utils;
|
||||
|
||||
const string SPACE_MINING = "space_mining";
|
||||
|
||||
int getPricePerUnit(obj_id station, string resourceClassName)
|
||||
{
|
||||
string priceList = getStringObjVar(station, "space_mining.priceList");
|
||||
string datatable = "";
|
||||
|
||||
if (priceList != "")
|
||||
{
|
||||
datatable = "datatables/space_mining/station_price_list/"+priceList+"_price_list.iff";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return dataTableGetInt(datatable, resourceClassName, "price_per_unit");
|
||||
}
|
||||
|
||||
trigger OnSpaceMiningSellResource(obj_id player, obj_id ship, obj_id station, obj_id resourceId, int amount)
|
||||
{
|
||||
if (getOwner(ship) != player)
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
if (getShipCargoHoldContent(ship, resourceId) >= amount && amount > 0)
|
||||
{
|
||||
string resourceClassName = getResourceClass(resourceId);
|
||||
int pricePerUnit = getPricePerUnit(self, resourceClassName);
|
||||
|
||||
if (pricePerUnit > 0)
|
||||
{
|
||||
modifyShipCargoHoldContent(ship, resourceId, -amount);
|
||||
int cashForPlayer = pricePerUnit * amount;
|
||||
money.bankTo("space_resource_sale", player, cashForPlayer);
|
||||
space_utils.sendSystemMessageShip(ship, new string_id("space_mining", "sold"), true, true, true, true);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user