1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-15 14:09:06 +00:00

Add Lua func entity_getSkeletalName() and do not abort when a skin file is not found. Also warn on missing skeletal file.

This commit is contained in:
fgenesis 2013-02-27 01:54:38 +01:00
parent aa60f7cac2
commit 23e0707c5b
2 changed files with 12 additions and 1 deletions

View file

@ -3369,6 +3369,15 @@ luaFunc(entity_loadSkin)
luaReturnNil(); luaReturnNil();
} }
luaFunc(entity_getSkeletalName)
{
Entity *e = entity(L);
const char *s = "";
if (e && e->skeletalSprite.isLoaded())
s = e->skeletalSprite.filenameLoaded.c_str();
luaReturnStr(s);
}
luaFunc(entity_idle) luaFunc(entity_idle)
{ {
Entity *e = entity(L); Entity *e = entity(L);
@ -7652,6 +7661,7 @@ static const struct {
luaRegister(entity_warpSegments), luaRegister(entity_warpSegments),
luaRegister(entity_initSkeletal), luaRegister(entity_initSkeletal),
luaRegister(entity_loadSkin), luaRegister(entity_loadSkin),
luaRegister(entity_getSkeletalName),
luaRegister(entity_initStrands), luaRegister(entity_initStrands),
luaRegister(entity_hurtTarget), luaRegister(entity_hurtTarget),

View file

@ -1172,7 +1172,7 @@ void SkeletalSprite::loadSkin(const std::string &fn)
file = core->adjustFilenameCase(file); file = core->adjustFilenameCase(file);
if (!exists(file,1)) if (!exists(file))
{ {
errorLog("Could not load skin[" + file + "]"); errorLog("Could not load skin[" + file + "]");
return; return;
@ -1304,6 +1304,7 @@ void SkeletalSprite::loadSkeletal(const std::string &fn)
if (!exists(file)) if (!exists(file))
{ {
filenameLoaded = ""; filenameLoaded = "";
errorLog("Could not load skeletal[" + file + "]");
return; return;
} }