Fixing dorm script bugs
This commit is contained in:
1 parent
07f45ad1e1
commit
7dadfd8ed8
6 files changed
+45
-32
No files matched your search
@@ -150,6 +150,17 @@ void Character::setTarget(const Eigen::Vector3f& target, std::function<void()> o
|
||||
state.walkTarget = normalizedTarget;
|
||||
}
|
||||
|
||||
void Character::stopAndRotateToTarget(int npcId)
|
||||
{
|
||||
state.onArrivedCallback = nullptr;
|
||||
state.onArrivedCallbackName = "";
|
||||
state.walkTarget = state.position;
|
||||
state.requestedWalkTarget = state.position;
|
||||
state.faceTargetIndex = npcId;
|
||||
state.pathWaypoints.clear();
|
||||
state.currentWaypointIndex = 0;
|
||||
}
|
||||
|
||||
void Character::setPathPlanner(PathPlanner planner) {
|
||||
pathPlanner = std::move(planner);
|
||||
}
|
||||
|
||||
@@ -55,6 +55,8 @@ public:
|
||||
// callbackName, if given, is the global Lua function name backing onArrived —
|
||||
// stored in state.onArrivedCallbackName so it survives save/load (see ScriptEngine::rehydrateNamedCallback).
|
||||
void setTarget(const Eigen::Vector3f& target, std::function<void()> onArrived = nullptr, std::string callbackName = "");
|
||||
void stopAndRotateToTarget(int npcId);
|
||||
|
||||
void forceReplan();
|
||||
void stopInPlace() { state.stopInPlace(); }
|
||||
|
||||
|
||||
@@ -802,37 +802,6 @@ namespace ZL
|
||||
CheckGlError(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
/*void Game::drawMobilePortraitOverlay()
|
||||
{
|
||||
if (!mobileRotateTexture) return;
|
||||
|
||||
const float W = Environment::projectionWidth;
|
||||
const float H = Environment::projectionHeight;
|
||||
|
||||
if (W != mobileRotateMeshLastW || H != mobileRotateMeshLastH) {
|
||||
mobileRotateMeshLastW = W;
|
||||
mobileRotateMeshLastH = H;
|
||||
const float minDim = min(W, H);
|
||||
mobileRotateMesh.data = CreateRect2D({ 0.f, 0.f }, { minDim * 0.5f, minDim * 0.5f }, 3.f);
|
||||
mobileRotateMesh.RefreshVBO();
|
||||
}
|
||||
|
||||
renderer.shaderManager.PushShader(defaultShaderName);
|
||||
renderer.RenderUniform1i(textureUniformName, 0);
|
||||
renderer.RenderUniform1f("uAlpha", 1.0f);
|
||||
renderer.PushProjectionMatrix(-W * 0.5f, W * 0.5f, -H * 0.5f, H * 0.5f, -10, 10);
|
||||
renderer.PushMatrix();
|
||||
renderer.LoadIdentity();
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, mobileRotateTexture->getTexID());
|
||||
renderer.DrawVertexRenderStruct(mobileRotateMesh);
|
||||
|
||||
renderer.PopMatrix();
|
||||
renderer.PopProjectionMatrix();
|
||||
renderer.shaderManager.PopShader();
|
||||
CheckGlError(__FILE__, __LINE__);
|
||||
}*/
|
||||
|
||||
void Game::drawLoading()
|
||||
{
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
@@ -128,6 +128,11 @@ namespace ZL {
|
||||
npcs[index]->state.targetFacingAngle = rad;
|
||||
});
|
||||
|
||||
api.set_function("player_stop_and_rotate_to_npc",
|
||||
[loc](int index) {
|
||||
loc->player->stopAndRotateToTarget(index);
|
||||
});
|
||||
|
||||
api.set_function("player_walk_to",
|
||||
[loc, this_impl = impl.get()](float x, float y, float z, sol::object on_arrived) {
|
||||
|
||||
|
||||
Reference in new issue
Block a user