; Handles game-play stateful information
(local pi math.pi)

(var game {:seed 14921215311})

; The Player table holds all the player stuff
; [x y] coordinates, [d] distance
; [dx dy] direction vector
; [o]xygen
(var player {:x 3.5 :y 3.5 :d 0
             :o 100})
(var inventory [])

; The Map table holds the map meta-data
; [n] number of cells
; [h w] hall and wall widths
(var map {:n 10 :h 3 :w 4})
 
{:getSeed (fn getSeed [] game.seed)
 :setSeed (fn setSeed [x] (set game.seed x))
 :getPlayer (fn getPlayer [] player)
 :getX (fn getX [] player.x)
 :setX (fn setX [x] (set player.x x))
 :getY (fn getY [] player.y)
 :setY (fn setY [y] (set player.y y))
 :getDirX (fn getDirX [] player.dx)
 :setDirX (fn setDirX [x] (set player.dx x))
 :getDirY (fn getDirY [] player.dy)
 :setDirY (fn setDirY [y] (set player.dy y))
 :getO (fn getO [] player.o)
 :setO (fn setO [x] (set player.o x))
 :getDis (fn getDis [] player.d)
 :setDis (fn setDis [x] (set player.d x))
 :modDis (fn modDis [x] (set player.d (+ player.d x)))
 :modO (fn modO [x] 
         (if (< (+ player.o x) 0)
           (set player.o 0)
           (set player.o (+ player.o x))))
 :getMap (fn getMap [] map)
}
