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
152 lines
5.3 KiB
Java
Executable File
152 lines
5.3 KiB
Java
Executable File
package script.ai;
|
|
|
|
import script.dictionary;
|
|
import script.library.ai_lib;
|
|
import script.library.factions;
|
|
import script.library.utils;
|
|
import script.obj_id;
|
|
|
|
public class tusken_bantha extends script.base_script
|
|
{
|
|
public tusken_bantha()
|
|
{
|
|
}
|
|
public static final String SOCIAL_VOLUME = "npc_socialization";
|
|
public static final float SOCIAL_RANGE = 15.0f;
|
|
public int OnAttach(obj_id self) throws InterruptedException
|
|
{
|
|
if (!utils.hasScriptVar(self, "ai.tusken"))
|
|
{
|
|
cancelFollowing(self);
|
|
messageTo(self, "resumeLoitering", null, 3, false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
followTusken(self, utils.getObjIdScriptVar(self, "ai.tusken"));
|
|
factions.setFaction(self, "tusken");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnDetach(obj_id self) throws InterruptedException
|
|
{
|
|
factions.setFaction(self, "bantha");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnAddedToWorld(obj_id self) throws InterruptedException
|
|
{
|
|
if (!utils.hasScriptVar(self, "ai.tusken"))
|
|
{
|
|
cancelFollowing(self);
|
|
messageTo(self, "resumeLoitering", null, 3, false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
followTusken(self, utils.getObjIdScriptVar(self, "ai.tusken"));
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnBehaviorChange(obj_id self, int newBehavior, int oldBehavior, int[] changeFlags) throws InterruptedException
|
|
{
|
|
if (isIncapacitated(self))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (newBehavior < oldBehavior)
|
|
{
|
|
if (!utils.hasScriptVar(self, "ai.tusken"))
|
|
{
|
|
cancelFollowing(self);
|
|
messageTo(self, "resumeLoitering", null, 3, false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
followTusken(self, utils.getObjIdScriptVar(self, "ai.tusken"));
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public void followTusken(obj_id bantha, obj_id target) throws InterruptedException
|
|
{
|
|
obj_id isFollowedBy = getObjIdObjVar(target, "ai.isFollowedBy");
|
|
if (isFollowedBy == null || isFollowedBy == bantha)
|
|
{
|
|
setMovementWalk(bantha);
|
|
follow(bantha, target, 2.0f, 5.0f);
|
|
setObjVar(target, "ai.isFollowedBy", bantha);
|
|
utils.setScriptVar(bantha, "ai.tusken", target);
|
|
setObjVar(bantha, "ai.isFollowing", target);
|
|
}
|
|
else
|
|
{
|
|
followTusken(bantha, isFollowedBy);
|
|
}
|
|
}
|
|
public int resumeLoitering(obj_id self, dictionary params) throws InterruptedException
|
|
{
|
|
if (!utils.hasScriptVar(self, "ai.tusken"))
|
|
{
|
|
detachScript(self, "ai.tusken_bantha");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
followTusken(self, utils.getObjIdScriptVar(self, "ai.tusken"));
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
public void cancelFollowing(obj_id npc) throws InterruptedException
|
|
{
|
|
utils.removeScriptVar(npc, "ai.tusken");
|
|
obj_id isFollowing = getObjIdObjVar(npc, "ai.isFollowing");
|
|
if (isFollowing != null)
|
|
{
|
|
messageTo(isFollowing, "stopBeingFollowed", null, 0, isObjectPersisted(isFollowing));
|
|
}
|
|
removeObjVar(npc, "ai.isFollowing");
|
|
if (hasObjVar(npc, "ai.isFollowedBy"))
|
|
{
|
|
obj_id isFollowedBy = getObjIdObjVar(npc, "ai.isFollowedBy");
|
|
messageTo(isFollowedBy, "stopFollowing", null, 0, isObjectPersisted(isFollowedBy));
|
|
}
|
|
}
|
|
public int stopBeingFollowed(obj_id self, dictionary params) throws InterruptedException
|
|
{
|
|
removeObjVar(self, "ai.isFollowedBy");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int stopFollowing(obj_id self, dictionary params) throws InterruptedException
|
|
{
|
|
removeObjVar(self, "ai.isFollowing");
|
|
cancelFollowing(self);
|
|
messageTo(self, "resumeLoitering", null, 3, false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnFollowTargetLost(obj_id self, obj_id oldTarget) throws InterruptedException
|
|
{
|
|
cancelFollowing(self);
|
|
messageTo(self, "resumeLoitering", null, 3, false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnFollowPathNotFound(obj_id self, obj_id target) throws InterruptedException
|
|
{
|
|
cancelFollowing(self);
|
|
messageTo(self, "resumeLoitering", null, 3, false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnTriggerVolumeEntered(obj_id self, String volumeName, obj_id breacher) throws InterruptedException
|
|
{
|
|
if (hasObjVar(breacher, "gm"))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (volumeName.equals(ai_lib.ALERT_VOLUME_NAME))
|
|
{
|
|
if (hasScript(breacher, "ai.tusken_raider"))
|
|
{
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnTriggerVolumeExited(obj_id self, String volumeName, obj_id breacher) throws InterruptedException
|
|
{
|
|
if (volumeName.equals(ai_lib.ALERT_VOLUME_NAME))
|
|
{
|
|
ignoreCreatureMovement(self, breacher);
|
|
}
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
}
|