screeps-purescript-bot/src/Screeps/Storage.purs

20 lines
533 B
Text
Raw Permalink Normal View History

2023-10-30 02:50:29 +00:00
module Screeps.Storage where
import Prelude
import Screeps.Types
import Screeps.FFI (unsafeField,runThisFn0)
storeFreeCapacity ∷ Store → Int
storeFreeCapacity = runThisFn0 "getFreeCapacity"
storeCapacity ∷ Store → Int
storeCapacity = unsafeField "storeCapacity"
store ∷ Storage → Store
store = unsafeField "store"
storageGet ∷ Storage → ResourceType → Int
storageGet s (ResourceType res) = unsafeField res (store s)
storeGet ∷ Store → ResourceType → Int
storeGet s (ResourceType res) = unsafeField res s