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

; The Player table holds all the player stuff
; The Inventory table holds the player's inventory
; [x y] coordinates, [d]irection, [f]ield-of-view
; [o]xygen and [p]ower
(var player {:x 3.5 :y 3.5 :d 0 :f (/ pi 3)
             :o 100 :p 45})
(var inventory [])

; The Map table holds the map
(var map [])
 
{: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))
 :getD (fn getD [] player.d)
 :setD (fn setD [d] (set player.d d))
 :getX (fn getX [] player.x)
 :getO (fn getO [] player.o)
 :setO (fn setO [x] (set player.o x))
 :modO (fn modO [x] 
         (if (< (+ player.o x) 0)
           (set player.o 0)
           (set player.o (+ player.o x))))
 :getP (fn getP [] player.p)
 :setP (fn setP [x] (set player.p x))
 :modP (fn modP [x]
         (if (< (+ player.p x) 0)
           (set player.p 0)
           (set player.p (+ player.p x))))
}
