mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-14 23:07:51 -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
109 lines
3.5 KiB
Java
Executable File
109 lines
3.5 KiB
Java
Executable File
package script.item;
|
|
|
|
import script.library.utils;
|
|
import script.*;
|
|
|
|
public class trigger_breach_sound extends script.base_script
|
|
{
|
|
public trigger_breach_sound()
|
|
{
|
|
}
|
|
public static final string_id SID_TURN_ON = new string_id("spam", "turn_on_sound_object");
|
|
public static final string_id SID_TURN_OFF = new string_id("spam", "turn_off_sound_object");
|
|
public static final String OBJVAR_SOUND_FILE = "soundFile";
|
|
public static final String OBJVAR_IS_TURNED_ON = "itemIsOn";
|
|
public int OnInitialize(obj_id self) throws InterruptedException
|
|
{
|
|
if (!utils.isInHouseCellSpace(self))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (!hasTriggerVolume(self, "itemBreach"))
|
|
{
|
|
createTriggerVolume("itemBreach", 5.0f, true);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnTriggerVolumeEntered(obj_id self, String volumeName, obj_id whoTriggeredMe) throws InterruptedException
|
|
{
|
|
if (!hasObjVar(self, OBJVAR_IS_TURNED_ON))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (getIntObjVar(self, OBJVAR_IS_TURNED_ON) == 0)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (volumeName.equals("itemBreach"))
|
|
{
|
|
if (!isPlayer(whoTriggeredMe))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (!hasObjVar(self, OBJVAR_SOUND_FILE))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
String soundFile = getStringObjVar(self, OBJVAR_SOUND_FILE);
|
|
playClientEffectObj(whoTriggeredMe, soundFile, self, "", new transform(), "");
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
|
|
{
|
|
if (!utils.isInHouseCellSpace(self))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (!hasObjVar(self, OBJVAR_IS_TURNED_ON) || getIntObjVar(self, OBJVAR_IS_TURNED_ON) == 0)
|
|
{
|
|
mi.addRootMenu(menu_info_types.SERVER_MENU1, SID_TURN_ON);
|
|
}
|
|
else
|
|
{
|
|
mi.addRootMenu(menu_info_types.SERVER_MENU1, SID_TURN_OFF);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
|
|
{
|
|
sendDirtyObjectMenuNotification(self);
|
|
if (!utils.isInHouseCellSpace(self))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (item == menu_info_types.SERVER_MENU1)
|
|
{
|
|
if (!hasObjVar(self, OBJVAR_IS_TURNED_ON) || getIntObjVar(self, OBJVAR_IS_TURNED_ON) == 0)
|
|
{
|
|
toggleSound(self, true);
|
|
}
|
|
else
|
|
{
|
|
toggleSound(self, false);
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public boolean toggleSound(obj_id item, boolean turnOn) throws InterruptedException
|
|
{
|
|
if (turnOn)
|
|
{
|
|
setObjVar(item, OBJVAR_IS_TURNED_ON, true);
|
|
if (!hasTriggerVolume(item, "itemBreach"))
|
|
{
|
|
createTriggerVolume("itemBreach", 5.0f, true);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
setObjVar(item, OBJVAR_IS_TURNED_ON, false);
|
|
if (hasTriggerVolume(item, "itemBreach"))
|
|
{
|
|
removeTriggerVolume("itemBreach");
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
}
|