groups = def.groups;
node_placement_prediction = def.node_placement_prediction;
place_param2 = def.place_param2;
+ has_on_place = def.has_on_place;
+ has_on_secondary_use = def.has_on_secondary_use;
sound_place = def.sound_place;
sound_place_failed = def.sound_place_failed;
+ sound_use = def.sound_use;
+ sound_use_air = def.sound_use_air;
range = def.range;
palette_image = def.palette_image;
color = def.color;
void ItemDefinition::reset()
{
type = ITEM_NONE;
- name = "";
- description = "";
- short_description = "";
- inventory_image = "";
- inventory_overlay = "";
- wield_image = "";
- wield_overlay = "";
- palette_image = "";
+ name.clear();
+ description.clear();
+ short_description.clear();
+ inventory_image.clear();
+ inventory_overlay.clear();
+ wield_image.clear();
+ wield_overlay.clear();
+ palette_image.clear();
color = video::SColor(0xFFFFFFFF);
wield_scale = v3f(1.0, 1.0, 1.0);
stack_max = 99;
groups.clear();
sound_place = SimpleSoundSpec();
sound_place_failed = SimpleSoundSpec();
+ sound_use = SimpleSoundSpec();
+ sound_use_air = SimpleSoundSpec();
range = -1;
- node_placement_prediction = "";
+ node_placement_prediction.clear();
place_param2 = 0;
+ has_on_place = false;
+ has_on_secondary_use = false;
}
void ItemDefinition::serialize(std::ostream &os, u16 protocol_version) const
os << serializeString16(short_description);
os << place_param2;
+
+ sound_use.serialize(os, protocol_version);
+ sound_use_air.serialize(os, protocol_version);
+
+ writeU8(os, has_on_place);
+ writeU8(os, has_on_secondary_use);
}
void ItemDefinition::deSerialize(std::istream &is, u16 protocol_version)
inventory_overlay = deSerializeString16(is);
wield_overlay = deSerializeString16(is);
- // If you add anything here, insert it primarily inside the try-catch
+ // If you add anything here, insert it inside the try-catch
// block to not need to increase the version.
try {
short_description = deSerializeString16(is);
place_param2 = readU8(is); // 0 if missing
+
+ sound_use.deSerialize(is, protocol_version);
+ sound_use_air.deSerialize(is, protocol_version);
+
+ has_on_place = readU8(is);
+ has_on_secondary_use = readU8(is);
} catch(SerializationError &e) {};
}
// "ignore" is the ignore node
ItemDefinition* hand_def = new ItemDefinition;
- hand_def->name = "";
+ hand_def->name.clear();
hand_def->wield_image = "wieldhand.png";
hand_def->tool_capabilities = new ToolCapabilities;
m_item_definitions.insert(std::make_pair("", hand_def));