mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Consistent HP and damage types (#8167)
Remove deprecated HUDs and chat message handling. Remove unused m_damage variable (compat break). HP: s32 for setter/calculations, u16 for getter.
This commit is contained in:
parent
ba5a9f2b36
commit
ffb17f1c9a
25 changed files with 67 additions and 136 deletions
|
@ -44,11 +44,11 @@ void PlayerDatabaseFiles::serialize(std::ostringstream &os, RemotePlayer *player
|
|||
args.set("name", player->getName());
|
||||
|
||||
sanity_check(player->getPlayerSAO());
|
||||
args.setS32("hp", player->getPlayerSAO()->getHP());
|
||||
args.setU16("hp", player->getPlayerSAO()->getHP());
|
||||
args.setV3F("position", player->getPlayerSAO()->getBasePosition());
|
||||
args.setFloat("pitch", player->getPlayerSAO()->getLookPitch());
|
||||
args.setFloat("yaw", player->getPlayerSAO()->getRotation().Y);
|
||||
args.setS32("breath", player->getPlayerSAO()->getBreath());
|
||||
args.setU16("breath", player->getPlayerSAO()->getBreath());
|
||||
|
||||
std::string extended_attrs;
|
||||
player->serializeExtraAttributes(extended_attrs);
|
||||
|
|
|
@ -553,7 +553,7 @@ bool PlayerDatabasePostgreSQL::loadPlayer(RemotePlayer *player, PlayerSAO *sao)
|
|||
pg_to_float(results, 0, 3),
|
||||
pg_to_float(results, 0, 4))
|
||||
);
|
||||
sao->setHPRaw((s16) pg_to_int(results, 0, 5));
|
||||
sao->setHPRaw((u16) pg_to_int(results, 0, 5));
|
||||
sao->setBreath((u16) pg_to_int(results, 0, 6), false);
|
||||
|
||||
PQclear(results);
|
||||
|
|
|
@ -546,7 +546,7 @@ bool PlayerDatabaseSQLite3::loadPlayer(RemotePlayer *player, PlayerSAO *sao)
|
|||
sao->setLookPitch(sqlite_to_float(m_stmt_player_load, 0));
|
||||
sao->setPlayerYaw(sqlite_to_float(m_stmt_player_load, 1));
|
||||
sao->setBasePosition(sqlite_to_v3f(m_stmt_player_load, 2));
|
||||
sao->setHPRaw((s16) MYMIN(sqlite_to_int(m_stmt_player_load, 5), S16_MAX));
|
||||
sao->setHPRaw((u16) MYMIN(sqlite_to_int(m_stmt_player_load, 5), U16_MAX));
|
||||
sao->setBreath((u16) MYMIN(sqlite_to_int(m_stmt_player_load, 6), U16_MAX), false);
|
||||
sqlite3_reset(m_stmt_player_load);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue