1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add support for audio feedback if placing node failed

This commit is contained in:
BlockMen 2015-10-24 12:28:35 +02:00
parent 578649bd15
commit 2a12579fab
5 changed files with 19 additions and 4 deletions

View file

@ -80,6 +80,7 @@ ItemDefinition& ItemDefinition::operator=(const ItemDefinition &def)
groups = def.groups;
node_placement_prediction = def.node_placement_prediction;
sound_place = def.sound_place;
sound_place_failed = def.sound_place_failed;
range = def.range;
return *this;
}
@ -114,6 +115,7 @@ void ItemDefinition::reset()
}
groups.clear();
sound_place = SimpleSoundSpec();
sound_place_failed = SimpleSoundSpec();
range = -1;
node_placement_prediction = "";
@ -155,8 +157,10 @@ void ItemDefinition::serialize(std::ostream &os, u16 protocol_version) const
os<<serializeString(sound_place.name);
writeF1000(os, sound_place.gain);
}
if(protocol_version > 20){
if (protocol_version > 20) {
writeF1000(os, range);
os << serializeString(sound_place_failed.name);
writeF1000(os, sound_place_failed.gain);
}
}
@ -211,8 +215,10 @@ void ItemDefinition::deSerialize(std::istream &is)
}
// If you add anything here, insert it primarily inside the try-catch
// block to not need to increase the version.
try{
}catch(SerializationError &e) {};
try {
sound_place_failed.name = deSerializeString(is);
sound_place_failed.gain = readF1000(is);
} catch(SerializationError &e) {};
}
/*