mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add option to give every object a nametag
or change the nametag text of players
This commit is contained in:
parent
19f73e4efc
commit
9eee3c3f46
9 changed files with 111 additions and 95 deletions
|
@ -43,7 +43,9 @@ ObjectProperties::ObjectProperties():
|
|||
stepheight(0),
|
||||
automatic_face_movement_dir(false),
|
||||
automatic_face_movement_dir_offset(0.0),
|
||||
backface_culling(true)
|
||||
backface_culling(true),
|
||||
nametag(""),
|
||||
nametag_color(255, 255, 255, 255)
|
||||
{
|
||||
textures.push_back("unknown_object.png");
|
||||
colors.push_back(video::SColor(255,255,255,255));
|
||||
|
@ -76,6 +78,9 @@ std::string ObjectProperties::dump()
|
|||
os<<", makes_footstep_sound="<<makes_footstep_sound;
|
||||
os<<", automatic_rotate="<<automatic_rotate;
|
||||
os<<", backface_culling="<<backface_culling;
|
||||
os << ", nametag=" << nametag;
|
||||
os << ", nametag_color=" << "\"" << nametag_color.getAlpha() << "," << nametag_color.getRed()
|
||||
<< "," << nametag_color.getGreen() << "," << nametag_color.getBlue() << "\" ";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
@ -109,6 +114,8 @@ void ObjectProperties::serialize(std::ostream &os) const
|
|||
writeU8(os, automatic_face_movement_dir);
|
||||
writeF1000(os, automatic_face_movement_dir_offset);
|
||||
writeU8(os, backface_culling);
|
||||
os << serializeString(nametag);
|
||||
writeARGB8(os, nametag_color);
|
||||
// Add stuff only at the bottom.
|
||||
// Never remove anything, because we don't want new versions of this
|
||||
}
|
||||
|
@ -146,6 +153,8 @@ void ObjectProperties::deSerialize(std::istream &is)
|
|||
automatic_face_movement_dir = readU8(is);
|
||||
automatic_face_movement_dir_offset = readF1000(is);
|
||||
backface_culling = readU8(is);
|
||||
nametag = deSerializeString(is);
|
||||
nametag_color = readARGB8(is);
|
||||
}catch(SerializationError &e){}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue