mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-09-27 13:13:10 -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
103 lines
4.1 KiB
Java
Executable File
103 lines
4.1 KiB
Java
Executable File
package script.structure.municipal;
|
|
|
|
import script.dictionary;
|
|
import script.library.create;
|
|
import script.library.player_structure;
|
|
import script.library.structure;
|
|
import script.library.utils;
|
|
import script.location;
|
|
import script.obj_id;
|
|
|
|
import java.util.Vector;
|
|
|
|
public class cloning_facility extends script.structure.municipal.cloning_base
|
|
{
|
|
public cloning_facility()
|
|
{
|
|
}
|
|
public static final String SCRIPT_CLONING_FACILITY = "structure.municipal.cloning_facility";
|
|
public static final String DATATABLE_TERMINAL_LIST = "datatables/structure/municipal/cloning_facility_terminal.iff";
|
|
public int OnInitialize(obj_id self) throws InterruptedException
|
|
{
|
|
messageTo(self, "handleTerminalSpawning", null, 5.0f, false);
|
|
return super.OnInitialize(self);
|
|
}
|
|
public int OnDetach(obj_id self) throws InterruptedException
|
|
{
|
|
obj_id planet = getPlanetByName(getCurrentSceneName());
|
|
if (isIdValid(planet))
|
|
{
|
|
dictionary params = new dictionary();
|
|
params.put("id", self);
|
|
messageTo(planet, "unregisterCloningFacility", params, 1.0f, false);
|
|
}
|
|
return super.OnDetach(self);
|
|
}
|
|
public int handleTerminalSpawning(obj_id self, dictionary params) throws InterruptedException
|
|
{
|
|
createCloningDroid(self);
|
|
if (!player_structure.isCivic(self))
|
|
{
|
|
structure.createStructureTerminals(self, SCRIPT_CLONING_FACILITY, DATATABLE_TERMINAL_LIST);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public void createCloningDroid(obj_id facility) throws InterruptedException
|
|
{
|
|
if (!isIdValid(facility))
|
|
{
|
|
return;
|
|
}
|
|
String facilityTemplate = getTemplateName(facility);
|
|
float fYaw = getYaw(facility);
|
|
String sceneName = getCurrentSceneName();
|
|
int numRows = dataTableGetNumRows(DATATABLE_TERMINAL_LIST);
|
|
Vector terminals = new Vector();
|
|
terminals.setSize(0);
|
|
for (int i = 0; i < numRows; i++)
|
|
{
|
|
String buildingTemplate = dataTableGetString(DATATABLE_TERMINAL_LIST, i, structure.DATATABLE_COL_STRUCTURE);
|
|
if (buildingTemplate.equals(facilityTemplate))
|
|
{
|
|
dictionary item = dataTableGetRow(DATATABLE_TERMINAL_LIST, i);
|
|
String droid_name = item.getString("DROID");
|
|
if (droid_name == null || droid_name.equals(""))
|
|
{
|
|
continue;
|
|
}
|
|
float x = item.getFloat(structure.DATATABLE_COL_X);
|
|
float y = item.getFloat(structure.DATATABLE_COL_Y);
|
|
float z = item.getFloat(structure.DATATABLE_COL_Z);
|
|
float relativeHeading = item.getFloat(structure.DATATABLE_COL_HEADING);
|
|
String cell_name = item.getString(structure.DATATABLE_COL_CELL);
|
|
obj_id cell_id = obj_id.NULL_ID;
|
|
if (!cell_name.equals(structure.WORLD_DELTA))
|
|
{
|
|
cell_id = getCellId(facility, cell_name);
|
|
}
|
|
if (cell_id != null)
|
|
{
|
|
obj_id droid_id = obj_id.NULL_ID;
|
|
location spot = new location(x, y, z, sceneName, cell_id);
|
|
float heading = relativeHeading;
|
|
if (cell_id == obj_id.NULL_ID)
|
|
{
|
|
location fLoc = getLocation(facility);
|
|
spot = new location(fLoc.x + x, fLoc.y + y, fLoc.z + z, sceneName, cell_id);
|
|
if (fYaw != 0)
|
|
{
|
|
spot = utils.rotatePointXZ(fLoc, spot, fYaw);
|
|
heading -= (90 - fYaw);
|
|
}
|
|
}
|
|
droid_id = create.object(droid_name, spot);
|
|
if ((droid_id != null) && (droid_id != obj_id.NULL_ID))
|
|
{
|
|
setYaw(droid_id, heading);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|