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

Object properties: Add 'glow', disables light's effect if negative

The 'glow' value is added to the ambient light value.
Negative 'glow' disables light's effect on object colour, for faking
self-lighting, UI-style entities, or programmatic colouring in mods.
This commit is contained in:
Rob Blanckaert 2017-09-01 23:12:15 -07:00 committed by paramat
parent 604fe2083d
commit a9d43a0471
9 changed files with 52 additions and 20 deletions

View file

@ -33,31 +33,32 @@ ObjectProperties::ObjectProperties()
std::string ObjectProperties::dump()
{
std::ostringstream os(std::ios::binary);
os<<"hp_max="<<hp_max;
os<<", physical="<<physical;
os<<", collideWithObjects="<<collideWithObjects;
os<<", weight="<<weight;
os<<", collisionbox="<<PP(collisionbox.MinEdge)<<","<<PP(collisionbox.MaxEdge);
os<<", visual="<<visual;
os<<", mesh="<<mesh;
os<<", visual_size="<<PP2(visual_size);
os<<", textures=[";
os << "hp_max=" << hp_max;
os << ", physical=" << physical;
os << ", collideWithObjects=" << collideWithObjects;
os << ", weight=" << weight;
os << ", collisionbox=" << PP(collisionbox.MinEdge) << "," << PP(collisionbox.MaxEdge);
os << ", visual=" << visual;
os << ", mesh=" << mesh;
os << ", visual_size=" << PP2(visual_size);
os << ", textures=[";
for (const std::string &texture : textures) {
os<<"\""<< texture <<"\" ";
os << "\"" << texture << "\" ";
}
os<<"]";
os<<", colors=[";
os << "]";
os << ", colors=[";
for (const video::SColor &color : colors) {
os << "\"" << color.getAlpha() << "," << color.getRed() << ","
<< color.getGreen() << "," << color.getBlue() << "\" ";
}
os<<"]";
os<<", spritediv="<<PP2(spritediv);
os<<", initial_sprite_basepos="<<PP2(initial_sprite_basepos);
os<<", is_visible="<<is_visible;
os<<", makes_footstep_sound="<<makes_footstep_sound;
os<<", automatic_rotate="<<automatic_rotate;
os<<", backface_culling="<<backface_culling;
os << "]";
os << ", spritediv=" << PP2(spritediv);
os << ", initial_sprite_basepos=" << PP2(initial_sprite_basepos);
os << ", is_visible=" << is_visible;
os << ", makes_footstep_sound=" << makes_footstep_sound;
os << ", automatic_rotate="<< automatic_rotate;
os << ", backface_culling="<< backface_culling;
os << ", glow=" << glow;
os << ", nametag=" << nametag;
os << ", nametag_color=" << "\"" << nametag_color.getAlpha() << "," << nametag_color.getRed()
<< "," << nametag_color.getGreen() << "," << nametag_color.getBlue() << "\" ";
@ -106,6 +107,7 @@ void ObjectProperties::serialize(std::ostream &os) const
os << serializeString(infotext);
os << serializeString(wield_item);
writeU8(os, can_zoom);
writeS8(os, glow);
// Add stuff only at the bottom.
// Never remove anything, because we don't want new versions of this
@ -153,4 +155,5 @@ void ObjectProperties::deSerialize(std::istream &is)
infotext = deSerializeString(is);
wield_item = deSerializeString(is);
can_zoom = readU8(is);
glow = readS8(is);
}