summaryrefslogtreecommitdiffhomepage
path: root/src/light.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/light.cpp')
-rw-r--r--src/light.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/light.cpp b/src/light.cpp
index 03fe4690..5c2c9145 100644
--- a/src/light.cpp
+++ b/src/light.cpp
@@ -22,7 +22,8 @@ light::light(object_id id, struct chunk& c, const light_proto& proto) :
entity{id, c, proto},
max_distance{proto.max_distance},
color{proto.color},
- falloff{proto.falloff}
+ falloff{proto.falloff},
+ enabled{proto.enabled}
{
}
@@ -38,6 +39,17 @@ Vector2 light::ordinal_offset(Vector2b) const
return ret;
}
+light::operator light_proto() const
+{
+ light_proto ret;
+ static_cast<entity_proto&>(ret) = entity_proto(*this);
+ ret.max_distance = max_distance;
+ ret.color = color;
+ ret.falloff = falloff;
+ ret.enabled = enabled;
+ return ret;
+}
+
entity_type light::type() const noexcept { return entity_type::light; }
bool light::update(size_t, float) { return false; }
bool light::is_dynamic() const { return true; }