1
0
Fork 0
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:
SmallJoker 2019-02-11 00:03:26 +01:00 committed by Paramat
parent ba5a9f2b36
commit ffb17f1c9a
25 changed files with 67 additions and 136 deletions

View file

@ -169,24 +169,6 @@ void ScriptApiEntity::luaentity_GetProperties(u16 id,
// Set default values that differ from ObjectProperties defaults
prop->hp_max = 10;
/* Read stuff */
prop->hp_max = getintfield_default(L, -1, "hp_max", 10);
getboolfield(L, -1, "physical", prop->physical);
getboolfield(L, -1, "collide_with_objects", prop->collideWithObjects);
getfloatfield(L, -1, "weight", prop->weight);
lua_getfield(L, -1, "collisionbox");
if (lua_istable(L, -1))
prop->collisionbox = read_aabb3f(L, -1, 1.0);
lua_pop(L, 1);
getstringfield(L, -1, "visual", prop->visual);
getstringfield(L, -1, "mesh", prop->mesh);
// Deprecated: read object properties directly
read_object_properties(L, -1, prop, getServer()->idef());

View file

@ -77,8 +77,8 @@ bool ScriptApiPlayer::on_punchplayer(ServerActiveObject *player,
return readParam<bool>(L, -1);
}
s16 ScriptApiPlayer::on_player_hpchange(ServerActiveObject *player,
s16 hp_change, const PlayerHPChangeReason &reason)
s32 ScriptApiPlayer::on_player_hpchange(ServerActiveObject *player,
s32 hp_change, const PlayerHPChangeReason &reason)
{
SCRIPTAPI_PRECHECKHEADER

View file

@ -46,7 +46,7 @@ public:
bool on_punchplayer(ServerActiveObject *player, ServerActiveObject *hitter,
float time_from_last_punch, const ToolCapabilities *toolcap,
v3f dir, s16 damage);
s16 on_player_hpchange(ServerActiveObject *player, s16 hp_change,
s32 on_player_hpchange(ServerActiveObject *player, s32 hp_change,
const PlayerHPChangeReason &reason);
void on_playerReceiveFields(ServerActiveObject *player,
const std::string &formname, const StringMap &fields);