From c6a1d9880f8d0b32c3399d3f9b7cc848aed271d0 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Sun, 23 Jul 2023 22:54:34 +1000 Subject: [PATCH] Add DanceDatabase fallback fixes being crashed when another player uses a modded dance --- assets/assetmissing/assetmissing.dance | 11 +++++++++++ source/game/StarDanceDatabase.cpp | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 assets/assetmissing/assetmissing.dance 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) {