summaryrefslogtreecommitdiff
path: root/obj.lua
diff options
context:
space:
mode:
Diffstat (limited to 'obj.lua')
-rw-r--r--obj.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/obj.lua b/obj.lua
index 6f69cb1..bdf30dc 100644
--- a/obj.lua
+++ b/obj.lua
@@ -74,6 +74,14 @@ function obj.all()
end)
end
+function obj.total_energy()
+ local res = 0
+ for obj in obj.all() do
+ res = res + obj:energy()
+ end
+ return res
+end
+
function obj:__index(v)
if obj[v] then
return obj[v]