mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add warning for initial properties directly inside definition (#9650)
This commit is contained in:
parent
98f097dc2f
commit
c6a0ead72d
7 changed files with 95 additions and 5 deletions
|
@ -195,6 +195,43 @@ void push_item_definition_full(lua_State *L, const ItemDefinition &i)
|
|||
lua_setfield(L, -2, "node_placement_prediction");
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
const std::array<const char *, 33> object_property_keys = {
|
||||
"hp_max",
|
||||
"breath_max",
|
||||
"physical",
|
||||
"collide_with_objects",
|
||||
"collisionbox",
|
||||
"selectionbox",
|
||||
"pointable",
|
||||
"visual",
|
||||
"mesh",
|
||||
"visual_size",
|
||||
"textures",
|
||||
"colors",
|
||||
"spritediv",
|
||||
"initial_sprite_basepos",
|
||||
"is_visible",
|
||||
"makes_footstep_sound",
|
||||
"stepheight",
|
||||
"eye_height",
|
||||
"automatic_rotate",
|
||||
"automatic_face_movement_dir",
|
||||
"backface_culling",
|
||||
"glow",
|
||||
"nametag",
|
||||
"nametag_color",
|
||||
"automatic_face_movement_max_rotation_per_sec",
|
||||
"infotext",
|
||||
"static_save",
|
||||
"wield_item",
|
||||
"zoom_fov",
|
||||
"use_texture_alpha",
|
||||
"shaded",
|
||||
"damage_texture_modifier",
|
||||
"show_on_minimap"
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
void read_object_properties(lua_State *L, int index,
|
||||
ServerActiveObject *sao, ObjectProperties *prop, IItemDefManager *idef)
|
||||
|
@ -362,6 +399,9 @@ void read_object_properties(lua_State *L, int index,
|
|||
getboolfield(L, -1, "show_on_minimap", prop->show_on_minimap);
|
||||
|
||||
getstringfield(L, -1, "damage_texture_modifier", prop->damage_texture_modifier);
|
||||
|
||||
// Remember to update object_property_keys above
|
||||
// when adding a new property
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -459,6 +499,9 @@ void push_object_properties(lua_State *L, ObjectProperties *prop)
|
|||
lua_setfield(L, -2, "damage_texture_modifier");
|
||||
lua_pushboolean(L, prop->show_on_minimap);
|
||||
lua_setfield(L, -2, "show_on_minimap");
|
||||
|
||||
// Remember to update object_property_keys above
|
||||
// when adding a new property
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -33,6 +33,7 @@ extern "C" {
|
|||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
|
||||
#include "irrlichttypes_bloated.h"
|
||||
#include "util/string.h"
|
||||
|
@ -71,6 +72,9 @@ struct collisionMoveResult;
|
|||
|
||||
extern struct EnumString es_TileAnimationType[];
|
||||
|
||||
|
||||
extern const std::array<const char *, 33> object_property_keys;
|
||||
|
||||
void read_content_features (lua_State *L, ContentFeatures &f,
|
||||
int index);
|
||||
void push_content_features (lua_State *L,
|
||||
|
@ -118,6 +122,7 @@ void read_object_properties (lua_State *L, int index,
|
|||
ServerActiveObject *sao,
|
||||
ObjectProperties *prop,
|
||||
IItemDefManager *idef);
|
||||
|
||||
void push_object_properties (lua_State *L,
|
||||
ObjectProperties *prop);
|
||||
|
||||
|
|
|
@ -177,7 +177,8 @@ void log_deprecated(lua_State *L, std::string message, int stack_depth)
|
|||
if (mode == DeprecatedHandlingMode::Ignore)
|
||||
return;
|
||||
|
||||
script_log_add_source(L, message, stack_depth);
|
||||
if (stack_depth >= 0)
|
||||
script_log_add_source(L, message, stack_depth);
|
||||
warningstream << message << std::endl;
|
||||
|
||||
if (mode == DeprecatedHandlingMode::Error)
|
||||
|
|
|
@ -147,7 +147,8 @@ DeprecatedHandlingMode get_deprecated_handling_mode();
|
|||
*
|
||||
* @param L Lua State
|
||||
* @param message The deprecation method
|
||||
* @param stack_depth How far on the stack to the first user function (ie: not builtin or core)
|
||||
* @param stack_depth How far on the stack to the first user function
|
||||
* (ie: not builtin or core). -1 to disabled.
|
||||
*/
|
||||
void log_deprecated(lua_State *L, std::string message, int stack_depth = 1);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue