mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-13 22:01:04 -04:00
* Code compiles - execution NOT tested * updating gitignore * Removed intellij settings files * Removed more intellij files * Added exclusion for JDK classes. * Fixed purchasing script for vendors that have listed coin types. * Updated script to not kick off until the entire preload is complete. * adds static name entry for Solo movie poster and tcg9 vendor entry * clean up empty and orphaned object templates * adds placeholder black market (static) spawns * corrects entries for the video game table to correctly set it in tcg series 2 and remove series 1 console errors * Updated gitignore and removed intellij project files * Fixed appearance reference for thranta payroll and kashyyyk door, added skipLosCheck objvar due to cannit see issue. Requires updated src * Fixed appearance and template for terminal (#2) * Fixed appearance and template for terminal (#3) * Fixed appearance and template for terminal (#4) * Deleted another faulty/orphaned object template * Fixed gcw ranks option on frog. Only issue is that it doesn't award the officer commands or badges. * Fixed some unneeded java 11 changes
129 lines
5.3 KiB
Java
Executable File
129 lines
5.3 KiB
Java
Executable File
package script.space.battlefields;
|
|
|
|
import script.dictionary;
|
|
import script.library.objvar_mangle;
|
|
import script.library.ship_ai;
|
|
import script.library.space_utils;
|
|
import script.library.utils;
|
|
import script.location;
|
|
import script.obj_id;
|
|
import script.transform;
|
|
|
|
import java.util.Vector;
|
|
|
|
public class battlefield_spawner extends script.base_script
|
|
{
|
|
public battlefield_spawner()
|
|
{
|
|
}
|
|
public int OnAttach(obj_id self) throws InterruptedException
|
|
{
|
|
setObjVar(self, "strDefaultBehavior", "specialty");
|
|
messageTo(self, "setupAttackTarget", null, 2, false);
|
|
setupPatrolPaths(self);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int setupAttackTarget(obj_id self, dictionary params) throws InterruptedException
|
|
{
|
|
String strTargetName = getStringObjVar(self, "strTargetName");
|
|
obj_id[] objTargets = getAllObjectsWithObjVar(getLocation(self), 320000, "strMyName");
|
|
if (objTargets != null)
|
|
{
|
|
for (int intI = 0; intI < objTargets.length; intI++)
|
|
{
|
|
String strMyName = getStringObjVar(objTargets[intI], "strMyName");
|
|
if (strTargetName.equals(strMyName))
|
|
{
|
|
setObjVar(self, "objAttackTarget", objTargets[intI]);
|
|
intI = objTargets.length + 1;
|
|
}
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int singleAttackerSpawned(obj_id self, dictionary params) throws InterruptedException
|
|
{
|
|
obj_id objShip = params.getObjId("objShip");
|
|
transform[] trPath = getRandomPathsFromSpawner(self);
|
|
transform trTest = trPath[trPath.length - 1];
|
|
location locTest = utils.getLocationFromTransform(trTest);
|
|
ship_ai.spacePatrol(objShip, trPath);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int squadAttackerSpawned(obj_id self, dictionary params) throws InterruptedException
|
|
{
|
|
obj_id[] objMembers = params.getObjIdArray("objMembers");
|
|
int intSquadId = ship_ai.unitGetSquadId(objMembers[0]);
|
|
transform[] trPath = getRandomPathsFromSpawner(self);
|
|
if ((trPath == null) || (trPath.length == 0))
|
|
{
|
|
}
|
|
for (transform transform : trPath) {
|
|
location locFoo = space_utils.getLocationFromTransform(transform);
|
|
}
|
|
transform trTest = trPath[trPath.length - 1];
|
|
location locTest = utils.getLocationFromTransform(trTest);
|
|
ship_ai.squadAddPatrolPath(intSquadId, trPath);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public void setupPatrolPaths(obj_id self) throws InterruptedException
|
|
{
|
|
if (hasObjVar(self, "strPaths"))
|
|
{
|
|
String[] strPaths = objvar_mangle.getMangledStringArrayObjVar(self, "strPaths");
|
|
int[] intPathCounts = getIntArrayObjVar(self, "intPathCounts");
|
|
for (int intM = 0; intM < strPaths.length; intM++)
|
|
{
|
|
int intPointCount = intPathCounts[intM];
|
|
Vector trPatrolPoints = new Vector();
|
|
trPatrolPoints.setSize(0);
|
|
obj_id[] objTestObjects = getAllObjectsWithTemplate(getLocation(self), 320000, "object/tangible/space/content_infrastructure/basic_patrol_point.iff");
|
|
if (objTestObjects == null)
|
|
{
|
|
}
|
|
for (int intI = 0; intI < intPointCount; intI++)
|
|
{
|
|
for (int intJ = 0; intJ < objTestObjects.length; intJ++)
|
|
{
|
|
if (hasObjVar(objTestObjects[intJ], "strName"))
|
|
{
|
|
String strName = getStringObjVar(objTestObjects[intJ], "strName");
|
|
int intCheck = intI + 1;
|
|
String strTest = "";
|
|
if (intCheck < 10)
|
|
{
|
|
strTest = strPaths[intM] + "_0";
|
|
}
|
|
else
|
|
{
|
|
strTest = strPaths[intM] + "_";
|
|
}
|
|
strTest += intCheck;
|
|
if (strName.equals(strTest))
|
|
{
|
|
trPatrolPoints = utils.addElement(trPatrolPoints, getTransform_o2w(objTestObjects[intJ]));
|
|
intJ = objTestObjects.length + 10;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for (Object trPatrolPoint : trPatrolPoints) {
|
|
location locTest = space_utils.getLocationFromTransform(((transform) trPatrolPoint));
|
|
}
|
|
utils.setLocalVar(self, "trPath" + strPaths[intM], trPatrolPoints);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
public transform[] getRandomPathsFromSpawner(obj_id objSpawner) throws InterruptedException
|
|
{
|
|
if (!hasObjVar(objSpawner, "strPaths"))
|
|
{
|
|
return null;
|
|
}
|
|
String[] strPaths = objvar_mangle.getMangledStringArrayObjVar(objSpawner, "strPaths");
|
|
int intRoll = rand(0, strPaths.length - 1);
|
|
return utils.getTransformArrayLocalVar(objSpawner, "trPath" + strPaths[intRoll]);
|
|
}
|
|
}
|