Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarSongbook.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2025-04-26 03:48:26 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2025-04-26 03:48:26 +1000
commit87751c5a84925cbd9d630c65738e0e77b01a66f0 (patch)
tree9ecfd6479a14fef5916b5dafa056f4d360757e39 /source/game/StarSongbook.cpp
parent6369ba9ec72f097d8cc9ab06bed0c6816da516c8 (diff)
songbook Lua bindings, give NPCs songbooks
Diffstat (limited to 'source/game/StarSongbook.cpp')
-rw-r--r--source/game/StarSongbook.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/source/game/StarSongbook.cpp b/source/game/StarSongbook.cpp
index 68db655..72f2b2b 100644
--- a/source/game/StarSongbook.cpp
+++ b/source/game/StarSongbook.cpp
@@ -158,7 +158,7 @@ void Songbook::render(RenderCallback* renderCallback) {
m_pendingAudio.clear();
}
-void Songbook::keepalive(String const& instrument, Vec2F const& position) {
+void Songbook::keepAlive(String const& instrument, Vec2F const& position) {
if (instrument != m_instrument) {
m_instrument = instrument;
m_dataUpdated = true;
@@ -681,11 +681,11 @@ void Songbook::play(Json const& song, String const& timeSource) {
m_activeCooldown = 3;
}
-bool Songbook::active() {
+bool Songbook::active() const {
return m_activeCooldown > 0;
}
-bool Songbook::instrumentPlaying() {
+bool Songbook::instrumentPlaying() const {
if (!active())
return false;
if (m_timeSourceInstance) {
@@ -698,6 +698,18 @@ bool Songbook::instrumentPlaying() {
return false;
}
+Maybe<String> Songbook::timeSource() const {
+ return m_timeSource;
+}
+
+Maybe<String> Songbook::instrument() const {
+ return m_instrument;
+}
+
+Json Songbook::song() const {
+ return m_song;
+}
+
double Songbook::fundamentalFrequency(double p) {
return 55.0 * pow(2.0, (p - 69.0) / 12.0 + 3.0);
}