From a47d965b82e45bcf600217899a2cd6951024093b Mon Sep 17 00:00:00 2001 From: haya_underscore Date: Wed, 5 Oct 2022 11:27:30 +0800 Subject: [PATCH] fix an issue with desyncs (somewhat) dont you ever use mo.skin without it being just the player skin --- src/lua_mobjlib.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 055f341c3..94791b514 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -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: {