Files
dsrc/sku.0/sys.server/compiled/game/script/systems/crafting/crafting_structure.java
T
TekaohandGitHub 5c2e112349 Java 11.0.2 migration (#32)
* 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
2019-04-18 18:31:52 -05:00

67 lines
2.5 KiB
Java
Executable File

package script.systems.crafting;
import script.library.craftinglib;
import script.obj_id;
public class crafting_structure extends script.base_script
{
public crafting_structure()
{
}
public static final String OBJVAR_CRAFTING_TYPE = "crafting.type";
public static final String INVISIBLE_CRAFTING_STATION_TEMPLATE = "object/tangible/crafting/station/inivisible_crafting_station.iff";
public static final String DINER_TEMPLATE_NO_PATH = "diner_no_planet_restriction";
public int OnInitialize(obj_id self) throws InterruptedException
{
String buildingTemplate = getTemplateName(self);
if (buildingTemplate == null || buildingTemplate.equals(""))
{
return SCRIPT_CONTINUE;
}
if (buildingTemplate.indexOf(DINER_TEMPLATE_NO_PATH) > 0)
{
spawnInvCraftingStation(self, craftinglib.STATION_TYPE_FOOD_AND_STRUCTURE);
}
return SCRIPT_CONTINUE;
}
public boolean spawnInvCraftingStation(obj_id building, int craftingBuff) throws InterruptedException
{
return spawnInvCraftingStation(building, craftingBuff, null);
}
public boolean spawnInvCraftingStation(obj_id building, int craftingBuff, String specificCell) throws InterruptedException
{
if (!isValidId(building) || !exists(building))
{
return false;
}
if (craftingBuff < 0)
{
return false;
}
String[] allCells = getCellNames(building);
if (allCells == null)
{
return false;
}
for (String allCell : allCells) {
if (specificCell != null && !specificCell.equals(allCell)) {
continue;
}
if (specificCell != null && specificCell.equals(allCell)) {
obj_id singleCellStation = createObjectInCell(INVISIBLE_CRAFTING_STATION_TEMPLATE, building, allCell);
if (!isValidId(singleCellStation) || !exists(singleCellStation)) {
return false;
}
setObjVar(singleCellStation, OBJVAR_CRAFTING_TYPE, craftingBuff);
break;
}
obj_id allCellsStation = createObjectInCell(INVISIBLE_CRAFTING_STATION_TEMPLATE, building, allCell);
if (!isValidId(allCellsStation) || !exists(allCellsStation)) {
return false;
}
setObjVar(allCellsStation, OBJVAR_CRAFTING_TYPE, craftingBuff);
}
return true;
}
}