mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-28 22:15:54 -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
87 lines
2.8 KiB
Java
Executable File
87 lines
2.8 KiB
Java
Executable File
package script.item.candle;
|
|
|
|
import script.obj_id;
|
|
|
|
public class candle_decay extends script.base_script
|
|
{
|
|
public candle_decay()
|
|
{
|
|
}
|
|
public static final int DECAY_LOOP_TIME = 30 * 60;
|
|
public int OnInitialize(obj_id self) throws InterruptedException
|
|
{
|
|
removeObjVar(self, "timeStamp");
|
|
removeObjVar(self, "decayTime");
|
|
String templateName = getTemplateName(self);
|
|
if (isLit(self) || templateName.contains("candlestick"))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
templateName = getTemplateName(self);
|
|
int idx = templateName.indexOf("frn_all_");
|
|
if (idx != -1)
|
|
{
|
|
String newTemplateName = templateName.substring(0, idx) + "frn_all_light_" + templateName.substring(idx + 8);
|
|
obj_id newLight = self;
|
|
if (isInHouse(self))
|
|
{
|
|
newLight = createObjectAt(newTemplateName, self);
|
|
if (isIdValid(newLight))
|
|
{
|
|
setYaw(newLight, getYaw(self));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
obj_id container = getContainedBy(self);
|
|
if (isIdValid(container))
|
|
{
|
|
newLight = createObject(newTemplateName, container, "");
|
|
}
|
|
else
|
|
{
|
|
newLight = createObjectAt(newTemplateName, self);
|
|
if (isIdValid(newLight))
|
|
{
|
|
setYaw(newLight, getYaw(self));
|
|
}
|
|
}
|
|
}
|
|
if (!isIdValid(newLight) || newLight == self)
|
|
{
|
|
detachScript(self, "item.candle.candle_decay");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else
|
|
{
|
|
attachScript(newLight, "item.candle.candle_decay");
|
|
destroyObject(self);
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public boolean isLit(obj_id light) throws InterruptedException
|
|
{
|
|
String templateName = getTemplateName(light);
|
|
int idx = templateName.indexOf("frn_all_light_");
|
|
return (idx != -1);
|
|
}
|
|
public boolean isInHouse(obj_id light) throws InterruptedException
|
|
{
|
|
obj_id container = getContainedBy(light);
|
|
if (!isIdValid(container))
|
|
{
|
|
return false;
|
|
}
|
|
int got = getGameObjectType(container);
|
|
if (isGameObjectTypeOf(got, GOT_misc_container) || isGameObjectTypeOf(got, GOT_misc_container_wearable) || isGameObjectTypeOf(got, GOT_tool) || isGameObjectTypeOf(got, GOT_installation))
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|