                 :terrain-type/game-id-idx terrain-type-idx
                 :terrain-type/description (:description terrain-def)
                 :terrain-type/image (:image terrain-def)
-                :terrain-type/base-type (:base-type terrain-def)})))
+                ;:terrain-type/can-build (into (build-terrains-tx db game-id terrain-type-id (:can-build terrain-def)))
+                })))
+          terrains-def)))
+
+(defn terrain-types-tx2 [db game-id terrains-def]
+  (let [game (game-by-id db game-id)]
+    (into []
+          (map
+           (fn [[terrain-type-name terrain-def]]
+             (let [terrain-type-id (to-terrain-type-id terrain-type-name)
+                   terrain-type-idx (game-id-idx game-id terrain-type-id)]
+               {:db/id (db/next-temp-id)
+                :game/_terrain-types (e game)
+                :terrain-type/id terrain-type-id
+                :terrain-type/game-id-idx terrain-type-idx
+                :terrain-type/description (:description terrain-def)
+                :terrain-type/image (:image terrain-def)
+                :terrain-type/can-build (into (build-terrains-tx db game-id terrain-type-id (:can-build terrain-def)))})))
           terrains-def)))
 
 (defn attack-strengths-tx [db game-id unit-type-eid attack-strengths-def]

    (d/transact! conn (terrain-types-tx @conn game-id (:terrains ruleset)))
    (d/transact! conn (unit-state-map-tx @conn game-id (:unit-state-maps ruleset)))
    (d/transact! conn (unit-types-tx @conn game-id (:units ruleset)))

    ;; Map and bases
    (d/transact! conn (game-map-tx @conn game-id (map-defs map-id)))

      :game/self-repair (:self-repair settings-def)
      :game/move-through-friendly (:move-through-friendly settings-def)}]))

(defn build-terrains-tx [db game-id terrain-type-id can-build-def]
  (let [game (game-by-id db game-id)]
    (into []
          (map
           (fn [unit-type-name]
             {:db/id (db/next-temp-id)
              :terrain-type/_can-build terrain-type-id
              :terrain-build/unit-type (e (find-by db :unit-type/id (to-unit-type-id unit-type-name)))}))
          can-build-def)))

(defn terrain-types-tx [db game-id terrains-def]
  (let [game (game-by-id db game-id)]
    (into []
