 
 		push 'function applyLeaveRules (prevPosition) {'
 
-		push 'var terrainItem = getTerrainItem(prevPosition)'
-
-		push 'var inventoryItem = getInventoryItem()'
+		push 'const terrainItem = getTerrainItem(prevPosition)'
 
 		ruleLines = makeList()
 		rules.forEach (rule) ->


		push "if (#{terrainItemCondition}) {"

		push "setTerrainItem(neighbor, '#{resolveItem rule.outTerrainItemName}')"

		push "}"

		if rule.healthDelta? and rule.healthDelta != 0
			push "state.player.health += #{rule.healthDelta}"

		join '\n'



			when '_inventory'
				'inventoryItem'
			else
				"'#{reference}'"


	makeList = ->
