mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Use place_param2 client-side for item appearance & prediction (#11024)
This commit is contained in:
parent
a21402b38f
commit
bf8fb2672e
5 changed files with 51 additions and 35 deletions
|
@ -71,13 +71,11 @@ ItemDefinition& ItemDefinition::operator=(const ItemDefinition &def)
|
|||
stack_max = def.stack_max;
|
||||
usable = def.usable;
|
||||
liquids_pointable = def.liquids_pointable;
|
||||
if(def.tool_capabilities)
|
||||
{
|
||||
tool_capabilities = new ToolCapabilities(
|
||||
*def.tool_capabilities);
|
||||
}
|
||||
if (def.tool_capabilities)
|
||||
tool_capabilities = new ToolCapabilities(*def.tool_capabilities);
|
||||
groups = def.groups;
|
||||
node_placement_prediction = def.node_placement_prediction;
|
||||
place_param2 = def.place_param2;
|
||||
sound_place = def.sound_place;
|
||||
sound_place_failed = def.sound_place_failed;
|
||||
range = def.range;
|
||||
|
@ -120,8 +118,8 @@ void ItemDefinition::reset()
|
|||
sound_place = SimpleSoundSpec();
|
||||
sound_place_failed = SimpleSoundSpec();
|
||||
range = -1;
|
||||
|
||||
node_placement_prediction = "";
|
||||
place_param2 = 0;
|
||||
}
|
||||
|
||||
void ItemDefinition::serialize(std::ostream &os, u16 protocol_version) const
|
||||
|
@ -166,6 +164,8 @@ void ItemDefinition::serialize(std::ostream &os, u16 protocol_version) const
|
|||
os << serializeString16(wield_overlay);
|
||||
|
||||
os << serializeString16(short_description);
|
||||
|
||||
os << place_param2;
|
||||
}
|
||||
|
||||
void ItemDefinition::deSerialize(std::istream &is)
|
||||
|
@ -219,6 +219,8 @@ void ItemDefinition::deSerialize(std::istream &is)
|
|||
// block to not need to increase the version.
|
||||
try {
|
||||
short_description = deSerializeString16(is);
|
||||
|
||||
place_param2 = readU8(is); // 0 if missing
|
||||
} catch(SerializationError &e) {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue