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.
-- ^ Limit automatic rotation to this value in degrees per second,
-- value < 0 no limit.
backface_culling = true, -- false to disable backface_culling for model
+ glow = 0,
+ -- ^ Add this much extra lighting when calculating texture color.
+ value < 0 disables light's effect on texture color.
+ For faking self-lighting, UI style entities, or programmatic coloring in mods.
nametag = "", -- by default empty, for players their name is shown if empty
nametag_color = <color>, -- sets color of nametag as ColorSpec
infotext = "", -- by default empty, text to be shown when pointed at object
void GenericCAO::updateLightNoCheck(u8 light_at_pos)
{
- u8 li = decode_light(light_at_pos);
+ if (m_glow < 0)
+ return;
+
+ u8 li = decode_light(light_at_pos + m_glow);
if (li != m_last_light) {
m_last_light = li;
video::SColor color(255,li,li,li);
m_previous_texture_modifier = m_current_texture_modifier;
m_current_texture_modifier = mod;
+ m_glow = m_prop.glow;
if (m_spritenode) {
if (m_prop.visual == "sprite") {
float m_step_distance_counter = 0.0f;
u8 m_last_light = 255;
bool m_is_visible = false;
+ s8 m_glow = 0;
std::vector<u16> m_children;
PROTOCOL VERSION 36:
Backwards compatibility drop
Add 'can_zoom' to player object properties
+ Add glow to object properties
*/
#define LATEST_PROTOCOL_VERSION 36
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() << "\" ";
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
infotext = deSerializeString(is);
wield_item = deSerializeString(is);
can_zoom = readU8(is);
+ glow = readS8(is);
}
bool automatic_face_movement_dir = false;
f32 automatic_face_movement_dir_offset = 0.0f;
bool backface_culling = true;
+ s8 glow = 0;
std::string nametag = "";
video::SColor nametag_color = video::SColor(255, 255, 255, 255);
f32 automatic_face_movement_max_rotation_per_sec = -1.0f;
}
lua_pop(L, 1);
getboolfield(L, -1, "backface_culling", prop->backface_culling);
+ getintfield(L, -1, "glow", prop->glow);
getstringfield(L, -1, "nametag", prop->nametag);
lua_getfield(L, -1, "nametag_color");
lua_setfield(L, -2, "automatic_face_movement_dir");
lua_pushboolean(L, prop->backface_culling);
lua_setfield(L, -2, "backface_culling");
+ lua_pushnumber(L, prop->glow);
+ lua_setfield(L, -2, "glow");
lua_pushlstring(L, prop->nametag.c_str(), prop->nametag.size());
lua_setfield(L, -2, "nametag");
push_ARGB8(L, prop->nametag_color);
return got;
}
+bool getintfield(lua_State *L, int table,
+ const char *fieldname, s8 &result)
+{
+ lua_getfield(L, table, fieldname);
+ bool got = false;
+ if (lua_isnumber(L, -1)) {
+ result = lua_tointeger(L, -1);
+ got = true;
+ }
+ lua_pop(L, 1);
+ return got;
+}
+
bool getintfield(lua_State *L, int table,
const char *fieldname, u16 &result)
{
const char *fieldname, int &result);
bool getintfield(lua_State *L, int table,
const char *fieldname, u8 &result);
+bool getintfield(lua_State *L, int table,
+ const char *fieldname, s8 &result);
bool getintfield(lua_State *L, int table,
const char *fieldname, u16 &result);
bool getintfield(lua_State *L, int table,