Fixing dorm script bugs
This commit is contained in:
parent
07f45ad1e1
commit
7dadfd8ed8
@ -25,6 +25,7 @@ function on_npc_interact(npc_index)
|
||||
else
|
||||
game_api.start_dialogue("dialog_alik001")
|
||||
end]]
|
||||
game_api.player_stop_and_rotate_to_npc(0)
|
||||
game_api.start_dialogue("dialog_alik002")
|
||||
end
|
||||
end
|
||||
@ -35,6 +36,7 @@ function on_phone_pickup()
|
||||
game_api.start_dialogue("dialog_phone_pickup001")
|
||||
phone_picked_up = true
|
||||
game_api.quest_set_objective_completed("tutorial_take_items", "take_phone")
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function on_journal_pickup()
|
||||
@ -43,6 +45,7 @@ function on_journal_pickup()
|
||||
game_api.start_dialogue("dialog_journal_pickup001")
|
||||
journal_picked_up = true
|
||||
game_api.quest_set_objective_completed("tutorial_take_items", "take_journal")
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function ladder_zone001_enter_callback()
|
||||
@ -77,16 +80,19 @@ function on_bed_sleep()
|
||||
print("Setting to day 1----x")
|
||||
game_api.play_sound("audio/587036__antoineromo__bed-sheets.ogg")
|
||||
end
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function on_alik_bathroom_click()
|
||||
game_api.start_dialogue("door_bathroom_alik_dialog001")
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function on_locked_door_click()
|
||||
game_api.start_dialogue("door_locked_dialog001")
|
||||
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||
--game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function on_sleep_cutscene()
|
||||
@ -103,6 +109,7 @@ function on_alik_door_click()
|
||||
game_api.start_dialogue("door_alik_dialog001")
|
||||
end
|
||||
end
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function callback_deactivate_cover_alik_room()
|
||||
@ -178,6 +185,8 @@ function on_player_bathroom_click()
|
||||
end
|
||||
|
||||
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||
|
||||
game_api.player_stop()
|
||||
end
|
||||
end
|
||||
|
||||
@ -203,6 +212,7 @@ function on_player_door_click()
|
||||
game_api.switch_navigation(2) --ba
|
||||
end
|
||||
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||
game_api.player_stop()
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -270,38 +280,47 @@ end
|
||||
|
||||
function on_freezer_click()
|
||||
game_api.start_dialogue("dialog_freezer001")
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function on_boombox_click()
|
||||
game_api.start_dialogue("dialog_boombox001")
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function on_washing_machine1_click()
|
||||
game_api.start_dialogue("dialog_washing_machine001")
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function on_shelf_click()
|
||||
game_api.start_dialogue("dialog_shelf001")
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function on_stove1_click()
|
||||
game_api.start_dialogue("dialog_stove001")
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function on_dryer1_click()
|
||||
game_api.start_dialogue("dialog_dryer001")
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function on_sink1_click()
|
||||
game_api.start_dialogue("dialog_wash001")
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function on_shower_click()
|
||||
game_api.start_dialogue("dialog_shower001")
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function on_toilet_click()
|
||||
game_api.start_dialogue("dialog_toilet001")
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function callback_enter_location()
|
||||
|
||||
@ -655,7 +655,14 @@ end
|
||||
|
||||
function on_lection_cutscene_fadein_callback()
|
||||
print("Lection cutscene in progress!")
|
||||
game_api.player_set_position(-2.41002, 0, 10.375)
|
||||
-- -0.0234149 0 10.1139
|
||||
game_api.npc_set_position(0, 0.0, 0.0, 10.1139)
|
||||
|
||||
--4.91002 0 10.375
|
||||
--game_api.player_set_position(-2.41002, 0, 10.375)
|
||||
|
||||
game_api.player_set_position(-4.91, 0, 10.375)
|
||||
|
||||
game_api.player_set_rotation(180)
|
||||
end
|
||||
|
||||
|
||||
@ -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(); }
|
||||
|
||||
|
||||
31
src/Game.cpp
31
src/Game.cpp
@ -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) {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user