diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-23 22:54:34 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-23 22:54:34 +1000 |
commit | c6a1d9880f8d0b32c3399d3f9b7cc848aed271d0 (patch) | |
tree | 05af604273b0de6c806fbb72146783ce212bcc28 | |
parent | 3b8ea95d61a714eaee72978c67c4890774396fa3 (diff) |
Add DanceDatabase fallback
fixes being crashed when another player uses a modded dance
-rw-r--r-- | assets/assetmissing/assetmissing.dance | 11 | ||||
-rw-r--r-- | source/game/StarDanceDatabase.cpp | 7 |
2 files changed, 17 insertions, 1 deletions
diff --git a/assets/assetmissing/assetmissing.dance b/assets/assetmissing/assetmissing.dance new file mode 100644 index 0000000..6070b60 --- /dev/null +++ b/assets/assetmissing/assetmissing.dance @@ -0,0 +1,11 @@ +{ + "name" : "assetmissing", + "states" : ["idle","sit"], + "cycle" : 0.5, + "cyclic" : true, + "duration" : 1.0, + "steps" : [ + // body, frontArm, backArm, headOffset, frontArmOffset, backArmOffset + [ "idle.1", "rotation?flipx", "rotation", [0, 0], [-6, 0], [0, 0] ] + ] +}
\ No newline at end of file diff --git a/source/game/StarDanceDatabase.cpp b/source/game/StarDanceDatabase.cpp index 3ad2277..2e81fe5 100644 --- a/source/game/StarDanceDatabase.cpp +++ b/source/game/StarDanceDatabase.cpp @@ -17,7 +17,12 @@ DanceDatabase::DanceDatabase() { } DancePtr DanceDatabase::getDance(String const& name) const { - return m_dances.get(name); + if (auto dance = m_dances.ptr(name)) + return *dance; + else { + Logger::error("Invalid dance '{}', using default", name); + return m_dances.get("assetmissing"); + } } DancePtr DanceDatabase::readDance(String const& path) { |