fix an issue with desyncs (somewhat)

dont you ever use mo.skin without it being just the player skin
This commit is contained in:
haya_underscore authored and haya3218 committed 2022-11-12 10:20:58 +08:00
1 parent 37d72b4680
commit a47d965b82
1 file changed
+7 -3
+7 -3
View File
@@ -17,6 +17,7 @@
#include "p_local.h"
#include "g_game.h"
#include "p_setup.h"
#include "doomdef.h"
#include "lua_script.h"
#include "lua_libs.h"
@@ -244,7 +245,7 @@ static int mobj_get(lua_State *L)
case mobj_skin: // skin name or nil, not struct
if (!mo->skin)
return 0;
if (mo->localskin) // only do this for demos
if (mo->localskin) // pretty cool, but also destructive
lua_pushstring(L, ((skin_t *)mo->localskin)->name);
else
lua_pushstring(L, ((skin_t *)mo->skin)->name);
@@ -521,13 +522,16 @@ static int mobj_set(lua_State *L)
char skin[SKINNAMESIZE+1]; // all skin names are limited to this length
strlcpy(skin, luaL_checkstring(L, 3), sizeof skin);
strlwr(skin); // all skin names are lowercase
for (i = 0; i < numskins; i++)
for (i = 0; i < numskins; i++) {
if (fastcmp(skins[i].name, skin))
{
mo->skin = &skins[i];
return 0;
}
return luaL_error(L, "mobj.skin '%s' not found!", skin);
}
mo->skin = &skins[players[consoleplayer].skin]; // we dont want to use our local skin for this!!!!!!!!!
return 0;
}
case mobj_color:
{