Add DanceDatabase fallback
fixes being crashed when another player uses a modded dance
This commit is contained in:
parent
3b8ea95d61
commit
c6a1d9880f
11
assets/assetmissing/assetmissing.dance
Normal file
11
assets/assetmissing/assetmissing.dance
Normal file
@ -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] ]
|
||||
]
|
||||
}
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user