mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-01 04:33:02 +00:00
Expose public_key to Lua
This commit is contained in:
parent
66c6ba125d
commit
f2c66a2171
4 changed files with 9 additions and 4 deletions
|
|
@ -3716,8 +3716,11 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
|
|||
|
||||
players[newplayernum].splitscreenindex = splitscreenplayer;
|
||||
players[newplayernum].bot = false;
|
||||
|
||||
// player_t is the only place in the game that a key is null-terminated, for ease of Lua push.
|
||||
memset(players[newplayernum].public_key, 0, 32 + 1);
|
||||
CONS_Printf("Adding player from node %d with ID %s\n", node, GetPrettyRRID(lastReceivedKey[node][splitscreenplayer], true));
|
||||
memcpy(players[newplayernum].public_key, lastReceivedKey[node][splitscreenplayer], sizeof(players[newplayernum].public_key));
|
||||
memcpy(players[newplayernum].public_key, lastReceivedKey[node][splitscreenplayer], 32);
|
||||
CONS_Printf("Node %d now has ID %s\n", node, GetPrettyRRID(players[newplayernum].public_key, true));
|
||||
|
||||
playerconsole[newplayernum] = console;
|
||||
|
|
|
|||
|
|
@ -713,7 +713,7 @@ struct player_t
|
|||
mobj_t *stumbleIndicator;
|
||||
mobj_t *sliptideZipIndicator;
|
||||
|
||||
uint8_t public_key[32];
|
||||
uint8_t public_key[32 + 1];
|
||||
|
||||
#ifdef HWRENDER
|
||||
fixed_t fovadd; // adjust FOV for hw rendering
|
||||
|
|
|
|||
|
|
@ -507,6 +507,8 @@ static int player_get(lua_State *L)
|
|||
#endif
|
||||
else if (fastcmp(field,"ping"))
|
||||
lua_pushinteger(L, playerpingtable[( plr - players )]);
|
||||
else if (fastcmp(field, "public_key"))
|
||||
lua_pushstring(L, plr->public_key);
|
||||
else {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
|||
WRITEUINT8(save->p, players[i].sliptideZipDelay);
|
||||
WRITEUINT16(save->p, players[i].sliptideZipBoost);
|
||||
|
||||
WRITESTRINGN(save->p, players[i].public_key, 32);
|
||||
WRITESTRINGN(save->p, players[i].public_key, 32 + 1);
|
||||
|
||||
// respawnvars_t
|
||||
WRITEUINT8(save->p, players[i].respawn.state);
|
||||
|
|
@ -789,7 +789,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
|||
players[i].sliptideZipDelay = READUINT8(save->p);
|
||||
players[i].sliptideZipBoost = READUINT16(save->p);
|
||||
|
||||
READSTRINGN(save->p, players[i].public_key, 32);
|
||||
READSTRINGN(save->p, players[i].public_key, 32 + 1);
|
||||
|
||||
// respawnvars_t
|
||||
players[i].respawn.state = READUINT8(save->p);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue