AiTechEye / xaenvironment

9 stars 4 forks source link

player_style mod crash #22

Closed MoNTE48 closed 1 year ago

MoNTE48 commented 1 year ago

ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'player_style' in callback on_joinplayer(): ...ame/files/games/xaenvironment/mods/player_style/init.lua:338: attempt to call method 'set_lighting' (a nil value) stack traceback: ...ame/files/games/xaenvironment/mods/player_style/init.lua:338: in function 'set_profile' ...ame/files/games/xaenvironment/mods/player_style/init.lua:331: in function <...ame/files/games/xaenvironment/mods/player_style/init.lua:330> ...er/0/com.multicraft.game/files/builtin/game/register.lua:441: in function <...er/0/com.multicraft.game/files/builtin/game/register.lua:425>

https://github.com/AiTechEye/xaenvironment/commit/a140628052e84ece84d5f12fe94ecca329b38ec0

MoNTE48 commented 1 year ago

I see that set_lighting() is MT 5.6 API. Maybe there is some way to check that player does not have this parameter? @luk3yx can you suggest something like a metatable check?

luk3yx commented 1 year ago

I see that set_lighting() is MT 5.6 API. Maybe there is some way to check that player does not have this parameter? @luk3yx can you suggest something like a metatable check?

If support for MT 5.5 and earlier is still desired then the set_lighting code could be changed to this:

    if player.set_lighting then
        player:set_lighting({shadows={intensity=0.1}})
    end
AiTechEye commented 1 year ago

f76b6ea fixed & thanks for reporting & tips :)