mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-09-29 14:13:42 -04:00
Fixed bartenders such that they again move freely about the bar area.
This commit is contained in:
Regular → Executable
+22
-26
@@ -1,16 +1,8 @@
|
||||
package script.npc.bartender;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.ai_lib;
|
||||
import script.library.chat;
|
||||
import script.library.consumable;
|
||||
import script.library.factions;
|
||||
import script.library.money;
|
||||
import script.library.prose;
|
||||
@@ -18,6 +10,8 @@ import script.library.sui;
|
||||
import script.library.township;
|
||||
import script.library.utils;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class base extends script.base_script
|
||||
{
|
||||
public base()
|
||||
@@ -70,7 +64,7 @@ public class base extends script.base_script
|
||||
};
|
||||
public static final String CONVONAME = "bartender";
|
||||
public static final String STF = "bartender";
|
||||
public static final string_id[] OPT_DEFAULT =
|
||||
public static final string_id[] OPT_DEFAULT =
|
||||
{
|
||||
new string_id(STF, "opt_buy"),
|
||||
new string_id(STF, "talk_to_me")
|
||||
@@ -239,13 +233,10 @@ public class base extends script.base_script
|
||||
{
|
||||
if (rand(0, 10) < 4)
|
||||
{
|
||||
if (bartenderMove(self))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
bartenderMove(self);
|
||||
}
|
||||
}
|
||||
playBarAnimation(self, true);
|
||||
playBarAnimation(self);
|
||||
messageTo(self, "handleTick", null, rand(15f, 30f), false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -288,32 +279,31 @@ public class base extends script.base_script
|
||||
switch (rand(1, 2))
|
||||
{
|
||||
case 1:
|
||||
float barYaw = yaw + rand(-10f, 10f);
|
||||
setYaw(self, barYaw);
|
||||
break;
|
||||
float barYaw = yaw + rand(-10f, 10f);
|
||||
setYaw(self, barYaw);
|
||||
break;
|
||||
case 2:
|
||||
default:
|
||||
float yawAway = yaw - 180f + rand(-10f, 10f);
|
||||
setYaw(self, yawAway);
|
||||
faceBar = false;
|
||||
float yawAway = yaw - 180f + rand(-10f, 10f);
|
||||
setYaw(self, yawAway);
|
||||
faceBar = false;
|
||||
break;
|
||||
}
|
||||
playBarAnimation(self, faceBar);
|
||||
playBarAnimation(self);
|
||||
}
|
||||
removeLocationTarget(locationName);
|
||||
removeObjVar(self, VAR_LOC_BASE + "." + locationName);
|
||||
}
|
||||
messageTo(self, "handleTick", null, rand(30f, 45f), false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public void playBarAnimation(obj_id self, boolean isFacingBar) throws InterruptedException
|
||||
public void playBarAnimation(obj_id self) throws InterruptedException
|
||||
{
|
||||
if (!isIdValid(self))
|
||||
{
|
||||
return;
|
||||
}
|
||||
String anim = "check_wrist_device";
|
||||
if (isFacingBar)
|
||||
if (getYaw(self) == getFloatObjVar(self, "heading"))
|
||||
{
|
||||
int tidx = rand(0, ANIMS_TOWARD.length - 1);
|
||||
anim = ANIMS_TOWARD[tidx];
|
||||
@@ -390,7 +380,7 @@ public class base extends script.base_script
|
||||
float nz = z1;
|
||||
if (z1 < z2)
|
||||
{
|
||||
nx = rand(z1, z2);
|
||||
nz = rand(z1, z2);
|
||||
}
|
||||
else if (z2 < z1)
|
||||
{
|
||||
@@ -404,6 +394,8 @@ public class base extends script.base_script
|
||||
}
|
||||
if (there != null)
|
||||
{
|
||||
// clean up past locations
|
||||
//cleanDestinations(self);
|
||||
int now = getGameTime();
|
||||
float heading = (heading1 + heading2) / 2f;
|
||||
setObjVar(self, VAR_LOC_BASE + "." + now + ".location", there);
|
||||
@@ -429,6 +421,11 @@ public class base extends script.base_script
|
||||
return false;
|
||||
}
|
||||
public void updateDestination(obj_id self) throws InterruptedException
|
||||
{
|
||||
cleanDestinations(self);
|
||||
bartenderMove(self);
|
||||
}
|
||||
public void cleanDestinations(obj_id self) throws InterruptedException
|
||||
{
|
||||
if (hasObjVar(self, VAR_LOC_BASE))
|
||||
{
|
||||
@@ -451,7 +448,6 @@ public class base extends script.base_script
|
||||
}
|
||||
removeObjVar(self, VAR_LOC_BASE);
|
||||
}
|
||||
bartenderMove(self);
|
||||
}
|
||||
public int showBuySui(obj_id target) throws InterruptedException
|
||||
{
|
||||
|
||||
Regular → Executable
+8
-2
@@ -28,9 +28,15 @@ public class cantina extends script.base_script
|
||||
behindBar = new location(8.54f, -0.89f, 0.14f, planet, cantina);
|
||||
obj_id bartender = create.object("bartender", behindBar);
|
||||
setYaw(bartender, 87);
|
||||
setCreatureStatic(bartender, true);
|
||||
// removed static setting as it caused bartenders to just stay put. They move around the bar
|
||||
// so this caused a memory leak by storing points it couldn't navigate to.
|
||||
// setCreatureStatic(bartender, true);
|
||||
|
||||
setInvulnerable(bartender, true);
|
||||
ai_lib.setDefaultCalmBehavior(self, ai_lib.BEHAVIOR_SENTINEL);
|
||||
attachScript(bartender, "npc.bartender.base");
|
||||
attachScript(bartender, "npc.bartender.listen");
|
||||
ai_lib.setDefaultCalmMood(bartender, "npc_imperial");
|
||||
//ai_lib.setDefaultCalmBehavior(self, ai_lib.BEHAVIOR_SENTINEL);
|
||||
if (hasScript(self, "theme_park.lok.cantina"))
|
||||
{
|
||||
if (hasScript(self, "city.imperial_crackdown.crackdown_cantina"))
|
||||
|
||||
Regular → Executable
+3
-1
@@ -400,7 +400,9 @@ public class masterspawner extends script.base_script
|
||||
location wuherLoc = new location(8.46f, 1.0f, 0.35f, "tatooine", room);
|
||||
obj_id wuher = create.object("wuher", wuherLoc);
|
||||
create.addDestroyMessage(wuher, "wuherDied", 10f, self);
|
||||
setCreatureStatic(wuher, true);
|
||||
// all bartenders should move around and do their job... nobody gets away with just standing around.
|
||||
// (removing setCreatureStatic to allow Wuher to move around.)
|
||||
// setCreatureStatic(wuher, true);
|
||||
setInvulnerable(wuher, true);
|
||||
setYaw(wuher, 47);
|
||||
ai_lib.setDefaultCalmMood(wuher, "npc_imperial");
|
||||
|
||||
Reference in New Issue
Block a user