; Emergency town-center
(defrule
	(building-type-count-total town-center < 1)
	(can-build-with-escrow town-center)
=>
	(build town-center)
	;(set-goal G-BUILDING 0)
	(chat-to-player my-player-number "Emergency town center")
)


; Land nomad lumber camp
(defrule
	(or	(and	(wood-amount > 10000)
			(strategic-number G-AGE-STATUS < GV-ADVANCING-TO-FEUDAL)
		)
		(and	(building-type-count-total town-center == 0)
			(not(can-afford-building town-center))
		)
	)
	(building-type-count-total lumber-camp == 0)
	(can-build-with-escrow lumber-camp)
=>
	(build lumber-camp)
	;(set-goal G-BUILDING 0)
	(chat-to-player my-player-number "Emergency lumber camp")
)


; Building houses
(defrule
	(taunt-detected my-player-number TA-INITIAL-AGE-FINISHED)
	(or	(or	(wood-amount > 2000)
			(housing-headroom < 4)
		)
		(or	(and	(current-age >= feudal-age)
				(housing-headroom < 15)
			)
			(current-age >= castle-age)
		)
	)
	(housing-headroom < 25)
	(population-headroom > 3)
	(can-build house)
=>
	(build house)
)

(defrule
	(taunt-detected my-player-number TA-INITIAL-AGE-FINISHED)
	(building-type-count-total town-center >= 1)
	(building-type-count-total dock >= 1)
	(not(goal G-BOAT GV-NONE))
	(housing-headroom < 5)
	(population-headroom > 3)
	(can-build house)
=>
	(build house)
)