Working on fixing scripting bugs'
This commit is contained in:
1 parent
7dadfd8ed8
commit
8e745ce0cd
8 files changed
+119
-71
No files matched your search
+3
-5
@@ -16,6 +16,7 @@
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef EMSCRIPTEN
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
@@ -1163,11 +1164,8 @@ namespace ZL
|
||||
case SDLK_k:
|
||||
x = x - 1;
|
||||
std::cout << "current x: " << x << std::endl;
|
||||
//y = y + 1;
|
||||
//std::cout << "current y: " << y << std::endl;
|
||||
//y = y - 0.002;
|
||||
|
||||
std::cout << "Player pos: " << currentLocation()->player->state.position.transpose() << std::endl;
|
||||
std::cout << "Player rotation: " << currentLocation()->player->state.facingAngle*180.0/M_PI << std::endl;
|
||||
//currentLocation->npcs[0]->walkSpeed -= 0.01f;
|
||||
//std::cout << "Walk speed: " << currentLocation->npcs[0]->walkSpeed << std::endl;
|
||||
break;
|
||||
@@ -1515,7 +1513,6 @@ namespace ZL
|
||||
|
||||
bool Game::startDarklandsTransition()
|
||||
{
|
||||
audioPlayer->playSoundAsync("audio/459618__n-lerche__blow.ogg");
|
||||
if (!gameState.isNight)
|
||||
{
|
||||
currentLocation()->dialogueSystem.startDialogue("darklands_day_dialog001");
|
||||
@@ -1528,6 +1525,7 @@ namespace ZL
|
||||
return false;
|
||||
}
|
||||
|
||||
audioPlayer->playSoundAsync("audio/459618__n-lerche__blow.ogg");
|
||||
if (darklandsFlashActive) return false;
|
||||
darklandsFlashActive = true;
|
||||
darklandsFlashFadingIn = true;
|
||||
|
||||
@@ -128,11 +128,29 @@ namespace ZL {
|
||||
npcs[index]->state.targetFacingAngle = rad;
|
||||
});
|
||||
|
||||
api.set_function("player_rotate_to",
|
||||
[loc](float angle) {
|
||||
const float rad = angle * static_cast<float>(M_PI) / 180.f;
|
||||
std::cout << "[script] player_rotate_to: angle " << angle << " degrees (" << rad << " radians)" << std::endl;
|
||||
loc->player->state.targetFacingAngle = rad;
|
||||
});
|
||||
|
||||
api.set_function("player_stop_and_rotate_to_npc",
|
||||
[loc](int index) {
|
||||
loc->player->stopAndRotateToTarget(index);
|
||||
});
|
||||
|
||||
api.set_function("npc_stop_and_rotate_to_player",
|
||||
[loc](int index) {
|
||||
auto& npcs = loc->npcs;
|
||||
if (index < 0 || index >= static_cast<int>(npcs.size())) {
|
||||
std::cerr << "[script] npc_stop_and_rotate_to_player: index " << index
|
||||
<< " out of range (0.." << npcs.size() - 1 << ")\n";
|
||||
return;
|
||||
}
|
||||
npcs[index]->stopAndRotateToTarget(CharacterState::kPlayerIndex);
|
||||
});
|
||||
|
||||
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