mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-02-03 18:07:53 +01:00
Read scriptName property from JSON
Use object identifier if no scriptName is provided
This commit is contained in:
@@ -104,6 +104,17 @@ void PeepAnimationsObject::ReadJson(IReadObjectContext* context, json_t& root)
|
||||
}
|
||||
}
|
||||
|
||||
// Do we have a preferred way of addressing this object in scripts?
|
||||
if (groupJson.contains("scriptName"))
|
||||
{
|
||||
group.scriptName = Json::GetString(groupJson["scriptName"]);
|
||||
}
|
||||
// If not, just use the object identifier.
|
||||
else
|
||||
{
|
||||
group.scriptName = GetIdentifier();
|
||||
}
|
||||
|
||||
_animationGroups.push_back(group);
|
||||
}
|
||||
}
|
||||
@@ -143,6 +154,11 @@ PeepAnimationGroup PeepAnimationsObject::GetLegacyPosition(PeepAnimationGroup an
|
||||
return _animationGroups[EnumValue(animGroup)].legacyPosition;
|
||||
}
|
||||
|
||||
std::string_view PeepAnimationsObject::GetScriptName(PeepAnimationGroup animGroup) const
|
||||
{
|
||||
return _animationGroups[EnumValue(animGroup)].scriptName;
|
||||
}
|
||||
|
||||
void PeepAnimationsObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
auto centre = ScreenCoordsXY{ width / 2, height / 2 };
|
||||
|
||||
Reference in New Issue
Block a user