mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
Breath cheat fix: server side
Breath is now handled server side. Changing this behaviour required some modifications to core: * Ignore TOSERVER_BREATH package, marking it as obsolete * Clients doesn't send the breath to server anymore * Use PlayerSAO pointer instead of peer_id in Server::SendPlayerBreath to prevent a useless lookup (little perf gain) * drop a useless static_cast in emergePlayer
This commit is contained in:
@@ -1152,13 +1152,8 @@ int ObjectRef::l_set_breath(lua_State *L)
|
||||
PlayerSAO* co = getplayersao(ref);
|
||||
if (co == NULL) return 0;
|
||||
u16 breath = luaL_checknumber(L, 2);
|
||||
// Do it
|
||||
co->setBreath(breath);
|
||||
|
||||
// If the object is a player sent the breath to client
|
||||
if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER)
|
||||
getServer(L)->SendPlayerBreath(((PlayerSAO*)co)->getPeerID());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user