1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Updates to the Python API

Throw away some stupid stuff and make things slightly easier to use...
This commit is contained in:
2012-05-07 23:17:46 -04:00
parent 3b69a4aee3
commit 5cf540b424
7 changed files with 34 additions and 49 deletions

View File

@ -1952,10 +1952,10 @@ hsBool plArmatureMod::IsLocalAvatar()
hsBool plArmatureMod::IsLocalAI()
{
plAvBrainCritter* ai = plAvBrainCritter::ConvertNoRef(FindBrainByClass(plAvBrainCritter::Index()));
if (ai)
return ai->LocallyControlled();
return false; // not an AI, obviously not local
// Formerly a lot of silly cached rigamaroll... Now, we'll just rely
// on the fact that one player is the game master. HACK TURD if net groups
// are ever brought back.
return plNetClientApp::GetInstance()->IsLocallyOwned(this);
}
void plArmatureMod::SynchIfLocal(double timeNow, int force)

View File

@ -126,7 +126,7 @@ protected:
///////////////////////////////////////////////////////////////////////////////
plAvBrainCritter::plAvBrainCritter(): fCallbackAction(nil), fCurMode(kIdle), fNextMode(kIdle), fFadingNextBehavior(true),
fLocallyControlled(false), fAvoidingAvatars(false), fFinalGoalPos(0, 0, 0), fImmediateGoalPos(0, 0, 0), fDotGoal(0),
fAvoidingAvatars(false), fFinalGoalPos(0, 0, 0), fImmediateGoalPos(0, 0, 0), fDotGoal(0),
fAngRight(0)
{
SightCone(M_PI/2); // 90deg
@ -229,6 +229,13 @@ void plAvBrainCritter::Resume()
plArmatureBrain::Resume();
}
plSceneObject* plAvBrainCritter::GetTarget() const
{
if (fArmature)
return fArmature->GetTarget(0);
return nil;
}
void plAvBrainCritter::AddBehavior(const std::string& animationName, const std::string& behaviorName, bool loop /* = true */, bool randomStartPos /* = true */,
float fadeInLen /* = 2.f */, float fadeOutLen /* = 2.f */)
{

View File

@ -83,13 +83,20 @@ public:
virtual void Suspend();
virtual void Resume();
/**
* Gets the SceneObject root for this avatar
*
* This is most useful in scripts that need to act upon the SceneObject directly.
* There are other ways of obtaining the SceneObject, but network synchronization often
* makes those ways more difficult than they need to be, so we have included this method
* to make the scripter's life easier.
*/
plSceneObject* GetTarget() const;
void AddBehavior(const std::string& animationName, const std::string& behaviorName, bool loop = true, bool randomStartPos = true,
float fadeInLen = 2.f, float fadeOutLen = 2.f);
void StartBehavior(const std::string& behaviorName, bool fade = true);
bool RunningBehavior(const std::string& behaviorName) const;
void LocallyControlled(bool local) {fLocallyControlled = local;}
bool LocallyControlled() const {return fLocallyControlled;}
std::string BehaviorName(int behavior) const;
plString AnimationName(int behavior) const;
@ -157,8 +164,6 @@ protected:
int fNextMode; // the next behavior to run (-1 if we aren't switching on next eval)
bool fFadingNextBehavior; // is the next behavior supposed to blend?
bool fLocallyControlled; // is our local AI script the one making all the choices?
bool fAvoidingAvatars; // are we avoiding avatars to the best of our ability when pathfinding?
hsPoint3 fFinalGoalPos; // the location we are pathfinding to
hsPoint3 fImmediateGoalPos; // the location of the point we are immediately going towards (not necessarily our final goal)