Fix nodeplacement prediction

stable-0.4
PilzAdam 2013-02-27 20:23:32 +01:00
parent d31f07bd4b
commit 0183bdad04
3 changed files with 5 additions and 8 deletions

View File

@ -100,7 +100,6 @@ void ItemDefinition::reset()
wield_scale = v3f(1.0, 1.0, 1.0); wield_scale = v3f(1.0, 1.0, 1.0);
stack_max = 99; stack_max = 99;
usable = false; usable = false;
rightclickable = false;
liquids_pointable = false; liquids_pointable = false;
if(tool_capabilities) if(tool_capabilities)
{ {

View File

@ -62,8 +62,6 @@ struct ItemDefinition
*/ */
s16 stack_max; s16 stack_max;
bool usable; bool usable;
// If true, don't use node placement prediction
bool rightclickable;
bool liquids_pointable; bool liquids_pointable;
// May be NULL. If non-NULL, deleted by destructor // May be NULL. If non-NULL, deleted by destructor
ToolCapabilities *tool_capabilities; ToolCapabilities *tool_capabilities;

View File

@ -1063,10 +1063,6 @@ static ItemDefinition read_item_definition(lua_State *L, int index,
def.usable = lua_isfunction(L, -1); def.usable = lua_isfunction(L, -1);
lua_pop(L, 1); lua_pop(L, 1);
lua_getfield(L, index, "on_rightclick");
def.rightclickable = lua_isfunction(L, -1);
lua_pop(L, 1);
getboolfield(L, index, "liquids_pointable", def.liquids_pointable); getboolfield(L, index, "liquids_pointable", def.liquids_pointable);
warn_if_field_exists(L, index, "tool_digging_properties", warn_if_field_exists(L, index, "tool_digging_properties",
@ -1164,6 +1160,10 @@ static ContentFeatures read_content_features(lua_State *L, int index)
if(!lua_isnil(L, -1)) f.has_after_destruct = true; if(!lua_isnil(L, -1)) f.has_after_destruct = true;
lua_pop(L, 1); lua_pop(L, 1);
lua_getfield(L, index, "on_rightclick");
f.rightclickable = lua_isfunction(L, -1);
lua_pop(L, 1);
/* Name */ /* Name */
getstringfield(L, index, "name", f.name); getstringfield(L, index, "name", f.name);
@ -4751,7 +4751,7 @@ static int l_register_item_raw(lua_State *L)
// Default to having client-side placement prediction for nodes // Default to having client-side placement prediction for nodes
// ("" in item definition sets it off) // ("" in item definition sets it off)
if(def.node_placement_prediction == "__default"){ if(def.node_placement_prediction == "__default"){
if(def.type == ITEM_NODE && !def.rightclickable) if(def.type == ITEM_NODE)
def.node_placement_prediction = name; def.node_placement_prediction = name;
else else
def.node_placement_prediction = ""; def.node_placement_prediction = "";