diff Profile.lua @ 228:ad40cd3fc7e9

pull states config out of namespace
author Flick
date Mon, 21 Mar 2011 11:33:15 -0700
parents 741c4f9b251e
children afb5ff4eccc0
line wrap: on
line diff
--- a/Profile.lua	Mon Mar 21 11:10:23 2011 -0700
+++ b/Profile.lua	Mon Mar 21 11:33:15 2011 -0700
@@ -117,6 +117,18 @@
       vehicle:ResetProfile()
     end
 
+    -- (10) State module uses the bar config directly
+    local state = db:GetNamespace("State",true) or db:RegisterNamespace("State")
+    if state then
+      for name, bar in pairs(db.profile.bars) do
+        local sc = state.profile.bars and state.profile.bars[name] and state.profile.bars[name].states
+        if sc then
+          bar.states = sc
+        end
+      end
+      vehicle:ResetProfile()
+    end
+
     db.profile.dbversion = 1
   end